* @static
* @access public
*/
- static function check($str, $contactID = NULL) {
+ public static function check($str, $contactID = NULL) {
if ($contactID == NULL) {
$session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
/**
* @return array|null
*/
- static function entityTable() {
+ public static function entityTable() {
if (!self::$_entityTable) {
self::$_entityTable = array(
'civicrm_contact' => ts('Contact'),
/**
* @return array|null
*/
- static function objectTable() {
+ public static function objectTable() {
if (!self::$_objectTable) {
self::$_objectTable = array(
'civicrm_contact' => ts('Contact'),
/**
* @return array|null
*/
- static function operation() {
+ public static function operation() {
if (!self::$_operation) {
self::$_operation = array(
'View' => ts('View'),
* @return array - Assoc. array of the ACL rule's properties
* @access public
*/
- function toArray($format = '%s', $hideEmpty = false) {
+ public function toArray($format = '%s', $hideEmpty = false) {
$result = array();
if (!self::$_fieldKeys) {
*
* @return CRM_ACL_DAO_ACL
*/
- static function create(&$params) {
+ public static function create(&$params) {
$dao = new CRM_ACL_DAO_ACL();
$dao->copyValues($params);
$dao->save();
* @param array $params
* @param $defaults
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
CRM_Core_DAO::commonRetrieve('CRM_ACL_DAO_ACL', $params, $defaults);
}
* @return Object DAO object on sucess, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
// note this also resets any ACL cache
CRM_Core_BAO_Cache::deleteGroup('contact fields');
*
* @return bool
*/
- static function check($str, $contactID) {
+ public static function check($str, $contactID) {
$acls = CRM_ACL_BAO_Cache::build($contactID);
*
* @return bool
*/
- static function matchType($type, $operation) {
+ public static function matchType($type, $operation) {
$typeCheck = FALSE;
switch ($operation) {
case 'All':
* @access public
* @static
*/
- static function del($aclId) {
+ public static function del($aclId) {
// delete all entries from the acl cache
CRM_ACL_BAO_Cache::resetCache();
*
* @return mixed
*/
- static function &build($id) {
+ public static function &build($id) {
if (!self::$_cache) {
self::$_cache = array();
}
*
* @return array
*/
- static function retrieve($id) {
+ public static function retrieve($id) {
$query = "
SELECT acl_id
FROM civicrm_acl_cache
* @param int $id
* @param array $cache
*/
- static function store($id, &$cache) {
+ public static function store($id, &$cache) {
foreach ($cache as $aclID => $data) {
$dao = new CRM_ACL_DAO_Cache();
if ($id) {
/**
* @param int $id
*/
- static function deleteEntry($id) {
+ public static function deleteEntry($id) {
if (self::$_cache &&
array_key_exists($id, self::$_cache)
) {
/**
* @param int $id
*/
- static function updateEntry($id) {
+ public static function updateEntry($id) {
// rebuilds civicrm_acl_cache
self::deleteEntry($id);
self::build($id);
}
// deletes all the cache entries
- static function resetCache() {
+ public static function resetCache() {
// reset any static caching
self::$_cache = NULL;
/**
* @return array|null
*/
- static function entityTable() {
+ public static function entityTable() {
if (!self::$_entityTable) {
self::$_entityTable = array(
'civicrm_contact' => ts('Contact'),
*
* @return CRM_ACL_DAO_EntityRole
*/
- static function create(&$params) {
+ public static function create(&$params) {
$dao = new CRM_ACL_DAO_EntityRole();
$dao->copyValues($params);
$dao->save();
* @param array $params
* @param $defaults
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
CRM_Core_DAO::commonRetrieve('CRM_ACL_DAO_EntityRole', $params, $defaults);
}
* @return Object DAO object on sucess, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_ACL_DAO_EntityRole', $id, 'is_active', $is_active);
}
* @access public
* @static
*/
- static function del($entityRoleId) {
+ public static function del($entityRoleId) {
$entityDAO = new CRM_ACL_DAO_EntityRole();
$entityDAO->id = $entityRoleId;
$entityDAO->find(TRUE);
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = parent::setDefaultValues();
if ($this->_action & CRM_Core_Action::ADD) {
*
* @return bool
*/
- static function formRule($params) {
+ public static function formRule($params) {
$showHide = new CRM_Core_ShowHideBlocks();
// Make sure role is not -1
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if ($this->_id ||
*
* @return array|bool
*/
- static function formRule($params) {
+ public static function formRule($params) {
if ($params['entity_id'] == -1) {
$errors = array('entity_id' => ts('Role is a required field'));
return $errors;
* @access public
* @return void
*/
- function buildQuickForm( ) {
+ public function buildQuickForm( ) {
CRM_Utils_System::setTitle( 'Wordpress Access Control' );
* @access public
* @return array civicrm permissions
*/
- static function getPermissionArray(){
+ public static function getPermissionArray(){
global $civicrm_root;
$permissions = CRM_Core_Permission::basicPermissions();
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_ACL_BAO_ACL';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
* @access public
*
*/
- function run() {
+ public function run() {
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String',
// default to 'browse'
* @access public
* @static
*/
- function browse() {
+ public function browse() {
// get all acl's sorted by weight
$acl = array();
$query = "
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_ACL_Form_ACL';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'ACL';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/acl';
}
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_ACL_BAO_ACL';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
* @access public
*
*/
- function run() {
+ public function run() {
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String',
// default to 'browse'
* @access public
* @static
*/
- function browse() {
+ public function browse() {
// get all acl's sorted by weight
$acl = array();
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_ACL_Form_ACLBasic';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Core ACLs';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/acl/basic';
}
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_ACL_BAO_EntityRole';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
* @access public
*
*/
- function run() {
+ public function run() {
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String',
// default to 'browse'
* @access public
* @static
*/
- function browse() {
+ public function browse() {
// get all acl's sorted by weight
$entityRoles = array();
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_ACL_Form_EntityRole';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'ACL EntityRole';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/acl/entityrole';
}
}
* @access public
* @static
*/
- static function &getActivities($input) {
+ public static function &getActivities($input) {
//step 1: Get the basic activity data
$bulkActivityTypeID = CRM_Core_OptionGroup::getValue(
'activity_type',
* @return array of component id and name.
* @static
**/
- static function activityComponents() {
+ public static function activityComponents() {
$components = array();
$compInfo = CRM_Core_Component::getEnabledComponents();
foreach ($compInfo as $compObj) {
* @access public
* @static
*/
- static function &getActivitiesCount($input) {
+ public static function &getActivitiesCount($input) {
$input['count'] = TRUE;
list($sqlClause, $params) = self::getActivitySQLClause($input);
* @access public
* @static
*/
- static function getActivitySQLClause($input) {
+ public static function getActivitySQLClause($input) {
$params = array();
$sourceWhere = $targetWhere = $assigneeWhere = $caseWhere = 1;
* @access public
* @static
*/
- static function &importableFields($status = FALSE) {
+ public static function &importableFields($status = FALSE) {
if (!self::$_importableFields) {
if (!self::$_importableFields) {
self::$_importableFields = array();
* @return array array of activity fields
* @access public
*/
- static function getContactActivity($contactId) {
+ public static function getContactActivity($contactId) {
$activities = array();
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
* @return int $parentId Id of parent activity otherwise false.
* @access public
*/
- static function getParentActivity($activityId) {
+ public static function getParentActivity($activityId) {
static $parentActivities = array();
$activityId = CRM_Utils_Type::escape($activityId, 'Integer');
* @return int $params count of prior activities otherwise false.
* @access public
*/
- static function getPriorCount($activityID) {
+ public static function getPriorCount($activityID) {
static $priorCounts = array();
$activityID = CRM_Utils_Type::escape($activityID, 'Integer');
* @return array $result prior activities info.
* @access public
*/
- static function getPriorAcitivities($activityID, $onlyPriorRevisions = FALSE) {
+ public static function getPriorAcitivities($activityID, $onlyPriorRevisions = FALSE) {
static $priorActivities = array();
$activityID = CRM_Utils_Type::escape($activityID, 'Integer');
* @return int current activity id.
* @access public
*/
- static function getLatestActivityId($activityID) {
+ public static function getLatestActivityId($activityID) {
static $latestActivityIds = array();
$activityID = CRM_Utils_Type::escape($activityID, 'Integer');
*
* @access public
*/
- static function createFollowupActivity($activityId, $params) {
+ public static function createFollowupActivity($activityId, $params) {
if (!$activityId) {
return;
}
*
* @static
*/
- static function getFileForActivityTypeId($activityTypeId, $crmDir = 'Activity') {
+ public static function getFileForActivityTypeId($activityTypeId, $crmDir = 'Activity') {
$activityTypes = CRM_Case_PseudoConstant::caseActivityType(FALSE, TRUE);
if ($activityTypes[$activityTypeId]['name']) {
* @access public
* @static
*/
- static function &exportableFields($name = 'Activity') {
+ public static function &exportableFields($name = 'Activity') {
if (!isset(self::$_exportableFields[$name])) {
self::$_exportableFields[$name] = array();
* @return array array of activity profile Fields
* @access public
*/
- static function getProfileFields() {
+ public static function getProfileFields() {
$exportableFields = self::exportableFields('Activity');
$skipFields = array(
'activity_id',
*
* @param array $params
*/
- static function copyExtendedActivityData($params) {
+ public static function copyExtendedActivityData($params) {
// attach custom data to the new activity
$customParams = $htmlType = array();
$customValues = CRM_Core_BAO_CustomValueTable::getEntityValues($params['activityID'], 'Activity');
/**
* @param array $params
*/
- function setApiFilter(&$params) {
+ public function setApiFilter(&$params) {
if (CRM_Utils_Array::value('target_contact_id', $params)) {
$this->selectAdd();
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
*
* @access public
*/
- static function retrieveAssigneeIdsByActivityId($activity_id) {
+ public static function retrieveAssigneeIdsByActivityId($activity_id) {
$assigneeArray = array();
if (!CRM_Utils_Rule::positiveInteger($activity_id)) {
return $assigneeArray;
* @access public
*
*/
- static function getAssigneeNames($activityIDs, $isDisplayName = FALSE, $skipDetails = TRUE) {
+ public static function getAssigneeNames($activityIDs, $isDisplayName = FALSE, $skipDetails = TRUE) {
$assigneeNames = array();
if (empty($activityIDs)) {
return $assigneeNames;
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
*
* @access public
*/
- static function getNames($activityID, $recordTypeID, $alsoIDs = FALSE) {
+ public static function getNames($activityID, $recordTypeID, $alsoIDs = FALSE) {
$names = array();
$ids = array();
*
* @access public
*/
- static function retrieveContactIdsByActivityId($activityID, $recordTypeID) {
+ public static function retrieveContactIdsByActivityId($activityID, $recordTypeID) {
$activityContact = array();
if (!CRM_Utils_Rule::positiveInteger($activityID) ||
!CRM_Utils_Rule::positiveInteger($recordTypeID)) {
/**
* @return array|null
*/
- function links() {
+ public function links() {
$link = array('activity_id' => 'civicrm_activity:id');
return $link;
}
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
*
* @access public
*/
- static function retrieveTargetIdsByActivityId($activity_id) {
+ public static function retrieveTargetIdsByActivityId($activity_id) {
$targetArray = array();
if (!CRM_Utils_Rule::positiveInteger($activity_id)) {
return $targetArray;
*
* @access public
*/
- static function getTargetNames($activityID) {
+ public static function getTargetNames($activityID) {
$targetNames = array();
if (empty($activityID)) {
* @return \CRM_Activity_BAO_ICalendar
@access public
*/
- function __construct( &$act ) {
+ public function __construct( &$act ) {
$this->activity = $act;
}
* @return string Array index of the added attachment in the $attachments array, or else null.
* @access public
*/
- function addAttachment( &$attachments, $contacts ) {
+ public function addAttachment( &$attachments, $contacts ) {
// Check preferences setting
if ( CRM_Core_BAO_Setting::getItem( CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'activity_assignee_notification_ics' ) ) {
$config = &CRM_Core_Config::singleton();
return null;
}
- function cleanup() {
+ public function cleanup() {
if ( !empty ( $this->icsfile ) ) {
@unlink( $this->icsfile );
}
* @return void
* @access public
*/
- static function select(&$query) {
+ public static function select(&$query) {
if (!empty($query->_returnProperties['activity_id'])) {
$query->_select['activity_id'] = "civicrm_activity.id as activity_id";
$query->_element['activity_id'] = 1;
* @return void
* @access public
*/
- static function where(&$query) {
+ public static function where(&$query) {
$grouping = NULL;
foreach (array_keys($query->_params) as $id) {
if (substr($query->_params[$id][0], 0, 9) == 'activity_') {
* @return void
* @access public
*/
- static function whereClauseSingle(&$values, &$query) {
+ public static function whereClauseSingle(&$values, &$query) {
list($name, $op, $value, $grouping, $wildcard) = $values;
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
*
* @return null|string
*/
- static function from($name, $mode, $side) {
+ public static function from($name, $mode, $side) {
$from = NULL;
switch ($name) {
case 'civicrm_activity':
* @return string
* @access public
*/
- function qill() {
+ public function qill() {
return (isset($this->_qill)) ? $this->_qill : "";
}
* @return void
* @static
*/
- static function buildSearchForm(&$form) {
+ public static function buildSearchForm(&$form) {
$activityOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
asort($activityOptions);
foreach ($activityOptions as $activityID => $activity) {
*
* @return array|null
*/
- static function defaultReturnProperties($mode, $includeCustomFields = TRUE) {
+ public static function defaultReturnProperties($mode, $includeCustomFields = TRUE) {
$properties = NULL;
if ($mode & CRM_Contact_BAO_Query::MODE_ACTIVITY) {
$properties = array(
*
* @return array
*/
- static function buildWhereAndQill(&$query, $value, $pseudoconstantType, $op, $grouping, $params) {
+ public static function buildWhereAndQill(&$query, $value, $pseudoconstantType, $op, $grouping, $params) {
$matches = $val = $clause = array();
if (is_array($value)) {
/**
* Class constructor
*/
- function __construct($title = NULL, $modal = TRUE, $action = CRM_Core_Action::NONE) {
+ public function __construct($title = NULL, $modal = TRUE, $action = CRM_Core_Action::NONE) {
parent::__construct($title, $modal);
* form fields based on their requirement
*
*/
- function setFields() {
+ public function setFields() {
$this->_fields = array(
'subject' => array(
'type' => 'text',
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->_cdType = CRM_Utils_Array::value('type', $_GET);
$this->assign('cdType', FALSE);
if ($this->_cdType) {
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::setDefaultValues($this);
}
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
// skip form rule if deleting
if (CRM_Utils_Array::value('_qf_Activity_next_', $fields) == 'Delete') {
return TRUE;
*
* @param array $params
*/
- function beginPostProcess(&$params) {
+ public function beginPostProcess(&$params) {
if ($this->_activityTypeFile) {
$className = "CRM_{$this->_crmDir}_Form_Activity_{$this->_activityTypeFile}";
$className::beginPostProcess($this, $params);
* @param array $params
* @param $activity
*/
- function endPostProcess(&$params, &$activity) {
+ public function endPostProcess(&$params, &$activity) {
if ($this->_activityTypeFile) {
$className = "CRM_{$this->_crmDir}_Form_Activity_{$this->_activityTypeFile}";
$className::endPostProcess($this, $params, $activity);
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
// CRM-11761 retrieve user's activity filter preferences
$defaults = array();
$session = CRM_Core_Session::singleton();
/**
* @param $self
*/
- static function commonBuildQuickForm($self) {
+ public static function commonBuildQuickForm($self) {
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $self);
if (!$contactId) {
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, NULL, $_REQUEST);
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->set('searchFormName', 'Search');
// set the button names
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
parent::buildQuickForm();
$this->addElement('text', 'sort_name', ts('Name or Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
* @return void
* @access public
*/
- function postProcess() {
+ public function postProcess() {
if ($this->_done) {
return;
}
$controller->run();
}
- function fixFormValues() {
+ public function fixFormValues() {
if (!$this->_force) {
return;
}
/**
* @return null
*/
- function getFormValues() {
+ public function getFormValues() {
return NULL;
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
self::preProcessCommon($this);
}
* @param CRM_Core_Form $form
* @param bool $useTable
*/
- static function preProcessCommon(&$form, $useTable = FALSE) {
+ public static function preProcessCommon(&$form, $useTable = FALSE) {
$form->_activityHolderIds = array();
$values = $form->controller->exportValues($form->get('searchFormName'));
* @return void
* @access public
*/
- function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
+ public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
$this->addButtons(array(
array(
'type' => $nextType,
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
// add select for tag
$this->_tags = CRM_Core_BAO_Tag::getTags('civicrm_activity');
$this->addDefaultButtons(ts('Tag Activities'));
}
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Activity_Form_Task_AddToTag', 'formRule'));
}
*
* @return array
*/
- static function formRule($form, $rule) {
+ public static function formRule($form, $rule) {
$errors = array();
if (empty($form['tag']) && empty($form['activity_taglist'])) {
$errors['_qf_default'] = ts("Please select at least one tag.");
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
/*
* initialize the task and row fields
*/
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$ufGroupId = $this->get('ufGroupId');
if (!$ufGroupId) {
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if (empty($this->_fields)) {
return;
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->addDefaultButtons(ts('Delete Activities'), 'done');
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$session = CRM_Core_Session::singleton();
$this->_userContext = $session->readUserContext();
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->add('text', 'unclosed_case_id', ts('Select Case'), array('class' => 'huge'), TRUE);
$this->addDefaultButtons(ts('Continue >>'));
}
*
* @return void
*/
- function addRules() {}
+ public function addRules() {}
/**
* Process the form after the input has been submitted and validated
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
/*
* initialize the task and row fields
*/
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->addElement('checkbox', 'with_contact', ts('With Contact'));
$this->addElement('checkbox', 'assigned_to', ts('Assigned to Contact'));
$this->addElement('checkbox', 'created_by', ts('Created by'));
*
* @return void
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Activity_Form_Task_PickOption', 'formRule'));
}
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
if ( !isset($fields['with_contact']) &&
!isset($fields['assigned_to']) &&
!isset($fields['created_by'])
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
/*
* initialize the task and row fields
*/
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$types = array('Activity');
$profiles = CRM_Core_BAO_UFGroup::getProfiles($types, TRUE);
*
* @return void
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Activity_Form_Task_PickProfile', 'formRule'));
}
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
return TRUE;
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preprocess();
// set print view, so that print templates are called
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
//
// just need to add a javacript to popup the window for printing
//
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
// add select for tag
$this->_tags = CRM_Core_BAO_Tag::getTags('civicrm_activity');
foreach ($this->_tags as $tagID => $tagName) {
$this->addDefaultButtons(ts('Remove Tags from activities'));
}
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Activity_Form_Task_RemoveFromTag', 'formRule'));
}
*
* @return array
*/
- static function formRule($form, $rule) {
+ public static function formRule($form, $rule) {
$errors = array();
if (empty($form['tag']) && empty($form['activity_taglist'])) {
$errors['_qf_default'] = "Please select atleast one tag.";
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
CRM_Contact_Form_Task_SMSCommon::preProcessProvider($this);
$this->assign('single', $this->_single);
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$rows = array();
// display name and activity details of all selected contacts
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
// lets get around the time limit issue if possible, CRM-2113
* @param string $headerPattern
* @param string $dataPattern
*/
- function __construct($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//') {
+ public function __construct($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//') {
$this->_name = $name;
$this->_title = $title;
$this->_type = $type;
$this->_value = NULL;
}
- function resetValue() {
+ public function resetValue() {
$this->_value = NULL;
}
* The value is in string format. convert the value to the type of this field
* and set the field value with the appropriate type
*/
- function setValue($value) {
+ public function setValue($value) {
$this->_value = $value;
}
/**
* @return bool
*/
- function validate() {
+ public function validate() {
if (CRM_Utils_System::isNull($this->_value)) {
return TRUE;
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$errors = array();
// define so we avoid notices below
$errors['_qf_default'] = '';
* @return void
* @access public
*/
- function setActiveFields($fieldKeys) {
+ public function setActiveFields($fieldKeys) {
$this->_activeFieldCount = count($fieldKeys);
foreach ($fieldKeys as $key) {
if (empty($this->_fields[$key])) {
* @return array (reference ) associative array of name/value pairs
* @access public
*/
- function &getActiveFieldParams() {
+ public function &getActiveFieldParams() {
$params = array();
for ($i = 0; $i < $this->_activeFieldCount; $i++) {
if (isset($this->_activeFields[$i]->_value)
* @param string $headerPattern
* @param string $dataPattern
*/
- function addField($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//') {
+ public function addField($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//') {
if (empty($name)) {
$this->_fields['doNotImport'] = new CRM_Activity_Import_Field($name, $title, $type, $headerPattern, $dataPattern);
}
* @return void
* @access public
*/
- function set($store, $mode = self::MODE_SUMMARY) {
+ public function set($store, $mode = self::MODE_SUMMARY) {
$store->set('fileSize', $this->_fileSize);
$store->set('lineCount', $this->_lineCount);
$store->set('seperator', $this->_seperator);
* @return void
* @access public
*/
- static function exportCSV($fileName, $header, $data) {
+ public static function exportCSV($fileName, $header, $data) {
$output = array();
$fd = fopen($fileName, 'w');
/**
* Class constructor
*/
- function __construct(&$mapperKeys, $mapperLocType = NULL, $mapperPhoneType = NULL) {
+ public function __construct(&$mapperKeys, $mapperLocType = NULL, $mapperPhoneType = NULL) {
parent::__construct();
$this->_mapperKeys = &$mapperKeys;
}
* @return void
* @access public
*/
- function init() {
+ public function init() {
$activityContact = CRM_Activity_BAO_ActivityContact::import();
$activityTarget['target_contact_id'] = $activityContact['contact_id'];
$fields = array_merge(CRM_Activity_BAO_Activity::importableFields(),
* @return boolean
* @access public
*/
- function mapField(&$values) {
+ public function mapField(&$values) {
return CRM_Import_Parser::VALID;
}
* @return boolean the result of this processing
* @access public
*/
- function preview(&$values) {
+ public function preview(&$values) {
return $this->summary($values);
}
* @return boolean the result of this processing
* @access public
*/
- function summary(&$values) {
+ public function summary(&$values) {
$erroneousField = NULL;
$response = $this->setActiveFieldValues($values, $erroneousField);
$index = -1;
* @return boolean the result of this processing
* @access public
*/
- function import($onDuplicate, &$values) {
+ public function import($onDuplicate, &$values) {
// first make sure this is a valid line
$response = $this->summary($values);
* @return void
* @access public
*/
- function fini() {}
+ public function fini() {}
}
* This class contains all the function that are called using AJAX (jQuery)
*/
class CRM_Activity_Page_AJAX {
- static function getCaseActivity() {
+ public static function getCaseActivity() {
$caseID = CRM_Utils_Type::escape($_GET['caseID'], 'Integer');
$contactID = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
$userID = CRM_Utils_Type::escape($_GET['userID'], 'Integer');
CRM_Utils_System::civiExit();
}
- static function getCaseGlobalRelationships() {
+ public static function getCaseGlobalRelationships() {
$sortMapper = array(
0 => 'sort_name', 1 => 'phone', 2 => 'email',
);
CRM_Utils_System::civiExit();
}
- static function getCaseClientRelationships() {
+ public static function getCaseClientRelationships() {
$caseID = CRM_Utils_Type::escape($_GET['caseID'], 'Integer');
$contactID = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
}
- static function getCaseRoles() {
+ public static function getCaseRoles() {
$caseID = CRM_Utils_Type::escape($_GET['caseID'], 'Integer');
$contactID = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
CRM_Utils_System::civiExit();
}
- static function convertToCaseActivity() {
+ public static function convertToCaseActivity() {
$params = array('caseID', 'activityID', 'contactID', 'newSubject', 'targetContactIds', 'mode');
$vals = array();
foreach ($params as $param) {
*
* @return array
*/
- static function _convertToCaseActivity($params) {
+ public static function _convertToCaseActivity($params) {
if (!$params['activityID'] || !$params['caseID']) {
return (array('error_msg' => 'required params missing.'));
}
return (array('error_msg' => $error_msg, 'newId' => $mainActivity->id));
}
- static function getContactActivity() {
+ public static function getContactActivity() {
$contactID = CRM_Utils_Type::escape($_POST['contact_id'], 'Integer');
$context = CRM_Utils_Type::escape(CRM_Utils_Array::value('context', $_GET), 'String');
*
* @access public
*/
- function browse() {
+ public function browse() {
$this->assign('admin', FALSE);
$this->assign('context', 'activity');
$this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('activity', $this->_contactId);
}
- function edit() {
+ public function edit() {
// used for ajax tabs
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->assign('context', $context);
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->assign('contactId', $this->_contactId);
//FIX ME: need to fix this conflict
$controller->run();
}
- function delete() {
+ public function delete() {
$controller = new CRM_Core_Controller_Simple(
'CRM_Activity_Form_Activity',
ts('Activity Record'),
*
* @access public
*/
- function run() {
+ public function run() {
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
$action = CRM_Utils_Request::retrieve('action', 'String', $this);
* return null
* @access public
*/
- function listActivities() {
+ public function listActivities() {
$controller =
new CRM_Core_Controller_Simple(
* return null
* @access public
*/
- function run() {
+ public function run() {
parent::preProcess();
$this->listActivities();
}
*
* @access public
*/
- function getPagerParams($action, &$params) {
+ public function getPagerParams($action, &$params) {
$params['status'] = ts('Activities %%StatusMessage%%');
$params['csvString'] = NULL;
$params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
* @return array the column headers that need to be displayed
* @access public
*/
- function &getColumnHeaders($action = NULL, $output = NULL) {
+ public function &getColumnHeaders($action = NULL, $output = NULL) {
if ($output == CRM_Core_Selector_Controller::EXPORT || $output == CRM_Core_Selector_Controller::SCREEN) {
$csvHeaders = array(ts('Activity Type'), ts('Description'), ts('Activity Date'));
foreach (self::_getColumnHeaders() as $column) {
* @return int Total number of rows
* @access public
*/
- function getTotalCount($action, $case = NULL) {
+ public function getTotalCount($action, $case = NULL) {
$params = array(
'contact_id' => $this->_contactId,
'admin' => $this->_admin,
*
* @return int the total number of rows for this action
*/
- function &getRows($action, $offset, $rowCount, $sort, $output = NULL, $case = NULL) {
+ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL, $case = NULL) {
$params = array(
'contact_id' => $this->_contactId,
'admin' => $this->_admin,
*
* @return string name of the file
*/
- function getExportFileName($output = 'csv') {
+ public function getExportFileName($output = 'csv') {
return ts('CiviCRM Activity');
}
*
* @access public
*/
- function getPagerParams($action, &$params) {
+ public function getPagerParams($action, &$params) {
$params['status'] = ts('Activities %%StatusMessage%%');
$params['csvString'] = NULL;
$params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
* @return int Total number of rows
* @access public
*/
- function getTotalCount($action) {
+ public function getTotalCount($action) {
return $this->_query->searchQuery(0, 0, NULL,
TRUE, FALSE,
FALSE, FALSE,
*
* @return array rows in the given offset and rowCount
*/
- function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
+ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
$result = $this->_query->searchQuery(
$offset, $rowCount, $sort,
FALSE, FALSE,
/**
* @return mixed
*/
- function alphabetQuery() {
+ public function alphabetQuery() {
return $this->_query->searchQuery(NULL, NULL, NULL, FALSE, FALSE, TRUE);
}
/**
* @return string
*/
- function &getQuery() {
+ public function &getQuery() {
return $this->_query;
}
*
* @return string name of the file
*/
- function getExportFileName($output = 'csv') {
+ public function getExportFileName($output = 'csv') {
return ts('CiviCRM Activity Search');
}
}
/**
* 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 name of the form that will handle the task
* @access protected
*/
- function taskName($controller, $formName = 'Search') {
+ public function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
$value = CRM_Utils_Array::value('task', $_POST);
if (!isset($value)) {
* @return string
* @access public
*/
- function getTaskFormName() {
+ public function getTaskFormName() {
return CRM_Utils_String::getClassName($this->_task);
}
/**
* @return bool
*/
- function shouldReset() {
+ public function shouldReset() {
return FALSE;
}
}
* @static
* @access public
*/
- static function &tasks() {
+ public static function &tasks() {
if (!(self::$_tasks)) {
self::$_tasks = array(
1 => array(
* @static
* @access public
*/
- static function &taskTitles() {
+ public static function &taskTitles() {
self::tasks();
$titles = array();
foreach (self::$_tasks as $id => $value) {
* @return array set of tasks that are valid for the user
* @access public
*/
- static function &permissionedTaskTitles($permission) {
+ public static function &permissionedTaskTitles($permission) {
$tasks = array();
if ($permission == CRM_Core_Permission::EDIT) {
$tasks = self::taskTitles();
* @static
* @access public
*/
- static function getTask($value) {
+ public static function getTask($value) {
self::tasks();
if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) {
// make the print task by default
/**
* Basic setup
*/
- function preProcess() {
+ public function preProcess() {
$this->_id = $this->get('id');
$this->_BAOName = $this->get('BAOName');
$this->_values = array();
*
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if (isset($this->_id) && empty($this->_values)) {
$this->_values = array();
$params = array('id' => $this->_id);
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
return $defaults;
}
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
return empty($errors) ? TRUE : $errors;
class CRM_Admin_Form_Job extends CRM_Admin_Form {
protected $_id = NULL;
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
* @return array|bool
* @throws API_Exception
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$errors = array();
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if (!$this->_id) {
*/
protected $_group = NULL;
- function preProcess() {
+ public function preProcess() {
$this->_id = $this->get('id');
$this->_group = CRM_Utils_Request::retrieve('group', 'String', $this, FALSE, 'label_format');
$this->_values = array();
/**
* @return int
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if ($this->_action & CRM_Core_Action::ADD) {
$defaults['weight'] = CRM_Utils_Array::value('weight', CRM_Core_BAO_LabelFormat::getDefaultValues($this->_group), 0);
}
*
* @return void
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Admin_Form_MailSettings', 'formRule'));
}
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$errors = array();
// Check for default from email address and organization (domain) name. Force them to change it.
if ($fields['domain'] == 'EXAMPLE.ORG') {
*
* @return void
*/
- function postProcess() {
+ public function postProcess() {
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Core_BAO_MailSettings::deleteMailSettings($this->_id);
CRM_Core_Session::setStatus("", ts('Mail Setting Deleted.'), "success");
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = parent::setDefaultValues();
return $defaults;
}
// which (and whether) mailing workflow this template belongs to
protected $_workflow_id = NULL;
- function preProcess() {
+ public function preProcess() {
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_action = CRM_Utils_Request::retrieve('action', 'String',
$this, FALSE, 'add'
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = parent::setDefaultValues();
if (!isset($defaults['weight']) || !$defaults['weight']) {
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
if ($self->_gName == 'case_status' && empty($fields['grouping'])) {
$errors['grouping'] = ts('Status class is a required field');
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = parent::setDefaultValues();
if (empty($defaults['weight'])) {
$defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Event_DAO_ParticipantStatusType');
return $defaults;
}
- function postProcess() {
+ public function postProcess() {
if ($this->_action & CRM_Core_Action::DELETE) {
if (CRM_Event_BAO_ParticipantStatusType::deleteParticipantStatusType($this->_id)) {
CRM_Core_Session::setStatus(ts('Selected participant status has been deleted.'), ts('Record Deleted'), 'success');
protected $_ppDAO;
- function preProcess() {
+ public function preProcess() {
if(!CRM_Core_Permission::check('administer payment processors')) {
CRM_Core_Error::statusBounce('The \'administer payment processors\' permission is required to add or edit a payment processor.');
}
*
* @return array|bool
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
// make sure that at least one of live or test is present
// and we have at least name and url_site
*
* @return bool
*/
- static function checkSection(&$fields, &$errors, $section = NULL) {
+ public static function checkSection(&$fields, &$errors, $section = NULL) {
$names = array('user_name');
$present = FALSE;
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if ($this->_ppType) {
$defaults['payment_processor_type_id'] = $this->_ppType;
*
* @return Void
*/
- function updatePaymentProcessor(&$values, $domainID, $test) {
+ public function updatePaymentProcessor(&$values, $domainID, $test) {
$dao = new CRM_Financial_DAO_PaymentProcessor( );
$dao->id = $test ? $this->_testID : $this->_id;
protected $_fields = NULL;
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$this->_fields = array(
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if (!$this->_id) {
/**
* @return int
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if ($this->_action & CRM_Core_Action::ADD) {
$defaults['weight'] = CRM_Utils_Array::value('weight', CRM_Core_BAO_PdfFormat::getDefaultValues(), 0);
}
protected $_params = NULL;
- function preProcess() {
+ public function preProcess() {
$this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive',
$this, FALSE
);
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
foreach ($this->_varNames as $groupName => $settings) {
/**
* @param $defaults
*/
- function cbsDefaultValues(&$defaults) {
+ public function cbsDefaultValues(&$defaults) {
foreach ($this->_varNames as $groupName => $groupValues) {
foreach ($groupValues as $settingName => $fieldValue) {
* This class generates form components for Address Section
*/
class CRM_Admin_Form_Preferences_Address extends CRM_Admin_Form_Preferences {
- function preProcess() {
+ public function preProcess() {
CRM_Utils_System::setTitle(ts('Settings - Addresses'));
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$defaults['address_standardization_provider'] = $this->_config->address_standardization_provider;
$defaults['address_standardization_userid'] = $this->_config->address_standardization_userid;
*
* @return bool
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$p = $fields['address_standardization_provider'];
$u = $fields['address_standardization_userid'];
$w = $fields['address_standardization_url'];
*
*/
class CRM_Admin_Form_Preferences_Campaign extends CRM_Admin_Form_Preferences {
- function preProcess() {
+ public function preProcess() {
CRM_Utils_System::setTitle(ts('CiviCampaign Component Settings'));
$this->_varNames = array(
CRM_Core_BAO_Setting::CAMPAIGN_PREFERENCES_NAME => array(
*
* @return void
*/
- function preProcess() {
+ public function preProcess() {
$config = CRM_Core_Config::singleton();
CRM_Utils_System::setTitle(ts('CiviContribute Component Settings'));
$this->_varNames = array(
* @return void
* @access public
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->add('checkbox', 'invoicing', ts('Enable Tax and Invoicing'));
parent::buildQuickForm();
}
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
return $defaults;
}
*
*/
class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
- function preProcess() {
+ public function preProcess() {
CRM_Utils_System::setTitle(ts('Settings - Display Preferences'));
$this->_varNames = array(
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = parent::setDefaultValues();
parent::cbsDefaultValues($defaults);
*
*/
class CRM_Admin_Form_Preferences_Event extends CRM_Admin_Form_Preferences {
- function preProcess() {
+ public function preProcess() {
CRM_Utils_System::setTitle(ts('CiviEvent Component Settings'));
// pass "wiki" as 6th param to docURL2 if you are linking to a page in wiki.civicrm.org
$docLink = CRM_Utils_System::docURL2("CiviEvent Cart Checkout", NULL, NULL, NULL, NULL, "wiki");
*
*/
class CRM_Admin_Form_Preferences_Mailing extends CRM_Admin_Form_Preferences {
- function preProcess() {
+ public function preProcess() {
CRM_Utils_System::setTitle(ts('CiviMail Component Settings'));
$this->_varNames = array(
CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME => array(
parent::preProcess();
}
- function postProcess() {
+ public function postProcess() {
// check if mailing tab is enabled, if not prompt user to enable the tab if "write_activity_record" is disabled
$params = $this->controller->exportValues($this->_name);
*
*/
class CRM_Admin_Form_Preferences_Member extends CRM_Admin_Form_Preferences {
- function preProcess() {
+ public function preProcess() {
CRM_Utils_System::setTitle(ts('CiviMember Component Settings'));
$this->_varNames = array(
CRM_Core_BAO_Setting::MEMBER_PREFERENCES_NAME => array(
* @return void
* @access public
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
parent::buildQuickForm();
}
}
*
*/
class CRM_Admin_Form_Preferences_Multisite extends CRM_Admin_Form_Preferences {
- function preProcess() {
+ public function preProcess() {
$msDoc = CRM_Utils_System::docURL2('Multi Site Installation', NULL, NULL, NULL, NULL, "wiki");
CRM_Utils_System::setTitle(ts('Multi Site Settings'));
$this->_varNames = array(
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$errors = array();
if ($fields['name'] == 'activityDateTime' && !$fields['time_format']) {
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if ($this->_action != CRM_Core_Action::DELETE &&
isset($this->_id)
) {
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
if ((array_key_exists(1, $fields['entity']) && $fields['entity'][1][0] === 0) ||
(array_key_exists(2, $fields['entity']) && $fields['entity'][2][0] == 0)
/**
* @return int
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if ($this->_action & CRM_Core_Action::ADD) {
$defaults['is_active'] = 1;
$defaults['mode'] = 'Email';
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if (!$this->_defaults) {
$this->_defaults = array();
$formArray = array('Component', 'Localization');
* @access public
* @static
*/
- static function formRule($fields, $files, $options) {
+ public static function formRule($fields, $files, $options) {
$errors = array();
if (array_key_exists('enableComponents', $fields) && is_array($fields['enableComponents'])) {
*
* @return array|bool
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$errors = array();
if (CRM_Utils_Array::value('monetaryThousandSeparator', $fields) ==
CRM_Utils_Array::value('monetaryDecimalPoint', $fields)
return empty($errors) ? TRUE : $errors;
}
- function setDefaultValues() {
+ public function setDefaultValues() {
parent::setDefaultValues();
// CRM-1496
*
* @return array|bool
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$errors = array();
if (CRM_Utils_Array::value('mailerJobSize', $fields) > 0) {
* @access public
* @static
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$errors = array();
if (!CRM_Utils_System::checkPHPVersion(5, FALSE)) {
* @return void
* @access public
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Admin_Form_Setting_Mapping', 'formRule'));
}
}
* @access public
* @static
*/
- static function formRule($fields, $files, $options) {
+ public static function formRule($fields, $files, $options) {
$errors = array();
// validate max file size
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
if ($fields['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_SMTP) {
if (empty($fields['smtpServer'])) {
$errors['smtpServer'] = 'SMTP Server name is a required field.';
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if (!$this->_defaults) {
$this->_defaults = array();
parent::buildQuickForm();
}
- function setDefaultValues() {
+ public function setDefaultValues() {
if (!$this->_defaults) {
parent::setDefaultValues();
*
* @return array
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$tmpDir = trim($fields['newBaseDir']);
$errors = array();
return $errors;
}
- function postProcess() {
+ public function postProcess() {
if (!empty($_POST['_qf_UpdateConfigBackend_next_cleanup'])) {
$config = CRM_Core_Config::singleton();
*
* @return array|bool
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
if (isset($fields['enableSSL']) &&
$fields['enableSSL']
) {
protected $_defaults = NULL;
- function preProcess() {
+ public function preProcess() {
// This controller was originally written to CRUD $config->locale_custom_strings,
// but that's no longer the canonical store. Re-sync from canonical store to ensure
// that we display that latest data. This is inefficient - at some point, we
* @static
* @access public
*/
- static function formRule($values) {
+ public static function formRule($values) {
$errors = array();
$oldValues = CRM_Utils_Array::value('old', $values);
* CRM-12337 Output navigation menu as executable javascript
* @see smarty_function_crmNavigationMenu
*/
- static function getNavigationMenu() {
+ public static function getNavigationMenu() {
$contactID = CRM_Core_Session::singleton()->get('userID');
if ($contactID) {
CRM_Core_Page_AJAX::setJsHeaders();
/**
* Return menu tree as json data for editing
*/
- static function getNavigationList() {
+ public static function getNavigationList() {
echo CRM_Core_BAO_Navigation::buildNavigation(TRUE, FALSE);
CRM_Utils_System::civiExit();
}
/**
* Process drag/move action for menu tree
*/
- static function menuTree() {
+ public static function menuTree() {
CRM_Core_BAO_Navigation::processNavigation($_GET);
}
* Build status message while
* enabling/ disabling various objects
*/
- static function getStatusMsg() {
+ public static function getStatusMsg() {
require_once('api/v3/utils.php');
$recordID = CRM_Utils_Type::escape($_GET['id'], 'Integer');
$entity = CRM_Utils_Type::escape($_GET['entity'], 'String');
CRM_Core_Page_AJAX::returnJsonResponse($ret);
}
- static function mergeTagList() {
+ public static function mergeTagList() {
$name = CRM_Utils_Type::escape($_GET['term'], 'String');
$fromId = CRM_Utils_Type::escape($_GET['fromId'], 'Integer');
$limit = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'search_autocomplete_count', NULL, 10);
CRM_Utils_JSON::output($result);
}
- function mappingList() {
+ public function mappingList() {
if (empty($_GET['mappingID'])) {
CRM_Utils_JSON::output(array('status' => 'error', 'error_msg' => 'required params missing.'));
}
CRM_Utils_JSON::output($output);
}
- static function mergeTags() {
+ public static function mergeTags() {
$tagAId = CRM_Utils_Type::escape($_POST['fromId'], 'Integer');
$tagBId = CRM_Utils_Type::escape($_POST['toId'], 'Integer');
/**
* @return string
*/
- function run() {
+ public function run() {
CRM_Utils_System::setTitle(ts('API Parameters'));
return parent::run();
}
/**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
return 'CRM/Core/APIDoc.tpl';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/api/doc';
}
}
/**
* @return string
*/
- function run() {
+ public function run() {
CRM_Utils_System::setTitle(ts('API explorer and generator'));
CRM_Core_Resources::singleton()
->addScriptFile('civicrm', 'templates/CRM/Admin/Page/APIExplorer.js')
*
* @return string user context.
*/
- function userContext() {
+ public function userContext() {
return 'civicrm/api/explorer';
}
}
/**
* @return string
*/
- function run() {
+ public function run() {
$config = CRM_Core_Config::singleton();
switch ($config->userFramework) {
/**
* @return string
*/
- function run() {
+ public function run() {
$errorMessage = '';
// ensure that all CiviCRM tables are InnoDB, else abort
// this is not a very fast operation, so we do it randomly 10% of the times
* @access public
*
*/
- function run() {
+ public function run() {
//if javascript is enabled
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean',
$this, '', '', 'GET'
/**
* @return string
*/
- function run() {
+ public function run() {
CRM_Utils_System::setTitle(ts("Configuration Checklist"));
$this->assign('recentlyViewed', FALSE);
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Contact_BAO_ContactType';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
return self::$_links;
}
- function run() {
+ public function run() {
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 0);
$this->assign('action', $action);
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
return parent::run();
}
- function browse() {
+ public function browse() {
$rows = CRM_Contact_BAO_ContactType::contactTypeInfo(TRUE);
foreach ($rows as $key => $value) {
$mask = NULL;
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_ContactType';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Contact Types';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/options/subtype';
}
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Event_BAO_Event';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
// helper variable for nicer formatting
self::$_links = array(
* @access public
* @static
*/
- function browse() {
+ public function browse() {
//get all event templates.
$allEventTemplates = array();
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_EventTemplate';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Event Templates';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/eventTemplate';
}
}
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
CRM_Utils_System::setTitle(ts('CiviCRM Extensions'));
$destination = CRM_Utils_System::url( 'civicrm/admin/extensions',
'reset=1' );
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Core_BAO_Extension';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::ADD => array(
*
* @return void
*/
- function run() {
+ public function run() {
$this->preProcess();
return parent::run();
}
* @access public
* @static
*/
- function browse() {
+ public function browse() {
$mapper = CRM_Extension_System::singleton()->getMapper();
$manager = CRM_Extension_System::singleton()->getManager();
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_Extensions';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'CRM_Admin_Form_Extensions';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/extensions';
}
* @return string
* @access public
*/
- function userContextParams($mode = NULL) {
+ public function userContextParams($mode = NULL) {
return 'reset=1&action=browse';
}
const END_URL = 'civicrm/admin/extensions';
const END_PARAMS = 'reset=1';
- function run() {
+ public function run() {
$queue = CRM_Extension_Upgrades::createQueue();
$runner = new CRM_Queue_Runner(array(
'title' => ts('Database Upgrades'),
/**
* Handle the final step of the queue
*/
- static function onEnd(CRM_Queue_TaskContext $ctx) {
+ public static function onEnd(CRM_Queue_TaskContext $ctx) {
CRM_Core_Error::debug_log_message('CRM_Admin_Page_ExtensionsUpgrade: Finish upgrades');
}
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Core_BAO_Job';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::FOLLOWUP => array(
* @access public
*
*/
- function run() {
+ public function run() {
// set title and breadcrumb
CRM_Utils_System::setTitle(ts('Settings - Scheduled Jobs'));
$breadCrumb = array(array('title' => ts('Scheduled Jobs'),
* @access public
* @static
*/
- function browse($action = NULL) {
+ public function browse($action = NULL) {
// using Export action for Execute. Doh.
if ($this->_action & CRM_Core_Action::EXPORT) {
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_Job';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Scheduled Jobs';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/job';
}
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Core_BAO_Job';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
return self::$_links;
}
* @access public
*
*/
- function run() {
+ public function run() {
// set title and breadcrumb
CRM_Utils_System::setTitle(ts('Settings - Scheduled Jobs Log'));
$breadCrumb = array(array('title' => ts('Administration'),
* @access public
* @static
*/
- function browse($action = NULL) {
+ public function browse($action = NULL) {
$jid = CRM_Utils_Request::retrieve('jid', 'Positive', $this);
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_Job';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Scheduled Jobs';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/job';
}
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Core_BAO_LabelFormat';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
// helper variable for nicer formatting
self::$_links = array(
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_LabelFormats';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Mailing Label Formats';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/labelFormats';
}
* @access public
* @static
*/
- function browse($action = NULL) {
+ public function browse($action = NULL) {
// Get list of configured Label Formats
$labelFormatList= CRM_Core_BAO_LabelFormat::getList();
$nameFormatList= CRM_Core_BAO_LabelFormat::getList(false, 'name_badge');
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Core_BAO_LocationType';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_LocationType';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Location Types';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/locationType';
}
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Core_BAO_MailSettings';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
// helper variable for nicer formatting
self::$_links = array(
* @access public
* @static
*/
- function browse() {
+ public function browse() {
//get all mail settings.
$allMailSettings = array();
$mailSetting = new CRM_Core_DAO_MailSettings();
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_MailSettings';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Mail Settings';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/mailSettings';
}
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Core_BAO_Mapping';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
// helper variable for nicer formatting
$deleteExtra = ts('Are you sure you want to delete this mapping?') . ' ' . ts('This operation cannot be undone.');
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_Mapping';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Mapping';
}
*
* @return string name of this page.
*/
- function deleteName() {
+ public function deleteName() {
return 'Mapping';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/mapping';
}
*
* @return string Classname of delete form.
*/
- function deleteForm() {
+ public function deleteForm() {
return 'CRM_Admin_Form_Mapping';
}
*
* @return void
*/
- function run() {
+ public function run() {
$sort = 'mapping_type asc';
return parent::run($sort);
}
* @param null $title
* @param null $mode
*/
- function __construct($title = NULL, $mode = NULL) {
+ public function __construct($title = NULL, $mode = NULL) {
parent::__construct($title, $mode);
// fetch the ids of templates which diverted from defaults and can be reverted –
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Core_BAO_MessageTemplate';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
$confirm = ts('Are you sure you want to revert this template to the default for this workflow? You will lose any customizations you have made.', array('escape' => 'js')) . '\n\n' . ts('We recommend that you save a copy of the your customized Text and HTML message content to a text file before reverting so you can combine your changes with the system default messages as needed.', array('escape' => 'js'));
self::$_links = array(
* @param string $permission
* @param bool $forceAction
*/
- function action(&$object, $action, &$values, &$links, $permission, $forceAction = FALSE) {
+ public function action(&$object, $action, &$values, &$links, $permission, $forceAction = FALSE) {
if ($object->workflow_id) {
// do not expose action link for reverting to default if the template did not diverge or we just reverted it now
if (!in_array($object->id, array_keys($this->_revertible)) or
*
* @throws Exception
*/
- function run($args = NULL, $pageArgs = NULL, $sort = NULL) {
+ public function run($args = NULL, $pageArgs = NULL, $sort = NULL) {
// handle the revert action and offload the rest to parent
if (CRM_Utils_Request::retrieve('action', 'String', $this) & CRM_Core_Action::REVERT) {
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_MessageTemplates';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return ts('Message Template');
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/messageTemplates';
}
* @return void
* @access public
*/
- function browse() {
+ public function browse() {
$action = func_num_args() ? func_get_arg(0) : NULL;
if ($this->_action & CRM_Core_Action::ADD) {
return;
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Core_BAO_Navigation';
}
*
* @return array (reference) of action links
*/
- function &links() {}
+ public function &links() {}
/**
* Get name of edit form
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_Navigation';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'CiviCRM Navigation';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/menu';
}
/**
* Browse all menus
*/
- function browse() {
+ public function browse() {
// assign home id to the template
$homeMenuId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Home', 'id', 'name');
$this->assign('homeMenuId', $homeMenuId);
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
if (!self::$_gName && !empty($this->urlPath[3])) {
self::$_gName = $this->urlPath[3];
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return self::$_gName ? 'CRM_Core_BAO_OptionValue' : 'CRM_Core_BAO_OptionGroup';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
*
* @return void
*/
- function run() {
+ public function run() {
$this->preProcess();
return parent::run();
}
* @access public
* @static
*/
- function browse() {
+ public function browse() {
if (!self::$_gName) {
return parent::browse();
}
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return self::$_gName ? 'CRM_Admin_Form_Options' : 'CRM_Admin_Form_OptionGroup';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return self::$_gLabel;
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/options' . (self::$_gName ? '/' . self::$_gName : '');
}
}
/**
* @return string
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Event_BAO_ParticipantStatusType';
}
/**
* @return array
*/
- function &links() {
+ public function &links() {
static $links = NULL;
if ($links === NULL) {
$links = array(
return $links;
}
- function browse() {
+ public function browse() {
$statusTypes = array();
$dao = new CRM_Event_DAO_ParticipantStatusType;
/**
* @return string
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_ParticipantStatus';
}
/**
* @return string
*/
- function editName() {
+ public function editName() {
return 'Participant Status';
}
*
* @return string
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/participant_status';
}
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Financial_BAO_PaymentProcessor';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
* @access public
*
*/
- function run() {
+ public function run() {
// set title and breadcrumb
CRM_Utils_System::setTitle(ts('Settings - Payment Processor'));
//CRM-15546
* @access public
* @static
*/
- function browse($action = NULL) {
+ public function browse($action = NULL) {
// get all custom groups sorted by weight
$paymentProcessor = array();
$dao = new CRM_Financial_DAO_PaymentProcessor();
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_PaymentProcessor';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Payment Processors';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/paymentProcessor';
}
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Financial_BAO_PaymentProcessorType';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_PaymentProcessorType';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Payment Processor Type';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/paymentProcessorType';
}
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Core_BAO_PdfFormat';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
// helper variable for nicer formatting
self::$_links = array(
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_PdfFormats';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'PDF Page Formats';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/pdfFormats';
}
* @access public
* @static
*/
- function browse($action = NULL) {
+ public function browse($action = NULL) {
// Get list of configured PDF Page Formats
$pdfFormatList = CRM_Core_BAO_PdfFormat::getList();
/**
* @return array
*/
- function &customizeActionLinks() {
+ public function &customizeActionLinks() {
// check if variable _actionsLinks is populated
if (!isset(self::$_customizeActionLinks)) {
*
* @return void
*/
- function run() {
+ public function run() {
CRM_Utils_System::setTitle(ts('DB Template Strings'));
$this->browse();
return parent::run();
* @access public
* @static
*/
- function browse() {
+ public function browse() {
$permission = FALSE;
$this->assign('editClass', FALSE);
if (CRM_Core_Permission::check('access CiviCRM')) {
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Core_BAO_PreferencesDate';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
* @access public
*
*/
- function run() {
+ public function run() {
// set title and breadcrumb
CRM_Utils_System::setTitle(ts('Settings - Date Preferences'));
return parent::run();
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_PreferencesDate';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Date Preferences';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/setting/preferences/date';
}
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Contact_BAO_RelationshipType';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::VIEW => array(
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_RelationshipType';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Relationship Types';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/reltype';
}
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Core_BAO_ActionSchedule';
}
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_ScheduleReminders';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'ScheduleReminders';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/scheduleReminders';
}
* @access public
* @static
*/
- function browse($action = NULL) {
+ public function browse($action = NULL) {
// Get list of configured reminders
$reminderList = CRM_Core_BAO_ActionSchedule::getList();
* @return string
* @throws Exception
*/
- function run() {
+ public function run() {
CRM_Core_Error::fatal('This page is deprecated. If you have followed a link or have been redirected here, please change link or redirect to Admin Console (/civicrm/admin?reset=1)');
CRM_Utils_System::setTitle(ts("Global Settings"));
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Core_BAO_Tag';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Admin_Form_Tag';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Tag';
}
*
* @return string name of this page.
*/
- function deleteName() {
+ public function deleteName() {
return 'Tag';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/tag';
}
*
* @return string Classname of delete form.
*/
- function deleteForm() {
+ public function deleteForm() {
return 'CRM_Admin_Form_Tag';
}
* @param null $action
* @param null $sort
*/
- function browse($action = NULL, $sort = NULL) {
+ public function browse($action = NULL, $sort = NULL) {
$adminTagSet = FALSE;
if (CRM_Core_Permission::check('administer Tagsets')) {
$adminTagSet = TRUE;
*
* @return array $formattedRow row with meta data
*/
- static function formatLabel(&$row, &$layout) {
+ public static function formatLabel(&$row, &$layout) {
$formattedRow = array('labelFormat' => $layout['label_format_name']);
$formattedRow['labelTitle'] = $layout['title'];
$formattedRow['labelId'] = $layout['id'];
* @return void
* @access public
*/
- function printImage($img, $x = '', $y = '', $w = NULL, $h = NULL) {
+ public function printImage($img, $x = '', $y = '', $w = NULL, $h = NULL) {
if (!$x) {
$x = $this->pdf->GetAbsX();
}
*
* @return array
*/
- static function getImageProperties($img, $imgRes = 300, $w = NULL, $h = NULL) {
+ public static function getImageProperties($img, $imgRes = 300, $w = NULL, $h = NULL) {
$imgsize = getimagesize($img);
$f = $imgRes / 25.4;
$w = !empty($w) ? $w : $imgsize[0] / $f;
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$printLabel = new CRM_Core_DAO_PrintLabel();
$printLabel->copyValues($params);
if ($printLabel->find(TRUE)) {
* @access public
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_PrintLabel', $id, 'is_active', $is_active);
}
*
* @return object
*/
- static function create(&$params) {
+ public static function create(&$params) {
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['is_default'] = CRM_Utils_Array::value('is_default', $params, FALSE);
$params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, FALSE);
* @access public
* @static
*/
- static function del($printLabelId) {
+ public static function del($printLabelId) {
$printLabel = new CRM_Core_DAO_PrintLabel();
$printLabel->id = $printLabelId;
$printLabel->delete();
* @access public
* @static
*/
- static function getList() {
+ public static function getList() {
$printLabel = new CRM_Core_DAO_PrintLabel();
$printLabel->find();
* @return array $formattedLayout array formatted array
* @access public
*/
- static function buildLayout(&$params) {
+ public static function buildLayout(&$params) {
$layoutParams = array('id' => $params['badge_id']);
CRM_Badge_BAO_Layout::retrieve($layoutParams, $layoutInfo);
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if (isset($this->_id)) {
$defaults = array_merge($this->_values,
CRM_Badge_BAO_Layout::getDecodedData($this->_values['data']));
*/
class CRM_Badge_Page_AJAX {
- static function getImageProp() {
+ public static function getImageProp() {
$img = $_GET['img'];
list($w, $h) = CRM_Badge_BAO_Badge::getImageProperties($img);
CRM_Utils_JSON::output(array('width' => $w, 'height' => $h));
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Badge_BAO_Layout';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Badge_Form_Layout';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Badge Layout';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/badgelayout';
}
}
* @return object $batch batch object
* @access public
*/
- static function create(&$params, $ids = NULL, $context = NULL) {
+ public static function create(&$params, $ids = NULL, $context = NULL) {
if (empty($params['id'])) {
$params['name'] = CRM_Utils_String::titleToVar($params['title']);
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$batch = new CRM_Batch_DAO_Batch();
$batch->copyValues($params);
if ($batch->find(TRUE)) {
* @return int $profileId profile id
* @static
*/
- static function getProfileId($batchTypeId) {
+ public static function getProfileId($batchTypeId) {
//retrieve the profile specific to batch type
switch ($batchTypeId) {
case 1:
* @return batch name
* @static
*/
- static function generateBatchName() {
+ public static function generateBatchName() {
$sql = "SELECT max(id) FROM civicrm_batch";
$batchNo = CRM_Core_DAO::singleValueQuery($sql) + 1;
return ts('Batch %1', array(1 => $batchNo)) . ': ' . date('Y-m-d');
* @return batch array
* @access public
*/
- static function addBatchEntity(&$params) {
+ public static function addBatchEntity(&$params) {
$entityBatch = new CRM_Batch_DAO_EntityBatch();
$entityBatch->copyValues($params);
$entityBatch->save();
* @param array $params associated array
* @return CRM_Batch_DAO_EntityBatch
*/
- static function removeBatchEntity($params) {
+ public static function removeBatchEntity($params) {
$entityBatch = new CRM_Batch_DAO_EntityBatch();
$entityBatch->copyValues($params);
$entityBatch->delete();
* @return void
* @access public
*/
- static function deleteBatch($batchId) {
+ public static function deleteBatch($batchId) {
// delete entry from batch table
$batch = new CRM_Batch_DAO_Batch();
$batch->id = $batchId;
* @return array
* @access public
*/
- static function getBatchList(&$params) {
+ public static function getBatchList(&$params) {
$whereClause = self::whereClause($params);
if (!empty($params['rowCount']) && is_numeric($params['rowCount'])
* @return array $links array of action links
* @access public
*/
- function links($context = NULL) {
+ public function links($context = NULL) {
if ($context == 'financialBatch') {
$links = array(
'transaction' => array(
* @return array array of all batches
* excluding batches with data entry in progress
*/
- static function getBatches() {
+ public static function getBatches() {
$dataEntryStatusId = CRM_Core_OptionGroup::getValue('batch_status','Data Entry', 'name');
$query = "SELECT id, title
FROM civicrm_batch
* @param array $batchIds
* @return array
*/
- static function batchTotals($batchIds) {
+ public static function batchTotals($batchIds) {
$totals = array_fill_keys($batchIds, array('item_count' => 0, 'total' => 0));
if ($batchIds) {
$sql = "SELECT eb.batch_id, COUNT(tx.id) AS item_count, SUM(tx.total_amount) AS total
* @param $expected: user-entered total
* @return array
*/
- static function displayTotals($actual, $expected) {
+ public static function displayTotals($actual, $expected) {
$class = 'actual-value';
if ($expected && $expected != $actual) {
$class .= ' crm-error';
* @static
* @access public
*/
- static function exportFinancialBatch($batchIds, $exportFormat) {
+ public static function exportFinancialBatch($batchIds, $exportFormat) {
if (empty($batchIds)) {
CRM_Core_Error::fatal(ts('No batches were selected.'));
return;
* @param array $batchIds
* @param $status
*/
- static function closeReOpen($batchIds = array(), $status) {
+ public static function closeReOpen($batchIds = array(), $status) {
$batchStatus = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id');
$params['status_id'] = CRM_Utils_Array::key( $status, $batchStatus );
$session = CRM_Core_Session::singleton( );
*
* @return Object
*/
- static function getBatchFinancialItems($entityID, $returnValues, $notPresent = NULL, $params = NULL, $getCount = FALSE) {
+ public static function getBatchFinancialItems($entityID, $returnValues, $notPresent = NULL, $params = NULL, $getCount = FALSE) {
if (!$getCount) {
if (!empty($params['rowCount']) &&
$params['rowCount'] > 0
*
* @return array array of batches
*/
- static function getBatchNames($batchIds) {
+ public static function getBatchNames($batchIds) {
$query = 'SELECT id, title
FROM civicrm_batch
WHERE id IN ('. $batchIds . ')';
*
* @return array array of batches
*/
- static function getBatchStatuses($batchIds) {
+ public static function getBatchStatuses($batchIds) {
$query = 'SELECT id, status_id
FROM civicrm_batch
WHERE id IN ('.$batchIds.')';
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if ($this->_action & CRM_Core_Action::ADD) {
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->_batchId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
if (!$this->_profileId) {
CRM_Core_Error::fatal(ts('Profile for bulk data entry is missing.'));
}
* @static
* @access public
*/
- static function formRule($params, $files, $self) {
+ public static function formRule($params, $files, $self) {
$errors = array();
$batchTypes = CRM_Core_Pseudoconstant::get('CRM_Batch_DAO_Batch', 'type_id', array('flip' => 1), 'validate');
/**
* Override default cancel action
*/
- function cancelAction() {
+ public function cancelAction() {
// redirect to batch listing
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/batch', 'reset=1'));
CRM_Utils_System::civiExit();
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if (empty($this->_fields)) {
return;
}
*
* @return bool
*/
- function testProcessMembership($params) {
+ public function testProcessMembership($params) {
return $this->processMembership($params);
}
*
* @return bool
*/
- function testProcessContribution($params) {
+ public function testProcessContribution($params) {
return $this->processContribution($params);
}
}
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$status = CRM_Utils_Request::retrieve('status', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1);
/**
* Save record
*/
- function batchSave() {
+ public function batchSave() {
// save the entered information in 'data' column
$batchId = CRM_Utils_Type::escape($_POST['batch_id'], 'Positive');
/**
* Retrieve records
*/
- static function getBatchList() {
+ public static function getBatchList() {
$sortMapper = array(
0 => 'batch.title',
1 => 'batch.type_id',
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Batch_BAO_Batch';
}
*
* @return array (reference) of action links
*/
- function &links() {}
+ public function &links() {}
/**
* Get name of edit form
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Batch_Form_Batch';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return ts('Batch Processing');
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return CRM_Utils_System::currentPath();
}
* @return void
* @access public
*/
- function browse() {
+ public function browse() {
$status = CRM_Utils_Request::retrieve('status', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1);
$this->assign('status', $status);
$this->search();
}
- function search() {
+ public function search() {
if ($this->_action &
(CRM_Core_Action::ADD |
CRM_Core_Action::UPDATE |
* @param $group
* @param $op
*/
- static function group($groupID, $group, $op) {
+ public static function group($groupID, $group, $op) {
if ($op == 'add') {
self::groupAdd($groupID, $group);
}
* @param int $groupID
* @param $group
*/
- static function groupAdd($groupID, $group) {
+ public static function groupAdd($groupID, $group) {
$ogID = CRM_Bridge_OG_Utils::ogID($groupID, FALSE);
$node = new StdClass();
* @param int $groupID
* @param $group
*/
- static function groupDelete($groupID, $group) {
+ public static function groupDelete($groupID, $group) {
$ogID = CRM_Bridge_OG_Utils::ogID($groupID, FALSE);
if (!$ogID) {
return;
* @param $contactIDs
* @param $op
*/
- static function groupContact($groupID, $contactIDs, $op) {
+ public static function groupContact($groupID, $contactIDs, $op) {
$config = CRM_Core_Config::singleton();
$ogID = CRM_Bridge_OG_Utils::ogID($groupID, FALSE);
* @param array $params
* @param $op
*/
- static function nodeapi(&$params, $op) {
+ public static function nodeapi(&$params, $op) {
$transaction = new CRM_Core_Transaction();
* @param $op
* @param null $groupType
*/
- static function updateCiviGroup(&$params, $op, $groupType = NULL) {
+ public static function updateCiviGroup(&$params, $op, $groupType = NULL) {
$abort = false;
$params['version'] = 3;
$params['id'] = CRM_Bridge_OG_Utils::groupID($params['source'], $params['title'], $abort);
* @param array $aclParams
* @param $op
*/
- static function updateCiviACLTables($aclParams, $op) {
+ public static function updateCiviACLTables($aclParams, $op) {
if ($op == 'delete') {
self::updateCiviACL($aclParams, $op);
self::updateCiviACLEntityRole($aclParams, $op);
* @param array $params
* @param $op
*/
- static function updateCiviACLRole(&$params, $op) {
+ public static function updateCiviACLRole(&$params, $op) {
$optionGroupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup',
'acl_role',
* @param array $params
* @param $op
*/
- static function updateCiviACLEntityRole(&$params, $op) {
+ public static function updateCiviACLEntityRole(&$params, $op) {
$dao = new CRM_ACL_DAO_EntityRole();
$dao->entity_table = 'civicrm_group';
* @param array $params
* @param $op
*/
- static function updateCiviACL(&$params, $op) {
+ public static function updateCiviACL(&$params, $op) {
$dao = new CRM_ACL_DAO_ACL();
$dao->object_table = 'civicrm_saved_search';
*
* @throws Exception
*/
- static function og(&$params, $op) {
+ public static function og(&$params, $op) {
$contactID = CRM_Bridge_OG_Utils::contactID($params['uf_id']);
if (!$contactID) {
/**
* @return int
*/
- static function aclEnabled() {
+ public static function aclEnabled() {
return self::aclEnabled;
}
* This was always false before, and is always true
* now. Most likely, this needs to be a setting.
*/
- static function syncFromCiviCRM() {
+ public static function syncFromCiviCRM() {
// make sure that acls are not enabled
//RMT -- the following makes no f**king sense...
//return ! self::aclEnabled & self::syncFromCiviCRM;
*
* @return string
*/
- static function ogSyncName($ogID) {
+ public static function ogSyncName($ogID) {
return "OG Sync Group :{$ogID}:";
}
*
* @return string
*/
- static function ogSyncACLName($ogID) {
+ public static function ogSyncACLName($ogID) {
return "OG Sync Group ACL :{$ogID}:";
}
* @return int|null|string
* @throws Exception
*/
- static function ogID($groupID, $abort = TRUE) {
+ public static function ogID($groupID, $abort = TRUE) {
$source = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group',
$groupID,
'source'
* @return int
* @throws Exception
*/
- static function contactID($ufID) {
+ public static function contactID($ufID) {
$contactID = CRM_Core_BAO_UFMatch::getContactId($ufID);
if ($contactID) {
return $contactID;
* @return null|string
* @throws Exception
*/
- static function groupID($source, $title = NULL, $abort = FALSE) {
+ public static function groupID($source, $title = NULL, $abort = FALSE) {
$query = "
SELECT id
FROM civicrm_group
* @access public
* @static
*/
- static function create(&$params) {
+ public static function create(&$params) {
if (empty($params)) {
return;
}
*
* @static
*/
- static function getCampaignSummary($params = array(), $onlyCount = FALSE) {
+ public static function getCampaignSummary($params = array(), $onlyCount = FALSE) {
$campaigns = array();
//build the limit and order clause.
*
* @static
*/
- static function getCampaignCount() {
+ public static function getCampaignCount() {
return (int)CRM_Core_DAO::singleValueQuery('SELECT COUNT(*) FROM civicrm_campaign');
}
* @return array
* @static
*/
- static function getCampaignGroups($campaignId) {
+ public static function getCampaignGroups($campaignId) {
static $campaignGroups;
if (!$campaignId) {
return array();
* @return Object DAO object on sucess, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Campaign_DAO_Campaign', $id, 'is_active', $is_active);
}
/**
* @return bool
*/
- static function accessCampaign() {
+ public static function accessCampaign() {
static $allow = NULL;
if (!isset($allow)) {
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
// expire cookie in one day
$this->cookieExpire = (1 * 60 * 60 * 24);
*
* @static
*/
- static function getPetitionSummary($params = array(), $onlyCount = FALSE) {
+ public static function getPetitionSummary($params = array(), $onlyCount = FALSE) {
//build the limit and order clause.
$limitClause = $orderByClause = $lookupTableJoins = NULL;
if (!$onlyCount) {
*
* @static
*/
- static function getPetitionCount() {
+ public static function getPetitionCount() {
$whereClause = 'WHERE ( 1 )';
$queryParams = array();
$petitionTypeID = CRM_Core_OptionGroup::getValue('activity_type', 'petition', 'name');
* @access public
* @static
*/
- function createSignature(&$params) {
+ public function createSignature(&$params) {
if (empty($params)) {
return;
}
*
* @return bool
*/
- function confirmSignature($activity_id, $contact_id, $petition_id) {
+ public function confirmSignature($activity_id, $contact_id, $petition_id) {
// change activity status to completed (status_id = 2)
// I wonder why do we need contact_id when we have activity_id anyway? [chastell]
$sql = 'UPDATE civicrm_activity SET status_id = 2 WHERE id = %1';
* @return array
* @static
*/
- static function getPetitionSignatureTotalbyCountry($surveyId) {
+ public static function getPetitionSignatureTotalbyCountry($surveyId) {
$countries = array();
$sql = "
SELECT count(civicrm_address.country_id) as total,
* @return array
* @static
*/
- static function getPetitionSignatureTotal($surveyId) {
+ public static function getPetitionSignatureTotal($surveyId) {
$surveyInfo = CRM_Campaign_BAO_Petition::getSurveyInfo((int) $surveyId);
//$activityTypeID = $surveyInfo['activity_type_id'];
$sql = "
* @return array
* @static
*/
- static function getPetitionSignature($surveyId, $status_id = NULL) {
+ public static function getPetitionSignature($surveyId, $status_id = NULL) {
// sql injection protection
$surveyId = (int) $surveyId;
* @return array $contactIds array of contact ids
* @access public
*/
- function getEntitiesByTag($tag) {
+ public function getEntitiesByTag($tag) {
$contactIds = array();
$entityTagDAO = new CRM_Core_DAO_EntityTag();
$entityTagDAO->tag_id = $tag['id'];
* @return array
* @static
*/
- static function checkSignature($surveyId, $contactId) {
+ public static function checkSignature($surveyId, $contactId) {
$surveyInfo = CRM_Campaign_BAO_Petition::getSurveyInfo($surveyId);
$signature = array();
* @return array self::$_campaignFields an associative array of campaign fields
* @static
*/
- static function &getFields() {
+ public static function &getFields() {
if (!isset(self::$_campaignFields)) {
self::$_campaignFields = array();
}
* @return void
* @access public
*/
- static function select(&$query) {
+ public static function select(&$query) {
self::$_applySurveyClause = FALSE;
if (is_array($query->_params)) {
foreach ($query->_params as $values) {
/**
* @param $query
*/
- static function where(&$query) {
+ public static function where(&$query) {
//get survey clause in force,
//only when we have survey id.
if (!self::$_applySurveyClause) {
* @param $values
* @param $query
*/
- static function whereClauseSingle(&$values, &$query) {
+ public static function whereClauseSingle(&$values, &$query) {
//get survey clause in force,
//only when we have survey id.
if (!self::$_applySurveyClause) {
*
* @return null|string
*/
- static function from($name, $mode, $side) {
+ public static function from($name, $mode, $side) {
$from = NULL;
//get survey clause in force,
//only when we have survey id.
/**
* @param $tables
*/
- static function tableNames(&$tables) {}
+ public static function tableNames(&$tables) {}
/**
* @param $row
* @param int $id
*/
- static function searchAction(&$row, $id) {}
+ public static function searchAction(&$row, $id) {}
/**
* @param $tables
*/
- static function info(&$tables) {
+ public static function info(&$tables) {
//get survey clause in force,
//only when we have survey id.
if (!self::$_applySurveyClause) {
* @return void
* @static
*/
- static function buildSearchForm(&$form) {
+ public static function buildSearchForm(&$form) {
$attributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_Address');
$className = CRM_Utils_System::getClassName($form);
*
* @return CRM_Campaign_DAO_Survey|null
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$dao = new CRM_Campaign_DAO_Survey();
$dao->copyValues($params);
* @access public
* @static
*/
- static function create(&$params) {
+ public static function create(&$params) {
if (empty($params)) {
return false;
}
*
* @static
*/
- static function getSurveySummary($params = array(), $onlyCount = FALSE) {
+ public static function getSurveySummary($params = array(), $onlyCount = FALSE) {
//build the limit and order clause.
$limitClause = $orderByClause = $lookupTableJoins = NULL;
if (!$onlyCount) {
*
* @static
*/
- static function getSurveyCount() {
+ public static function getSurveyCount() {
return (int)CRM_Core_DAO::singleValueQuery('SELECT COUNT(*) FROM civicrm_survey');
}
*
* @static
*/
- static function getSurveys($onlyActive = TRUE, $onlyDefault = FALSE, $forceAll = FALSE, $includePetition = FALSE ) {
+ public static function getSurveys($onlyActive = TRUE, $onlyDefault = FALSE, $forceAll = FALSE, $includePetition = FALSE ) {
$cacheKey = 0;
$cacheKeyParams = array('onlyActive', 'onlyDefault', 'forceAll', 'includePetition');
foreach ($cacheKeyParams as $param) {
* @return array
* @static
*/
- static function getSurveyCustomGroups($surveyTypes = array()) {
+ public static function getSurveyCustomGroups($surveyTypes = array()) {
$customGroups = array();
if (!is_array($surveyTypes)) {
$surveyTypes = array($surveyTypes);
* @return Object DAO object on sucess, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Campaign_DAO_Survey', $id, 'is_active', $is_active);
}
* @static
*
*/
- static function del($id) {
+ public static function del($id) {
if (!$id) {
return NULL;
}
* @return array $voterDetails array of contact info.
* @static
*/
- static function voterDetails($voterIds, $returnProperties = array()) {
+ public static function voterDetails($voterIds, $returnProperties = array()) {
$voterDetails = array();
if (!is_array($voterIds) || empty($voterIds)) {
return $voterDetails;
* @return array $$contactIds survey related contact ids.
* @static
*/
- static function getSurveyVoterInfo($surveyId, $interviewerId = NULL, $statusIds = array( )) {
+ public static function getSurveyVoterInfo($surveyId, $interviewerId = NULL, $statusIds = array( )) {
$voterIds = array();
if (!$surveyId) {
return $voterIds;
* @param string $valueColumnName
* @return array $resultSets an array of option groups.@static
*/
- static function getResultSets( $valueColumnName = 'title' ) {
+ public static function getResultSets( $valueColumnName = 'title' ) {
$resultSets = array();
$valueColumnName = CRM_Utils_Type::escape($valueColumnName, 'String');
* @return boolean $isSurveyActivity true/false
* @static
*/
- static function isSurveyActivity($activityId) {
+ public static function isSurveyActivity($activityId) {
$isSurveyActivity = FALSE;
if (!$activityId) {
return $isSurveyActivity;
* @param int $surveyId survey id.
* @return array $responseOptions an array of option values@static
*/
- static function getResponsesOptions($surveyId) {
+ public static function getResponsesOptions($surveyId) {
$responseOptions = array();
if (!$surveyId) {
return $responseOptions;
* @param string $extraULName
* @return array|string $url array of permissioned links@static
*/
- static function buildPermissionLinks($surveyId, $enclosedInUL = FALSE, $extraULName = 'more') {
+ public static function buildPermissionLinks($surveyId, $enclosedInUL = FALSE, $extraULName = 'more') {
$menuLinks = array();
if (!$surveyId) {
return $menuLinks;
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
*
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = $this->_values;
//load only custom data defaults.
* @access public
* @see valid_date
*/
- static function formRule($fields, $files, $errors) {
+ public static function formRule($fields, $files, $errors) {
$errors = array();
return empty($errors) ? TRUE : $errors;
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
if ($this->_search) {
return;
}
$this->validateIds();
}
- function validateIds() {
+ public function validateIds() {
$errorMessages = array();
//check for required permissions.
if (!CRM_Core_Permission::check('manage campaign') &&
* @return array array of default values
* @access public
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = $this->_values;
$ufContactJoinParams = array(
* Global validation rules for the form
*
*/
- static function formRule($fields, $files, $form) {
+ public static function formRule($fields, $files, $form) {
$errors = array();
// Petitions should be unique by: title, campaign ID (if assigned) and activity type ID
// NOTE: This class is called for both Petition create / update AND for Survey Results tab, but this rule is only for Petition.
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
// this property used by civicrm_fb module and if true, forces thank you email to be sent
// for users signing in via Facebook connect; also sets Fb email to check against
/**
* @return mixed
*/
- function getContactID() {
+ public function getContactID() {
$tempID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
// force to ignore the authenticated user
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$this->_defaults = array();
if ($this->_contactId) {
CRM_Core_BAO_UFGroup::setProfileDefaults($this->_contactId, $this->_contactProfileFields, $this->_defaults, TRUE);
* @see valid_date
*/
- static function formRule($fields, $files, $errors) {
+ public static function formRule($fields, $files, $errors) {
$errors = array();
return empty($errors) ? TRUE : $errors;
* @return void
* @access public
*/
- function buildCustom($id, $name, $viewOnly = FALSE) {
+ public function buildCustom($id, $name, $viewOnly = FALSE) {
if ($id) {
$session = CRM_Core_Session::singleton();
$this->assign("petition", $this->petition);
/**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
if (isset($this->thankyou)) {
return ('CRM/Campaign/Page/Petition/ThankYou.tpl');
}
/**
* @param array $params
*/
- function redirectIfSigned($params) {
+ public function redirectIfSigned($params) {
$signature = $this->bao->checkSignature($this->_surveyId, $this->_contactId);
//TODO: error case when more than one signature found for this petition and this contact
if (!empty($signature) && (count($signature) == 1)) {
CRM_Utils_System::setTitle(ts('Find Respondents To %1', array(1 => ucfirst($this->_operation))));
}
- function setDefaultValues() {
+ public function setDefaultValues() {
//load the default survey for all actions.
if (empty($this->_defaults)) {
$defaultSurveyId = key(CRM_Campaign_BAO_Survey::getSurveys(TRUE, TRUE));
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
parent::buildQuickForm();
//build the search form.
CRM_Campaign_BAO_Query::buildSearchForm($this);
* @return void
* @access public
*/
- function postProcess() {
+ public function postProcess() {
if ($this->_done) {
return;
}
$controller->run();
}
- function formatParams() {
+ public function formatParams() {
$interviewerId = CRM_Utils_Array::value('survey_interviewer_id', $this->_formValues);
if ($interviewerId) {
$this->set('interviewerId', $interviewerId);
$this->_formValues['campaign_search_voter_for'] = $this->_operation;
}
- function fixFormValues() {
+ public function fixFormValues() {
// if this search has been forced
// then see if there are any get values, and if so over-ride the post values
// note that this means that GET over-rides POST :)
/**
* @return array
*/
- function voterClause() {
+ public function voterClause() {
$params = array('campaign_search_voter_for' => $this->_operation);
$clauseFields = array(
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
if ($this->_search) {
return;
}
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
if ($this->_search) {
return;
}
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
if ($this->_search) {
return;
}
$session->replaceUserContext($url);
}
- function endPostProcess() {
+ public function endPostProcess() {
// make submit buttons keep the current working tab opened.
if ($this->_action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD)) {
$tabTitle = $className = CRM_Utils_String::getClassName($this->_name);
/**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
if ($this->controller->getPrint() || $this->getVar('_surveyId') <= 0 ) {
return parent::getTemplateFileName();
}
* @return array array of default values
* @access public
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::setDefaultValues($this);
}
* @return array array of default values
* @access public
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$ufJoinParams = array(
* @return array array of default values
* @access public
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = $this->_values;
// set defaults for weight.
* Global validation rules for the form
*
*/
- static function formRule($fields, $files, $form) {
+ public static function formRule($fields, $files, $form) {
$errors = array();
if (!empty($fields['option_label']) && !empty($fields['option_value']) &&
(count(array_filter($fields['option_label'])) == 0) &&
*
* @return array
*/
- static function build(&$form) {
+ public static function build(&$form) {
$tabs = $form->get('tabHeader');
if (!$tabs || empty($_GET['reset'])) {
$tabs = self::process($form);
*
* @return array
*/
- static function process(&$form) {
+ public static function process(&$form) {
if ($form->getVar('_surveyId') <= 0) {
return NULL;
}
/**
* @param CRM_Core_Form $form
*/
- static function reset(&$form) {
+ public static function reset(&$form) {
$tabs = self::process($form);
$form->set('tabHeader', $tabs);
}
*
* @return int|string
*/
- static function getCurrentTab($tabs) {
+ public static function getCurrentTab($tabs) {
static $current = FALSE;
if ($current) {
*
* @return int|string
*/
- static function getNextTab(&$form) {
+ public static function getNextTab(&$form) {
static $next = FALSE;
if ($next)
return $next;
* @return array array of default values
* @access public
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = parent::setDefaultValues();
if (!isset($defaults['weight']) || !$defaults['weight']) {
* @return void
* @access public
*/
- function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
+ public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
$this->addButtons(array(
array(
'type' => $nextType,
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->_votingTab = $this->get('votingTab');
$this->_reserveToInterview = $this->get('reserveToInterview');
if ($this->_reserveToInterview || $this->_votingTab) {
CRM_Utils_System::setTitle(ts('Record %1 Responses', array(1 => $activityTypes[$this->_surveyTypeId])));
}
- function validateIds() {
+ public function validateIds() {
$required = array('surveyId' => ts('Could not find Survey.'),
'interviewerId' => ts('Could not find Interviewer.'),
'contactIds' => ts('No respondents are currently reserved for you to interview.'),
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->assign('surveyTypeId', $this->_surveyTypeId);
$options =
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
//load default data for only contact fields.
$contactFields = $defaults = array();
foreach ($this->_surveyFields as $name => $field) {
*
* @return mixed
*/
- static function registerInterview($params) {
+ public static function registerInterview($params) {
$activityId = CRM_Utils_Array::value('activity_id', $params);
$surveyTypeId = CRM_Utils_Array::value('activity_type_id', $params);
if (!is_array($params) || !$surveyTypeId || !$activityId) {
return $activityId;
}
- function getVoterIds() {
+ public function getVoterIds() {
if (!$this->_interviewerId) {
$session = CRM_Core_Session::singleton();
$this->_interviewerId = $session->get('userID');
}
}
- function filterVoterIds() {
+ public function filterVoterIds() {
//do the cleanup later on.
if (!is_array($this->_contactIds)) {
return;
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preprocess();
// set print view, so that print templates are called
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
//
// just need to add a javacript to popup the window for printing
//
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->addDefaultButtons(ts('Release Respondents'), 'done');
}
- function postProcess() {
+ public function postProcess() {
$deleteActivityIds = array();
foreach ($this->_contactIds as $cid) {
if (array_key_exists($cid, $this->_surveyActivities)) {
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
//get the survey id from user submitted values.
CRM_Utils_System::setTitle(ts('Reserve Respondents'));
}
- function validateSurvey() {
+ public function validateSurvey() {
$errorMsg = NULL;
$maxVoters = CRM_Utils_Array::value('max_number_of_contacts', $this->_surveyDetails);
if ($maxVoters) {
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
// allow to add contact to either new or existing group.
$this->addElement('text', 'ActivityType', ts('Activity Type'));
$this->addElement('text', 'newGroupName', ts('Name for new group'));
* @static
* @access public
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
$invalidGroupName = FALSE;
if (!empty($fields['newGroupName'])) {
* @return void
* @access public
*/
- function preProcess() {}
+ public function preProcess() {}
/**
* Build the form object
*/
class CRM_Campaign_Page_AJAX {
- static function registerInterview() {
+ public static function registerInterview() {
$fields = array(
'result',
'voter_id',
CRM_Utils_JSON::output($result);
}
- static function loadOptionGroupDetails() {
+ public static function loadOptionGroupDetails() {
$id = CRM_Utils_Array::value('option_group_id', $_POST);
$status = 'fail';
CRM_Utils_JSON::output($result);
}
- function voterList() {
+ public function voterList() {
//get the search criteria params.
$searchParams = explode(',', CRM_Utils_Array::value('searchCriteria', $_POST));
CRM_Utils_System::civiExit();
}
- function processVoterData() {
+ public function processVoterData() {
$status = NULL;
$operation = CRM_Utils_Type::escape($_POST['operation'], 'String');
if ($operation == 'release') {
CRM_Utils_JSON::output(array('status' => $status));
}
- function allActiveCampaigns() {
+ public function allActiveCampaigns() {
$currentCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns();
$campaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
$options = array(
CRM_Utils_JSON::output($results);
}
- function campaignGroups() {
+ public function campaignGroups() {
$surveyId = CRM_Utils_Request::retrieve('survey_id', 'Positive',
CRM_Core_DAO::$_nullObject, FALSE, NULL, 'POST'
);
* Retrieve campaigns as for campaign dashboard.
*
**/
- function campaignList() {
+ public function campaignList() {
//get the search criteria params.
$searchParams = explode(',', CRM_Utils_Array::value('searchCriteria', $_POST));
* Retrieve survey for survey dashboard.
*
**/
- function surveyList() {
+ public function surveyList() {
//get the search criteria params.
$searchParams = explode(',', CRM_Utils_Array::value('searchCriteria', $_POST));
* Retrieve petitions for petition dashboard.
*
**/
- function petitionList() {
+ public function petitionList() {
//get the search criteria params.
$searchParams = explode(',', CRM_Utils_Array::value('searchCriteria', $_POST));
* @return array $_actionLinks
*
*/
- function &actionLinks() {
+ public function &actionLinks() {
// check if variable _actionsLinks is populated
if (!isset(self::$_actionLinks)) {
$deleteExtra = ts('Are you sure you want to delete this Campaign?');
return self::$_actionLinks;
}
- function browse() {
+ public function browse() {
$campaigns = CRM_Campaign_BAO_Campaign::getCampaignSummary();
/**
* @return string
*/
- function run() {
+ public function run() {
if (!CRM_Core_Permission::check('administer CiviCampaign')) {
CRM_Utils_System::permissionDenied();
}
* @return array $_campaignActionLinks
*
*/
- function &campaignActionLinks() {
+ public function &campaignActionLinks() {
// check if variable _actionsLinks is populated
if (!isset(self::$_campaignActionLinks)) {
$deleteExtra = ts('Are you sure you want to delete this Campaign?');
/**
* @return array
*/
- function &surveyActionLinks() {
+ public function &surveyActionLinks() {
// check if variable _actionsLinks is populated
if (!isset(self::$_surveyActionLinks)) {
self::$_surveyActionLinks = array(
/**
* @return array
*/
- function &petitionActionLinks() {
+ public function &petitionActionLinks() {
if (!isset(self::$_petitionActionLinks)) {
self::$_petitionActionLinks = self::surveyActionLinks();
self::$_petitionActionLinks[CRM_Core_Action::UPDATE] = array(
/**
* @return mixed
*/
- function browseCampaign() {
+ public function browseCampaign() {
// ensure valid javascript (these must have a value set)
$this->assign('searchParams', json_encode(NULL));
$this->assign('campaignTypes', json_encode(NULL));
/**
* @return mixed
*/
- function browseSurvey() {
+ public function browseSurvey() {
// ensure valid javascript - this must have a value set
$this->assign('searchParams', json_encode(NULL));
$this->assign('surveyTypes', json_encode(NULL));
*
* @return array
*/
- function getSurveySummary($params = array()) {
+ public function getSurveySummary($params = array()) {
$surveysData = array();
//get the survey.
return $surveysData;
}
- function browsePetition() {
+ public function browsePetition() {
// ensure valid javascript - this must have a value set
$this->assign('searchParams', json_encode(NULL));
$this->assign('petitionCampaigns', json_encode(NULL));
*
* @return array
*/
- function getPetitionSummary($params = array()) {
+ public function getPetitionSummary($params = array()) {
$config = CRM_Core_Config::singleton();
$petitionsData = array();
return $petitionsData;
}
- function browse() {
+ public function browse() {
$this->_tabs = array(
'campaign' => ts('Campaigns'),
'survey' => ts('Surveys'),
/**
* @return string
*/
- function run() {
+ public function run() {
if (!CRM_Campaign_BAO_Campaign::accessCampaign()) {
CRM_Utils_System::permissionDenied();
}
return parent::run();
}
- function buildTabs() {
+ public function buildTabs() {
$allTabs = array();
foreach ($this->_tabs as $name => $title) {
$allTabs[$name] = array(
* Page for displaying Petition Signatures
*/
class CRM_Campaign_Page_Petition extends CRM_Core_Page {
- function browse() {
+ public function browse() {
//get the survey id
$surveyId = CRM_Utils_Request::retrieve('sid', 'Positive', $this);
/**
* @return string
*/
- function run() {
+ public function run() {
$action = CRM_Utils_Request::retrieve('action', 'String',
$this, FALSE, 0
);
* @return string
* @throws Exception
*/
- function run() {
+ public function run() {
CRM_Utils_System::addHTMLHead('<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">');
$contact_id = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
/**
* @return string
*/
- function run() {
+ public function run() {
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$petition_id = CRM_Utils_Request::retrieve('pid', 'Positive', $this);
$params['id'] = $petition_id;
/**
* @return array
*/
- function &actionLinks() {
+ public function &actionLinks() {
// check if variable _actionsLinks is populated
if (!isset(self::$_actionLinks)) {
return self::$_actionLinks;
}
- function browse() {
+ public function browse() {
$surveys = CRM_Campaign_BAO_Survey::getSurveySummary();
/**
* @return string
*/
- function run() {
+ public function run() {
if (!CRM_Campaign_BAO_Campaign::accessCampaign()) {
CRM_Utils_System::permissionDenied();
}
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
$this->_gName = 'activity_type';
$this->_gid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $this->_gName, 'id', 'name');
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Core_BAO_OptionValue';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
*
* @return void
*/
- function run() {
+ public function run() {
$this->preProcess();
return parent::run();
}
* @access public
* @static
*/
- function browse() {
+ public function browse() {
$campaingCompId = CRM_Core_Component::getComponentID('CiviCampaign');
$groupParams = array('name' => $this->_gName);
$optionValues = CRM_Core_OptionValue::getRows($groupParams, $this->links(), 'component_id,weight');
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Campaign_Form_SurveyType';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return $this->_GName;
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/campaign/surveyType';
}
* @return string
* @access public
*/
- function userContextParams($mode = NULL) {
+ public function userContextParams($mode = NULL) {
return 'reset=1';
}
}
/**
* @return mixed
*/
- function reserve() {
+ public function reserve() {
//build ajax voter search and selector.
$controller = new CRM_Core_Controller_Simple('CRM_Campaign_Form_Gotv', ts('Reserve Respondents'));
$controller->set('votingTab', TRUE);
/**
* @return mixed
*/
- function interview() {
+ public function interview() {
//build interview and release voter interface.
$controller = new CRM_Core_Controller_Simple('CRM_Campaign_Form_Task_Interview', ts('Interview Respondents'));
$controller->set('votingTab', TRUE);
return $controller->run();
}
- function browse() {
+ public function browse() {
$this->_tabs = array('reserve' => ts('Reserve Respondents'),
'interview' => ts('Interview Respondents'),
);
/**
* @return string
*/
- function run() {
+ public function run() {
$this->browse();
return parent::run();
}
- function buildTabs() {
+ public function buildTabs() {
$allTabs = array();
foreach ($this->_tabs as $name => $title) {
// check for required permissions.
*
*/
static
- function &links() {
+ public function &links() {
return self::$_links = array();
}
*
* @access public
*/
- function getPagerParams($action, &$params) {
+ public function getPagerParams($action, &$params) {
$params['csvString'] = NULL;
$params['status'] = ts('Respondents') . ' %%StatusMessage%%';
$params['rowCount'] = ($this->_limit) ? $this->_limit : CRM_Utils_Pager::ROWCOUNT;
* @return int Total number of rows
* @access public
*/
- function getTotalCount($action) {
+ public function getTotalCount($action) {
return $this->_query->searchQuery(0, 0, NULL,
TRUE, FALSE,
FALSE, FALSE, FALSE,
*
* @return int the total number of rows for this action
*/
- function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
+ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
$result = $this->_query->searchQuery($offset, $rowCount, $sort,
FALSE, FALSE,
FALSE, FALSE,
/**
* @param $sort
*/
- function buildPrevNextCache($sort) {
+ public function buildPrevNextCache($sort) {
//for prev/next pagination
$crmPID = CRM_Utils_Request::retrieve('crmPID', 'Integer', CRM_Core_DAO::$_nullObject);
/**
* @return string
*/
- function &getQuery() {
+ public function &getQuery() {
return $this->_query;
}
*
* @return string name of the file
*/
- function getExportFileName($output = 'csv') {
+ public function getExportFileName($output = 'csv') {
return ts('CiviCRM Respondent Search');
}
}
* @return string the name of the form that will handle the task
* @access protected
*/
- function taskName($controller, $formName = 'Search') {
+ public function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
$value = CRM_Utils_Array::value('task', $_POST);
if (!isset($value)) {
* @return string
* @access public
*/
- function getTaskFormName() {
+ public function getTaskFormName() {
return CRM_Utils_String::getClassName($this->_task);
}
}
* @static
* @access public
*/
- static function &tasks() {
+ public static function &tasks() {
if (!(self::$_tasks)) {
self::$_tasks = array(1 => array(
'title' => ts('Record Respondents Interview'),
* @static
* @access public
*/
- static function &taskTitles() {
+ public static function &taskTitles() {
self::tasks();
$titles = array();
foreach (self::$_tasks as $id => $value) {
* @return array set of tasks that are valid for the user
* @access public
*/
- static function &permissionedTaskTitles($permission) {
+ public static function &permissionedTaskTitles($permission) {
$tasks = self::taskTitles();
return $tasks;
* @static
* @access public
*/
- static function getTask($value) {
+ public static function getTask($value) {
self::tasks();
if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) {
// make the interview task by default
* @return mixed
*/
static
- function run($xmlString, $clientID, $caseID, $printReport = FALSE) {
+ public function run($xmlString, $clientID, $caseID, $printReport = FALSE) {
/*
$fh = fopen('C:/temp/audit2.xml', 'w');
fwrite($fh, $xmlString);
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
*
* @return bool
*/
- static function enabled() {
+ public static function enabled() {
$config = CRM_Core_Config::singleton();
return in_array('CiviCase', $config->enableComponents);
}
* @access public
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
$caseDAO = new CRM_Case_DAO_Case();
$caseDAO->copyValues($params);
return $caseDAO->save();
* @access public
* @static
*/
- static function &getValues(&$params, &$values, &$ids) {
+ public static function &getValues(&$params, &$values, &$ids) {
$case = new CRM_Case_BAO_Case();
$case->copyValues($params);
* @access public
* @static
*/
- static function &create(&$params) {
+ public static function &create(&$params) {
$transaction = new CRM_Core_Transaction();
if (!empty($params['id'])) {
* @return object
* @access public
*/
- static function addCaseToContact($params) {
+ public static function addCaseToContact($params) {
$caseContact = new CRM_Case_DAO_CaseContact();
$caseContact->case_id = $params['case_id'];
$caseContact->contact_id = $params['contact_id'];
* @return Void
* @access public
*/
- static function deleteCaseContact($caseID) {
+ public static function deleteCaseContact($caseID) {
$caseContact = new CRM_Case_DAO_CaseContact();
$caseContact->case_id = $caseID;
$caseContact->delete();
* the api needs the name => value conversion, also the view layer typically
* requires value => name conversion
*/
- static function lookupValue(&$defaults, $property, &$lookup, $reverse) {
+ public static function lookupValue(&$defaults, $property, &$lookup, $reverse) {
$id = $property . '_id';
$src = $reverse ? $property : $id;
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults, &$ids) {
+ public static function retrieve(&$params, &$defaults, &$ids) {
$case = CRM_Case_BAO_Case::getValues($params, $defaults, $ids);
return $case;
}
* @access public
* @static
*/
- static function processCaseActivity(&$params) {
+ public static function processCaseActivity(&$params) {
$caseActivityDAO = new CRM_Case_DAO_CaseActivity();
$caseActivityDAO->activity_id = $params['activity_id'];
$caseActivityDAO->case_id = $params['case_id'];
* @access public
* @static
*/
- static function getCaseSubject($activityId) {
+ public static function getCaseSubject($activityId) {
$caseActivity = new CRM_Case_DAO_CaseActivity();
$caseActivity->activity_id = $activityId;
if ($caseActivity->find(TRUE)) {
* @access public
* @static
*/
- static function getCaseType($caseId, $colName = 'title') {
+ public static function getCaseType($caseId, $colName = 'title') {
$query = "
SELECT civicrm_case_type.{$colName} FROM civicrm_case
LEFT JOIN civicrm_case_type ON
* @access public
* @static
*/
- static function deleteCase($caseId, $moveToTrash = FALSE) {
+ public static function deleteCase($caseId, $moveToTrash = FALSE) {
CRM_Utils_Hook::pre('delete', 'Case', $caseId, CRM_Core_DAO::$_nullArray);
//delete activities
* @access public
* @static
*/
- static function enableDisableCaseRelationships($caseId, $enable) {
+ public static function enableDisableCaseRelationships($caseId, $enable) {
$contactIds = self::retrieveContactIdsByCaseId($caseId);
if (!empty($contactIds)) {
foreach ($contactIds as $cid) {
* @access public
* @static
*/
- static function deleteCaseActivity($activityId) {
+ public static function deleteCaseActivity($activityId) {
$case = new CRM_Case_DAO_CaseActivity();
$case->activity_id = $activityId;
$case->delete();
* @return array
* @access public
*/
- static function retrieveContactIdsByCaseId($caseId, $contactID = NULL) {
+ public static function retrieveContactIdsByCaseId($caseId, $contactID = NULL) {
$caseContact = new CRM_Case_DAO_CaseContact();
$caseContact->case_id = $caseId;
$caseContact->find();
*
* @return int, case ID
*/
- static function getCaseIdByActivityId($activityId) {
+ public static function getCaseIdByActivityId($activityId) {
$originalId = CRM_Core_DAO::singleValueQuery(
'SELECT original_id FROM civicrm_activity WHERE id = %1',
array('1' => array($activityId, 'Integer'))
* @access public
*
*/
- static function getContactNames($caseId) {
+ public static function getContactNames($caseId) {
$contactNames = array();
if (!$caseId) {
return $contactNames;
*
* @access public
*/
- static function retrieveCaseIdsByContactId($contactID, $includeDeleted = FALSE, $caseType = NULL) {
+ public static function retrieveCaseIdsByContactId($contactID, $includeDeleted = FALSE, $caseType = NULL) {
$query = "
SELECT ca.id as id
FROM civicrm_case_contact cc
*
* @return string
*/
- static function getCaseActivityQuery($type = 'upcoming', $userID = NULL, $condition = NULL, $isDeleted = 0) {
+ public static function getCaseActivityQuery($type = 'upcoming', $userID = NULL, $condition = NULL, $isDeleted = 0) {
if (!$userID) {
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID');
*
* @access public
*/
- static function getCases($allCases = TRUE, $userID = NULL, $type = 'upcoming', $context = 'dashboard') {
+ public static function getCases($allCases = TRUE, $userID = NULL, $type = 'upcoming', $context = 'dashboard') {
$condition = NULL;
$casesList = array();
* @param int $userID
* @return array
*/
- static function getCasesSummary($allCases = TRUE, $userID) {
+ public static function getCasesSummary($allCases = TRUE, $userID) {
$caseSummary = array();
//validate access for civicase.
*
* @static
*/
- static function getCaseRoles($contactID, $caseID, $relationshipID = NULL) {
+ public static function getCaseRoles($contactID, $caseID, $relationshipID = NULL) {
$query = '
SELECT civicrm_relationship.id as civicrm_relationship_id,
civicrm_contact.sort_name as sort_name,
*
* @static
*/
- static function getCaseActivity($caseID, &$params, $contactID, $context = NULL, $userID = NULL, $type = NULL) {
+ public static function getCaseActivity($caseID, &$params, $contactID, $context = NULL, $userID = NULL, $type = NULL) {
$values = array();
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
*
* @static
*/
- static function getRelatedContacts($caseID, $skipDetails = FALSE) {
+ public static function getRelatedContacts($caseID, $skipDetails = FALSE) {
$values = array();
$query = '
SELECT cc.display_name as name, cc.sort_name as sort_name, cc.id, crt.label_b_a as role, ce.email
* @return void
* @access public
*/
- static function sendActivityCopy($clientId, $activityId, $contacts, $attachments = NULL, $caseId) {
+ public static function sendActivityCopy($clientId, $activityId, $contacts, $attachments = NULL, $caseId) {
if (!$activityId) {
return;
}
* @access public
*
*/
- static function getCaseActivityCount($caseId, $activityTypeId) {
+ public static function getCaseActivityCount($caseId, $activityTypeId) {
$queryParam = array(
1 => array($caseId, 'Integer'),
2 => array($activityTypeId, 'Integer'),
*
* @return array|void $activity object of newly creted activity via email@access public
*/
- static function recordActivityViaEmail($file) {
+ public static function recordActivityViaEmail($file) {
if (!file_exists($file) ||
!is_readable($file)
) {
*
* @static
*/
- static function getNextScheduledActivity($cases, $type = 'upcoming') {
+ public static function getNextScheduledActivity($cases, $type = 'upcoming') {
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID');
* @access public
* @static
*/
- static function &exportableFields() {
+ public static function &exportableFields() {
if (!self::$_exportableFields) {
if (!self::$_exportableFields) {
self::$_exportableFields = array();
* @access public
* @static
*/
- static function restoreCase($caseId) {
+ public static function restoreCase($caseId) {
//restore activities
$activities = self::getCaseActivityDates($caseId);
if ($activities) {
*
* @return array
*/
- static function getGlobalContacts(&$groupInfo, $sort = NULL, $showLinks = NULL, $returnOnlyCount = FALSE, $offset = 0, $rowCount = 25) {
+ public static function getGlobalContacts(&$groupInfo, $sort = NULL, $showLinks = NULL, $returnOnlyCount = FALSE, $offset = 0, $rowCount = 25) {
$globalContacts = array();
$settingsProcessor = new CRM_Case_XMLProcessor_Settings();
*
* @return array
*/
- static function getRelatedAndGlobalContacts($caseId) {
+ public static function getRelatedAndGlobalContacts($caseId) {
$relatedContacts = self::getRelatedContacts($caseId);
$groupInfo = array();
*
* @static
*/
- static function getCaseActivityDates($caseID, $criteriaParams = array(), $latestDate = FALSE) {
+ public static function getCaseActivityDates($caseID, $criteriaParams = array(), $latestDate = FALSE) {
$values = array();
$selectDate = " ca.activity_date_time";
$where = $groupBy = ' ';
*
* @static
*/
- static function createCaseRoleActivity($caseId, $relationshipId, $relContactId = NULL, $contactId = NULL) {
+ public static function createCaseRoleActivity($caseId, $relationshipId, $relContactId = NULL, $contactId = NULL) {
if (!$caseId || !$relationshipId || empty($relationshipId)) {
return;
}
*
* @static
*/
- static function getCaseManagerContact($caseType, $caseId) {
+ public static function getCaseManagerContact($caseType, $caseId) {
if (!$caseType || !$caseId) {
return;
}
*
* @return array of case and related data keyed on case id
*/
- static function getUnclosedCases($params = array(), $excludeCaseIds = array(), $excludeDeleted = TRUE, $includeClosed = FALSE) {
+ public static function getUnclosedCases($params = array(), $excludeCaseIds = array(), $excludeDeleted = TRUE, $includeClosed = FALSE) {
//params from ajax call.
$where = array($includeClosed ? '(1)' : '(ca.end_date is null)');
if ($caseType = CRM_Utils_Array::value('case_type', $params)) {
*
* @return null|string
*/
- static function caseCount($contactId = NULL, $excludeDeleted = TRUE) {
+ public static function caseCount($contactId = NULL, $excludeDeleted = TRUE) {
$whereConditions = array();
if ($excludeDeleted) {
$whereConditions[] = "( civicrm_case.is_deleted = 0 OR civicrm_case.is_deleted IS NULL )";
*
* @access public
*/
- static function getContactCases($contactId, $excludeDeleted = TRUE) {
+ public static function getContactCases($contactId, $excludeDeleted = TRUE) {
$cases = array();
if (!$contactId) {
return $cases;
*
* @access public
*/
- static function getRelatedCases($mainCaseId, $contactId, $excludeDeleted = TRUE) {
+ public static function getRelatedCases($mainCaseId, $contactId, $excludeDeleted = TRUE) {
//FIXME : do check for permissions.
$relatedCases = array();
*
* TODO: use the 3rd $sqls param to append sql statements rather than executing them here
*/
- static function mergeContacts($mainContactId, $otherContactId) {
+ public static function mergeContacts($mainContactId, $otherContactId) {
self::mergeCases($mainContactId, NULL, $otherContactId);
}
* @return void
* @static
*/
- static function buildPermissionLinks(&$tplParams, $activityParams) {
+ public static function buildPermissionLinks(&$tplParams, $activityParams) {
$activityTypeId = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $activityParams['source_record_id'],
'activity_type_id', 'id'
);
* @return boolean $allow true/false
* @static
*/
- static function checkPermission($activityId, $operation, $actTypeId = NULL, $contactId = NULL, $checkComponent = TRUE) {
+ public static function checkPermission($activityId, $operation, $actTypeId = NULL, $contactId = NULL, $checkComponent = TRUE) {
$allow = FALSE;
if (!$actTypeId && $activityId) {
$actTypeId = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $activityId, 'activity_type_id');
* if user has 'access my cases and activities'
* or 'access all cases and activities'
*/
- static function accessCiviCase() {
+ public static function accessCiviCase() {
if (!self::enabled()) {
return FALSE;
}
*
* @return bool
*/
- static function accessCase($caseId, $denyClosed = TRUE) {
+ public static function accessCase($caseId, $denyClosed = TRUE) {
if (!$caseId || !self::enabled()) {
return FALSE;
}
*
* @return boolean $isCaseActivity true/false
*/
- static function isCaseActivity($activityID) {
+ public static function isCaseActivity($activityID) {
$isCaseActivity = FALSE;
if ($activityID) {
$params = array(1 => array($activityID, 'Integer'));
*
* @return array $caseTypeIds
*/
- static function getUsedCaseType() {
+ public static function getUsedCaseType() {
static $caseTypeIds;
if (!is_array($caseTypeIds)) {
*
* @return array $caseStatusIds
*/
- static function getUsedCaseStatuses() {
+ public static function getUsedCaseStatuses() {
static $caseStatusIds;
if (!is_array($caseStatusIds)) {
* Get all the encounter medium ids currently in use
* @return array
*/
- static function getUsedEncounterMediums() {
+ public static function getUsedEncounterMediums() {
static $mediumIds;
if (!is_array($mediumIds)) {
*
* @return array $configured
*/
- static function isCaseConfigured($contactId = NULL) {
+ public static function isCaseConfigured($contactId = NULL) {
$configured = array_fill_keys(array('configured', 'allowToAddNewCase', 'redirectToCaseAdmin'), FALSE);
//lets check for case configured.
/**
* Used during case component enablement and during ugprade
*/
- static function createCaseViews() {
+ public static function createCaseViews() {
$errorScope = CRM_Core_TemporaryErrorScope::ignoreException();
$dao = new CRM_Core_DAO();
/**
* Helper function, also used by the upgrade in case of error
*/
- static function createCaseViewsQuery($section = 'upcoming') {
+ public static function createCaseViewsQuery($section = 'upcoming') {
$sql = "";
$scheduled_id = CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name');
switch ($section) {
*
* @return void
*/
- static function addCaseRelationships($caseId, $contactId) {
+ public static function addCaseRelationships($caseId, $contactId) {
// get the case role / relationships for the case
$caseRelationships = new CRM_Contact_DAO_Relationship();
$caseRelationships->case_id = $caseId;
* @return array $clients associated array with client ids
* @static
*/
- static function getCaseClients($caseId) {
+ public static function getCaseClients($caseId) {
$clients = array();
$caseContact = new CRM_Case_DAO_CaseContact();
$caseContact->case_id = $caseId;
* @access public
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
$caseTypeDAO = new CRM_Case_DAO_CaseType();
// form the name only if missing: CRM-627
* @static
* @access public
*/
- static function convertDefinitionToXML($name, $definition) {
+ public static function convertDefinitionToXML($name, $definition) {
$xmlFile = '<?xml version="1.0" encoding="utf-8" ?>' . "\n\n<CaseType>\n";
$xmlFile .= "<name>{$name}</name>\n";
* @return array the definition of the case-type, expressed as PHP array-tree
* @static
*/
- static function convertXmlToDefinition($xml) {
+ public static function convertXmlToDefinition($xml) {
// build PHP array based on definition
$definition = array();
* @access public
* @static
*/
- static function &getValues(&$params, &$values) {
+ public static function &getValues(&$params, &$values) {
$caseType = new CRM_Case_BAO_CaseType();
$caseType->copyValues($params);
* @access public
* @static
*/
- static function &create(&$params) {
+ public static function &create(&$params) {
$transaction = new CRM_Core_Transaction();
if (!empty($params['id'])) {
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$caseType = CRM_Case_BAO_CaseType::getValues($params, $defaults);
return $caseType;
}
* @throws CRM_Core_Exception
* @return mixed
*/
- static function del($caseTypeId) {
+ public static function del($caseTypeId) {
$caseType = new CRM_Case_DAO_CaseType();
$caseType->id = $caseTypeId;
$refCounts = $caseType->getReferenceCounts();
* @param string $caseType
* @return bool
*/
- static function isValidName($caseType) {
+ public static function isValidName($caseType) {
return preg_match('/^[a-zA-Z0-9_]+$/', $caseType);
}
* @param int $caseTypeId
* @return bool|null TRUE if there are *both* DB and file-based definitions
*/
- static function isForked($caseTypeId) {
+ public static function isForked($caseTypeId) {
$caseTypeName = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseType', $caseTypeId, 'name', 'id', TRUE);
if ($caseTypeName) {
$dbDefinition = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseType', $caseTypeId, 'definition', 'id', TRUE);
* @param int $caseTypeId
* @return bool TRUE if the definition can be modified
*/
- static function isForkable($caseTypeId) {
+ public static function isForkable($caseTypeId) {
$caseTypeName = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseType', $caseTypeId, 'name', 'id', TRUE);
if ($caseTypeName) {
// if file-based definition explicitly disables "forkable" option, then don't allow changes to definition
*
* @return array
*/
- static function &getFields($excludeActivityFields = FALSE) {
+ public static function &getFields($excludeActivityFields = FALSE) {
$fields = array();
$fields = CRM_Case_BAO_Case::exportableFields();
* @return void
* @access public
*/
- static function select(&$query) {
+ public static function select(&$query) {
if (($query->_mode & CRM_Contact_BAO_Query::MODE_CASE) || !empty($query->_returnProperties['case_id'])) {
$query->_select['case_id'] = "civicrm_case.id as case_id";
$query->_element['case_id'] = 1;
* @return void
* @access public
*/
- static function where(&$query) {
+ public static function where(&$query) {
foreach ($query->_params as $id => $values) {
if (!is_array($values) || count($values) != 5) {
continue;
* @return void
* @access public
*/
- static function whereClauseSingle(&$values, &$query) {
+ public static function whereClauseSingle(&$values, &$query) {
list($name, $op, $value, $grouping, $wildcard) = $values;
$val = $names = array();
switch ($name) {
*
* @return string
*/
- static function from($name, $mode, $side) {
+ public static function from($name, $mode, $side) {
$from = "";
switch ($name) {
* @return string
* @access public
*/
- function qill() {
+ public function qill() {
return (isset($this->_qill)) ? $this->_qill : "";
}
/**
* This includes any extra fields that might need for export etc
*/
- static function extraReturnProperties($mode) {
+ public static function extraReturnProperties($mode) {
$properties = NULL;
if ($mode & CRM_Contact_BAO_Query::MODE_CASE) {
/**
* @param $tables
*/
- static function tableNames(&$tables) {
+ public static function tableNames(&$tables) {
if (!empty($tables['civicrm_case'])) {
$tables = array_merge(array('civicrm_case_contact' => 1), $tables);
}
* @return void
* @static
*/
- static function buildSearchForm(&$form) {
+ public static function buildSearchForm(&$form) {
$config = CRM_Core_Config::singleton();
//validate case configuration.
* @param $row
* @param int $id
*/
- static function searchAction(&$row, $id) {}
+ public static function searchAction(&$row, $id) {}
}
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$caseIds = CRM_Utils_Request::retrieve('caseid', 'String', $this);
$this->_caseId = explode(',', $caseIds);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$this->_defaults = parent::setDefaultValues();
$targetContactValues = array();
foreach ($this->_caseId as $key => $val) {
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
// skip form rule if deleting
if (CRM_Utils_Array::value('_qf_Activity_next_', $fields) == 'Delete' || CRM_Utils_Array::value('_qf_Activity_next_', $fields) == 'Restore') {
return TRUE;
*
* @throws Exception
*/
- static function preProcess(&$form) {
+ public static function preProcess(&$form) {
if (!isset($form->_caseId)) {
CRM_Core_Error::fatal(ts('Case Id not found.'));
}
*
* @return void
*/
- static function setDefaultValues(&$form) {
+ public static function setDefaultValues(&$form) {
$defaults = array();
$openCaseActivityType = CRM_Core_OptionGroup::getValue('activity_type',
/**
* @param CRM_Core_Form $form
*/
- static function buildQuickForm(&$form) {
+ public static function buildQuickForm(&$form) {
$form->removeElement('status_id');
$form->removeElement('priority_id');
$caseId = CRM_Utils_Array::first($form->_caseId);
* @static
* @access public
*/
- static function formRule($values, $files, $form) {
+ public static function formRule($values, $files, $form) {
return TRUE;
}
*
* @return void
*/
- static function beginPostProcess(&$form, &$params) {
+ public static function beginPostProcess(&$form, &$params) {
if ($form->_context == 'case') {
$params['id'] = $form->_id;
}
*
* @return void
*/
- static function endPostProcess(&$form, &$params, $activity) {
+ public static function endPostProcess(&$form, &$params, $activity) {
if (!empty($params['start_date'])) {
$params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time']);
}
*
* @throws Exception
*/
- static function preProcess(&$form) {
+ public static function preProcess(&$form) {
if (!isset($form->_caseId)) {
CRM_Core_Error::fatal(ts('Case Id not found.'));
}
*
* @return void
*/
- static function setDefaultValues(&$form) {
+ public static function setDefaultValues(&$form) {
$defaults = array();
// Retrieve current case status
$defaults['case_status_id'] = $form->_defaultCaseStatus;
/**
* @param CRM_Core_Form $form
*/
- static function buildQuickForm(&$form) {
+ public static function buildQuickForm(&$form) {
$form->removeElement('status_id');
$form->removeElement('priority_id');
* @static
* @access public
*/
- static function formRule($values, $files, $form) {
+ public static function formRule($values, $files, $form) {
return TRUE;
}
*
* @return void
*/
- static function beginPostProcess(&$form, &$params) {
+ public static function beginPostProcess(&$form, &$params) {
$params['id'] = CRM_Utils_Array::value('case_id', $params);
}
*
* @return void
*/
- static function endPostProcess(&$form, &$params, $activity) {
+ public static function endPostProcess(&$form, &$params, $activity) {
$groupingValues = CRM_Core_OptionGroup::values('case_status', FALSE, TRUE, FALSE, NULL, 'value');
// Set case end_date if we're closing the case. Clear end_date if we're (re)opening it.
*
* @throws Exception
*/
- static function preProcess(&$form) {
+ public static function preProcess(&$form) {
if (!isset($form->_caseId)) {
CRM_Core_Error::fatal(ts('Case Id not found.'));
}
*
* @return void
*/
- static function setDefaultValues(&$form) {
+ public static function setDefaultValues(&$form) {
$defaults = array();
$defaults['is_reset_timeline'] = 1;
/**
* @param CRM_Core_Form $form
*/
- static function buildQuickForm(&$form) {
+ public static function buildQuickForm(&$form) {
$form->removeElement('status_id');
$form->removeElement('priority_id');
* @static
* @access public
*/
- static function formRule($values, $files, $form) {
+ public static function formRule($values, $files, $form) {
return TRUE;
}
*
* @return void
*/
- static function beginPostProcess(&$form, &$params) {
+ public static function beginPostProcess(&$form, &$params) {
if ($form->_context == 'case') {
$params['id'] = $form->_id;
}
*
* @return void
*/
- static function endPostProcess(&$form, &$params, $activity) {
+ public static function endPostProcess(&$form, &$params, $activity) {
if (!$form->_caseId) {
// always expecting a change, so case-id is a must.
return;
*
* @throws Exception
*/
- static function preProcess(&$form) {
+ public static function preProcess(&$form) {
if (!isset($form->_caseId)) {
CRM_Core_Error::fatal(ts('Case Id not found.'));
}
*
* @return void
*/
- static function setDefaultValues(&$form) {
+ public static function setDefaultValues(&$form) {
return $defaults = array();
}
/**
* @param CRM_Core_Form $form
*/
- static function buildQuickForm(&$form) {
+ public static function buildQuickForm(&$form) {
$form->add('text', 'link_to_case_id', ts('Link To Case'), array('class' => 'huge'), TRUE);
}
* @static
* @access public
*/
- static function formRule($values, $files, $form) {
+ public static function formRule($values, $files, $form) {
$errors = array();
$linkCaseId = CRM_Utils_Array::value('link_to_case_id', $values);
*
* @return void
*/
- static function beginPostProcess(&$form, &$params) {}
+ public static function beginPostProcess(&$form, &$params) {}
/**
* Process the form submission
*
* @return void
*/
- static function endPostProcess(&$form, &$params, &$activity) {
+ public static function endPostProcess(&$form, &$params, &$activity) {
$activityId = $activity->id;
$linkCaseID = CRM_Utils_Array::value('link_to_case_id', $params);
/**
* @param CRM_Core_Form $form
*/
- static function preProcess(&$form) {
+ public static function preProcess(&$form) {
//get multi client case configuration
$xmlProcessorProcess = new CRM_Case_XMLProcessor_Process();
$form->_allowMultiClient = (bool) $xmlProcessorProcess->getAllowMultipleCaseClients();
*
* @return void
*/
- static function setDefaultValues(&$form) {
+ public static function setDefaultValues(&$form) {
$defaults = array();
if ($form->_context == 'caseActivity') {
return $defaults;
/**
* @param CRM_Case_Form_Case $form
*/
- static function buildQuickForm(&$form) {
+ public static function buildQuickForm(&$form) {
if ($form->_context == 'caseActivity') {
return;
}
*
* @return void
*/
- static function beginPostProcess(&$form, &$params) {
+ public static function beginPostProcess(&$form, &$params) {
if ($form->_context == 'caseActivity') {
return;
}
* @static
* @access public
*/
- static function formRule($fields, $files, $form) {
+ public static function formRule($fields, $files, $form) {
if ($form->_context == 'caseActivity') {
return TRUE;
}
*
* @return void
*/
- static function endPostProcess(&$form, &$params) {
+ public static function endPostProcess(&$form, &$params) {
if ($form->_context == 'caseActivity') {
return;
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->_activityId = CRM_Utils_Request::retrieve('activityId', 'Positive', CRM_Core_DAO::$_nullObject);
if (!$this->_activityId) {
CRM_Core_Error::fatal('required activity id is missing.');
*
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$params = array('id' => $this->_activityId);
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->_cdType = CRM_Utils_Array::value('type', $_GET);
$this->assign('cdType', FALSE);
if ($this->_cdType) {
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if ($this->_action & CRM_Core_Action::DELETE || $this->_action & CRM_Core_Action::RENEW || $this->_cdType) {
return TRUE;
}
*
* @return void
*/
- function addRules() {
+ public function addRules() {
if ($this->_action & CRM_Core_Action::DELETE || $this->_action & CRM_Core_Action::RENEW || $this->_cdType) {
return TRUE;
}
* @static
* @access public
*/
- static function formRule($values, $files, $form) {
+ public static function formRule($values, $files, $form) {
return TRUE;
}
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
return $defaults;
}
* @param CRM_Core_Form $form
* @param array $aTypes to include acivities related to current case id $form->_caseID
*/
- static function activityForm($form, $aTypes = array()) {
+ public static function activityForm($form, $aTypes = array()) {
$caseRelationships = CRM_Case_BAO_Case::getCaseRoles($form->_contactID, $form->_caseID);
//build reporter select
$reporters = array("" => ts(' - any reporter - '));
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
$this->_groupID = CRM_Utils_Request::retrieve('groupID', 'Positive', $this, TRUE);
$this->_entityID = CRM_Utils_Request::retrieve('entityID', 'Positive', $this, TRUE);
$this->_subTypeID = CRM_Utils_Request::retrieve('subType', 'Positive', $this, TRUE);
}
- function addRules() {
+ public function addRules() {
$this->addFormRule(array(get_class($this), 'formRule'), $this);
}
*
* @return array
*/
- static function formRule($vals, $rule, $form) {
+ public static function formRule($vals, $rule, $form) {
$errors = array();
if (empty($vals['reassign_contact_id']) || $vals['reassign_contact_id'] == $form->get('cid')) {
$errors['reassign_contact_id'] = ts("Please select a different contact.");
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->set('searchFormName', 'Search');
//check for civicase access.
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
parent::buildQuickForm();
$this->addElement('text',
'sort_name',
* @return void
* @access public
*/
- function postProcess() {
+ public function postProcess() {
if ($this->_done) {
return;
}
* @access public
* @see valid_date
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Case_Form_Search', 'formRule'));
}
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$errors = array();
if (!empty($errors)) {
*
* @return array the default array reference
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$defaults = $this->_formValues;
return $defaults;
}
- function fixFormValues() {
+ public function fixFormValues() {
if (!$this->_force) {
return;
}
/**
* @return null
*/
- function getFormValues() {
+ public function getFormValues() {
return NULL;
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
self::preProcessCommon($this);
}
* @param CRM_Core_Form $form
* @param bool $useTable
*/
- static function preProcessCommon(&$form, $useTable = FALSE) {
+ public static function preProcessCommon(&$form, $useTable = FALSE) {
$form->_caseIds = array();
$values = $form->controller->exportValues($form->get('searchFormName'));
* @return void
* @access public
*/
- function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
+ public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
$this->addButtons(array(
array(
'type' => $nextType,
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->addDefaultButtons(ts('Delete Cases'), 'done');
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preprocess();
// set print view, so that print templates are called
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
//
// just need to add a javacript to popup the window for printing
//
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->addDefaultButtons(ts('Restore Cases'), 'done');
}
* @return void
* @access public
*/
- function preProcess() {}
+ public function preProcess() {}
/**
* Build the form object
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$rows = array();
// display name and email of all contact ids
/**
* Retrieve unclosed cases.
*/
- static function unclosedCases() {
+ public static function unclosedCases() {
$params = array(
'limit' => CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'search_autocomplete_count', NULL, 10),
'sort_name' => CRM_Utils_Type::escape(CRM_Utils_Array::value('term', $_GET, ''), 'String'),
CRM_Utils_JSON::output($results);
}
- function processCaseTags() {
+ public function processCaseTags() {
$caseId = CRM_Utils_Type::escape($_POST['case_id'], 'Positive');
$tags = CRM_Utils_Type::escape($_POST['tag'], 'String');
CRM_Utils_System::civiExit();
}
- function caseDetails() {
+ public function caseDetails() {
$caseId = CRM_Utils_Type::escape($_GET['caseId'], 'Positive');
if (!CRM_Case_BAO_Case::accessCase($caseId, FALSE)) {
CRM_Utils_System::civiExit();
}
- function addClient() {
+ public function addClient() {
$caseId = CRM_Utils_Type::escape($_POST['caseID'], 'Positive');
$contactId = CRM_Utils_Type::escape($_POST['contactID'], 'Positive');
/**
* Delete relationships specific to case and relationship type
*/
- static function deleteCaseRoles() {
+ public static function deleteCaseRoles() {
$caseId = CRM_Utils_Type::escape($_POST['case_id'], 'Positive');
$relType = CRM_Utils_Type::escape($_POST['rel_type'], 'Positive');
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$type = CRM_Utils_Request::retrieve('type', 'String', CRM_Core_DAO::$_nullObject);
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
//check for civicase access.
if (!CRM_Case_BAO_Case::accessCiviCase()) {
CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
return parent::run();
public $_permission = NULL;
public $_contactId = NULL;
- function preProcess() {
+ public function preProcess() {
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
* @return void
* @access public
*/
- function view() {
+ public function view() {
$controller = new CRM_Core_Controller_Simple(
'CRM_Case_Form_CaseView',
'View Case',
* return null
* @access public
*/
- function browse() {
+ public function browse() {
$controller = new CRM_Core_Controller_Simple('CRM_Case_Form_Search', ts('Case'), NULL);
$controller->setEmbedded(TRUE);
* return null
* @access public
*/
- function edit() {
+ public function edit() {
$config = CRM_Core_Config::singleton();
$controller = new CRM_Core_Controller_Simple(
* return null
* @access public
*/
- function run() {
+ public function run() {
$contactID = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullArray);
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
* @static
*/
static
- function &links() {
+ public function &links() {
$config = CRM_Core_Config::singleton();
if (!(self::$_links)) {
return self::$_links;
}
- function setContext() {
+ public function setContext() {
$context = $this->get('context');
$url = NULL;
* @access public
*/
static
- function &links($isDeleted = FALSE, $key = NULL) {
+ public function &links($isDeleted = FALSE, $key = NULL) {
$extraParams = ($key) ? "&key={$key}" : NULL;
if ($isDeleted) {
*
* @access public
*/
- function getPagerParams($action, &$params) {
+ public function getPagerParams($action, &$params) {
$params['status'] = ts('Case') . ' %%StatusMessage%%';
$params['csvString'] = NULL;
if ($this->_limit) {
* @return int Total number of rows
* @access public
*/
- function getTotalCount($action) {
+ public function getTotalCount($action) {
return $this->_query->searchQuery(0, 0, NULL,
TRUE, FALSE,
FALSE, FALSE,
*
* @return int the total number of rows for this action
*/
- function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
+ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
$result = $this->_query->searchQuery($offset, $rowCount, $sort,
FALSE, FALSE,
FALSE, FALSE,
/**
* @return mixed
*/
- function alphabetQuery() {
+ public function alphabetQuery() {
return $this->_query->searchQuery(NULL, NULL, NULL, FALSE, FALSE, TRUE);
}
/**
* @return string
*/
- function &getQuery() {
+ public function &getQuery() {
return $this->_query;
}
*
* @return string name of the file
*/
- function getExportFileName($output = 'csv') {
+ public function getExportFileName($output = 'csv') {
return ts('Case Search');
}
}
* @return string the name of the form that will handle the task
* @access protected
*/
- function taskName($controller, $formName = 'Search') {
+ public function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
$value = CRM_Utils_Array::value('task', $_POST);
if (!isset($value)) {
* @return string
* @access public
*/
- function getTaskFormName() {
+ public function getTaskFormName() {
return CRM_Utils_String::getClassName($this->_task);
}
* we dont want to issue a reset of the state session when we are done processing a task
*
*/
- function shouldReset() {
+ public function shouldReset() {
return FALSE;
}
}
* @static
* @access public
*/
- static function &tasks() {
+ public static function &tasks() {
if (!self::$_tasks) {
self::$_tasks = array(
1 => array(
* @static
* @access public
*/
- static function &taskTitles() {
+ public static function &taskTitles() {
self::tasks();
$titles = array();
foreach (self::$_tasks as $id => $value) {
* @static
* @access public
*/
- static function &optionalTaskTitle() {
+ public static function &optionalTaskTitle() {
$tasks = array();
return $tasks;
}
* @return array set of tasks that are valid for the user
* @access public
*/
- static function &permissionedTaskTitles($permission) {
+ public static function &permissionedTaskTitles($permission) {
$tasks = array();
if (($permission == CRM_Core_Permission::EDIT)
|| CRM_Core_Permission::check('access all cases and activities')
* @static
* @access public
*/
- static function getTask($value) {
+ public static function getTask($value) {
self::tasks();
if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) {
// make the print task by default
*
* @return array
*/
- function &allActivityTypes($indexName = TRUE, $all = FALSE) {
+ public function &allActivityTypes($indexName = TRUE, $all = FALSE) {
if (self::$activityTypes === NULL) {
self::$activityTypes = CRM_Case_PseudoConstant::caseActivityType($indexName, $all);
}
/**
* @return array
*/
- function &allRelationshipTypes() {
+ public function &allRelationshipTypes() {
if (self::$relationshipTypes === NULL) {
$relationshipInfo = CRM_Core_PseudoConstant::relationshipType('label', TRUE);
*
* @throws Exception
*/
- function run($caseType, &$params) {
+ public function run($caseType, &$params) {
$xml = $this->retrieve($caseType);
if ($xml === FALSE) {
* @return array|bool|mixed
* @throws Exception
*/
- function get($caseType, $fieldSet, $isLabel = FALSE, $maskAction = FALSE) {
+ public function get($caseType, $fieldSet, $isLabel = FALSE, $maskAction = FALSE) {
$xml = $this->retrieve($caseType);
if ($xml === FALSE) {
$docLink = CRM_Utils_System::docURL2("user/case-management/setup");
*
* @throws Exception
*/
- function process($xml, &$params) {
+ public function process($xml, &$params) {
$standardTimeline = CRM_Utils_Array::value('standardTimeline', $params);
$activitySetName = CRM_Utils_Array::value('activitySetName', $params);
$activityTypeName = CRM_Utils_Array::value('activityTypeName', $params);
* @param $activitySetXML
* @param array $params
*/
- function processStandardTimeline($activitySetXML, &$params) {
+ public function processStandardTimeline($activitySetXML, &$params) {
if ('Change Case Type' == CRM_Utils_Array::value('activityTypeName', $params)
&& CRM_Utils_Array::value('resetTimeline', $params, TRUE)) {
// delete all existing activities which are non-empty
* @param $activitySetXML
* @param array $params
*/
- function processActivitySet($activitySetXML, &$params) {
+ public function processActivitySet($activitySetXML, &$params) {
foreach ($activitySetXML->ActivityTypes as $activityTypesXML) {
foreach ($activityTypesXML as $activityTypeXML) {
$this->createActivity($activityTypeXML, $params);
*
* @return array|mixed
*/
- function &caseRoles($caseRolesXML, $isCaseManager = FALSE) {
+ public function &caseRoles($caseRolesXML, $isCaseManager = FALSE) {
$relationshipTypes = &$this->allRelationshipTypes();
$result = array();
* @return bool
* @throws Exception
*/
- function createRelationships($relationshipTypeName, &$params) {
+ public function createRelationships($relationshipTypeName, &$params) {
$relationshipTypes = &$this->allRelationshipTypes();
// get the relationship id
$relationshipTypeID = array_search($relationshipTypeName, $relationshipTypes);
*
* @return bool
*/
- function createRelationship(&$params) {
+ public function createRelationship(&$params) {
$dao = new CRM_Contact_DAO_Relationship();
$dao->copyValues($params);
// only create a relationship if it does not exist
*
* @return array
*/
- function activityTypes($activityTypesXML, $maxInst = FALSE, $isLabel = FALSE, $maskAction = FALSE) {
+ public function activityTypes($activityTypesXML, $maxInst = FALSE, $isLabel = FALSE, $maskAction = FALSE) {
$activityTypes = &$this->allActivityTypes(TRUE, TRUE);
$result = array();
foreach ($activityTypesXML as $activityTypeXML) {
* @param SimpleXMLElement $caseTypeXML
* @return array<string> symbolic activity-type names
*/
- function getDeclaredActivityTypes($caseTypeXML) {
+ public function getDeclaredActivityTypes($caseTypeXML) {
$result = array();
if (!empty($caseTypeXML->ActivityTypes) && $caseTypeXML->ActivityTypes->ActivityType) {
* @param SimpleXMLElement $caseTypeXML
* @return array<string> symbolic relationship-type names
*/
- function getDeclaredRelationshipTypes($caseTypeXML) {
+ public function getDeclaredRelationshipTypes($caseTypeXML) {
$result = array();
if (!empty($caseTypeXML->CaseRoles) && $caseTypeXML->CaseRoles->RelationshipType) {
/**
* @param array $params
*/
- function deleteEmptyActivity(&$params) {
+ public function deleteEmptyActivity(&$params) {
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
*
* @return bool
*/
- function isActivityPresent(&$params) {
+ public function isActivityPresent(&$params) {
$query = "
SELECT count(a.id)
FROM civicrm_activity a
* @throws CRM_Core_Exception
* @throws Exception
*/
- function createActivity($activityTypeXML, &$params) {
+ public function createActivity($activityTypeXML, &$params) {
$activityTypeName = (string) $activityTypeXML->name;
$activityTypes = &$this->allActivityTypes(TRUE, TRUE);
$activityTypeInfo = CRM_Utils_Array::value($activityTypeName, $activityTypes);
*
* @return array
*/
- static function activitySets($activitySetsXML) {
+ public static function activitySets($activitySetsXML) {
$result = array();
foreach ($activitySetsXML as $activitySetXML) {
foreach ($activitySetXML as $recordXML) {
* @return array|bool|mixed
* @throws Exception
*/
- function getMaxInstance($caseType, $activityTypeName = NULL) {
+ public function getMaxInstance($caseType, $activityTypeName = NULL) {
$xml = $this->retrieve($caseType);
if ($xml === FALSE) {
*
* @return array|mixed
*/
- function getCaseManagerRoleId($caseType) {
+ public function getCaseManagerRoleId($caseType) {
$xml = $this->retrieve($caseType);
return $this->caseRoles($xml->CaseRoles, TRUE);
}
* @param string $caseType
* @return array<\Civi\CCase\CaseChangeListener>
*/
- function getListeners($caseType) {
+ public function getListeners($caseType) {
$xml = $this->retrieve($caseType);
$listeners = array();
if ($xml->Listeners && $xml->Listeners->Listener) {
/**
* @return int
*/
- function getRedactActivityEmail() {
+ public function getRedactActivityEmail() {
$xml = $this->retrieve("Settings");
return ( string ) $xml->RedactActivityEmail ? 1 : 0;
}
*
* @return string 1 if allowed, 0 if not
*/
- function getAllowMultipleCaseClients() {
+ public function getAllowMultipleCaseClients() {
$xml = $this->retrieve("Settings");
if ($xml) {
return ( string ) $xml->AllowMultipleCaseClients ? 1 : 0;
*
* @return string 1 if natural, 0 if alphabetic
*/
- function getNaturalActivityTypeSort() {
+ public function getNaturalActivityTypeSort() {
$xml = $this->retrieve("Settings");
return ( string ) $xml->NaturalActivityTypeSort ? 1 : 0;
}
*
* @return mixed
*/
- function run($clientID, $caseID, $activitySetName, $params) {
+ public function run($clientID, $caseID, $activitySetName, $params) {
$contents = self::getCaseReport($clientID,
$caseID,
$activitySetName,
return CRM_Case_Audit_Audit::run($contents, $clientID, $caseID);
}
- function &getRedactionRules() {
+ public function &getRedactionRules() {
foreach (array(
'redactionStringRules', 'redactionRegexRules') as $key => $rule) {
$$rule = CRM_Case_PseudoConstant::redactionRule($key);
*
* @return array|bool
*/
- function getActivityTypes($xml, $activitySetName) {
+ public function getActivityTypes($xml, $activitySetName) {
foreach ($xml->ActivitySets as $activitySetsXML) {
foreach ($activitySetsXML->ActivitySet as $activitySetXML) {
if ((string ) $activitySetXML->name == $activitySetName) {
*
* @return null|string
*/
- function getActivitySetLabel($xml, $activitySetName) {
+ public function getActivitySetLabel($xml, $activitySetName) {
foreach ($xml->ActivitySets as $activitySetsXML) {
foreach ($activitySetsXML->ActivitySet as $activitySetXML) {
if ((string ) $activitySetXML->name == $activitySetName) {
* @param $activityTypes
* @param $activities
*/
- function getActivities($clientID, $caseID, $activityTypes, &$activities) {
+ public function getActivities($clientID, $caseID, $activityTypes, &$activities) {
// get all activities for this case that in this activityTypes set
foreach ($activityTypes as $aType) {
$map[$aType['id']] = $aType;
*
* @return mixed
*/
- function &getActivityInfo($clientID, $activityID, $anyActivity = FALSE, $redact = 0) {
+ public function &getActivityInfo($clientID, $activityID, $anyActivity = FALSE, $redact = 0) {
static $activityInfos = array();
if ($redact) {
$this->_isRedact = 1;
*
* @return array
*/
- function &getActivity($clientID, $activityDAO, &$activityTypeInfo) {
+ public function &getActivity($clientID, $activityDAO, &$activityTypeInfo) {
if (empty($this->_redactionStringRules)) {
$this->_redactionStringRules = array();
}
*
* @return array|null
*/
- function getCustomData($clientID, $activityDAO, &$activityTypeInfo) {
+ public function getCustomData($clientID, $activityDAO, &$activityTypeInfo) {
list($typeValues, $options, $sql) = $this->getActivityTypeCustomSQL($activityTypeInfo['id'], '%Y-%m-%d');
$params = array(1 => array($activityDAO->id, 'Integer'));
*
* @return mixed
*/
- function getActivityTypeCustomSQL($activityTypeID, $dateFormat = NULL) {
+ public function getActivityTypeCustomSQL($activityTypeID, $dateFormat = NULL) {
static $cache = array();
if (is_null($activityTypeID)) {
*
* @return null|string
*/
- function getCreatedBy($activityID) {
+ public function getCreatedBy($activityID) {
$query = "
SELECT c.display_name
FROM civicrm_contact c,
*
* @return mixed
*/
- static function getCaseReport($clientID, $caseID, $activitySetName, $params, $form) {
+ public static function getCaseReport($clientID, $caseID, $activitySetName, $params, $form) {
$template = CRM_Core_Smarty::singleton();
return $contents;
}
- static function printCaseReport() {
+ public static function printCaseReport() {
$caseID = CRM_Utils_Request::retrieve('caseID', 'Positive', CRM_Core_DAO::$_nullObject);
$clientID = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject);
$activitySetName = CRM_Utils_Request::retrieve('asn', 'String', CRM_Core_DAO::$_nullObject);
*
* @return array
*/
- function run($filename = 'settings') {
+ public function run($filename = 'settings') {
$xml = $this->retrieve($filename);
// For now it's not an error. In the future it might be a required file.
* @param string $activityType symbolic-name of an activity type
* @return int
*/
- function getActivityReferenceCount($activityType) {
+ public function getActivityReferenceCount($activityType) {
$p = new CRM_Case_XMLProcessor_Process();
$count = 0;
foreach ($this->getAllCaseTypes() as $caseTypeName) {
* @param string $relationshipTypeName symbolic-name of a relationship-type
* @return int
*/
- function getRelationshipReferenceCount($relationshipTypeName) {
+ public function getRelationshipReferenceCount($relationshipTypeName) {
$p = new CRM_Case_XMLProcessor_Process();
$count = 0;
foreach ($this->getAllCaseTypes() as $caseTypeName) {
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
$contact = new CRM_Contact_DAO_Contact();
if (empty($params)) {
* @access public
* @static
*/
- static function &create(&$params, $fixAddress = TRUE, $invokeHooks = TRUE, $skipDelete = FALSE) {
+ public static function &create(&$params, $fixAddress = TRUE, $invokeHooks = TRUE, $skipDelete = FALSE) {
$contact = NULL;
if (empty($params['contact_type']) && empty($params['contact_id'])) {
return $contact;
* @access public
* @static
*/
- static function getDisplayAndImage($id, $type = FALSE) {
+ public static function getDisplayAndImage($id, $type = FALSE) {
//CRM-14276 added the * on the civicrm_contact table so that we have all the contact info available
$sql = "
SELECT civicrm_contact.*,
* @access public
* @static
*/
- static function resolveDefaults(&$defaults, $reverse = FALSE) {
+ public static function resolveDefaults(&$defaults, $reverse = FALSE) {
// hack for birth_date
if (!empty($defaults['birth_date'])) {
if (is_array($defaults['birth_date'])) {
* @access public
* @static
*/
- static function &retrieve(&$params, &$defaults, $microformat = FALSE) {
+ public static function &retrieve(&$params, &$defaults, $microformat = FALSE) {
if (array_key_exists('contact_id', $params)) {
$params['id'] = $params['contact_id'];
}
* @static
* @access public
*/
- static function displayName($id) {
+ public static function displayName($id) {
$displayName = NULL;
if ($id) {
$displayName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $id, 'display_name');
* @access public
* @static
*/
- static function deleteContact($id, $restore = FALSE, $skipUndelete = FALSE) {
+ public static function deleteContact($id, $restore = FALSE, $skipUndelete = FALSE) {
if (!$id) {
return FALSE;
* @return void
* @static
*/
- static function contactTrashRestore($contact, $restore = FALSE) {
+ public static function contactTrashRestore($contact, $restore = FALSE) {
$op = ($restore ? 'restore' : 'trash');
CRM_Utils_Hook::pre($op, $contact->contact_type, $contact->id, CRM_Core_DAO::$_nullArray);
* @access public
* @static
*/
- static function &exportableFields($contactType = 'Individual', $status = FALSE, $export = FALSE, $search = FALSE, $withMultiRecord = FALSE) {
+ public static function &exportableFields($contactType = 'Individual', $status = FALSE, $export = FALSE, $search = FALSE, $withMultiRecord = FALSE) {
if (empty($contactType)) {
$contactType = 'All';
}
* @static
* @access public
*/
- static function getHierContactDetails($contactId, &$fields) {
+ public static function getHierContactDetails($contactId, &$fields) {
$params = array(array('contact_id', '=', $contactId, 0, 0));
$options = array();
* @access public
* @static
*/
- static function &makeHierReturnProperties($fields, $contactId = NULL) {
+ public static function &makeHierReturnProperties($fields, $contactId = NULL) {
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
$returnProperties = array();
* @access public
* @static
*/
- static function getPrimaryLocationType($contactId, $skipDefaultPriamry = FALSE, $block = NULL) {
+ public static function getPrimaryLocationType($contactId, $skipDefaultPriamry = FALSE, $block = NULL) {
if($block){
$entityBlock = array('contact_id' => $contactId);
$blocks = CRM_Core_BAO_Location::getValues($entityBlock);
* @static
* @access public
*/
- static function getContactDetails($id) {
+ public static function getContactDetails($id) {
// check if the contact type
$contactType = self::getContactType($id);
* @return object $dao contact details
* @static
*/
- static function &matchContactOnEmail($mail, $ctype = NULL) {
+ public static function &matchContactOnEmail($mail, $ctype = NULL) {
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
$mail = $strtolower(trim($mail));
$query = "
* @return object $dao contact details
* @static
*/
- static function &matchContactOnOpenId($openId, $ctype = NULL) {
+ public static function &matchContactOnOpenId($openId, $ctype = NULL) {
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
$openId = $strtolower(trim($openId));
$query = "
* @access public
* @static
*/
- static function getCountComponent($component, $contactId, $tableName = NULL) {
+ public static function getCountComponent($component, $contactId, $tableName = NULL) {
$object = NULL;
switch ($component) {
case 'tag':
* @access public
* @static
*/
- static function processGreetings(&$contact, $useDefaults = FALSE) {
+ public static function processGreetings(&$contact, $useDefaults = FALSE) {
if ($useDefaults) {
//retrieve default greetings
$defaultGreetings = CRM_Core_PseudoConstant::greetingDefaults();
* @return array $locBlockIds loc block ids which fulfill condition.
* @static
*/
- static function getLocBlockIds($contactId, $criteria = array(), $condOperator = 'AND') {
+ public static function getLocBlockIds($contactId, $criteria = array(), $condOperator = 'AND') {
$locBlockIds = array();
if (!$contactId) {
return $locBlockIds;
* @return array of context menu for logged in user.
* @static
*/
- static function contextMenu($contactId = NULL) {
+ public static function contextMenu($contactId = NULL) {
$menu = array(
'view' => array(
'title' => ts('View Contact'),
* @access public
* @static
*/
- static function getMasterDisplayName($masterAddressId = NULL, $contactId = NULL) {
+ public static function getMasterDisplayName($masterAddressId = NULL, $contactId = NULL) {
$masterDisplayName = NULL;
$sql = NULL;
if (!$masterAddressId && !$contactId) {
*
* @return array('created_date' => $, 'modified_date' => $)
*/
- static function getTimestamps($contactId) {
+ public static function getTimestamps($contactId) {
$timestamps = CRM_Core_DAO::executeQuery(
'SELECT created_date, modified_date
FROM civicrm_contact
* @access public
* @static
*/
- static function generateTimestampTriggers(&$info, $reqTableName, $relatedTableNames, $contactRefColumn) {
+ public static function generateTimestampTriggers(&$info, $reqTableName, $relatedTableNames, $contactRefColumn) {
// Safety
$contactRefColumn = CRM_Core_DAO::escapeString($contactRefColumn);
// If specific related table requested, just process that one
* @see CRM_Core_DAO::triggerRebuild
* @see http://issues.civicrm.org/jira/browse/CRM-10554
*/
- static function triggerInfo(&$info, $tableName = NULL) {
+ public static function triggerInfo(&$info, $tableName = NULL) {
//during upgrade, first check for valid version and then create triggers
//i.e the columns created_date and modified_date are introduced in 4.3.alpha1 so dont create triggers for older version
if (CRM_Core_Config::isUpgradeMode()) {
* @access public
* @static
*/
- static function checkDomainContact($contactId) {
+ public static function checkDomainContact($contactId) {
if (!$contactId)
return FALSE;
$domainId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Domain', $contactId, 'id', 'contact_id');
* @static
* @access public
*/
- static function getEmailDetails($id, $isPrimary = TRUE, $locationTypeID = NULL) {
+ public static function getEmailDetails($id, $isPrimary = TRUE, $locationTypeID = NULL) {
$primaryClause = NULL;
if ($isPrimary) {
$primaryClause = " AND civicrm_email.is_primary = 1";
* @static
* @access public
*/
- static function getPhoneDetails($id, $type = NULL) {
+ public static function getPhoneDetails($id, $type = NULL) {
if (!$id) {
return array(NULL, NULL);
}
* @static
* @access public
*/
- static function &getMapInfo($ids, $locationTypeID = NULL, $imageUrlOnly = FALSE) {
+ public static function &getMapInfo($ids, $locationTypeID = NULL, $imageUrlOnly = FALSE) {
$idString = ' ( ' . implode(',', $ids) . ' ) ';
$sql = "
SELECT civicrm_contact.id as contact_id,
* @param $newValues
* @param $oldValues
*/
- static function edit( &$newValues, &$oldValues ) {
+ public static function edit( &$newValues, &$oldValues ) {
// still need to do more work on this
// CRM-10192
return;
* @param $newValues
* @param $oldValues
*/
- static function website( &$newValues, &$oldValues ) {
+ public static function website( &$newValues, &$oldValues ) {
$oldWebsiteValues = CRM_Utils_Array::value( 'website', $oldValues );
$newWebsiteValues = CRM_Utils_Array::value( 'website', $newValues );
* @param $newValues
* @param $oldValues
*/
- static function email( &$newValues, &$oldValues ) {
+ public static function email( &$newValues, &$oldValues ) {
$oldEmailValues = CRM_Utils_Array::value( 'email', $oldValues );
$newEmailValues = CRM_Utils_Array::value( 'email', $newValues );
* @access public
* @static
*/
- static function allow($id, $type = CRM_Core_Permission::VIEW) {
+ public static function allow($id, $type = CRM_Core_Permission::VIEW) {
$tables = array();
$whereTables = array();
* @access public
* @static
*/
- static function cache($userID, $type = CRM_Core_Permission::VIEW, $force = FALSE) {
+ public static function cache($userID, $type = CRM_Core_Permission::VIEW, $force = FALSE) {
static $_processed = array();
if ($type = CRM_Core_Permission::VIEW) {
*
* @return array
*/
- static function cacheClause($contactAlias = 'contact_a', $contactID = NULL) {
+ public static function cacheClause($contactAlias = 'contact_a', $contactID = NULL) {
if (CRM_Core_Permission::check('view all contacts') ||
CRM_Core_Permission::check('edit all contacts')
) {
* selected contact record else false
* @static
*/
- static function relationship($selectedContactID, $contactID = NULL) {
+ public static function relationship($selectedContactID, $contactID = NULL) {
$session = CRM_Core_Session::singleton();
$config = CRM_Core_Config::singleton();
if (!$contactID) {
*
* @return bool
*/
- static function validateOnlyChecksum($contactID, &$form, $redirect = TRUE) {
+ public static function validateOnlyChecksum($contactID, &$form, $redirect = TRUE) {
// check if this is of the format cs=XXX
if (!CRM_Contact_BAO_Contact_Utils::validChecksum($contactID,
CRM_Utils_Request::retrieve('cs', 'String', $form, FALSE)
* @param bool $checkSumValidationResult
* @param null $form
*/
- static function initChecksumAuthSrc($checkSumValidationResult = FALSE, $form = NULL) {
+ public static function initChecksumAuthSrc($checkSumValidationResult = FALSE, $form = NULL) {
$session = CRM_Core_Session::singleton();
if ($checkSumValidationResult && $form && CRM_Utils_Request::retrieve('cs', 'String', $form, FALSE)) {
// if result is already validated, and url has cs, set the flag.
*
* @return bool
*/
- static function validateChecksumContact($contactID, &$form, $redirect = TRUE) {
+ public static function validateChecksumContact($contactID, &$form, $redirect = TRUE) {
if (!self::allow($contactID, CRM_Core_Permission::EDIT)) {
// check if this is of the format cs=XXX
return self::validateOnlyChecksum($contactID, $form, $redirect);
* @access public
* @static
*/
- static function getImage($contactType, $urlOnly = FALSE, $contactId = NULL, $addProfileOverlay = TRUE) {
+ public static function getImage($contactType, $urlOnly = FALSE, $contactId = NULL, $addProfileOverlay = TRUE) {
static $imageInfo = array();
$contactType = explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($contactType, CRM_Core_DAO::VALUE_SEPARATOR));
* @static
* @access public
*/
- static function generateChecksum($entityId, $ts = NULL, $live = NULL, $hash = NULL, $entityType = 'contact', $hashSize = NULL) {
+ public static function generateChecksum($entityId, $ts = NULL, $live = NULL, $hash = NULL, $entityType = 'contact', $hashSize = NULL) {
// return a warning message if we dont get a entityId
// this typically happens when we do a message preview
// or an anon mailing view - CRM-8298
* @static
* @access public
*/
- static function validChecksum($contactID, $inputCheck) {
+ public static function validChecksum($contactID, $inputCheck) {
$input = CRM_Utils_System::explode('_', $inputCheck, 3);
* @static
* @access public
*/
- static function maxLocations($contactId) {
+ public static function maxLocations($contactId) {
$contactLocations = array();
// find number of location blocks for this contact and adjust value accordinly
* @access public
* @static
*/
- static function createCurrentEmployerRelationship($contactID, $organization, $previousEmployerID = NULL, $newContact = FALSE) {
+ public static function createCurrentEmployerRelationship($contactID, $organization, $previousEmployerID = NULL, $newContact = FALSE) {
//if organization name is passed. CRM-15368,CRM-15547
if ($organization && !is_numeric($organization)) {
$organizationParams['organization_name'] = $organization;
* @access public
* @static
*/
- static function currentEmployerRelatedMembership($contactID, $employerID, $relationshipParams, $duplicate = FALSE, $previousEmpID = NULL) {
+ public static function currentEmployerRelatedMembership($contactID, $employerID, $relationshipParams, $duplicate = FALSE, $previousEmpID = NULL) {
$ids = array();
$action = CRM_Core_Action::ADD;
* @param array $currentEmployerParams associated array of contact id and its employer id
*
*/
- static function setCurrentEmployer($currentEmployerParams) {
+ public static function setCurrentEmployer($currentEmployerParams) {
foreach ($currentEmployerParams as $contactId => $orgId) {
$query = "UPDATE civicrm_contact contact_a,civicrm_contact contact_b
SET contact_a.employer_id=contact_b.id, contact_a.organization_name=contact_b.organization_name
* @param int $organizationId current employer id
*
*/
- static function updateCurrentEmployer($organizationId) {
+ public static function updateCurrentEmployer($organizationId) {
$query = "UPDATE civicrm_contact contact_a,civicrm_contact contact_b
SET contact_a.organization_name=contact_b.organization_name
WHERE contact_a.employer_id=contact_b.id AND contact_b.id={$organizationId}; ";
* @param int $employerId contact id ( mostly organization contact id)
*
*/
- static function clearCurrentEmployer($contactId, $employerId = NULL) {
+ public static function clearCurrentEmployer($contactId, $employerId = NULL) {
$query = "UPDATE civicrm_contact
SET organization_name=NULL, employer_id = NULL
WHERE id={$contactId}; ";
*
* @static
*/
- static function buildOnBehalfForm(&$form, $contactType, $countryID, $stateID, $title) {
+ public static function buildOnBehalfForm(&$form, $contactType, $countryID, $stateID, $title) {
$config = CRM_Core_Config::singleton();
* @param int $employerId contact id of employer ( organization id )
*
*/
- static function clearAllEmployee($employerId) {
+ public static function clearAllEmployee($employerId) {
$query = "
UPDATE civicrm_contact
SET organization_name=NULL, employer_id = NULL
* @static
* @access public
*/
- static function formatContactIDSToLinks($contactIDs, $addViewLink = TRUE, $addEditLink = TRUE, $originalId = NULL) {
+ public static function formatContactIDSToLinks($contactIDs, $addViewLink = TRUE, $addEditLink = TRUE, $originalId = NULL) {
$contactLinks = array();
if (!is_array($contactIDs) || empty($contactIDs)) {
return $contactLinks;
*
* @return array $contactDetails array of contact info.@static
*/
- static function contactDetails($componentIds, $componentName, $returnProperties = array()) {
+ public static function contactDetails($componentIds, $componentName, $returnProperties = array()) {
$contactDetails = array();
if (empty($componentIds) ||
!in_array($componentName, array('CiviContribute', 'CiviMember', 'CiviEvent', 'Activity'))
* @static
* @access public
*/
- static function processSharedAddress(&$address) {
+ public static function processSharedAddress(&$address) {
if (!is_array($address)) {
return;
}
*
* @return array $contactNames associated array of contact names@static
*/
- static function getAddressShareContactNames(&$addresses) {
+ public static function getAddressShareContactNames(&$addresses) {
$contactNames = array();
// get the list of master id's for address
$masterAddressIds = array();
* @return void
* @static
*/
- static function clearContactCaches($contactID = NULL) {
+ public static function clearContactCaches($contactID = NULL) {
// clear acl cache if any.
CRM_ACL_BAO_Cache::resetCache();
*
* @return int or null
*/
- static function defaultGreeting($contactType, $greetingType) {
+ public static function defaultGreeting($contactType, $greetingType) {
$contactTypeFilters = array('Individual' => 1, 'Household' => 2, 'Organization' => 3);
if (!isset($contactTypeFilters[$contactType])) {
return;
* @return void
* @static
*/
- static function processGreetingTemplate(&$templateString, $contactDetails, $contactID, $className) {
+ public static function processGreetingTemplate(&$templateString, $contactDetails, $contactID, $className) {
CRM_Utils_Token::replaceGreetingTokens($templateString, $contactDetails, $contactID, $className, TRUE);
$smarty = CRM_Core_Smarty::singleton();
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$contactType = new CRM_Contact_DAO_ContactType();
$contactType->copyValues($params);
if ($contactType->find(TRUE)) {
*
* @return bool
*/
- static function isActive($contactType) {
+ public static function isActive($contactType) {
$contact = self::contactTypeInfo(FALSE);
$active = array_key_exists($contactType, $contact) ? TRUE : FALSE;
return $active;
* @return array of basic contact types information.
* @static
*/
- static function &basicTypeInfo($all = FALSE) {
+ public static function &basicTypeInfo($all = FALSE) {
static $_cache = NULL;
if ($_cache === NULL) {
* @return array of basic contact types
* @static
*/
- static function basicTypes($all = FALSE) {
+ public static function basicTypes($all = FALSE) {
return array_keys(self::basicTypeInfo($all));
}
*
* @return array
*/
- static function basicTypePairs($all = FALSE, $key = 'name') {
+ public static function basicTypePairs($all = FALSE, $key = 'name') {
$subtypes = self::basicTypeInfo($all);
$pairs = array();
* @return array of sub type information
* @static
*/
- static function &subTypeInfo($contactType = NULL, $all = FALSE, $ignoreCache = FALSE, $reset = FALSE) {
+ public static function &subTypeInfo($contactType = NULL, $all = FALSE, $ignoreCache = FALSE, $reset = FALSE) {
static $_cache = NULL;
if ($reset === TRUE) {
*a given basic contact type
* @static
*/
- static function subTypes($contactType = NULL, $all = FALSE, $columnName = 'name', $ignoreCache = FALSE) {
+ public static function subTypes($contactType = NULL, $all = FALSE, $columnName = 'name', $ignoreCache = FALSE) {
if ($columnName == 'name') {
return array_keys(self::subTypeInfo($contactType, $all, $ignoreCache));
}
* @return list of subtypes with name as 'subtype-name' and 'label' as value
* @static
*/
- static function subTypePairs($contactType = NULL, $all = FALSE, $labelPrefix = '- ', $ignoreCache = FALSE) {
+ public static function subTypePairs($contactType = NULL, $all = FALSE, $labelPrefix = '- ', $ignoreCache = FALSE) {
$subtypes = self::subTypeInfo($contactType, $all, $ignoreCache);
$pairs = array();
* @return array of basic types + all subtypes.
* @static
*/
- static function contactTypes($all = FALSE) {
+ public static function contactTypes($all = FALSE) {
return array_keys(self::contactTypeInfo($all));
}
* @return array of basic types + all subtypes.
* @static
*/
- static function contactTypeInfo($all = FALSE, $reset = FALSE) {
+ public static function contactTypeInfo($all = FALSE, $reset = FALSE) {
static $_cache = NULL;
if ($reset === TRUE) {
* @return array of basictypes with name as 'built-in name' and 'label' as value
* @static
*/
- static function contactTypePairs($all = FALSE, $typeName = NULL, $delimiter = NULL) {
+ public static function contactTypePairs($all = FALSE, $typeName = NULL, $delimiter = NULL) {
$types = self::contactTypeInfo($all);
if ($typeName && !is_array($typeName)) {
* @return boolean true if subType, false otherwise.
* @static
*/
- static function isaSubType($subType, $ignoreCache = FALSE) {
+ public static function isaSubType($subType, $ignoreCache = FALSE) {
return in_array($subType, self::subTypes(NULL, TRUE, 'name', $ignoreCache));
}
*@static
*
*/
- static function getBasicType($subType) {
+ public static function getBasicType($subType) {
static $_cache = NULL;
if ($_cache === NULL) {
$_cache = array();
* @return array of suppressed subTypes.
* @static
*/
- static function suppressSubTypes(&$subTypes, $ignoreCache = FALSE) {
+ public static function suppressSubTypes(&$subTypes, $ignoreCache = FALSE) {
$subTypes = array_diff($subTypes, self::subTypes(NULL, TRUE, 'name', $ignoreCache));
return $subTypes;
}
* @return boolean true if contact extends, false otherwise.
* @static
*/
- static function isExtendsContactType($subType, $contactType, $ignoreCache = FALSE, $columnName = 'name') {
+ public static function isExtendsContactType($subType, $contactType, $ignoreCache = FALSE, $columnName = 'name') {
if (!is_array($subType)) {
$subType = explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($subType, CRM_Core_DAO::VALUE_SEPARATOR));
}
* @return array of contactTypes
* @static
*/
- static function getCreateNewList() {
+ public static function getCreateNewList() {
$shortCuts = array();
//@todo FIXME - using the CRM_Core_DAO::VALUE_SEPARATOR creates invalid html - if you can find the form
// this is loaded onto then replace with something like '__' & test
* @access public
* @static
*/
- static function del($contactTypeId) {
+ public static function del($contactTypeId) {
if (!$contactTypeId) {
return FALSE;
* @access public
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
// label or name
if (empty($params['id']) && empty($params['label'])) {
* @return Object DAO object on success, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
$params = array('id' => $id);
self::retrieve($params, $contactinfo);
$params = array('name' => "New $contactinfo[name]");
*
* @return mixed
*/
- static function getLabel($typeName) {
+ public static function getLabel($typeName) {
$types = self::contactTypeInfo(TRUE);
if (array_key_exists($typeName, $types)) {
* @return boolean true/false.
* @static
*/
- static function isAllowEdit($contactId, $subType = NULL) {
+ public static function isAllowEdit($contactId, $subType = NULL) {
if (!$contactId) {
return TRUE;
*
* @return bool
*/
- static function hasCustomData($contactType, $contactId = NULL) {
+ public static function hasCustomData($contactType, $contactId = NULL) {
$subTypeClause = '';
if (self::isaSubType($contactType)) {
*
* @return bool
*/
- static function hasRelationships($contactId, $contactType) {
+ public static function hasRelationships($contactId, $contactType) {
$subTypeClause = NULL;
if (self::isaSubType($contactType)) {
$subType = $contactType;
*
* @return array
*/
- static function getSubtypeCustomPair($contactType, $subtypeSet = array()) {
+ public static function getSubtypeCustomPair($contactType, $subtypeSet = array()) {
if (empty($subtypeSet)) {
return $subtypeSet;
}
* @return void
* @access public
*/
- function deleteCustomRowsForEntityID($customTable, $entityID) {
+ public function deleteCustomRowsForEntityID($customTable, $entityID) {
$customTable = CRM_Utils_Type::escape($customTable, 'String');
$query = "DELETE FROM {$customTable} WHERE entity_id = %1";
return CRM_Core_DAO::singleValueQuery($query, array(1 => array($entityID, 'Integer')));
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$group = new CRM_Contact_DAO_Group();
$group->copyValues($params);
if ($group->find(TRUE)) {
* @static
*
*/
- static function discard($id) {
+ public static function discard($id) {
CRM_Utils_Hook::pre('delete', 'Group', $id, CRM_Core_DAO::$_nullArray);
$transaction = new CRM_Core_Transaction();
* Returns an array of the contacts in the given group.
*
*/
- static function getGroupContacts($id) {
+ public static function getGroupContacts($id) {
$params = array(array('group', 'IN', array($id => 1), 0, 0));
list($contacts, $_) = CRM_Contact_BAO_Query::apiQuery($params, array('contact_id'));
return $contacts;
* @return int count of members in the group with above status
* @access public
*/
- static function memberCount($id, $status = 'Added', $countChildGroups = FALSE) {
+ public static function memberCount($id, $status = 'Added', $countChildGroups = FALSE) {
$groupContact = new CRM_Contact_DAO_GroupContact();
$groupIds = array($id);
if ($countChildGroups) {
* @access public
* @static
*/
- static function &getMember($groupID, $useCache = TRUE) {
+ public static function &getMember($groupID, $useCache = TRUE) {
$params = array(array('group', 'IN', array($groupID => 1), 0, 0));
$returnProperties = array('contact_id');
list($contacts, $_) = CRM_Contact_BAO_Query::apiQuery($params, $returnProperties, NULL, NULL, 0, 0, $useCache);
* @access public
* @static
*/
- static function checkPermission($id) {
+ public static function checkPermission($id) {
$allGroups = CRM_Core_PseudoConstant::allGroup();
$permissions = NULL;
* Given a saved search compute the clause and the tables
* and store it for future use
*/
- function buildClause() {
+ public function buildClause() {
$params = array(array('group', 'IN', array($this->id => 1), 0, 0));
if (!empty($params)) {
* @return Object DAO object on sucess, null otherwise
* @static
*/
- static function setIsActive($id, $isActive) {
+ public static function setIsActive($id, $isActive) {
return CRM_Core_DAO::setFieldValue('CRM_Contact_DAO_Group', $id, 'is_active', $isActive);
}
* @return string $condition
* @static
*/
- static function groupTypeCondition($groupType = NULL, $excludeHidden = TRUE) {
+ public static function groupTypeCondition($groupType = NULL, $excludeHidden = TRUE) {
$value = NULL;
if ($groupType == 'Mailing') {
$value = CRM_Core_DAO::VALUE_SEPARATOR . '2' . CRM_Core_DAO::VALUE_SEPARATOR;
* @access public
* @static
*/
- static function createHiddenSmartGroup($params) {
+ public static function createHiddenSmartGroup($params) {
$ssId = CRM_Utils_Array::value('saved_search_id', $params);
//add mapping record only for search builder saved search
* @return array
* @access public
*/
- static function getGroupList(&$params) {
+ public static function getGroupList(&$params) {
$config = CRM_Core_Config::singleton();
$whereClause = self::whereClause($params, FALSE);
*
* @return null|string
*/
- static function getGroupCount(&$params) {
+ public static function getGroupCount(&$params) {
$whereClause = self::whereClause($params, FALSE);
$query = "SELECT COUNT(*) FROM civicrm_group groups";
*
* @return string
*/
- static function whereClause(&$params, $sortBy = TRUE, $excludeHidden = TRUE) {
+ public static function whereClause(&$params, $sortBy = TRUE, $excludeHidden = TRUE) {
$values = array();
$title = CRM_Utils_Array::value('title', $params);
if ($title) {
* @return array $links array of action links
* @access public
*/
- static function actionLinks() {
+ public static function actionLinks() {
$links = array(
CRM_Core_Action::VIEW => array(
'name' => ts('Contacts'),
*
* @return string
*/
- function pagerAtoZ($whereClause, $whereParams) {
+ public function pagerAtoZ($whereClause, $whereParams) {
$query = "
SELECT DISTINCT UPPER(LEFT(groups.title, 1)) as sort_name
FROM civicrm_group groups
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
$dataExists = self::dataExists($params);
if (!$dataExists) {
* @access public
* @static
*/
- static function dataExists(&$params) {
+ public static function dataExists(&$params) {
// return if no data present
if ($params['group_id'] == 0) {
return FALSE;
* @access public
* @static
*/
- static function getValues(&$params, &$values) {
+ public static function getValues(&$params, &$values) {
if (empty($params)) {
return NULL;
}
* @return array $values this array has key-> group id and value group title
* @static
*/
- static function getGroupList($contactId = 0, $visibility = FALSE) {
+ public static function getGroupList($contactId = 0, $visibility = FALSE) {
$group = new CRM_Contact_DAO_Group();
$select = $from = $where = '';
* @access public
* @static
*/
- static function getMembershipDetail($contactId, $groupID, $method = 'Email') {
+ public static function getMembershipDetail($contactId, $groupID, $method = 'Email') {
$leftJoin = $where = $orderBy = null;
if ($method) {
* @access public
* @static
*/
- static function getGroupId($groupContactID) {
+ public static function getGroupId($groupContactID) {
$dao = new CRM_Contact_DAO_GroupContact();
$dao->id = $groupContactID;
$dao->find(TRUE);
* @access public
* @static
*/
- static function create(&$params, $contactId, $visibility = FALSE, $method = 'Admin') {
+ public static function create(&$params, $contactId, $visibility = FALSE, $method = 'Admin') {
$contactIds = array();
$contactIds[] = $contactId;
*
* @return bool
*/
- static function isContactInGroup($contactID, $groupID) {
+ public static function isContactInGroup($contactID, $groupID) {
if (!CRM_Utils_Rule::positiveInteger($contactID) ||
!CRM_Utils_Rule::positiveInteger($groupID)
) {
* @return void.
* @static
*/
- static function mergeGroupContact($mainContactId, $otherContactId) {
+ public static function mergeGroupContact($mainContactId, $otherContactId) {
$params = array(1 => array($mainContactId, 'Integer'),
2 => array($otherContactId, 'Integer'),
);
*
* @return boolean true if we did not regenerate, false if we did
*/
- static function check($groupIDs) {
+ public static function check($groupIDs) {
if (empty($groupIDs)) {
return TRUE;
}
* @static
* @public
*/
- static function groupRefreshedClause($groupIDClause = null, $includeHiddenGroups = FALSE) {
+ public static function groupRefreshedClause($groupIDClause = null, $includeHiddenGroups = FALSE) {
$smartGroupCacheTimeout = self::smartGroupCacheTimeout();
$now = CRM_Utils_Date::getUTCTime();
* @static
* @public
*/
- static function shouldGroupBeRefreshed($groupID, $includeHiddenGroups = FALSE) {
+ public static function shouldGroupBeRefreshed($groupID, $includeHiddenGroups = FALSE) {
$query = self::groupRefreshedClause("g.id = %1", $includeHiddenGroups);
$params = array(1 => array($groupID, 'Integer'));
*
* @return boolean true if we did not regenerate, false if we did
*/
- static function loadAll($groupIDs = null, $limit = 0) {
+ public static function loadAll($groupIDs = null, $limit = 0) {
// ensure that all the smart groups are loaded
// this function is expensive and should be sparingly used if groupIDs is empty
if (empty($groupIDs)) {
/**
* FIXME: This function should not be needed, because the cache table should not be getting truncated
*/
- static function fillIfEmpty() {
+ public static function fillIfEmpty() {
if (!CRM_Core_DAO::singleValueQuery("SELECT COUNT(id) FROM civicrm_group_contact_cache")) {
self::loadAll();
}
/**
* @param int $groupID
*/
- static function add($groupID) {
+ public static function add($groupID) {
// first delete the current cache
self::remove($groupID);
if (!is_array($groupID)) {
* @param int $groupID
* @param $values
*/
- static function store(&$groupID, &$values) {
+ public static function store(&$groupID, &$values) {
$processed = FALSE;
// sort the values so we put group IDs in front and hence optimize
* @param $groupID array(int)
* @param $processed bool, whether the cache data was recently modified
*/
- static function updateCacheTime($groupID, $processed) {
+ public static function updateCacheTime($groupID, $processed) {
// only update cache entry if we had any values
if ($processed) {
// also update the group with cache date information
* @return void
* @static
*/
- static function remove($groupID = NULL, $onceOnly = TRUE) {
+ public static function remove($groupID = NULL, $onceOnly = TRUE) {
static $invoked = FALSE;
// typically this needs to happy only once per instance
* @param int $groupId
* @return bool - true if successful
*/
- static function removeContact($cid, $groupId = NULL) {
+ public static function removeContact($cid, $groupId = NULL) {
$cids = array();
// sanitize input
foreach ((array) $cid as $c) {
* @param boolean $force - should we force a search through
*
*/
- static function load(&$group, $force = FALSE) {
+ public static function load(&$group, $force = FALSE) {
$groupID = $group->id;
$savedSearchID = $group->saved_search_id;
if (array_key_exists($groupID, self::$_alreadyLoaded) && !$force) {
/**
* @return int
*/
- static function smartGroupCacheTimeout() {
+ public static function smartGroupCacheTimeout() {
$config = CRM_Core_Config::singleton();
if (
*
* @return array an array of groups that this contact belongs to
*/
- static function contactGroup($contactID, $showHidden = FALSE) {
+ public static function contactGroup($contactID, $showHidden = FALSE) {
if (empty($contactID)) {
return;
}
/**
* Class constructor
*/
- function __construct($styleLabels = FALSE, $styleIndent = " -- ") {
+ public function __construct($styleLabels = FALSE, $styleIndent = " -- ") {
parent::__construct();
$this->_styleLabels = $styleLabels;
$this->_styleIndent = $styleIndent;
/**
* @param $sortOrder
*/
- function setSortOrder($sortOrder) {
+ public function setSortOrder($sortOrder) {
switch ($sortOrder) {
case 'ASC':
case 'DESC':
/**
* @return string
*/
- function getSortOrder() {
+ public function getSortOrder() {
return self::$_sortOrder;
}
/**
* @return int
*/
- function getCurrentNestingLevel() {
+ public function getCurrentNestingLevel() {
return count($this->_parentStack);
}
* which is the first group (according to _sortOrder) that
* has no parent groups
*/
- function rewind() {
+ public function rewind() {
$this->_parentStack = array();
// calling _getNextParentlessGroup w/ no arguments
// makes it return the first parentless group
$this->_alreadyStyled = FALSE;
}
- function current() {
+ public function current() {
if ($this->_styleLabels &&
$this->valid() &&
!$this->_alreadyStyled
/**
* @return string
*/
- function key() {
+ public function key() {
$group = &$this->_current;
$ids = array();
foreach ($this->_parentStack as $parentGroup) {
/**
* @return CRM_Contact_BAO_Group|null
*/
- function next() {
+ public function next() {
$currentGroup = &$this->_current;
$childGroup = $this->_getNextChildGroup($currentGroup);
if ($childGroup) {
/**
* @return bool
*/
- function valid() {
+ public function valid() {
if ($this->_current) {
return TRUE;
}
*
* @return CRM_Contact_BAO_Group|null
*/
- function _getNextParentlessGroup(&$group = NULL) {
+ public function _getNextParentlessGroup(&$group = NULL) {
$lastParentlessGroup = $this->_lastParentlessGroup;
$nextGroup = new CRM_Contact_BAO_Group();
$nextGroup->order_by = 'title ' . self::$_sortOrder;
*
* @return CRM_Contact_BAO_Group|null
*/
- function _getNextChildGroup(&$parentGroup, &$group = NULL) {
+ public function _getNextChildGroup(&$parentGroup, &$group = NULL) {
$children = self::getChildGroupIds($parentGroup->id);
if (count($children) > 0) {
// we have child groups, so get the first one based on _sortOrder
*
* @return CRM_Contact_BAO_Group|null
*/
- function _getNextSiblingGroup(&$group) {
+ public function _getNextSiblingGroup(&$group) {
$parentGroup = end($this->_parentStack);
if ($parentGroup) {
$nextGroup = $this->_getNextChildGroup($parentGroup, $group);
* @return void
* @access public
*/
- static function add($parentID, $childID) {
+ public static function add($parentID, $childID) {
// TODO: Add checks here to make sure invalid nests can't be created
$dao = new CRM_Contact_DAO_GroupNesting();
$query = "REPLACE INTO civicrm_group_nesting (child_group_id, parent_group_id) VALUES ($childID,$parentID);";
*
* @access public
*/
- static function remove($parentID, $childID) {
+ public static function remove($parentID, $childID) {
$dao = new CRM_Contact_DAO_GroupNesting();
$query = "DELETE FROM civicrm_group_nesting WHERE child_group_id = $childID AND parent_group_id = $parentID";
$dao->query($query);
*
* @access public
*/
- static function removeAllParentForChild($childID) {
+ public static function removeAllParentForChild($childID) {
$dao = new CRM_Contact_DAO_GroupNesting();
$query = "DELETE FROM civicrm_group_nesting WHERE child_group_id = $childID";
$dao->query($query);
*
* @access public
*/
- static function isParentChild($parentID, $childID) {
+ public static function isParentChild($parentID, $childID) {
$dao = new CRM_Contact_DAO_GroupNesting();
$query = "SELECT id FROM civicrm_group_nesting WHERE child_group_id = $childID AND parent_group_id = $parentID";
$dao->query($query);
*
* @access public
*/
- static function hasChildGroups($groupId) {
+ public static function hasChildGroups($groupId) {
$dao = new CRM_Contact_DAO_GroupNesting();
$query = "SELECT child_group_id FROM civicrm_group_nesting WHERE parent_group_id = $groupId LIMIT 1";
//print $query . "\n<br><br>";
*
* @access public
*/
- static function hasParentGroups($groupId) {
+ public static function hasParentGroups($groupId) {
$dao = new CRM_Contact_DAO_GroupNesting();
$query = "SELECT parent_group_id FROM civicrm_group_nesting WHERE child_group_id = $groupId LIMIT 1";
$dao->query($query);
*
* @access public
*/
- static function isParentGroup($groupIds, $checkGroupId) {
+ public static function isParentGroup($groupIds, $checkGroupId) {
if (!is_array($groupIds)) {
$groupIds = array($groupIds);
}
*
* @access public
*/
- static function isChildGroup($groupIds, $checkGroupId) {
+ public static function isChildGroup($groupIds, $checkGroupId) {
if (!is_array($groupIds)) {
$groupIds = array($groupIds);
*
* @access public
*/
- static function isAncestorGroup($groupIds, $checkGroupId) {
+ public static function isAncestorGroup($groupIds, $checkGroupId) {
if (!is_array($groupIds)) {
$groupIds = array($groupIds);
}
*
* @access public
*/
- static function isDescendentGroup($groupIds, $checkGroupId) {
+ public static function isDescendentGroup($groupIds, $checkGroupId) {
if (!is_array($groupIds)) {
$groupIds = array($groupIds);
}
*
* @return array $groupIdArray List of groupIds that represent the requested group and its ancestors@access public
*/
- static function getAncestorGroupIds($groupIds, $includeSelf = TRUE) {
+ public static function getAncestorGroupIds($groupIds, $includeSelf = TRUE) {
if (!is_array($groupIds)) {
$groupIds = array($groupIds);
}
* @param bool $includeSelf
* @return \An $groupArray List of ancestor groups@access public
*/
- static function getAncestorGroups($groupIds, $includeSelf = TRUE) {
+ public static function getAncestorGroups($groupIds, $includeSelf = TRUE) {
$groupIds = self::getAncestorGroupIds($groupIds, $includeSelf);
$params['id'] = $groupIds;
return CRM_Contact_BAO_Group::getGroups($params);
*
* @return array $groupIdArray List of groupIds that represent the requested group and its children@access public
*/
- static function getChildGroupIds($groupIds) {
+ public static function getChildGroupIds($groupIds) {
if (!is_array($groupIds)) {
$groupIds = array($groupIds);
}
*
* @return array $groupIdArray List of groupIds that represent the requested group and its parents@access public
*/
- static function getParentGroupIds($groupIds) {
+ public static function getParentGroupIds($groupIds) {
if (!is_array($groupIds)) {
$groupIds = array($groupIds);
}
* @param bool $includeSelf
* @return array $groupIdArray List of groupIds that represent the requested group and its descendents@access public
*/
- static function getDescendentGroupIds($groupIds, $includeSelf = TRUE) {
+ public static function getDescendentGroupIds($groupIds, $includeSelf = TRUE) {
if (!is_array($groupIds)) {
$groupIds = array($groupIds);
}
* @param bool $includeSelf
* @return \An $groupArray List of descendent groups@access public
*/
- static function getDescendentGroups($groupIds, $includeSelf = TRUE) {
+ public static function getDescendentGroups($groupIds, $includeSelf = TRUE) {
$groupIds = self::getDescendentGroupIds($groupIds, $includeSelf);
$params['id'] = $groupIds;
return CRM_Contact_BAO_Group::getGroups($params);
*
* @return array $groupIdArray List of groupIds that represent the valid potential children of the group@access public
*/
- static function getPotentialChildGroupIds($groupId) {
+ public static function getPotentialChildGroupIds($groupId) {
$groups = CRM_Contact_BAO_Group::getGroups();
$potentialChildGroupIds = array();
foreach ($groups as $group) {
*
* @return array
*/
- static function getContainingGroups($contactId, $parentGroupId) {
+ public static function getContainingGroups($contactId, $parentGroupId) {
$groups = CRM_Contact_BAO_Group::getGroups();
$containingGroups = array();
foreach ($groups as $group) {
*
* @return bool
*/
- static function checkCyclicGraph(&$tree) {
+ public static function checkCyclicGraph(&$tree) {
// lets keep this simple, we should probably use a graph algoritm here at some stage
// foreach group that has a parent or a child, ensure that
*
* @return bool
*/
- static function isCyclic(&$tree, $id) {
+ public static function isCyclic(&$tree, $id) {
$parents = $children = array();
self::getAll($parent, $tree, $id, 'parents');
self::getAll($child, $tree, $id, 'children');
*
* @return array
*/
- static function getPotentialCandidates($id, &$groups) {
+ public static function getPotentialCandidates($id, &$groups) {
$tree = CRM_Core_BAO_Cache::getItem('contact groups', 'nestable tree hierarchy');
if ($tree === NULL) {
* @param int $id
* @param $token
*/
- static function invalidate(&$potential, &$tree, $id, $token) {
+ public static function invalidate(&$potential, &$tree, $id, $token) {
unset($potential[$id]);
if (!isset($tree[$id]) ||
* @param int $id
* @param $token
*/
- static function getAll(&$all, &$tree, $id, $token) {
+ public static function getAll(&$all, &$tree, $id, $token) {
// if seen before, dont do anything
if (isset($all[$id])) {
return;
/**
* @return string
*/
- static function json() {
+ public static function json() {
$tree = CRM_Core_BAO_Cache::getItem('contact groups', 'nestable tree hierarchy');
if ($tree === NULL) {
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
$formattedValues = array();
self::formatValues($params, $formattedValues);
$dataExists = self::dataExists($formattedValues);
* @access public
* @static
*/
- static function formatValues(&$params, &$formatedValues) {
+ public static function formatValues(&$params, &$formatedValues) {
if (!empty($params['group_organization'])) {
$formatedValues['id'] = $params['group_organization'];
}
* @access public
* @static
*/
- static function dataExists($params) {
+ public static function dataExists($params) {
// return if no data present
if (!empty($params['organization_id']) && !empty($params['group_id'])) {
return TRUE;
* @param int $groupID
* @param $defaults
*/
- static function retrieve($groupID, &$defaults) {
+ public static function retrieve($groupID, &$defaults) {
$dao = new CRM_Contact_DAO_GroupOrganization();
$dao->group_id = $groupID;
if ($dao->find(TRUE)) {
* @access public
* @static
*/
- static function hasGroupAssociated($contactID) {
+ public static function hasGroupAssociated($contactID) {
$orgID = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_GroupOrganization',
$contactID, 'group_id', 'organization_id'
);
*
* @return mixed|null $results no of deleted group organization on success, false otherwise@access public
*/
- static function deleteGroupOrganization($groupOrganizationID) {
+ public static function deleteGroupOrganization($groupOrganizationID) {
$results = NULL;
$groupOrganization = new CRM_Contact_DAO_GroupOrganization();
$groupOrganization->id = $groupOrganizationID;
/**
* This is a contructor of the class.
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function updatePrimaryContact($primaryContactId, $contactId) {
+ public static function updatePrimaryContact($primaryContactId, $contactId) {
$queryString = "UPDATE civicrm_contact
SET primary_contact_id = ";
/**
* This is a contructor of the class.
*/
- function __construct() {}
+ public function __construct() {}
/**
* Function is used to format the individual contact values
* @access public
* @static
*/
- static function format(&$params, &$contact) {
+ public static function format(&$params, &$contact) {
if (!self::dataExists($params)) {
return;
}
*
* @return void
*/
- static function updateDisplayNames(&$ids, $action) {
+ public static function updateDisplayNames(&$ids, $action) {
// get the proper field name (prefix_id or suffix_id) and its value
$fieldName = '';
foreach ($ids as $key => $value) {
*
* @return string the constructed display name
*/
- function displayName() {
+ public function displayName() {
$prefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id');
$suffix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id');
return str_replace(' ', ' ', trim($prefix[$this->prefix_id] . ' ' . $this->first_name . ' ' . $this->middle_name . ' ' . $this->last_name . ' ' . $suffix[$this->suffix_id]));
* @access public
* @static
*/
- static function dataExists(&$params) {
+ public static function dataExists(&$params) {
if ($params['contact_type'] == 'Individual') {
return TRUE;
}
static protected $_earthRadiusSemiMajor;
static protected $_earthEccentricitySQ;
- static function initialize() {
+ public static function initialize() {
static $_initialized = FALSE;
if (!$_initialized) {
* Default to an approximate average radius for the United States.
*/
- static function earthRadius($latitude) {
+ public static function earthRadius($latitude) {
$lat = deg2rad($latitude);
$x = cos($lat) / self::$_earthRadiusSemiMajor;
* Convert longitude and latitude to earth-centered earth-fixed coordinates.
* X axis is 0 long, 0 lat; Y axis is 90 deg E; Z axis is north pole.
*/
- static function earthXYZ($longitude, $latitude, $height = 0) {
+ public static function earthXYZ($longitude, $latitude, $height = 0) {
$long = deg2rad($longitude);
$lat = deg2rad($latitude);
/**
* Convert a given angle to earth-surface distance.
*/
- static function earthArcLength($angle, $latitude) {
+ public static function earthArcLength($angle, $latitude) {
return deg2rad($angle) * self::earthRadius($latitude);
}
/**
* Estimate the min and max longitudes within $distance of a given location.
*/
- static function earthLongitudeRange($longitude, $latitude, $distance) {
+ public static function earthLongitudeRange($longitude, $latitude, $distance) {
$long = deg2rad($longitude);
$lat = deg2rad($latitude);
$radius = self::earthRadius($latitude);
/**
* Estimate the min and max latitudes within $distance of a given location.
*/
- static function earthLatitudeRange($longitude, $latitude, $distance) {
+ public static function earthLatitudeRange($longitude, $latitude, $distance) {
$long = deg2rad($longitude);
$lat = deg2rad($latitude);
$radius = self::earthRadius($latitude);
*
* @return string
*/
- static function where($latitude, $longitude, $distance, $tablePrefix = 'civicrm_address') {
+ public static function where($latitude, $longitude, $distance, $tablePrefix = 'civicrm_address') {
self::initialize();
$params = array();
*
* @throws Exception
*/
- static function process(&$query, &$values) {
+ public static function process(&$query, &$values) {
list($name, $op, $distance, $grouping, $wildcard) = $values;
// also get values array for all address related info
/**
* @param $input
*/
- static function fixInputParams(&$input) {
+ public static function fixInputParams(&$input) {
foreach ($input as $param) {
if (CRM_Utils_Array::value('0', $param) == 'prox_distance') {
// add prox_ prefix to these
* @return void
* @access private
*/
- function initialize() {
+ public function initialize() {
$this->_select = array();
$this->_element = array();
$this->_tables = array();
$this->openedSearchPanes(TRUE);
}
- function buildParamsLookup() {
+ public function buildParamsLookup() {
// first fix and handle contact deletion nicely
// this code is primarily for search builder use case
// where different clauses can specify if they want deleted
* @return void
* @access public
*/
- function addSpecialFields() {
+ public function addSpecialFields() {
static $special = array('contact_type', 'contact_sub_type', 'sort_name', 'display_name');
foreach ($special as $name) {
if (!empty($this->_returnProperties[$name])) {
* @return void
* @access public
*/
- function selectClause() {
+ public function selectClause() {
$this->addSpecialFields();
* @return void
* @access public
*/
- function addHierarchicalElements() {
+ public function addHierarchicalElements() {
if (empty($this->_returnProperties['location'])) {
return;
}
* @return void
* @access public
*/
- function addMultipleElements() {
+ public function addMultipleElements() {
if (empty($this->_returnProperties['website'])) {
return;
}
* @return array sql query parts as an array
* @access public
*/
- function query($count = FALSE, $sortByChar = FALSE, $groupContacts = FALSE, $onlyDeleted = FALSE) {
+ public function query($count = FALSE, $sortByChar = FALSE, $groupContacts = FALSE, $onlyDeleted = FALSE) {
// build permission clause
$this->generatePermissionClause($onlyDeleted, $count);
*
* @return null
*/
- function &getWhereValues($name, $grouping) {
+ public function &getWhereValues($name, $grouping) {
$result = NULL;
foreach ($this->_params as $values) {
if ($values[0] == $name && $values[3] == $grouping) {
* @param $from
* @param $to
*/
- static function fixDateValues($relative, &$from, &$to) {
+ public static function fixDateValues($relative, &$from, &$to) {
if ($relative) {
list($from, $to) = CRM_Utils_Date::getFromTo($relative, $from, $to);
}
*
* @return array
*/
- static function convertFormValues(&$formValues, $wildcard = 0, $useEquals = FALSE) {
+ public static function convertFormValues(&$formValues, $wildcard = 0, $useEquals = FALSE) {
$params = array();
if (empty($formValues)) {
return $params;
*
* @return array|null
*/
- static function &fixWhereValues($id, &$values, $wildcard = 0, $useEquals = FALSE) {
+ public static function &fixWhereValues($id, &$values, $wildcard = 0, $useEquals = FALSE) {
// skip a few search variables
static $skipWhere = NULL;
static $likeNames = NULL;
/**
* @param $values
*/
- function whereClauseSingle(&$values) {
+ public function whereClauseSingle(&$values) {
// do not process custom fields or prefixed contact ids or component params
if (CRM_Core_BAO_CustomField::getKeyID($values[0]) ||
(substr($values[0], 0, CRM_Core_Form::CB_PREFIX_LEN) == CRM_Core_Form::CB_PREFIX) ||
* @return string
* @access public
*/
- function whereClause() {
+ public function whereClause() {
$this->_where[0] = array();
$this->_qill[0] = array();
*
* @throws Exception
*/
- function restWhere(&$values) {
+ public function restWhere(&$values) {
$name = CRM_Utils_Array::value(0, $values);
$op = CRM_Utils_Array::value(1, $values);
$value = CRM_Utils_Array::value(2, $values);
* @return array
* @throws Exception
*/
- static function getLocationTableName(&$where, &$locType) {
+ public static function getLocationTableName(&$where, &$locType) {
if (isset($locType[1]) && is_numeric($locType[1])) {
list($tbName, $fldName) = explode(".", $where);
*
* @return array values for this query
*/
- function store($dao) {
+ public function store($dao) {
$value = array();
foreach ($this->_element as $key => $dontCare) {
* @return array
* @access public
*/
- function tables() {
+ public function tables() {
return $this->_tables;
}
* logic may have eroded
* @return array
*/
- function whereTables() {
+ public function whereTables() {
return $this->_whereTables;
}
* @access public
* @static
*/
- static function getWhereClause($params, $fields, &$tables, &$whereTables, $strict = FALSE) {
+ public static function getWhereClause($params, $fields, &$tables, &$whereTables, $strict = FALSE) {
$query = new CRM_Contact_BAO_Query($params, NULL, $fields,
FALSE, $strict
);
* @access public
* @static
*/
- static function fromClause(&$tables, $inner = NULL, $right = NULL, $primaryLocation = TRUE, $mode = 1) {
+ public static function fromClause(&$tables, $inner = NULL, $right = NULL, $primaryLocation = TRUE, $mode = 1) {
$from = ' FROM civicrm_contact contact_a';
if (empty($tables)) {
*
* @return void
*/
- function deletedContacts($values) {
+ public function deletedContacts($values) {
list($_, $_, $value, $grouping, $_) = $values;
if ($value) {
// *prepend* to the relevant grouping as this is quite an important factor
* @return void
* @access public
*/
- function contactType(&$values) {
+ public function contactType(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
$subTypes = array();
* @return void
* @access public
*/
- function contactSubType(&$values) {
+ public function contactSubType(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
$this->includeContactSubTypes($value, $grouping, $op);
}
* @param $value
* @param $grouping
*/
- function includeContactSubTypes($value, $grouping, $op = 'LIKE') {
+ public function includeContactSubTypes($value, $grouping, $op = 'LIKE') {
$clause = array();
$alias = "contact_a.contact_sub_type";
* @return void
* @access public
*/
- function group(&$values) {
+ public function group(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
if (count($value) > 1) {
*
* @return array
*/
- function getGroupsFromTypeCriteria($value){
+ public function getGroupsFromTypeCriteria($value){
$groupIds = array();
foreach ($value as $groupTypeValue) {
$groupList = CRM_Core_PseudoConstant::group($groupTypeValue);
* @return string|NULL
* @access public
*/
- function savedSearch(&$values) {
+ public function savedSearch(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
return $this->addGroupContactCache(array_keys($value));
}
*
* @return null|string
*/
- function addGroupContactCache($groups, $tableAlias = NULL, $joinTable = "contact_a") {
+ public function addGroupContactCache($groups, $tableAlias = NULL, $joinTable = "contact_a") {
$config = CRM_Core_Config::singleton();
// Find all the groups that are part of a saved search.
* @return void
* @access public
*/
- function ufUser(&$values) {
+ public function ufUser(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
if ($value == 1) {
* @return void
* @access public
*/
- function tagSearch(&$values) {
+ public function tagSearch(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
$op = "LIKE";
* @return void
* @access public
*/
- function tag(&$values) {
+ public function tag(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
$tagNames = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE));
* @return void
* @access public
*/
- function notes(&$values) {
+ public function notes(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
$noteOptionValues = $this->getWhereValues('note_option', $grouping);
*
* @return bool
*/
- function nameNullOrEmptyOp($name, $op, $grouping) {
+ public function nameNullOrEmptyOp($name, $op, $grouping) {
switch ( $op ) {
case 'IS NULL':
case 'IS NOT NULL':
* @return void
* @access public
*/
- function sortName(&$values) {
+ public function sortName(&$values) {
list($fieldName, $op, $value, $grouping, $wildcard) = $values;
// handle IS NULL / IS NOT NULL / IS EMPTY / IS NOT EMPTY
* @return void
* @access public
*/
- function email(&$values) {
+ public function email(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
$n = trim($value);
* @return void
* @access public
*/
- function phone_numeric(&$values) {
+ public function phone_numeric(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
// Strip non-numeric characters; allow wildcards
$number = preg_replace('/[^\d%]/', '', $value);
* @return void
* @access public
*/
- function phone_option_group($values) {
+ public function phone_option_group($values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
$option = ($name == 'phone_phone_type_id' ? 'phone_type_id' : 'location_type_id');
$options = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', $option);
* @return void
* @access public
*/
- function street_address(&$values) {
+ public function street_address(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
if (!$op) {
* @return void
* @access public
*/
- function street_number(&$values) {
+ public function street_number(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
if (!$op) {
* @return void
* @access public
*/
- function sortByCharacter(&$values) {
+ public function sortByCharacter(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
$name = trim($value);
* @return void
* @access public
*/
- function includeContactIDs() {
+ public function includeContactIDs() {
if (!$this->_includeContactIds || empty($this->_params)) {
return;
}
* @return void
* @access public
*/
- function postalCode(&$values) {
+ public function postalCode(&$values) {
// skip if the fields dont have anything to do with postal_code
if (empty($this->_fields['postal_code'])) {
return;
* @return void
* @access public
*/
- function locationType(&$values, $status = NULL) {
+ public function locationType(&$values, $status = NULL) {
list($name, $op, $value, $grouping, $wildcard) = $values;
if (is_array($value)) {
*
* @return array
*/
- function country(&$values, $fromStateProvince = TRUE) {
+ public function country(&$values, $fromStateProvince = TRUE) {
list($name, $op, $value, $grouping, $wildcard) = $values;
if (!$fromStateProvince) {
* @return void
* @access public
*/
- function county(&$values, $status = null) {
+ public function county(&$values, $status = null) {
list($name, $op, $value, $grouping, $wildcard) = $values;
if (! is_array($value)) {
* @return void
* @access public
*/
- function stateProvince(&$values, $status = NULL) {
+ public function stateProvince(&$values, $status = NULL) {
list($name, $op, $value, $grouping, $wildcard) = $values;
// quick escape for IS NULL
* @return void
* @access public
*/
- function changeLog(&$values) {
+ public function changeLog(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
$targetName = $this->getWhereValues('changed_by', $grouping);
/**
* @param $values
*/
- function modifiedDates($values) {
+ public function modifiedDates($values) {
$this->_useDistinct = TRUE;
// CRM-11281, default to added date if not set
/**
* @param $values
*/
- function demographics(&$values) {
+ public function demographics(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
if (($name == 'birth_date_low') || ($name == 'birth_date_high')) {
/**
* @param $values
*/
- function privacy(&$values) {
+ public function privacy(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
//fixed for profile search listing CRM-4633
if (strpbrk($value, "[")) {
/**
* @param $values
*/
- function privacyOptions($values) {
+ public function privacyOptions($values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
if (empty($value) || !is_array($value)) {
/**
* @param $values
*/
- function preferredCommunication(&$values) {
+ public function preferredCommunication(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
$pref = array();
* @return void
* @access public
*/
- function relationship(&$values) {
+ public function relationship(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
if ($this->_relationshipValuesAdded){
return;
* @param array $where = array to add where clauses to, in case you are generating a temp table
* not the main query.
*/
- function addRelationshipDateClauses($grouping, &$where){
+ public function addRelationshipDateClauses($grouping, &$where){
$dateValues = array();
$dateTypes = array(
'start_date',
* @return array derault return properties
* @access public
*/
- static function &defaultReturnProperties($mode = 1) {
+ public static function &defaultReturnProperties($mode = 1) {
if (!isset(self::$_defaultReturnProperties)) {
self::$_defaultReturnProperties = array();
}
* @return string|NULL
* @access public
*/
- static function getPrimaryCondition($value) {
+ public static function getPrimaryCondition($value) {
if (is_numeric($value)) {
$value = (int ) $value;
return ($value == 1) ? 'is_primary = 1' : 'is_primary = 0';
* @return string
* @access public
*/
- static function getQuery($params = NULL, $returnProperties = NULL, $count = FALSE) {
+ public static function getQuery($params = NULL, $returnProperties = NULL, $count = FALSE) {
$query = new CRM_Contact_BAO_Query($params, $returnProperties);
list($select, $from, $where, $having) = $query->query();
* @param bool $includeContactIds
* @return CRM_Core_DAO
*/
- function getCachedContacts($cacheKey, $offset, $rowCount, $includeContactIds) {
+ public function getCachedContacts($cacheKey, $offset, $rowCount, $includeContactIds) {
$this->_includeContactIds = $includeContactIds;
$onlyDeleted = in_array(array('deleted_contacts', '=', '1', '0', '0'), $this->_params);
list($select, $from, $where) = $this->query(FALSE, FALSE, FALSE, $onlyDeleted);
*
* @return null
*/
- function generatePermissionClause($onlyDeleted = FALSE, $count = FALSE) {
+ public function generatePermissionClause($onlyDeleted = FALSE, $count = FALSE) {
if (!$this->_skipPermission) {
$this->_permissionWhereClause = CRM_ACL_API::whereClause(
CRM_Core_Permission::VIEW,
/**
* @param $val
*/
- function setSkipPermission($val) {
+ public function setSkipPermission($val) {
$this->_skipPermission = $val;
}
*
* @return array
*/
- function &summaryContribution($context = NULL) {
+ public function &summaryContribution($context = NULL) {
list($innerselect, $from, $where, $having) = $this->query(TRUE);
// hack $select
* @return string
* @access public
*/
- function qill() {
+ public function qill() {
return $this->_qill;
}
* @return array
* @access public
*/
- static function &defaultHierReturnProperties() {
+ public static function &defaultHierReturnProperties() {
if (!isset(self::$_defaultHierReturnProperties)) {
self::$_defaultHierReturnProperties = array(
'home_URL' => 1,
* @return string where clause for the query
* @access public
*/
- static function buildClause($field, $op, $value = NULL, $dataType = NULL) {
+ public static function buildClause($field, $op, $value = NULL, $dataType = NULL) {
$op = trim($op);
$clause = "$field $op";
*
* @return array
*/
- function openedSearchPanes($reset = FALSE) {
+ public function openedSearchPanes($reset = FALSE) {
if (!$reset || empty($this->_whereTables)) {
return self::$_openedPanes;
}
/**
* @param $operator
*/
- function setOperator($operator) {
+ public function setOperator($operator) {
$validOperators = array('AND', 'OR');
if (!in_array($operator, $validOperators)) {
$operator = 'AND';
/**
* @return string
*/
- function getOperator() {
+ public function getOperator() {
return $this->_operator;
}
* @param $where
* @param $having
*/
- function filterRelatedContacts(&$from, &$where, &$having) {
+ public function filterRelatedContacts(&$from, &$where, &$having) {
static $_rTypeProcessed = NULL;
static $_rTypeFrom = NULL;
static $_rTypeWhere = NULL;
*
* @return bool
*/
- static function caseImportant( $op ) {
+ public static function caseImportant( $op ) {
return
in_array($op, array('LIKE', 'IS NULL', 'IS NOT NULL', 'IS EMPTY', 'IS NOT EMPTY')) ? FALSE : TRUE;
}
*
* @return bool
*/
- static function componentPresent( &$returnProperties, $prefix ) {
+ public static function componentPresent( &$returnProperties, $prefix ) {
foreach ($returnProperties as $name => $dontCare ) {
if (substr($name, 0, strlen($prefix)) == $prefix) {
return TRUE;
* array of numeric values if string does match the pattern
* @static
*/
- static function parseSearchBuilderString($string, $dataType = 'Integer') {
+ public static function parseSearchBuilderString($string, $dataType = 'Integer') {
$string = trim($string);
if (substr($string, 0, 1) != '(' || substr($string, -1, 1) != ')') {
Return FALSE;
*
* @return array
*/
- function convertToPseudoNames(&$dao, $return = FALSE) {
+ public function convertToPseudoNames(&$dao, $return = FALSE) {
if (empty($this->_pseudoConstantsSelect)) {
return;
}
*
* @return array
*/
- function includePseudoFieldsJoin($sort) {
+ public function includePseudoFieldsJoin($sort) {
if (!$sort || empty($this->_pseudoConstantsSelect)) {
return;
}
* @access public
* @static
*/
- static function create(&$params, $ids = array()) {
+ public static function create(&$params, $ids = array()) {
$valid = $invalid = $duplicate = $saved = 0;
$relationships = $relationshipIds = array();
$relationshipId = CRM_Utils_Array::value('relationship', $ids, CRM_Utils_Array::value('id', $params));
* @access public
* @static
*/
- static function add(&$params, $ids = array(), $contactId = NULL) {
+ public static function add(&$params, $ids = array(), $contactId = NULL) {
$relationshipId =
CRM_Utils_Array::value('relationship', $ids, CRM_Utils_Array::value('id', $params));
* @access public
* @static
*/
- static function getdefaults() {
+ public static function getdefaults() {
return array(
'is_active' => 0,
'is_permission_a_b' => 0,
* @access public
* @static
*/
- static function dataExists(&$params) {
+ public static function dataExists(&$params) {
// return if no data present
if (!is_array(CRM_Utils_Array::value('contact_check', $params))) {
return FALSE;
*
* @return CRM_Contact_DAO_Relationship
*/
- static function clearCurrentEmployer($id, $action) {
+ public static function clearCurrentEmployer($id, $action) {
$relationship = new CRM_Contact_DAO_Relationship();
$relationship->id = $id;
$relationship->find(TRUE);
*
* @static
*/
- static function del($id) {
+ public static function del($id) {
// delete from relationship table
CRM_Utils_Hook::pre('delete', 'Relationship', $id, CRM_Core_DAO::$_nullArray);
* @access public
* @static
*/
- static function disableEnableRelationship($id, $action) {
+ public static function disableEnableRelationship($id, $action) {
$relationship = self::clearCurrentEmployer($id, $action);
if (CRM_Core_Permission::access('CiviMember')) {
// create $params array which isrequired to delete memberships
* @access public
* @static
*/
- static function deleteContact($contactId) {
+ public static function deleteContact($contactId) {
$relationship = new CRM_Contact_DAO_Relationship();
$relationship->contact_id_a = $contactId;
$relationship->delete();
* @access public
* @static
*/
- static function getContactIds($id) {
+ public static function getContactIds($id) {
$relationship = new CRM_Contact_DAO_Relationship();
$relationship->id = $id;
* @access public
* @static
*/
- static function checkRelationshipType($contact_a, $contact_b, $relationshipTypeId) {
+ public static function checkRelationshipType($contact_a, $contact_b, $relationshipTypeId) {
$relationshipType = new CRM_Contact_DAO_RelationshipType();
$relationshipType->id = $relationshipTypeId;
$relationshipType->selectAdd();
@access public
* @static
*/
- static function checkValidRelationship(&$params, &$ids, $contactId) {
+ public static function checkValidRelationship(&$params, &$ids, $contactId) {
$errors = '';
// get the string of relationship type
* @access public
* @static
*/
- static function checkDuplicateRelationship(&$params, $id, $contactId = 0, $relationshipId = 0) {
+ public static function checkDuplicateRelationship(&$params, $id, $contactId = 0, $relationshipId = 0) {
$relationshipTypeId = CRM_Utils_Array::value('relationship_type_id', $params);
list($type, $first, $second) = explode('_', $relationshipTypeId);
* @return Object DAO object on success, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
// as both the create & add functions have a bunch of logic in them that
// doesn't seem to cope with a normal update we will call the api which
// has tested handling for this
* @access public
* @static
*/
- static function &getValues(&$params, &$values) {
+ public static function &getValues(&$params, &$values) {
if (empty($params)) {
return NULL;
}
* @static
* @access public
*/
- static function makeURLClause($contactId, $status, $numRelationship, $count, $relationshipId, $direction, $params = array()) {
+ public static function makeURLClause($contactId, $status, $numRelationship, $count, $relationshipId, $direction, $params = array()) {
$select = $from = $where = '';
$select = '( ';
* @return array - array reference of all relationship types with context to current contact type .
*
*/
- function getRelationType($targetContactType) {
+ public function getRelationType($targetContactType) {
$relationshipType = array();
$allRelationshipType = CRM_Core_PseudoConstant::relationshipType();
*
* @static
*/
- static function relatedMemberships($contactId, &$params, $ids, $action = CRM_Core_Action::ADD, $active = TRUE) {
+ public static function relatedMemberships($contactId, &$params, $ids, $action = CRM_Core_Action::ADD, $active = TRUE) {
// Check the end date and set the status of the relationship
// accrodingly.
$status = self::CURRENT;
* @static
*
*/
- static function isDeleteRelatedMembership($relTypeIds, $contactId, $mainRelatedContactId, $relTypeId, $relIds) {
+ public static function isDeleteRelatedMembership($relTypeIds, $contactId, $mainRelatedContactId, $relTypeId, $relIds) {
if (in_array($relTypeId, $relTypeIds)) {
return TRUE;
}
*
* @return array $currentEmployer array of the current employer@static
*/
- static function getCurrentEmployer($contactIds) {
+ public static function getCurrentEmployer($contactIds) {
$contacts = implode(',', $contactIds);
$query = "
* @return array array of employers.
*
*/
- static function getPermissionedEmployer($contactID, $name = NULL) {
+ public static function getPermissionedEmployer($contactID, $name = NULL) {
//get the relationship id
$relTypeId = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType',
'Employee of', 'id', 'name_a_b'
*
* @return array of contacts
*/
- static function getPermissionedContacts($contactID, $relTypeId, $name = NULL) {
+ public static function getPermissionedContacts($contactID, $relTypeId, $name = NULL) {
$contacts = array();
if ($relTypeId) {
*
* @static
*/
- static function mergeRelationships($mainId, $otherId, &$sqls) {
+ public static function mergeRelationships($mainId, $otherId, &$sqls) {
// Delete circular relationships
$sqls[] = "DELETE FROM civicrm_relationship
WHERE (contact_id_a = $mainId AND contact_id_b = $otherId)
*
* @return True on success, false if error is encountered.
*/
- static function disableExpiredRelationships() {
+ public static function disableExpiredRelationships() {
$query = "SELECT id FROM civicrm_relationship WHERE is_active = 1 AND end_date < CURDATE()";
$dao = CRM_Core_DAO::executeQuery($query);
*
* @return array
*/
- static function membershipTypeToRelationshipTypes(&$params, $direction = NULL) {
+ public static function membershipTypeToRelationshipTypes(&$params, $direction = NULL) {
$membershipType = civicrm_api3('membership_type', 'getsingle', array('id' => $params['membership_type_id'], 'return' => 'relationship_type_id, relationship_direction'));
$relationshipTypes = $membershipType['relationship_type_id'];
if(empty($relationshipTypes)) {
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$relationshipType = new CRM_Contact_DAO_RelationshipType();
$relationshipType->copyValues($params);
if ($relationshipType->find(TRUE)) {
* @return Object DAO object on sucess, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Contact_DAO_RelationshipType', $id, 'is_active', $is_active);
}
* @static
*
*/
- static function add(&$params, &$ids) {
+ public static function add(&$params, &$ids) {
//to change name, CRM-3336
if (empty($params['label_a_b']) && !empty($params['name_a_b'])) {
$params['label_a_b'] = $params['name_a_b'];
* @return mixed
* @static
*/
- static function del($relationshipTypeId) {
+ public static function del($relationshipTypeId) {
// make sure relationshipTypeId is an integer
// @todo review this as most delete functions rely on the api & form layer for this
// or do a find first & throw error if no find
*
* @return \CRM_Contact_BAO_SavedSearch CRM_Contact_BAO_SavedSearch
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
*
* @access public
*/
- function getAll() {
+ public function getAll() {
$savedSearch = new CRM_Contact_DAO_SavedSearch();
$savedSearch->selectAdd();
$savedSearch->selectAdd('id, name');
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$savedSearch = new CRM_Contact_DAO_SavedSearch();
$savedSearch->copyValues($params);
if ($savedSearch->find(TRUE)) {
* @access public
* @static
*/
- static function &getFormValues($id) {
+ public static function &getFormValues($id) {
$fv = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $id, 'form_values');
$result = NULL;
if ($fv) {
*
* @return array
*/
- static function getSearchParams($id) {
+ public static function getSearchParams($id) {
$fv = self::getFormValues($id);
//check if the saved search has mapping id
if (CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $id, 'mapping_id')) {
* @access public
* @static
*/
- static function whereClause($id, &$tables, &$whereTables) {
+ public static function whereClause($id, &$tables, &$whereTables) {
$params = self::getSearchParams($id);
if ($params) {
if (!empty($params['customSearchID'])) {
*
* @return string
*/
- static function contactIDsSQL($id) {
+ public static function contactIDsSQL($id) {
$params = self::getSearchParams($id);
if ($params && !empty($params['customSearchID'])) {
return CRM_Contact_BAO_SearchCustom::contactIDSQL(NULL, $id);
*
* @return array
*/
- static function fromWhereEmail($id) {
+ public static function fromWhereEmail($id) {
$params = self::getSearchParams($id);
if ($params) {
* Given a saved search compute the clause and the tables
* and store it for future use
*/
- function buildClause() {
+ public function buildClause() {
$fv = unserialize($this->form_values);
if ($this->mapping_id) {
return;
}
- function save() {
+ public function save() {
// first build the computed fields
$this->buildClause();
* @access public
* @static
*/
- static function getName($id, $value = 'name') {
+ public static function getName($id, $value = 'name') {
$group = new CRM_Contact_DAO_Group();
$group->saved_search_id = $id;
if ($group->find(TRUE)) {
* Given a label and a set of normalized POST
* formValues, create a smart group with that
*/
- static function create(&$params) {
+ public static function create(&$params) {
$savedSearch = new CRM_Contact_DAO_SavedSearch();
if (isset($params['formValues']) &&
!empty($params['formValues'])
* @return array
* @throws Exception
*/
- static function details($csID, $ssID = NULL, $gID = NULL) {
+ public static function details($csID, $ssID = NULL, $gID = NULL) {
$error = array(NULL, NULL, NULL);
if (!$csID &&
* @return mixed
* @throws Exception
*/
- static function customClass($csID, $ssID) {
+ public static function customClass($csID, $ssID) {
list($customSearchID, $customSearchClass, $formValues) = self::details($csID, $ssID);
if (!$customSearchID) {
*
* @return mixed
*/
- static function contactIDSQL($csID, $ssID) {
+ public static function contactIDSQL($csID, $ssID) {
$customClass = self::customClass($csID, $ssID);
return $customClass->contactIDs();
}
*
* @return array
*/
- static function &buildFormValues($args) {
+ public static function &buildFormValues($args) {
$args = trim($args);
$values = explode("\n", $args);
*
* @return array
*/
- static function fromWhereEmail($csID, $ssID) {
+ public static function fromWhereEmail($csID, $ssID) {
$customClass = self::customClass($csID, $ssID);
$from = $customClass->from();
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
* Class constructor
*/
- function __construct($title = NULL, $modal = TRUE, $action = CRM_Core_Action::NONE) {
+ public function __construct($title = NULL, $modal = TRUE, $action = CRM_Core_Action::NONE) {
parent::__construct($title, $modal);
$this->_stateMachine = new CRM_Contact_StateMachine_Search($this, $action);
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
$this->_dedupeButtonName = $this->getButtonName('refresh', 'dedupe');
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = $this->_values;
$params = array();
* primary location, default country
*
*/
- function blockSetDefaults(&$defaults) {
+ public function blockSetDefaults(&$defaults) {
$locationTypeKeys = array_filter(array_keys(CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id')), 'is_int');
sort($locationTypeKeys);
* @access public
* @see valid_date
*/
- function addRules() {
+ public function addRules() {
// skip adding formRules when custom data is build
if ($this->_addBlockName || ($this->_action & CRM_Core_Action::DELETE)) {
return;
* @return bool $primaryID email/openId@static
* @access public
*/
- static function formRule($fields, &$errors, $contactId = NULL) {
+ public static function formRule($fields, &$errors, $contactId = NULL) {
$config = CRM_Core_Config::singleton();
// validations.
* @static
* @access public
*/
- static function blockDataExists(&$fields) {
+ public static function blockDataExists(&$fields) {
if (!is_array($fields)) {
return FALSE;
}
* @param string $contactType contact type
*
*/
- static function checkDuplicateContacts(&$fields, &$errors, $contactID, $contactType) {
+ public static function checkDuplicateContacts(&$fields, &$errors, $contactID, $contactType) {
// if this is a forced save, ignore find duplicate rule
if (empty($fields['_qf_Contact_upload_duplicate'])) {
* @return string
* @access public
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
if ($this->_contactSubType) {
$templateFile = "CRM/Contact/Form/Edit/SubType/{$this->_contactSubType}.tpl";
$template = CRM_Core_Form::getTemplate();
*
* @return array $parseSuccess as array of sucess/fails for each address block@static
*/
- function parseAddress(&$params) {
+ public function parseAddress(&$params) {
$parseSuccess = $parsedFields = array();
if (!is_array($params['address']) ||
CRM_Utils_System::isNull($params['address'])
*
* @return null|string $statusMsg string status message for all address blocks.@static
*/
- static function parseAddressStatusMsg($parseResult) {
+ public static function parseAddressStatusMsg($parseResult) {
$statusMsg = NULL;
if (!is_array($parseResult) || empty($parseResult)) {
return $statusMsg;
* @return ordinal number for given number.
* @static
*/
- static function ordinalNumber($number) {
+ public static function ordinalNumber($number) {
if (empty($number)) {
return NULL;
}
*
* @return null|string $updateMembershipMsg string status message for updated membership.
*/
- function updateMembershipStatus($deceasedParams) {
+ public function updateMembershipStatus($deceasedParams) {
$updateMembershipMsg = NULL;
$contactId = CRM_Utils_Array::value('contact_id', $deceasedParams);
$deceasedDate = CRM_Utils_Array::value('deceased_date', $deceasedParams);
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
$this->_cdType = CRM_Utils_Array::value('type', $_GET);
$this->assign('cdType', FALSE);
$this->_multiRecordDisplay = CRM_Utils_Request::retrieve('multiRecordDisplay', 'String', $this);
*
* @return array the default array reference
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if ($this->_cdType || $this->_multiRecordDisplay == 'single') {
if ($this->_copyValueId) {
// cached tree is fetched
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->rgid = CRM_Utils_Request::retrieve('rgid', 'Positive', $this, FALSE, 0);
}
);
}
- function setDefaultValues() {
+ public function setDefaultValues() {
return $this->_defaults;
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
// Ensure user has permission to be here
if (!CRM_Core_Permission::check('administer dedupe rules')) {
CRM_Utils_System::permissionDenied();
* @static
* @access public
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
if (!empty($fields['is_reserved'])) {
return TRUE;
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
return $this->_defaults;
}
*/
const LOCATION_BLOCKS = 1;
- function preProcess() {
+ public function preProcess() {
CRM_Utils_System::setTitle(ts('Organization Address and Contact Info'));
$breadCrumbPath = CRM_Utils_System::url('civicrm/admin', 'reset=1');
CRM_Utils_System::appendBreadCrumb(ts('Administer CiviCRM'), $breadCrumbPath);
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$params = array();
*
* @return void
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Contact_Form_Domain', 'formRule'));
}
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
// check for state/country mapping
$errors = CRM_Contact_Form_Edit_Address::formRule($fields, CRM_Core_DAO::$_nullArray, CRM_Core_DAO::$_nullObject);
// $errors === TRUE means no errors from above formRule excution,
* @access public
* @static
*/
- static function buildQuickForm(&$form, $addressBlockCount = NULL, $sharing = TRUE, $inlineEdit = FALSE) {
+ public static function buildQuickForm(&$form, $addressBlockCount = NULL, $sharing = TRUE, $inlineEdit = FALSE) {
// passing this via the session is AWFUL. we need to fix this
if (!$addressBlockCount) {
$blockId = ($form->get('Address_Block_Count')) ? $form->get('Address_Block_Count') : 1;
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
$customDataRequiredFields = array();
* @static
* @access public
*/
- static function setDefaultValues( &$defaults, &$form ) {
+ public static function setDefaultValues( &$defaults, &$form ) {
$addressValues = array();
if (isset($defaults['address']) && is_array($defaults['address']) &&
!CRM_Utils_System::isNull($defaults['address'])
* @param CRM_Core_Form $form
* @param $groupTree
*/
- static function storeRequiredCustomDataInfo(&$form, $groupTree) {
+ public static function storeRequiredCustomDataInfo(&$form, $groupTree) {
if (CRM_Utils_System::getClassName($form) == 'CRM_Contact_Form_Contact') {
$requireOmission = NULL;
foreach ($groupTree as $csId => $csVal) {
* @access public
* @static
*/
- static function buildQuickForm(&$form) {
+ public static function buildQuickForm(&$form) {
// since the pcm - preferred comminication method is logically
// grouped hence we'll use groups of HTML_QuickForm
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
//CRM-4575
$greetings = self::getGreetingFields($self->_contactType);
*
* @return void
*/
- static function setDefaultValues(&$form, &$defaults) {
+ public static function setDefaultValues(&$form, &$defaults) {
if (!empty($defaults['preferred_language'])) {
$languages = CRM_Contact_BAO_Contact::buildOptions('preferred_language');
* @return void
* @access public
*/
- static function getGreetingFields($contactType) {
+ public static function getGreetingFields($contactType) {
if (empty(self::$greetings[$contactType])) {
self::$greetings[$contactType] = array();
* @return void
* @access public
*/
- static function preProcess(&$form) {
+ public static function preProcess(&$form) {
$form->_type = CRM_Utils_Request::retrieve('type', 'String', CRM_Core_DAO::$_nullObject);
$form->_subType = CRM_Utils_Request::retrieve('subType', 'String', CRM_Core_DAO::$_nullObject);
* @access public
* @static
*/
- static function buildQuickForm(&$form) {
+ public static function buildQuickForm(&$form) {
if(!empty($form->_submitValues)) {
if ($customValueCount = CRM_Utils_Array::value('hidden_custom_group_count', $form->_submitValues)) {
if (is_array($customValueCount)) {
*
* @return void
*/
- static function setDefaultValues(&$form, &$defaults) {
+ public static function setDefaultValues(&$form, &$defaults) {
$defaults += CRM_Custom_Form_CustomData::setDefaultValues($form);
}
}
* @access public
* @static
*/
- static function buildQuickForm(&$form) {
+ public static function buildQuickForm(&$form) {
// radio button for gender
$genderOptions = array();
$gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id', array('localize' => TRUE));
*
* @return void
*/
- static function setDefaultValues(&$form, &$defaults) {}
+ public static function setDefaultValues(&$form, &$defaults) {}
}
* @access public
* @static
*/
- static function buildQuickForm(&$form, $blockCount = NULL, $blockEdit = FALSE) {
+ public static function buildQuickForm(&$form, $blockCount = NULL, $blockEdit = FALSE) {
// passing this via the session is AWFUL. we need to fix this
if (!$blockCount) {
$blockId = ($form->get('Email_Block_Count')) ? $form->get('Email_Block_Count') : 1;
* @return array|bool $error@static
* @public
*/
- static function formRule($fields, $files, $contactID = NULL) {
+ public static function formRule($fields, $files, $contactID = NULL) {
$errors = array();
$primaryID = CRM_Contact_Form_Contact::formRule($fields, $errors, $contactID);
* @access public
* @static
*/
- static function buildQuickForm(&$form, $blockCount = NULL, $blockEdit = FALSE) {
+ public static function buildQuickForm(&$form, $blockCount = NULL, $blockEdit = FALSE) {
if (!$blockCount) {
$blockId = ($form->get('IM_Block_Count')) ? $form->get('IM_Block_Count') : 1;
}
* @access public
* @static
*/
- static function formRule($fields, $files, $contactID = NULL) {
+ public static function formRule($fields, $files, $contactID = NULL) {
$errors = array();
$primaryID = CRM_Contact_Form_Contact::formRule($fields, $errors, $contactID);
* @access public
* @static
*/
- static function formRule($fields, $files, $contactID = NULL) {
+ public static function formRule($fields, $files, $contactID = NULL) {
$errors = array();
$timestamps = CRM_Contact_BAO_Contact::getTimestamps($contactID);
* @static
* @access public
*/
- static function buildQuickForm(&$form) {
+ public static function buildQuickForm(&$form) {
$form->applyFilter('__ALL__', 'trim');
$form->add('text', 'subject', ts('Subject'), array('size' => 60, 'maxlength' => 254));
$form->add('textarea', 'note', ts('Notes'), array('cols' => '60', 'rows' => '3'));
* @access public
* @static
*/
- static function buildQuickForm(&$form, $blockCount = NULL, $blockEdit = FALSE) {
+ public static function buildQuickForm(&$form, $blockCount = NULL, $blockEdit = FALSE) {
if (!$blockCount) {
$blockId = ($form->get('OpenID_Block_Count')) ? $form->get('OpenID_Block_Count') : 1;
}
*
* @return array|bool
*/
- static function formRule($fields, $files, $contactID = NULL) {
+ public static function formRule($fields, $files, $contactID = NULL) {
$errors = array();
$primaryID = CRM_Contact_Form_Contact::formRule($fields, $errors, $contactID);
* @access public
* @static
*/
- static function buildQuickForm(&$form, $addressBlockCount = NULL, $blockEdit = FALSE) {
+ public static function buildQuickForm(&$form, $addressBlockCount = NULL, $blockEdit = FALSE) {
// passing this via the session is AWFUL. we need to fix this
if (!$addressBlockCount) {
$blockId = ($form->get('Phone_Block_Count')) ? $form->get('Phone_Block_Count') : 1;
$form->assign('tagGroup', $form->_tagGroup);
}
- static function climbtree($form, $tree, &$elements) {
+ public static function climbtree($form, $tree, &$elements) {
foreach ($tree as $tagID => $varValue) {
$tagAttribute = array(
'onclick' => "return changeRowColor(\"rowidtag_$tagID\")",
* @access public
* @static
*/
- static function setDefaults($id, &$defaults, $type = self::ALL, $fieldName = NULL, $groupElementType = 'checkbox') {
+ public static function setDefaults($id, &$defaults, $type = self::ALL, $fieldName = NULL, $groupElementType = 'checkbox') {
$type = (int ) $type;
if ($type & self::GROUP) {
$fName = 'group';
* @access public
* @static
*/
- static function buildQuickForm(&$form, $blockCount = NULL) {
+ public static function buildQuickForm(&$form, $blockCount = NULL) {
if (!$blockCount) {
$blockId = ($form->get('Website_Block_Count')) ? $form->get('Website_Block_Count') : 1;
}
*/
protected $_contactId;
- function preProcess() {
+ public function preProcess() {
$this->_contactId = $this->get('contactId');
$this->_groupContactId = $this->get('groupContactId');
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
* of address block, we need to generate unique form name for each,
* hence calling parent contructor
*/
- function __construct() {
+ public function __construct() {
$locBlockNo = CRM_Utils_Request::retrieve('locno', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
$name = "Address_{$locBlockNo}";
* @return array $errors@static
* @access public
*/
- static function formRule($fields, $errors) {
+ public static function formRule($fields, $errors) {
$hasData = $hasPrimary = $errors = array();
if (!empty($fields['email']) && is_array($fields['email'])) {
foreach ($fields['email'] as $instance => $blockValues) {
* @return array $errors@static
* @access public
*/
- static function formRule($fields, $errors) {
+ public static function formRule($fields, $errors) {
$hasData = $hasPrimary = $errors = array();
if (!empty($fields['im']) && is_array($fields['im'])) {
foreach ($fields['im'] as $instance => $blockValues) {
* @access public
* @return void
*/
- static function buildQuickForm(&$form, $contactID) {
+ public static function buildQuickForm(&$form, $contactID) {
// We provide a value for oplock_ts to client, but JS uses it carefully
// -- i.e. when loading the first inline form, JS copies oplock_ts to a
// global value, and that global value is used for future form submissions.
* @access public
* @static
*/
- static function formRule($fields, $files, $contactID = NULL) {
+ public static function formRule($fields, $files, $contactID = NULL) {
$errors = array();
$timestamps = CRM_Contact_BAO_Contact::getTimestamps($contactID);
*
* @return array extra options to return in JSON
*/
- static function getResponse($contactID) {
+ public static function getResponse($contactID) {
$timestamps = CRM_Contact_BAO_Contact::getTimestamps($contactID);
return array('oplock_ts' => $timestamps['modified_date']);
}
* @return array $errors@static
* @access public
*/
- static function formRule($fields, $errors) {
+ public static function formRule($fields, $errors) {
$hasData = $hasPrimary = $errors = array();
if (!empty($fields['openid']) && is_array($fields['openid'])) {
foreach ($fields['openid'] as $instance => $blockValues) {
* @return array $errors@static
* @access public
*/
- static function formRule($fields, $errors) {
+ public static function formRule($fields, $errors) {
$hasData = $hasPrimary = $errors = array();
if (!empty($fields['phone']) && is_array($fields['phone'])) {
$primaryID = null;
*
* @return void
*/
- static function preProcess(&$form) {
+ public static function preProcess(&$form) {
$form->_addBlockName = CRM_Utils_Request::retrieve('block', 'String', CRM_Core_DAO::$_nullObject);
$additionalblockCount = CRM_Utils_Request::retrieve('count', 'Positive', CRM_Core_DAO::$_nullObject);
* @return void
* @access public
*/
- static function buildQuickForm(&$form) {
+ public static function buildQuickForm(&$form) {
// required for subsequent AJAX requests.
$ajaxRequestBlocks = array();
$generateAjaxRequest = 0;
// to side-step this, we use the below UUID as a (re)placeholder
var $_qfZeroBug = 'e8cddb72-a257-11dc-b9cc-0016d3330ee9';
- function preProcess() {
+ public function preProcess() {
if (!CRM_Core_Permission::check('merge duplicate contacts')) {
CRM_Core_Error::fatal(ts('You do not have access to this page'));
}
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
return array('deleteOther' => 1);
}
- function addRules() {}
+ public function addRules() {}
public function buildQuickForm() {
CRM_Utils_System::setTitle(ts('Merge %1s', array(1 => $this->_contactType)));
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
$link = CRM_Utils_System::href(ts('Flip between the original and duplicate contacts.'),
'civicrm/contact/merge',
* @return void
* @access public
*/
- static function preProcess(&$form) {
+ public static function preProcess(&$form) {
$session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
*
* @static
*/
- static function buildQuickForm(&$form) {
+ public static function buildQuickForm(&$form) {
$ufGroup = new CRM_Core_DAO_UFGroup();
$ufGroup->id = $form->_honoreeProfileId;
if (!$ufGroup->find(TRUE)) {
/**
* @param $form
*/
- static function postProcess($form) {
+ public static function postProcess($form) {
$params = $form->_params;
if (!empty($form->_honor_block_is_active) && !empty($params['soft_credit_type_id'])) {
$honorId = null;
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
// reset action from the session
$this->_action = CRM_Utils_Request::retrieve('action', 'String',
$this, FALSE, 'update'
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
return $this->_defaults;
}
*/
public $_cdType;
- function preProcess() {
+ public function preProcess() {
//custom data related code
$this->_cdType = CRM_Utils_Array::value('type', $_GET);
$this->assign('cdType', FALSE);
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::setDefaultValues($this);
}
* @return void
* @access public
*/
- function addRules() {
+ public function addRules() {
if ($this->_cdType) {
return;
}
* @access public
* @static
*/
- static function dateRule($params) {
+ public static function dateRule($params) {
$errors = array();
// check start and end date
* @access protected
* @static
*/
- static function &validContext() {
+ public static function &validContext() {
if (!(self::$_validContext)) {
self::$_validContext = array(
'smog' => 'Show members of group',
*
* @return bool
*/
- static function isSearchContext($context) {
+ public static function isSearchContext($context) {
$searchContext = CRM_Utils_Array::value($context, self::validContext());
return $searchContext ? TRUE : FALSE;
}
- static function setModeValues() {
+ public static function setModeValues() {
if (!self::$_modeValues) {
self::$_modeValues = array(
1 => array(
*
* @return mixed
*/
- static function getModeValue($mode = 1) {
+ public static function getModeValue($mode = 1) {
self::setModeValues();
if (!array_key_exists($mode, self::$_modeValues)) {
/**
* @return array
*/
- static function getModeSelect() {
+ public static function getModeSelect() {
self::setModeValues();
$select = array();
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
parent::buildQuickForm();
CRM_Core_Resources::singleton()
// jsTree is needed for tags popup
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
// set the various class variables
$this->_group = CRM_Core_PseudoConstant::group();
/**
* @return array
*/
- function &getFormValues() {
+ public function &getFormValues() {
return $this->_formValues;
}
* @return void
* @access public
*/
- function postProcess() {
+ public function postProcess() {
/*
* sometime we do a postProcess early on, so we dont need to repeat it
* this will most likely introduce some more bugs :(
/**
* @return null
*/
- function &returnProperties() {
+ public function &returnProperties() {
return CRM_Core_DAO::$_nullObject;
}
* @return string
* @access public
*/
- function getTitle() {
+ public function getTitle() {
return ts('Search');
}
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->set('searchFormName', 'Advanced');
parent::preProcess();
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->set('context', 'advanced');
$this->_searchPane = CRM_Utils_Array::value('searchPane', $_GET);
/**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
if (!$this->_searchPane) {
return parent::getTemplateFileName();
}
*
* @return array the default array reference
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = $this->_formValues;
$this->normalizeDefaultValues($defaults);
* @return void
* @access public
*/
- function postProcess() {
+ public function postProcess() {
$this->set('isAdvanced', '1');
// get user submitted values
* @return void
* @access private
*/
- function normalizeFormValues() {
+ public function normalizeFormValues() {
$contactType = CRM_Utils_Array::value('contact_type', $this->_formValues);
if ($contactType && is_array($contactType)) {
* @return array
* @access private
*/
- function normalizeDefaultValues(&$defaults) {
+ public function normalizeDefaultValues(&$defaults) {
if (!is_array($defaults)) {
$defaults = array();
}
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
// text for sort_name or email criteria
$config = CRM_Core_Config::singleton();
$label = empty($config->includeEmailInName) ? ts('Name') : ts('Name or Email');
*
* @return array the default array reference
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$defaults['sort_name'] = CRM_Utils_Array::value('sort_name', $this->_formValues);
*
* @return void
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Contact_Form_Search_Basic', 'formRule'));
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->set('searchFormName', 'Basic');
parent::preProcess();
/**
* @return array
*/
- function &getFormValues() {
+ public function &getFormValues() {
return $this->_formValues;
}
* @return void
* @access public
*/
- function postProcess() {
+ public function postProcess() {
$this->set('isAdvanced', '0');
$this->set('isSearchBuilder', '0');
* @return void
* @access private
*/
- function normalizeFormValues() {
+ public function normalizeFormValues() {
$contactType = CRM_Utils_Array::value('contact_type', $this->_formValues);
if ($contactType && !is_array($contactType)) {
unset($this->_formValues['contact_type']);
* Add a form rule for this form. If Go is pressed then we must select some checkboxes
* and an action
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
// check actionName and if next, then do not repeat a search, since we are going to the next page
if (array_key_exists('_qf_Search_next', $fields)) {
if (empty($fields['task'])) {
/**
* @return string
*/
- function getTitle() {
+ public function getTitle() {
return ts('Find Contacts');
}
}
*
* @return void
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Contact_Form_Search_Builder', 'formRule'), $this);
}
* @static
* @access public
*/
- static function formRule($values, $files, $self) {
+ public static function formRule($values, $files, $self) {
if (!empty($values['addMore']) || !empty($values['addBlock'])) {
return TRUE;
}
/**
* @return array
*/
- static function fields() {
+ public static function fields() {
$fields = array_merge(
CRM_Contact_BAO_Contact::exportableFields('All', FALSE, TRUE),
CRM_Core_Component::getQueryFields(),
* @return array: (string => string) key: field_name value: api entity name
* Note: options are fetched via ajax using the api "getoptions" method
*/
- static function fieldOptions() {
+ public static function fieldOptions() {
// Hack to add options not retrieved by getfields
// This list could go on and on, but it would be better to fix getfields
$options = array(
* if using IS NULL/NOT NULL, an array with no array key is created
* convert that to simple null so processing can proceed
*/
- static function checkArrayKeyEmpty($val) {
+ public static function checkArrayKeyEmpty($val) {
if (is_array($val)) {
$v2empty = true;
foreach ($val as $vk => $vv) {
/**
* @param CRM_Core_Form $form
*/
- static function basic(&$form) {
+ public static function basic(&$form) {
$form->addElement('hidden', 'hidden_basic', 1);
if ($form->_searchOptions['contactType']) {
/**
* @param CRM_Core_Form $form
*/
- static function location(&$form) {
+ public static function location(&$form) {
$config = CRM_Core_Config::singleton();
// Build location criteria based on _submitValues if
// available; otherwise, use $form->_formValues.
/**
* @param CRM_Core_Form $form
*/
- static function activity(&$form) {
+ public static function activity(&$form) {
$form->add('hidden', 'hidden_activity', 1);
CRM_Activity_BAO_Query::buildSearchForm($form);
}
/**
* @param CRM_Core_Form $form
*/
- static function changeLog(&$form) {
+ public static function changeLog(&$form) {
$form->add('hidden', 'hidden_changeLog', 1);
// block for change log
/**
* @param CRM_Core_Form $form
*/
- static function task(&$form) {
+ public static function task(&$form) {
$form->add('hidden', 'hidden_task', 1);
}
/**
* @param $form
*/
- static function relationship(&$form) {
+ public static function relationship(&$form) {
$form->add('hidden', 'hidden_relationship', 1);
$allRelationshipType = array();
/**
* @param $form
*/
- static function demographics(&$form) {
+ public static function demographics(&$form) {
$form->add('hidden', 'hidden_demographics', 1);
// radio button for gender
$genderOptions = array();
/**
* @param $form
*/
- static function notes(&$form) {
+ public static function notes(&$form) {
$form->add('hidden', 'hidden_notes', 1);
$options = array(
*
* @return void
*/
- static function custom(&$form) {
+ public static function custom(&$form) {
$form->add('hidden', 'hidden_custom', 1);
$extends = array_merge(array('Contact', 'Individual', 'Household', 'Organization'),
CRM_Contact_BAO_ContactType::subTypes()
/**
* @param $form
*/
- static function CiviCase(&$form) {
+ public static function CiviCase(&$form) {
//Looks like obsolete code, since CiviCase is a component, but might be used by HRD
$form->add('hidden', 'hidden_CiviCase', 1);
CRM_Case_BAO_Query::buildSearchForm($form);
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if (method_exists($this->_customSearchClass, 'setDefaultValues')) {
return $this->_customClass->setDefaultValues();
}
return $this->_formValues;
}
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->_customClass->buildForm($this);
parent::buildQuickForm();
/**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
$ext = CRM_Extension_System::singleton()->getMapper();
return $fileName ? $fileName : parent::getTemplateFileName();
}
- function postProcess() {
+ public function postProcess() {
$this->set('isAdvanced', '3');
$this->set('isCustom', '1');
*
* @return bool
*/
- function isPermissioned($components) {
+ public function isPermissioned($components) {
if (empty($components)) {
return TRUE;
}
/**
* @param $formValues
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
$this->_formValues = $formValues;
/**
/**
* @param CRM_Core_Form $form
*/
- function buildForm(&$form) {
+ public function buildForm(&$form) {
/**
* You can define a custom title for the search form
/**
* Define the smarty template used to layout the search form and results listings.
*/
- function templateFile() {
+ public function templateFile() {
return 'CRM/Contact/Form/Search/Custom/ActivitySearch.tpl';
}
/**
* @param $row
*/
- function alterRow(&$row) {
+ public function alterRow(&$row) {
$row['activity_date'] = CRM_Utils_Date::customFormat($row['activity_date'], '%B %E%f, %Y %l:%M %P');
}
/**
* @return string
*/
- function from() {
+ public function from() {
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
*
* @return string
*/
- function where($includeContactIDs = FALSE) {
+ public function where($includeContactIDs = FALSE) {
$clauses = array();
// add contact name search; search on primary name, source contact, assignee
* Functions below generally don't need to be modified
* @return integer
*/
- function count() {
+ public function count() {
$sql = $this->all();
$dao = CRM_Core_DAO::executeQuery($sql,
*
* @return string
*/
- function contactIDs($offset = 0, $rowcount = 0, $sort = NULL) {
+ public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL) {
return $this->all($offset, $rowcount, $sort, FALSE, TRUE);
}
/**
* @return array
*/
- function &columns() {
+ public function &columns() {
return $this->_columns;
}
/**
* @param $title
*/
- function setTitle($title) {
+ public function setTitle($title) {
if ($title) {
CRM_Utils_System::setTitle($title);
}
/**
* @return null
*/
- function summary() {
+ public function summary() {
return NULL;
}
}
/**
* @param $formValues
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
$this->_formValues = &$formValues;
}
/**
* @return null|string
*/
- function count() {
+ public function count() {
return CRM_Core_DAO::singleValueQuery($this->sql('count(distinct contact_a.id) as total'));
}
/**
* @return null
*/
- function summary() {
+ public function summary() {
return NULL;
}
*
* @return string
*/
- function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE) {
+ public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE) {
$sql = $this->sql(
'contact_a.id as contact_id',
$offset,
/**
* @return null
*/
- function templateFile() {
+ public function templateFile() {
return NULL;
}
- function &columns() {
+ public function &columns() {
return $this->_columns;
}
* @param $sql
* @param $formValues
*/
- static function includeContactIDs(&$sql, &$formValues) {
+ public static function includeContactIDs(&$sql, &$formValues) {
$contactIDs = array();
foreach ($formValues as $id => $value) {
if ($value &&
* @param $rowcount
* @param $sort
*/
- function addSortOffset(&$sql, $offset, $rowcount, $sort) {
+ public function addSortOffset(&$sql, $offset, $rowcount, $sort) {
if (!empty($sort)) {
if (is_string($sort)) {
$sort = CRM_Utils_Type::escape($sort, 'String');
*
* @throws Exception
*/
- function validateUserSQL(&$sql, $onlyWhere = FALSE) {
+ public function validateUserSQL(&$sql, $onlyWhere = FALSE) {
$includeStrings = array('contact_a');
$excludeStrings = array('insert', 'delete', 'update');
*
* @return string
*/
- function whereClause(&$where, &$params) {
+ public function whereClause(&$where, &$params) {
return CRM_Core_DAO::composeQuery($where, $params, TRUE);
}
/**
* @return null
*/
- function getQueryObj() {
+ public function getQueryObj() {
return NULL;
}
}
/**
* @param $formValues
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
parent::__construct($formValues);
$this->normalize();
* @return void
* @access private
*/
- function normalize() {
+ public function normalize() {
$contactType = CRM_Utils_Array::value('contact_type', $this->_formValues);
if ($contactType && !is_array($contactType)) {
unset($this->_formValues['contact_type']);
/**
* @param CRM_Core_Form $form
*/
- function buildForm(&$form) {
+ public function buildForm(&$form) {
//@todo FIXME - using the CRM_Core_DAO::VALUE_SEPARATOR creates invalid html - if you can find the form
// this is loaded onto then replace with something like '__' & test
$separator = CRM_Core_DAO::VALUE_SEPARATOR;
/**
* @return CRM_Contact_DAO_Contact
*/
- function count() {
+ public function count() {
return $this->_query->searchQuery(0, 0, NULL, TRUE);
}
/**
* @return string
*/
- function from() {
+ public function from() {
return $this->_query->_fromClause;
}
*
* @return string|void
*/
- function where($includeContactIDs = FALSE) {
+ public function where($includeContactIDs = FALSE) {
if ($whereClause = $this->_query->whereClause()) {
return $whereClause;
}
/**
* @return string
*/
- function templateFile() {
+ public function templateFile() {
return 'CRM/Contact/Form/Search/Basic.tpl';
}
/**
* @return CRM_Contact_BAO_Query
*/
- function getQueryObj() {
+ public function getQueryObj() {
return $this->_query;
}
}
/**
* @param $formValues
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
$this->_formValues = $formValues;
$this->_permissionedComponent = 'CiviContribute';
/**
* @param CRM_Core_Form $form
*/
- function buildForm(&$form) {
+ public function buildForm(&$form) {
foreach ($this->_amounts as $name => $title) {
$form->add('text',
/**
* @return mixed
*/
- function count() {
+ public function count() {
$sql = $this->all();
$dao = CRM_Core_DAO::executeQuery($sql);
*
* @return string
*/
- function contactIDs($offset = 0, $rowcount = 0, $sort = NULL) {
+ public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL) {
return $this->all($offset, $rowcount, $sort, FALSE, TRUE);
}
/**
* @return string
*/
- function select() {
+ public function select() {
if (!empty($this->start_date_2) || !empty($this->end_date_2)) {
return "
sum(contrib_1.total_amount) + sum(contrib_2.total_amount) AS donation_amount,
/**
* @return null|string
*/
- function from() {
+ public function from() {
$from = NULL;
if (!empty($this->start_date_2) || !empty($this->end_date_2)) {
$from .= " LEFT JOIN civicrm_contribution contrib_2 ON contrib_2.contact_id = contact_a.id ";
*
* @return string
*/
- function where($includeContactIDs = FALSE) {
+ public function where($includeContactIDs = FALSE) {
$clauses = array();
if (!empty($this->start_date_1)) {
*
* @return string
*/
- function having($includeContactIDs = FALSE) {
+ public function having($includeContactIDs = FALSE) {
$clauses = array();
$min = CRM_Utils_Array::value('min_amount', $this->_formValues);
if ($min) {
/**
* @return array
*/
- function &columns() {
+ public function &columns() {
return $this->_columns;
}
/**
* @return string
*/
- function templateFile() {
+ public function templateFile() {
return 'CRM/Contact/Form/Search/Custom/ContribSYBNT.tpl';
}
/**
* @return null
*/
- function summary() {
+ public function summary() {
return NULL;
}
/**
* @param $title
*/
- function setTitle($title) {
+ public function setTitle($title) {
if ($title) {
CRM_Utils_System::setTitle($title);
}
/**
* @param $formValues
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
$this->_formValues = $formValues;
/**
* Define the columns for search result rows
/**
* @param CRM_Core_Form $form
*/
- function buildForm(&$form) {
+ public function buildForm(&$form) {
/**
* You can define a custom title for the search form
/**
* Define the smarty template used to layout the search form and results listings.
*/
- function templateFile() {
+ public function templateFile() {
return 'CRM/Contact/Form/Search/Custom/ContributionAggregate.tpl';
}
/**
* @return string
*/
- function from() {
+ public function from() {
return "
civicrm_contribution AS contrib,
civicrm_contact AS contact_a
*
* @return string
*/
- function where($includeContactIDs = FALSE) {
+ public function where($includeContactIDs = FALSE) {
$clauses = array();
$clauses[] = "contrib.contact_id = contact_a.id";
*
* @return string
*/
- function having($includeContactIDs = FALSE) {
+ public function having($includeContactIDs = FALSE) {
$clauses = array();
$min = CRM_Utils_Array::value('min_amount', $this->_formValues);
if ($min) {
/*
* Functions below generally don't need to be modified
*/
- function count() {
+ public function count() {
$sql = $this->all();
$dao = CRM_Core_DAO::executeQuery($sql,
*
* @return string
*/
- function contactIDs($offset = 0, $rowcount = 0, $sort = NULL) {
+ public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL) {
return $this->all($offset, $rowcount, $sort, FALSE, TRUE);
}
/**
* @return array
*/
- function &columns() {
+ public function &columns() {
return $this->_columns;
}
/**
* @param $title
*/
- function setTitle($title) {
+ public function setTitle($title) {
if ($title) {
CRM_Utils_System::setTitle($title);
}
/**
* @return null
*/
- function summary() {
+ public function summary() {
return NULL;
}
}
/**
* @param $formValues
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
parent::__construct($formValues);
$this->_includeGroups = CRM_Utils_Array::value('includeGroups', $formValues, array());
/**
* @param CRM_Core_Form $form
*/
- function buildForm(&$form) {
+ public function buildForm(&$form) {
$form->addDate('start_date', ts('Start Date'), FALSE, array('formatType' => 'custom'));
$form->addDate('end_date', ts('End Date'), FALSE, array('formatType' => 'custom'));
/**
* @return null
*/
- function summary() {
+ public function summary() {
return NULL;
}
- function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE) {
+ public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE) {
return $this->all($offset, $rowcount, $sort, FALSE, TRUE);
}
/**
* @return string
*/
- function from() {
+ public function from() {
//define table name
$randomNum = md5(uniqid());
$this->_tableName = "civicrm_temp_custom_{$randomNum}";
*
* @return string
*/
- function where($includeContactIDs = FALSE) {
+ public function where($includeContactIDs = FALSE) {
return '(1)';
}
/**
* @return string
*/
- function templateFile() {
+ public function templateFile() {
return 'CRM/Contact/Form/Search/Custom.tpl';
}
/**
* @param $title
*/
- function setTitle($title) {
+ public function setTitle($title) {
if ($title) {
CRM_Utils_System::setTitle($title);
}
/**
* @return mixed
*/
- function count() {
+ public function count() {
$sql = $this->all();
$dao = CRM_Core_DAO::executeQuery($sql,
return $dao->N;
}
- function __destruct() {
+ public function __destruct() {
//drop the temp. tables if they exist
if (!empty($this->_includeGroups)) {
$sql = "DROP TEMPORARY TABLE IF EXISTS Ig_{$this->_tableName}";
/**
* @param $formValues
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
$this->_formValues = $formValues;
/**
/**
* @param CRM_Core_Form $form
*/
- function buildForm(&$form) {
+ public function buildForm(&$form) {
/**
* You can define a custom title for the search form
*
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
// Setting default search state to California
return array(
'state_province_id' => 1004,
/**
* Define the smarty template used to layout the search form and results listings.
*/
- function templateFile() {
+ public function templateFile() {
return 'CRM/Contact/Form/Search/Custom.tpl';
}
/**
* @return string
*/
- function from() {
+ public function from() {
return "
civicrm_relationship cR,
civicrm_contact cInd
*
* @return string
*/
- function where($includeContactIDs = FALSE) {
+ public function where($includeContactIDs = FALSE) {
$clauses = array();
// These are required filters for our query.
*
* @return string
*/
- function having($includeContactIDs = FALSE) {
+ public function having($includeContactIDs = FALSE) {
$clauses = array();
return implode(' AND ', $clauses);
}
/*
* Functions below generally don't need to be modified
*/
- function count() {
+ public function count() {
$sql = $this->all();
$dao = CRM_Core_DAO::executeQuery($sql,
*
* @return string
*/
- function contactIDs($offset = 0, $rowcount = 0, $sort = NULL) {
+ public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL) {
return $this->all($offset, $rowcount, $sort);
}
/**
* @return array
*/
- function &columns() {
+ public function &columns() {
return $this->_columns;
}
/**
* @param $title
*/
- function setTitle($title) {
+ public function setTitle($title) {
if ($title) {
CRM_Utils_System::setTitle($title);
}
/**
* @return null
*/
- function summary() {
+ public function summary() {
return NULL;
}
}
/**
* @param $formValues
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
$this->_formValues = $formValues;
$this->_permissionedComponent = array('CiviContribute', 'CiviEvent');
/**
* @param CRM_Core_Form $form
*/
- function buildForm(&$form) {
+ public function buildForm(&$form) {
/**
* You can define a custom title for the search form
/**
* Define the smarty template used to layout the search form and results listings.
*/
- function templateFile() {
+ public function templateFile() {
return 'CRM/Contact/Form/Search/Custom/EventDetails.tpl';
}
/**
* @return string
*/
- function from() {
+ public function from() {
return "
civicrm_participant_payment
left join civicrm_participant
*
* @return string
*/
- function where($includeContactIDs = FALSE) {
+ public function where($includeContactIDs = FALSE) {
$clauses = array();
$clauses[] = "civicrm_participant.status_id in ( 1 )";
/**
* @return array
*/
- function summary() {
+ public function summary() {
$totalSelect = "
SUM(civicrm_contribution.total_amount) as payment_amount,COUNT(civicrm_participant.id) as participant_count,
format(sum(if(civicrm_contribution.payment_instrument_id <>0,(civicrm_contribution.total_amount *.034) +.45,0)),2) as fee,
/*
* Functions below generally don't need to be modified
*/
- function count() {
+ public function count() {
$sql = $this->all();
$dao = CRM_Core_DAO::executeQuery($sql,
*
* @return string
*/
- function contactIDs($offset = 0, $rowcount = 0, $sort = NULL) {
+ public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL) {
return $this->all($offset, $rowcount, $sort);
}
/**
* @return array
*/
- function &columns() {
+ public function &columns() {
return $this->_columns;
}
/**
* @param $title
*/
- function setTitle($title) {
+ public function setTitle($title) {
if ($title) {
CRM_Utils_System::setTitle($title);
}
/**
* @param $formValues
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
$this->_partialQueries = array(
new CRM_Contact_Form_Search_Custom_FullText_Contact(),
new CRM_Contact_Form_Search_Custom_FullText_Activity(),
return $value;
}
- function __destruct() {
+ public function __destruct() {
}
- function initialize() {
+ public function initialize() {
static $initialized = FALSE;
if (!$initialized) {
}
}
- function buildTempTable() {
+ public function buildTempTable() {
$randomNum = md5(uniqid());
$this->_tableName = "civicrm_temp_custom_details_{$randomNum}";
CRM_Core_DAO::executeQuery($sql);
}
- function fillTable() {
+ public function fillTable() {
foreach ($this->_partialQueries as $partialQuery) {
/** @var $partialQuery CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery */
if (!$this->_table || $this->_table == $partialQuery->getName()) {
$this->filterACLContacts();
}
- function filterACLContacts() {
+ public function filterACLContacts() {
if (CRM_Core_Permission::check('view all contacts')) {
CRM_Core_DAO::executeQuery("DELETE FROM {$this->_tableName} WHERE contact_id IN (SELECT id FROM civicrm_contact WHERE is_deleted = 1)");
return;
/**
* @param CRM_Core_Form $form
*/
- function buildForm(&$form) {
+ public function buildForm(&$form) {
$config = CRM_Core_Config::singleton();
$form->applyFilter('__ALL__', 'trim');
/**
* @return array
*/
- function &columns() {
+ public function &columns() {
$this->_columns = array(
ts('Contact ID') => 'contact_id',
ts('Name') => 'sort_name',
/**
* @return array
*/
- function summary() {
+ public function summary() {
$this->initialize();
$summary = array();
/**
* @return null|string
*/
- function count() {
+ public function count() {
$this->initialize();
if ($this->_table) {
*
* @return null|string
*/
- function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE) {
+ public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE) {
$this->initialize();
if ($returnSQL) {
*
* @return string
*/
- function all($offset = 0, $rowcount = 0, $sort = NULL, $includeContactIDs = FALSE, $justIDs = FALSE) {
+ public function all($offset = 0, $rowcount = 0, $sort = NULL, $includeContactIDs = FALSE, $justIDs = FALSE) {
$this->initialize();
if ($justIDs) {
/**
* @return null
*/
- function from() {
+ public function from() {
return NULL;
}
*
* @return null
*/
- function where($includeContactIDs = FALSE) {
+ public function where($includeContactIDs = FALSE) {
return NULL;
}
/**
* @return string
*/
- function templateFile() {
+ public function templateFile() {
return 'CRM/Contact/Form/Search/Custom/FullText.tpl';
}
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
return array();
}
/**
* @param $row
*/
- function alterRow(&$row) {
+ public function alterRow(&$row) {
}
/**
* @param $title
*/
- function setTitle($title) {
+ public function setTitle($title) {
if ($title) {
CRM_Utils_System::setTitle($title);
}
* @param $tables
* @param $extends
*/
- function fillCustomInfo(&$tables, $extends) {
+ public function fillCustomInfo(&$tables, $extends) {
$sql = "
SELECT cg.table_name, cf.column_name
FROM civicrm_custom_group cg
* - count: int
* - files: NULL | array
*/
- function runQueries($queryText, &$tables, $entityIDTableName, $limit) {
+ public function runQueries($queryText, &$tables, $entityIDTableName, $limit) {
$sql = "TRUNCATE {$entityIDTableName}";
CRM_Core_DAO::executeQuery($sql);
*/
class CRM_Contact_Form_Search_Custom_FullText_Activity extends CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery {
- function __construct() {
+ public function __construct() {
parent::__construct('Activity', ts('Activities'));
}
- function isActive() {
+ public function isActive() {
return CRM_Core_Permission::check('view all activities');
}
* @param string $entityIDTableName
* @return array list tables/queries (for runQueries)
*/
- function prepareQueries($queryText, $entityIDTableName) {
+ public function prepareQueries($queryText, $entityIDTableName) {
// Note: For available full-text indices, see CRM_Core_InnoDBIndexer
$contactSQL = array();
*/
class CRM_Contact_Form_Search_Custom_FullText_Case extends CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery {
- function __construct() {
+ public function __construct() {
parent::__construct('Case', ts('Cases'));
}
- function isActive() {
+ public function isActive() {
$config = CRM_Core_Config::singleton();
return in_array('CiviCase', $config->enableComponents);
}
* @param string $entityIDTableName
* @return array list tables/queries (for runQueries)
*/
- function prepareQueries($queryText, $entityIDTableName) {
+ public function prepareQueries($queryText, $entityIDTableName) {
// Note: For available full-text indices, see CRM_Core_InnoDBIndexer
$contactSQL = array();
*/
class CRM_Contact_Form_Search_Custom_FullText_Contact extends CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery {
- function __construct() {
+ public function __construct() {
parent::__construct('Contact', ts('Contacts'));
}
- function isActive() {
+ public function isActive() {
return CRM_Core_Permission::check('view all contacts');
}
* @param string $entityIDTableName
* @return array list tables/queries (for runQueries)
*/
- function prepareQueries($queryText, $entityIDTableName) {
+ public function prepareQueries($queryText, $entityIDTableName) {
// Note: For available full-text indices, see CRM_Core_InnoDBIndexer
$contactSQL = array();
*/
class CRM_Contact_Form_Search_Custom_FullText_Contribution extends CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery {
- function __construct() {
+ public function __construct() {
parent::__construct('Contribution', ts('Contributions'));
}
- function isActive() {
+ public function isActive() {
$config = CRM_Core_Config::singleton();
return in_array('CiviContribute', $config->enableComponents) &&
CRM_Core_Permission::check('access CiviContribute');
* @param string $entityIDTableName
* @return array list tables/queries (for runQueries)
*/
- function prepareQueries($queryText, $entityIDTableName) {
+ public function prepareQueries($queryText, $entityIDTableName) {
// Note: For available full-text indices, see CRM_Core_InnoDBIndexer
$contactSQL = array();
*/
class CRM_Contact_Form_Search_Custom_FullText_Membership extends CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery {
- function __construct() {
+ public function __construct() {
parent::__construct('Membership', ts('Memberships'));
}
- function isActive() {
+ public function isActive() {
$config = CRM_Core_Config::singleton();
return in_array('CiviMember', $config->enableComponents) &&
CRM_Core_Permission::check('access CiviMember');
* @param string $entityIDTableName
* @return array list tables/queries (for runQueries)
*/
- function prepareQueries($queryText, $entityIDTableName) {
+ public function prepareQueries($queryText, $entityIDTableName) {
// Note: For available full-text indices, see CRM_Core_InnoDBIndexer
$contactSQL = array();
*/
class CRM_Contact_Form_Search_Custom_FullText_Participant extends CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery {
- function __construct() {
+ public function __construct() {
parent::__construct('Participant', ts('Participants'));
}
- function isActive() {
+ public function isActive() {
$config = CRM_Core_Config::singleton();
return in_array('CiviEvent', $config->enableComponents) &&
CRM_Core_Permission::check('view event participants');
* @param string $entityIDTableName
* @return array list tables/queries (for runQueries)
*/
- function prepareQueries($queryText, $entityIDTableName) {
+ public function prepareQueries($queryText, $entityIDTableName) {
// Note: For available full-text indices, see CRM_Core_InnoDBIndexer
$contactSQL = array();
/**
* @param $formValues
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
$this->_formValues = $formValues;
$this->_columns = array(
ts('Contact ID') => 'contact_id',
$this->_tags = (!empty($this->_includeTags) || !empty($this->_excludeTags));
}
- function __destruct() {
+ public function __destruct() {
// mysql drops the tables when connectiomn is terminated
// cannot drop tables here, since the search might be used
// in other parts after the object is destroyed
/**
* @param CRM_Core_Form $form
*/
- function buildForm(&$form) {
+ public function buildForm(&$form) {
$this->setTitle(ts('Include / Exclude Search'));
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array( 'andOr' => '1' );
if (!empty($this->_formValues)) {
* @return string
* @throws Exception
*/
- function from() {
+ public function from() {
$iGroups = $xGroups = $iTags = $xTags = 0;
*
* @return string
*/
- function where($includeContactIDs = FALSE) {
+ public function where($includeContactIDs = FALSE) {
if ($includeContactIDs) {
$contactIDs = array();
/**
* @return mixed
*/
- function count() {
+ public function count() {
$sql = $this->all();
$dao = CRM_Core_DAO::executeQuery($sql);
*
* @return string
*/
- function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE) {
+ public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE) {
return $this->all($offset, $rowcount, $sort, FALSE, TRUE);
}
/**
* @return array
*/
- function &columns() {
+ public function &columns() {
return $this->_columns;
}
/**
* @return null
*/
- function summary() {
+ public function summary() {
return NULL;
}
/**
* @return string
*/
- function templateFile() {
+ public function templateFile() {
return 'CRM/Contact/Form/Search/Custom.tpl';
}
/**
* @param $title
*/
- function setTitle($title) {
+ public function setTitle($title) {
if ($title) {
CRM_Utils_System::setTitle($title);
}
/**
* @param string $tableAlias
*/
- function buildACLClause($tableAlias = 'contact') {
+ public function buildACLClause($tableAlias = 'contact') {
list($this->_aclFrom, $this->_aclWhere) = CRM_Contact_BAO_Contact_Permission::cacheClause($tableAlias);
}
}
/**
* @param $formValues
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
parent::__construct($formValues);
$this->_groupTree = CRM_Core_BAO_CustomGroup::getTree("'Contact', 'Individual', 'Organization', 'Household'",
}
}
- function addColumns() {
+ public function addColumns() {
// add all the fields for chosen groups
$this->_tables = $this->_options = array();
foreach ($this->_groupTree as $groupID => $group) {
/**
* @param CRM_Core_Form $form
*/
- function buildForm(&$form) {
+ public function buildForm(&$form) {
/**
* You can define a custom title for the search form
/**
* @return null
*/
- function summary() {
+ public function summary() {
return NULL;
}
- function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE) {
+ public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE) {
return $this->all($offset, $rowcount, $sort, FALSE, TRUE);
}
*
* @return string
*/
- function all($offset = 0, $rowcount = 0, $sort = NULL, $includeContactIDs = FALSE, $justIDs = FALSE) {
+ public function all($offset = 0, $rowcount = 0, $sort = NULL, $includeContactIDs = FALSE, $justIDs = FALSE) {
//redirect if custom group not select in search criteria
if (empty($this->_formValues['custom_group'])) {
CRM_Core_Error::statusBounce(ts("You must select at least one Custom Group as a search criteria."),
/**
* @return string
*/
- function from() {
+ public function from() {
$from = "FROM civicrm_contact contact_a";
$customFrom = array();
// lets do an INNER JOIN so we get only relevant values rather than all values
*
* @return string
*/
- function where($includeContactIDs = FALSE) {
+ public function where($includeContactIDs = FALSE) {
$count = 1;
$clause = array();
$params = array();
/**
* @return string
*/
- function templateFile() {
+ public function templateFile() {
return 'CRM/Contact/Form/Search/Custom/MultipleValues.tpl';
}
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
return array();
}
/**
* @param $row
*/
- function alterRow(&$row) {
+ public function alterRow(&$row) {
foreach ($this->_options as $fieldID => $values) {
$customVal = $valueSeparatedArray = array();
if (in_array($values['attributes']['html_type'],
/**
* @param $title
*/
- function setTitle($title) {
+ public function setTitle($title) {
CRM_Utils_System::setTitle($title);
}
}
/**
* @param $formValues
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
parent::__construct($formValues);
$this->_columns = array(
/**
* @param CRM_Core_Form $form
*/
- function buildForm(&$form) {
+ public function buildForm(&$form) {
$groups = array('' => ts('- select group -')) + CRM_Core_PseudoConstant::nestedGroup(FALSE);
$form->addElement('select', 'group_id', ts('Group'), $groups, array('class' => 'crm-select2 huge'));
$form->assign('elements', array('group_id'));
}
- function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE) {
+ public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE) {
return $this->all($offset, $rowcount, $sort, FALSE, TRUE);
}
/**
* @return string
*/
- function from() {
+ public function from() {
return "
FROM civicrm_group_contact as cgc,
civicrm_contact as contact_a
*
* @return string
*/
- function where($includeContactIDs = FALSE) {
+ public function where($includeContactIDs = FALSE) {
$params = array();
$count = 1;
/**
* @return string
*/
- function templateFile() {
+ public function templateFile() {
return 'CRM/Contact/Form/Search/Custom.tpl';
}
}
/**
* @param $formValues
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
parent::__construct($formValues);
$this->_eventID = CRM_Utils_Array::value('event_id',
$this->_permissionedComponent = 'CiviEvent';
}
- function __destruct() {
+ public function __destruct() {
/*
if ( $this->_eventID ) {
$sql = "DROP TEMPORARY TABLE {$this->_tableName}";
*/
}
- function buildTempTable() {
+ public function buildTempTable() {
$randomNum = md5(uniqid());
$this->_tableName = "civicrm_temp_custom_{$randomNum}";
$sql = "
CRM_Core_DAO::executeQuery($sql);
}
- function fillTable() {
+ public function fillTable() {
$sql = "
REPLACE INTO {$this->_tableName}
( contact_id, participant_id )
*
* @return Object
*/
- function priceSetDAO($eventID = NULL) {
+ public function priceSetDAO($eventID = NULL) {
// get all the events that have a price set associated with it
$sql = "
*
* @throws Exception
*/
- function buildForm(&$form) {
+ public function buildForm(&$form) {
$dao = $this->priceSetDAO();
$event = array();
$form->assign('elements', array('event_id'));
}
- function setColumns() {
+ public function setColumns() {
$this->_columns = array(
ts('Contact ID') => 'contact_id',
ts('Participant ID') => 'participant_id',
/**
* @return null
*/
- function summary() {
+ public function summary() {
return NULL;
}
/**
* @return string
*/
- function from() {
+ public function from() {
return "
FROM civicrm_contact contact_a
INNER JOIN {$this->_tableName} tempTable ON ( tempTable.contact_id = contact_a.id )
*
* @return string
*/
- function where($includeContactIDs = FALSE) {
+ public function where($includeContactIDs = FALSE) {
return ' ( 1 ) ';
}
/**
* @return string
*/
- function templateFile() {
+ public function templateFile() {
return 'CRM/Contact/Form/Search/Custom.tpl';
}
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
return array();
}
/**
* @param $row
*/
- function alterRow(&$row) {}
+ public function alterRow(&$row) {}
/**
* @param $title
*/
- function setTitle($title) {
+ public function setTitle($title) {
if ($title) {
CRM_Utils_System::setTitle($title);
}
*
* @throws Exception
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
parent::__construct($formValues);
// unset search profile and other search params if set
/**
* @param CRM_Core_Form $form
*/
- function buildForm(&$form) {
+ public function buildForm(&$form) {
$config = CRM_Core_Config::singleton();
$countryDefault = $config->defaultContactCountry;
/**
* @return string
*/
- function from() {
+ public function from() {
$f = "
FROM civicrm_contact contact_a
LEFT JOIN civicrm_address address ON ( address.contact_id = contact_a.id AND
*
* @return string
*/
- function where($includeContactIDs = FALSE) {
+ public function where($includeContactIDs = FALSE) {
$params = array();
$clause = array();
/**
* @return string
*/
- function templateFile() {
+ public function templateFile() {
return 'CRM/Contact/Form/Search/Custom/Proximity.tpl';
}
/**
* @return array|null
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$config = CRM_Core_Config::singleton();
$countryDefault = $config->defaultContactCountry;
$stateprovinceDefault = $config->defaultContactStateProvince;
/**
* @param $row
*/
- function alterRow(&$row) {}
+ public function alterRow(&$row) {}
/**
* @param $title
*/
- function setTitle($title) {
+ public function setTitle($title) {
if ($title) {
CRM_Utils_System::setTitle($title);
}
/**
* @param $formValues
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
parent::__construct($formValues);
$this->_columns = array(
$this->initialize();
}
- function initialize() {
+ public function initialize() {
$this->_segmentSize = CRM_Utils_Array::value('segmentSize', $this->_formValues);
$this->_includeGroups = CRM_Utils_Array::value('includeGroups', $this->_formValues);
/**
* @param CRM_Core_Form $form
*/
- function buildForm(&$form) {
+ public function buildForm(&$form) {
$form->add('text',
'segmentSize',
ts('Segment Size'),
/**
* @return null
*/
- function summary() {
+ public function summary() {
return NULL;
}
/**
* @return string
*/
- function from() {
+ public function from() {
//define table name
$randomNum = md5(uniqid());
$this->_tableName = "civicrm_temp_custom_{$randomNum}";
*
* @return string
*/
- function where($includeContactIDs = FALSE) {
+ public function where($includeContactIDs = FALSE) {
return '(1)';
}
/**
* @return string
*/
- function templateFile() {
+ public function templateFile() {
return 'CRM/Contact/Form/Search/Custom.tpl';
}
/**
* @param $title
*/
- function setTitle($title) {
+ public function setTitle($title) {
if ($title) {
CRM_Utils_System::setTitle($title);
}
/**
* @return mixed
*/
- function count() {
+ public function count() {
$sql = $this->all();
$dao = CRM_Core_DAO::executeQuery($sql);
return $dao->N;
}
- function __destruct() {
+ public function __destruct() {
// the temporary tables are dropped automatically
// so we don't do it here
// but let mysql clean up
/**
* @param $formValues
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
parent::__construct($formValues);
if (!isset($formValues['state_province_id'])) {
/**
* @param CRM_Core_Form $form
*/
- function buildForm(&$form) {
+ public function buildForm(&$form) {
$form->add('text',
'household_name',
/**
* @return array
*/
- function summary() {
+ public function summary() {
$summary = array(
'summary' => 'This is a summary',
'total' => 50.0,
return $summary;
}
- function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE) {
+ public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE) {
return $this->all($offset, $rowcount, $sort, FALSE, TRUE);
}
/**
* @return string
*/
- 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
*/
- function where($includeContactIDs = FALSE) {
+ public function where($includeContactIDs = FALSE) {
$params = array();
$where = "contact_a.contact_type = 'Household'";
/**
* @return string
*/
- function templateFile() {
+ public function templateFile() {
return 'CRM/Contact/Form/Search/Custom.tpl';
}
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
return array(
'household_name' => '',
);
/**
* @param $row
*/
- function alterRow(&$row) {
+ public function alterRow(&$row) {
$row['sort_name'] .= ' ( altered )';
}
/**
* @param $title
*/
- function setTitle($title) {
+ public function setTitle($title) {
if ($title) {
CRM_Utils_System::setTitle($title);
}
/**
* @param $formValues
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
$this->_formValues = $formValues;
$this->_permissionedComponent = 'CiviContribute';
/**
* @param CRM_Core_Form $form
*/
- function buildForm(&$form) {
+ public function buildForm(&$form) {
/**
* You can define a custom title for the search form
/**
* Define the smarty template used to layout the search form and results listings.
*/
- function templateFile() {
+ public function templateFile() {
return 'CRM/Contact/Form/Search/Custom.tpl';
}
/**
* @return string
*/
- function from() {
+ public function from() {
return "
civicrm_contribution,
civicrm_contact contact_a
*
* @return string
*/
- function where($includeContactIDs = FALSE) {
+ public function where($includeContactIDs = FALSE) {
$clauses = array();
$clauses[] = "contact_a.contact_type = 'Individual'";
/**
* @return mixed
*/
- function count() {
+ public function count() {
$sql = $this->all();
$dao = CRM_Core_DAO::executeQuery($sql,
*
* @return string
*/
- function contactIDs($offset = 0, $rowcount = 0, $sort = NULL) {
+ public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL) {
return $this->all($offset, $rowcount, $sort, FALSE, TRUE);
}
/**
* @return array
*/
- function &columns() {
+ public function &columns() {
return $this->_columns;
}
/**
* @param $title
*/
- function setTitle($title) {
+ public function setTitle($title) {
if ($title) {
CRM_Utils_System::setTitle($title);
}
/**
* @return null
*/
- function summary() {
+ public function summary() {
return NULL;
}
}
/**
* @param $formValues
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
parent::__construct($formValues);
$this->_columns = array(
/**
* @param CRM_Core_Form $form
*/
- function buildForm(&$form) {
+ public function buildForm(&$form) {
$form->add('text',
'postal_code_low',
ts('Postal Code Start'),
/**
* @return array
*/
- function summary() {
+ public function summary() {
$summary = array();
return $summary;
}
- function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE) {
+ public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE) {
return $this->all($offset, $rowcount, $sort, FALSE, TRUE);
}
/**
* @return string
*/
- 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
*/
- function where($includeContactIDs = FALSE) {
+ public function where($includeContactIDs = FALSE) {
$params = array();
$low = CRM_Utils_Array::value('postal_code_low',
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
return array();
}
/**
* @return string
*/
- function templateFile() {
+ public function templateFile() {
return 'CRM/Contact/Form/Search/Custom.tpl';
}
/**
* @param $title
*/
- function setTitle($title) {
+ public function setTitle($title) {
if ($title) {
CRM_Utils_System::setTitle($title);
}
/**
* The constructor gets the submitted form values
*/
- function __construct(&$formValues);
+ public function __construct(&$formValues);
/**
* Builds the quickform for this search
*/
- function buildForm(&$form);
+ public function buildForm(&$form);
/**
* Builds the search query for various cases. We break it down into finer cases
* Count of records that match the current input parameters
* Used by pager
*/
- function count();
+ public function count();
/**
* Summary information for the query that can be displayed in the template
* This is useful to pass total / sub total information if needed
*/
- function summary();
+ public function summary();
/**
* List of contact ids that match the current input parameters
* Used by different tasks. Will be also used to optimize the
* 'all' query below to avoid excessive LEFT JOIN blowup
*/
- function contactIDs($offset = 0, $rowcount = 0, $sort = NULL);
+ public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL);
/**
* Retrieve all the values that match the current input parameters
* Used by the selector
*/
- function all($offset = 0, $rowcount = 0, $sort = NULL, $includeContactIDs = FALSE, $justIDs = FALSE);
+ public function all($offset = 0, $rowcount = 0, $sort = NULL, $includeContactIDs = FALSE, $justIDs = FALSE);
/**
* The below two functions (from and where) are ONLY used if you want to
/**
* The from clause for the query
*/
- function from();
+ public function from();
/**
* The where clause for the query
*/
- function where($includeContactIDs = FALSE);
+ public function where($includeContactIDs = FALSE);
/**
* The template FileName to use to display the results
*/
- function templateFile();
+ public function templateFile();
/**
* Returns an array of column headers and field names and sort options
*/
- function &columns();
+ public function &columns();
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
self::preProcessCommon($this);
}
* @param CRM_Core_Form $form
* @param bool $useTable
*/
- static function preProcessCommon(&$form, $useTable = FALSE) {
+ public static function preProcessCommon(&$form, $useTable = FALSE) {
$form->_contactIds = array();
$form->_contactTypes = array();
*
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
return $defaults;
}
* @return void
* @access public
*/
- function addRules() {
+ public function addRules() {
}
/**
* @return void
* @access public
*/
- function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
+ public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
$this->addButtons(array(
array(
'type' => $nextType,
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
/*
* initialize the task and row fields
*/
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
//create radio buttons to select existing group or add a new group
$options = array(ts('Add Contact To Existing Group'), ts('Create New Group'));
*
* @return array the default array reference
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if ($this->_context === 'amtg') {
*
* @return void
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Contact_Form_task_AddToGroup', 'formRule'));
}
* @static
* @access public
*/
- static function formRule($params) {
+ public static function formRule($params) {
$errors = array();
if (!empty($params['group_option']) && empty($params['title'])) {
*
* @return void
*/
- function preProcess() {
+ public function preProcess() {
/*
* initialize the task and row fields
*/
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
CRM_Utils_System::setTitle(ts('Add Members to Household'));
$this->addElement('text', 'name', ts('Find Target Household'));
*
* @return void
*/
- function search(&$form, &$params) {
+ public function search(&$form, &$params) {
//max records that will be listed
$searchValues = array();
if (!empty($params['rel_contact'])) {
*
* @return void
*/
- function preProcess() {
+ public function preProcess() {
// initialize the task and row fields
parent::preProcess();
}
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
CRM_Utils_System::setTitle(ts('Add Contacts to Organization'));
$this->addElement('text', 'name', ts('Find Target Organization'));
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
// add select for tag
$this->_tags = CRM_Core_BAO_Tag::getTags();
$this->addDefaultButtons(ts('Tag Contacts'));
}
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Contact_Form_Task_AddToTag', 'formRule'));
}
*
* @return array
*/
- static function formRule($form, $rule) {
+ public static function formRule($form, $rule) {
$errors = array();
if (empty($form['tag']) && empty($form['contact_taglist'])) {
$errors['_qf_default'] = ts("Please select at least one tag.");
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
// add select for preferences
$options = array(ts('Add Selected Options'), ts('Remove selected options'));
$this->addDefaultButtons(ts('Set Privacy Options'));
}
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Contact_Form_Task_AlterPreferences', 'formRule'));
}
*
* @return array the default array reference
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$defaults['actionTypeOption'] = 0;
*
* @return array
*/
- static function formRule($form, $rule) {
+ public static function formRule($form, $rule) {
$errors = array();
if (empty($form['pref']) && empty($form['contact_taglist'])) {
$errors['_qf_default'] = ts("Please select at least one privacy option.");
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
/*
* initialize the task and row fields
*/
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$ufGroupId = $this->get('ufGroupId');
if (!$ufGroupId) {
*
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if (empty($this->_fields)) {
return;
}
* @access public
* @static
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$errors = array();
$externalIdentifiers = array();
foreach ($fields['field'] as $componentId => $field) {
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$cid = CRM_Utils_Request::retrieve('cid', 'Positive',
$this, FALSE
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$label = $this->_restore ? ts('Restore Contact(s)') : ts('Delete Contact(s)');
if ($this->_single) {
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
// CRM-12929
$error = array();
if ($self->_skipUndelete) {
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
// store case id if present
$this->_caseId = CRM_Utils_Request::retrieve('caseid', 'String', $this, FALSE);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
/**
* @param CRM_Core_Form $form
*/
- static function preProcessFromAddress(&$form) {
+ public static function preProcessFromAddress(&$form) {
$form->_single = FALSE;
$className = CRM_Utils_System::getClassName($form);
if (property_exists($form, '_context') &&
*
* @return void
*/
- static function buildQuickForm(&$form) {
+ public static function buildQuickForm(&$form) {
$toArray = $ccArray = $bccArray = array();
$suppressedEmails = 0;
//here we are getting logged in user id as array but we need target contact id. CRM-5988
* @access public
*
*/
- static function formRule($fields, $dontCare, $self) {
+ public static function formRule($fields, $dontCare, $self) {
$errors = array();
$template = CRM_Core_Smarty::singleton();
*
* @return void
*/
- static function postProcess(&$form) {
+ public static function postProcess(&$form) {
if (count($form->_contactIds) > self::MAX_EMAILS_KILL_SWITCH) {
CRM_Core_Error::fatal(ts('Please do not use this task to send a lot of emails (greater than %1). We recommend using CiviMail instead.',
array(1 => self::MAX_EMAILS_KILL_SWITCH)
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
// display name and email of all contact ids
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->addDefaultButtons(ts('Back to Search'), 'done');
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->set('contactIds', $this->_contactIds);
parent::preProcess();
}
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
CRM_Utils_System::setTitle(ts('Make Mailing Labels'));
//add select for label
* @return array array of default values
* @access public
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$format = CRM_Core_BAO_LabelFormat::getDefaultValues();
$defaults['label_name'] = CRM_Utils_Array::value('name', $format);
*
* @return bool
*/
- function tokenIsFound($contact, $mailingFormatProperties, $tokenFields) {
+ public function tokenIsFound($contact, $mailingFormatProperties, $tokenFields) {
foreach (array_merge($mailingFormatProperties, array_fill_keys($tokenFields, 1)) as $key => $dontCare) {
if (!empty($contact[$key])) {
return TRUE;
* @return null
* @access public
*/
- function createLabel(&$contactRows, &$format, $fileName = 'MailingLabels_CiviCRM.pdf') {
+ public function createLabel(&$contactRows, &$format, $fileName = 'MailingLabels_CiviCRM.pdf') {
$pdf = new CRM_Utils_PDF_Label($format, 'mm');
$pdf->Open();
$pdf->AddPage();
* @return array of returnProperties
* @access public
*/
- function getReturnProperties(&$format) {
+ public function getReturnProperties(&$format) {
$returnProperties = array();
$matches = array();
preg_match_all('/(?<!\{|\\\\)\{(\w+\.\w+)\}(?!\})/',
/**
* @param $rows
*/
- function mergeSameAddress(&$rows) {
+ public function mergeSameAddress(&$rows) {
$uniqueAddress = array();
foreach (array_keys($rows) as $rowID) {
// load complete address as array key
*
* @return bool
*/
- function tokenIsFound($contact, $mailingFormatProperties, $tokenFields) {
+ public function tokenIsFound($contact, $mailingFormatProperties, $tokenFields) {
foreach (array_merge($mailingFormatProperties, array_fill_keys($tokenFields, 1)) as $key => $dontCare) {
//we should not consider addressee for data exists, CRM-6025
if ($key != 'addressee' && !empty($contact[$key])) {
* @return null
* @access public
*/
- static function createLabel(&$contactRows, &$format, $fileName = 'MailingLabels_CiviCRM.pdf') {
+ public static function createLabel(&$contactRows, &$format, $fileName = 'MailingLabels_CiviCRM.pdf') {
$pdf = new CRM_Utils_PDF_Label($format, 'mm');
$pdf->Open();
$pdf->AddPage();
* @access public
*/
- static function getRows($contactIDs, $locationTypeID, $respectDoNotMail, $mergeSameAddress, $mergeSameHousehold) {
+ public static function getRows($contactIDs, $locationTypeID, $respectDoNotMail, $mergeSameAddress, $mergeSameHousehold) {
$locName = NULL;
//get the address format sequence from the config file
$addressReturnProperties = CRM_Contact_Form_Task_LabelCommon::getAddressReturnProperties();
* @param unknown_type $format
* @return multitype:number
*/
- function regexReturnProperties(&$format) {
+ public function regexReturnProperties(&$format) {
$returnProperties = array();
$matches = array();
preg_match_all('/(?<!\{|\\\\)\{(\w+\.\w+)\}(?!\})/',
* - [supplemental_address_2] => 1
* )
*/
- function getAddressReturnProperties() {
+ public function getAddressReturnProperties() {
$mailingFormat = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'mailing_format'
);
* @param unknown_type $contacts
* @return unknown
*/
- function getTokenData(&$contacts) {
+ public function getTokenData(&$contacts) {
$mailingFormat = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'mailing_format'
);
* Merge contacts with the Same address to get one shared label
* @param unknown_type $rows
*/
- function mergeSameAddress(&$rows) {
+ public function mergeSameAddress(&$rows) {
$uniqueAddress = array();
foreach (array_keys($rows) as $rowID) {
// load complete address as array key
*
* @return array
*/
- function mergeSameHousehold(&$rows) {
+ public function mergeSameHousehold(&$rows) {
# group selected contacts by type
$individuals = array();
$households = array();
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$cid = CRM_Utils_Request::retrieve('cid', 'Positive',
$this, FALSE
);
* @return string the location of the file we have created
* @access protected
*/
- static function createMapXML($ids, $locationId, &$page, $addBreadCrumb, $type = 'Contact') {
+ public static function createMapXML($ids, $locationId, &$page, $addBreadCrumb, $type = 'Contact') {
$config = CRM_Core_Config::singleton();
CRM_Utils_System::setTitle(ts('Map Location(s)'));
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$ids = CRM_Utils_Request::retrieve('eid', 'Positive',
$this, TRUE
);
/**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
return 'CRM/Contact/Form/Task/Map.tpl';
}
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$statusMsg = NULL;
$contactIds = array();
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->skipOnHold = $this->skipDeceased = FALSE;
CRM_Contact_Form_Task_PDFLetterCommon::preProcess($this);
/**
*
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if (isset($this->_activityId)) {
$params = array('id' => $this->_activityId);
* @return void
* @access public
*/
- static function preProcess(&$form) {
+ public static function preProcess(&$form) {
$messageText = array();
$messageSubject = array();
$dao = new CRM_Core_BAO_MessageTemplate();
* @param CRM_Core_Form $form
* @param int $cid
*/
- static function preProcessSingle(&$form, $cid) {
+ public static function preProcessSingle(&$form, $cid) {
$form->_contactIds = array($cid);
// put contact display name in title for single contact mode
CRM_Utils_System::setTitle(ts('Create Printable Letter (PDF) for %1', array(1 => CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'display_name'))));
*
* @return void
*/
- static function buildQuickForm(&$form) {
+ public static function buildQuickForm(&$form) {
// This form outputs a file so should never be submitted via ajax
$form->preventAjaxSubmit();
/**
* Set default values
*/
- static function setDefaultValues() {
+ public static function setDefaultValues() {
$defaultFormat = CRM_Core_BAO_PdfFormat::getDefaultValues();
$defaultFormat['format_id'] = $defaultFormat['id'];
return $defaultFormat;
* @access public
*
*/
- static function formRule($fields, $dontCare, $self) {
+ public static function formRule($fields, $dontCare, $self) {
$errors = array();
$template = CRM_Core_Smarty::singleton();
*
* @return void
*/
- static function postProcess(&$form) {
+ public static function postProcess(&$form) {
list($formValues, $categories, $html_message, $messageToken, $returnProperties) = self::processMessageTemplate($form);
$skipOnHold = isset($form->skipOnHold) ? $form->skipOnHold : FALSE;
*
* @throws CRM_Core_Exception
*/
- static function createActivities($form, $html_message, $contactIds) {
+ public static function createActivities($form, $html_message, $contactIds) {
//Added for CRM-12682: Add activity subject and campaign fields
$formValues = $form->controller->exportValues($form->getName());
/**
* @param $message
*/
- static function formatMessage(&$message) {
+ public static function formatMessage(&$message) {
$newLineOperators = array(
'p' => array(
'oper' => '<p>',
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
/*
* initialize the task and row fields
*/
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
CRM_Utils_System::setTitle(ts('Batch Profile Update for Contact'));
foreach ($this->_contactIds as $id) {
*
* @return void
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Contact_Form_Task_PickProfile', 'formRule'));
}
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
if (CRM_Core_BAO_UFField::checkProfileType($fields['uf_group_id'])) {
$errorMsg['uf_group_id'] = "You cannot select mix profile for batch update.";
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preprocess();
// set print view, so that print templates are called
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
//
// just need to add a javacript to popup the window for printing
//
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
/*
* initialize the task and row fields
*/
*
* @return void
*/
- function buildQuickForm($form, $proxSearch) {
+ public function buildQuickForm($form, $proxSearch) {
// is proximity search required (2) or optional (1)?
$proxRequired = ($proxSearch == 2 ? TRUE : FALSE);
$form->assign('proximity_search', TRUE);
* @access public
* @static
*/
- static function formRule($fields, $files, $form) {
+ public static function formRule($fields, $files, $form) {
$errors = array();
// If Distance is present, make sure state, country and city or postal code are populated.
if (!empty($fields['prox_distance'])) {
*
* @return array the default array reference
*/
- function setDefaultValues($form) {
+ public function setDefaultValues($form) {
$defaults = array();
$config = CRM_Core_Config::singleton();
$countryDefault = $config->defaultContactCountry;
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
// add select for groups
$group = array('' => ts('- select group -')) + CRM_Core_PseudoConstant::nestedGroup();
$groupElement = $this->add('select', 'group_id', ts('Select Group'), $group, TRUE, array('class' => 'crm-select2 huge'));
*
* @return array the default array reference
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if ($this->get('context') === 'smog') {
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
// add select for tag
$this->_tags = CRM_Core_BAO_Tag::getTags();
foreach ($this->_tags as $tagID => $tagName) {
$this->addDefaultButtons(ts('Remove Tags from Contacts'));
}
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Contact_Form_Task_RemoveFromTag', 'formRule'));
}
*
* @return array
*/
- static function formRule($form, $rule) {
+ public static function formRule($form, $rule) {
$errors = array();
if (empty($form['tag']) && empty($form['contact_taglist'])) {
$errors['_qf_default'] = "Please select atleast one tag.";
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$session = CRM_Core_Session::singleton();
//this is done to unset searchRows variable assign during AddToHousehold and AddToOrganization
*/
public $_templates = NULL;
- function preProcess() {
+ public function preProcess() {
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
/**
* @param CRM_Core_Form $form
*/
- static function preProcessProvider(&$form) {
+ public static function preProcessProvider(&$form) {
$form->_single = FALSE;
$className = CRM_Utils_System::getClassName($form);
*
* @return void
*/
- static function buildQuickForm(&$form) {
+ public static function buildQuickForm(&$form) {
$toArray = array();
* @access public
*
*/
- static function formRule($fields, $dontCare, $self) {
+ public static function formRule($fields, $dontCare, $self) {
$errors = array();
$template = CRM_Core_Smarty::singleton();
*
* @return void
*/
- static function postProcess(&$form) {
+ public static function postProcess(&$form) {
// check and ensure that
$thisValues = $form->controller->exportValues($form->getName());
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
// get the qill
$query = new CRM_Contact_BAO_Query($this->get('queryParams'));
$qill = $query->qill();
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$this->_id = $this->get('ssID');
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$params = array();
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->addDefaultButtons(ts('Unhold Email'), 'done');
}
*/
public $_email;
- function preProcess() {
+ public function preProcess() {
$params = $defaults = $ids = array();
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$defaults['contactID'] = $this->_contactId;
$defaults['name'] = $this->_displayName;
*
* @static
*/
- static function usernameRule($params) {
+ public static function usernameRule($params) {
$config = CRM_Core_Config::singleton();
$errors = array();
$check_params = array(
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
// lets get around the time limit issue if possible, CRM-2113
* @param null $relatedContactLocType
* @param null $relatedContactPhoneType
*/
- function __construct($name, $title, $type = CRM_Utils_Type::T_INT, $columnPattern = '//', $dataPattern = '//', $hasLocationType = NULL, $phoneType = NULL, $related = NULL, $relatedContactType = NULL, $relatedContactDetails = NULL, $relatedContactLocType = NULL, $relatedContactPhoneType = NULL) {
+ public function __construct($name, $title, $type = CRM_Utils_Type::T_INT, $columnPattern = '//', $dataPattern = '//', $hasLocationType = NULL, $phoneType = NULL, $related = NULL, $relatedContactType = NULL, $relatedContactDetails = NULL, $relatedContactLocType = NULL, $relatedContactPhoneType = NULL) {
$this->_name = $name;
$this->_title = $title;
$this->_type = $type;
$this->_value = NULL;
}
- function resetValue() {
+ public function resetValue() {
$this->_value = NULL;
}
* The value is in string format. convert the value to the type of this field
* and set the field value with the appropriate type
*/
- function setValue($value) {
+ public function setValue($value) {
$this->_value = $value;
}
/**
* @return bool
*/
- function validate() {
+ public function validate() {
// echo $this->_value."===========<br>";
$message = '';
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$config = CRM_Core_Config::singleton();
$defaults = array(
'dataSource' => 'CRM_Import_DataSource_CSV',
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$errors = array();
if (!empty($fields['saveMapping'])) {
$nameField = CRM_Utils_Array::value('saveMappingName', $fields);
* @return void
* @access public
*/
- function formatCustomFieldName(&$fields) {
+ public function formatCustomFieldName(&$fields) {
//CRM-2676, replacing the conflict for same custom field name from different custom group.
$fieldIds = $formattedFieldNames = array();
foreach ($fields as $key => $value) {
* @static
* @access public
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
$invalidTagName = $invalidGroupName = FALSE;
/**
* Show import status
*/
- static function status() {
+ public static function status() {
// make sure we get an id
if (!isset($_GET['id'])) {
return;
* @return void
* @access public
*/
- function setActiveFields($fieldKeys) {
+ public function setActiveFields($fieldKeys) {
$this->_activeFieldCount = count($fieldKeys);
foreach ($fieldKeys as $key) {
if (empty($this->_fields[$key])) {
/**
* @param $elements
*/
- function setActiveFieldLocationTypes($elements) {
+ public function setActiveFieldLocationTypes($elements) {
for ($i = 0; $i < count($elements); $i++) {
$this->_activeFields[$i]->_hasLocationType = $elements[$i];
}
/**
* @param $elements
*/
- function setActiveFieldPhoneTypes($elements) {
+ public function setActiveFieldPhoneTypes($elements) {
for ($i = 0; $i < count($elements); $i++) {
$this->_activeFields[$i]->_phoneType = $elements[$i];
}
/**
* @param $elements
*/
- function setActiveFieldWebsiteTypes($elements) {
+ public function setActiveFieldWebsiteTypes($elements) {
for ($i = 0; $i < count($elements); $i++) {
$this->_activeFields[$i]->_websiteType = $elements[$i];
}
* @return void
* @access public
*/
- function setActiveFieldImProviders($elements) {
+ public function setActiveFieldImProviders($elements) {
for ($i = 0; $i < count($elements); $i++) {
$this->_activeFields[$i]->_imProvider = $elements[$i];
}
/**
* @param $elements
*/
- function setActiveFieldRelated($elements) {
+ public function setActiveFieldRelated($elements) {
for ($i = 0; $i < count($elements); $i++) {
$this->_activeFields[$i]->_related = $elements[$i];
}
/**
* @param $elements
*/
- function setActiveFieldRelatedContactType($elements) {
+ public function setActiveFieldRelatedContactType($elements) {
for ($i = 0; $i < count($elements); $i++) {
$this->_activeFields[$i]->_relatedContactType = $elements[$i];
}
/**
* @param $elements
*/
- function setActiveFieldRelatedContactDetails($elements) {
+ public function setActiveFieldRelatedContactDetails($elements) {
for ($i = 0; $i < count($elements); $i++) {
$this->_activeFields[$i]->_relatedContactDetails = $elements[$i];
}
/**
* @param $elements
*/
- function setActiveFieldRelatedContactLocType($elements) {
+ public function setActiveFieldRelatedContactLocType($elements) {
for ($i = 0; $i < count($elements); $i++) {
$this->_activeFields[$i]->_relatedContactLocType = $elements[$i];
}
/**
* @param $elements
*/
- function setActiveFieldRelatedContactPhoneType($elements) {
+ public function setActiveFieldRelatedContactPhoneType($elements) {
for ($i = 0; $i < count($elements); $i++) {
$this->_activeFields[$i]->_relatedContactPhoneType = $elements[$i];
}
/**
* @param $elements
*/
- function setActiveFieldRelatedContactWebsiteType($elements) {
+ public function setActiveFieldRelatedContactWebsiteType($elements) {
for ($i = 0; $i < count($elements); $i++) {
$this->_activeFields[$i]->_relatedContactWebsiteType = $elements[$i];
}
* @return void
* @access public
*/
- function setActiveFieldRelatedContactImProvider($elements) {
+ public function setActiveFieldRelatedContactImProvider($elements) {
for ($i = 0; $i < count($elements); $i++) {
$this->_activeFields[$i]->_relatedContactImProvider = $elements[$i];
}
* @return array (reference ) associative array of name/value pairs
* @access public
*/
- function &getActiveFieldParams() {
+ public function &getActiveFieldParams() {
$params = array();
for ($i = 0; $i < $this->_activeFieldCount; $i++) {
/**
* @return array
*/
- function getColumnPatterns() {
+ public function getColumnPatterns() {
$values = array();
foreach ($this->_fields as $name => $field) {
$values[$name] = $field->_columnPattern;
* @return void
* @access public
*/
- function set($store, $mode = self::MODE_SUMMARY) {
+ public function set($store, $mode = self::MODE_SUMMARY) {
$store->set('rowCount', $this->_rowCount);
$store->set('fields', $this->getSelectValues());
$store->set('fieldTypes', $this->getSelectTypes());
* @return void
* @access public
*/
- static function exportCSV($fileName, $header, $data) {
+ public static function exportCSV($fileName, $header, $data) {
if (file_exists($fileName) && !is_writable($fileName)) {
CRM_Core_Error::movedSiteError($fileName);
* @return void
* @access public
*/
- function init() {
+ public function init() {
$contactFields = CRM_Contact_BAO_Contact::importableFields($this->_contactType);
// exclude the address options disabled in the Address Settings
$fields = CRM_Core_BAO_Address::validateAddressOptions($contactFields);
* @return boolean
* @access public
*/
- function mapField(&$values) {
+ public function mapField(&$values) {
return CRM_Import_Parser::VALID;
}
* @return boolean the result of this processing
* @access public
*/
- function preview(&$values) {
+ public function preview(&$values) {
return $this->summary($values);
}
* @return boolean the result of this processing
* @access public
*/
- function summary(&$values) {
+ public function summary(&$values) {
$erroneousField = NULL;
$response = $this->setActiveFieldValues($values, $erroneousField);
* @return boolean the result of this processing
* @access public
*/
- function import($onDuplicate, &$values, $doGeocodeAddress = FALSE) {
+ public function import($onDuplicate, &$values, $doGeocodeAddress = FALSE) {
$config = CRM_Core_Config::singleton();
$this->_unparsedStreetAddressContacts = array();
if (!$doGeocodeAddress) {
* @return array
* @access public
*/
- function &getImportedContacts() {
+ public function &getImportedContacts() {
return $this->_newContacts;
}
* @return array
* @access public
*/
- function &getRelatedImportedContacts() {
+ public function &getRelatedImportedContacts() {
return $this->_newRelatedContacts;
}
* @return void
* @access public
*/
- function fini() {}
+ public function fini() {}
/**
* Check if an error in custom data
*
* @access public
*/
- static function isErrorInCustomData($params, &$errorMessage, $csType = NULL, $relationships = NULL) {
+ public static function isErrorInCustomData($params, &$errorMessage, $csType = NULL, $relationships = NULL) {
$session = CRM_Core_Session::singleton();
$dateType = $session->get("dateTypes");
*
* @access public
*/
- function isErrorInCoreData($params, &$errorMessage) {
+ public function isErrorInCoreData($params, &$errorMessage) {
foreach ($params as $key => $value) {
if ($value) {
$session = CRM_Core_Session::singleton();
*
* @access public
*/
- function in_value($value, $valueArray) {
+ public function in_value($value, $valueArray) {
foreach ($valueArray as $key => $v) {
//fix for CRM-1514
if (strtolower(trim($v, ".")) == strtolower(trim($value, "."))) {
* @static
* @access public
*/
- static function addToErrorMsg($errorName, &$errorMessage) {
+ public static function addToErrorMsg($errorName, &$errorMessage) {
if ($errorMessage) {
$errorMessage .= "; $errorName";
}
*
*
*/
- function createContact(&$formatted, &$contactFields, $onDuplicate, $contactId = NULL, $requiredCheck = TRUE, $dedupeRuleGroupID = NULL) {
+ public function createContact(&$formatted, &$contactFields, $onDuplicate, $contactId = NULL, $requiredCheck = TRUE, $dedupeRuleGroupID = NULL) {
$dupeCheck = FALSE;
$newContact = NULL;
* @param $onDuplicate int
* @param $cid int contact id
*/
- function formatParams(&$params, $onDuplicate, $cid) {
+ public function formatParams(&$params, $onDuplicate, $cid) {
if ($onDuplicate == CRM_Import_Parser::DUPLICATE_SKIP) {
return;
}
* @param string $dateParam index of params
* @static
*/
- function formatCustomDate(&$params, &$formatted, $dateType, $dateParam) {
+ public function formatCustomDate(&$params, &$formatted, $dateType, $dateParam) {
//fix for CRM-2687
CRM_Utils_Date::convertToDefaultDate($params, $dateType, $dateParam);
$formatted[$dateParam] = CRM_Utils_Date::processDate($params[$dateParam]);
* @param array $contactFields contact DAO fields.
* @static
*/
- function formatCommonData($params, &$formatted, &$contactFields) {
+ public function formatCommonData($params, &$formatted, &$contactFields) {
$csType = array(
CRM_Utils_Array::value('contact_type', $formatted),
);
* @return int
* @access public
*/
- function processMessage(&$values, $statusFieldName, $returnCode) {
+ public function processMessage(&$values, $statusFieldName, $returnCode) {
if (empty($this->_unparsedStreetAddressContacts)) {
$importRecordParams = array(
$statusFieldName => 'IMPORTED',
*
* @return bool
*/
- function checkRelatedContactFields($relKey, $params) {
+ public function checkRelatedContactFields($relKey, $params) {
//avoid blank contact creation.
$allowToCreate = FALSE;
/**
* @deprecated
*/
- static function getContactList() {
+ public static function getContactList() {
// if context is 'customfield'
if (CRM_Utils_Array::value('context', $_GET) == 'customfield') {
return self::contactReference();
*
* Todo: Migrate contact reference fields to use EntityRef
*/
- static function contactReference() {
+ public static function contactReference() {
$name = CRM_Utils_Array::value('term', $_GET);
$name = CRM_Utils_Type::escape($name, 'String');
$cfID = CRM_Utils_Type::escape($_GET['id'], 'Positive');
/**
* Fetch PCP ID by PCP Supporter sort_name, also displays PCP title and associated Contribution Page title
*/
- static function getPCPList() {
+ public static function getPCPList() {
$name = CRM_Utils_Array::value('s', $_GET);
$name = CRM_Utils_Type::escape($name, 'String');
$limit = '10';
CRM_Utils_JSON::output($results);
}
- static function relationship() {
+ public static function relationship() {
$relType = CRM_Utils_Request::retrieve('rel_type', 'Positive', CRM_Core_DAO::$_nullObject, TRUE);
$relContactID = CRM_Utils_Request::retrieve('rel_contact', 'Positive', CRM_Core_DAO::$_nullObject, TRUE);
$relationshipID = CRM_Utils_Array::value('rel_id', $_REQUEST); // this used only to determine add or update mode
/**
* Fetch the custom field help
*/
- static function customField() {
+ public static function customField() {
$fieldId = CRM_Utils_Type::escape($_REQUEST['id'], 'Integer');
$params = array('id' => $fieldId);
$returnProperties = array('help_pre', 'help_post');
CRM_Utils_JSON::output($values);
}
- static function groupTree() {
+ public static function groupTree() {
$gids = CRM_Utils_Type::escape($_GET['gids'], 'String');
echo CRM_Contact_BAO_GroupNestingCache::json($gids);
CRM_Utils_System::civiExit();
* Old quicksearch function. No longer used in core.
* @todo: Remove this function and associated menu entry in CiviCRM 5
*/
- static function search() {
+ public static function search() {
$json = TRUE;
$name = CRM_Utils_Array::value('name', $_GET, '');
if (!array_key_exists('name', $_GET)) {
* Delete custom value
*
*/
- static function deleteCustomValue() {
+ public static function deleteCustomValue() {
$customValueID = CRM_Utils_Type::escape($_REQUEST['valueID'], 'Positive');
$customGroupID = CRM_Utils_Type::escape($_REQUEST['groupID'], 'Positive');
* Perform enable / disable actions on record.
*
*/
- static function enableDisable() {
+ public static function enableDisable() {
$op = CRM_Utils_Type::escape($_REQUEST['op'], 'String');
$recordID = CRM_Utils_Type::escape($_REQUEST['recordID'], 'Positive');
$recordBAO = CRM_Utils_Type::escape($_REQUEST['recordBAO'], 'String');
/**
* Function to get email address of a contact
*/
- static function getContactEmail() {
+ public static function getContactEmail() {
if (!empty($_REQUEST['contact_id'])) {
$contactID = CRM_Utils_Type::escape($_REQUEST['contact_id'], 'Positive');
if (!CRM_Contact_BAO_Contact_Permission::allow($contactID, CRM_Core_Permission::EDIT)) {
CRM_Utils_System::civiExit();
}
- static function getContactPhone() {
+ public static function getContactPhone() {
$queryString = NULL;
//check for mobile type
}
- static function buildSubTypes() {
+ public static function buildSubTypes() {
$parent = CRM_Utils_Array::value('parentId', $_REQUEST);
switch ($parent) {
CRM_Utils_JSON::output($subTypes);
}
- static function buildDedupeRules() {
+ public static function buildDedupeRules() {
$parent = CRM_Utils_Array::value('parentId', $_REQUEST);
switch ($parent) {
/**
* Function used for CiviCRM dashboard operations
*/
- static function dashboard() {
+ public static function dashboard() {
$operation = CRM_Utils_Type::escape($_REQUEST['op'], 'String');
switch ($operation) {
/**
* Retrieve signature based on email id
*/
- static function getSignature() {
+ public static function getSignature() {
$emailID = CRM_Utils_Type::escape($_REQUEST['emailID'], 'Positive');
$query = "SELECT signature_text, signature_html FROM civicrm_email WHERE id = {$emailID}";
$dao = CRM_Core_DAO::executeQuery($query);
* Process dupes.
*
*/
- static function processDupes() {
+ public static function processDupes() {
$oper = CRM_Utils_Type::escape($_REQUEST['op'], 'String');
$cid = CRM_Utils_Type::escape($_REQUEST['cid'], 'Positive');
$oid = CRM_Utils_Type::escape($_REQUEST['oid'], 'Positive');
CRM_Utils_JSON::output(array('status' => ($status) ? $oper : $status));
}
- static function getDedupes() {
+ public static function getDedupes() {
$sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
$offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
/**
* Retrieve a PDF Page Format for the PDF Letter form
*/
- function pdfFormat() {
+ public function pdfFormat() {
$formatId = CRM_Utils_Type::escape($_REQUEST['formatId'], 'Integer');
$pdfFormat = CRM_Core_BAO_PdfFormat::getById($formatId);
/**
* Retrieve Paper Size dimensions
*/
- static function paperSize() {
+ public static function paperSize() {
$paperSizeName = CRM_Utils_Type::escape($_REQUEST['paperSizeName'], 'String');
$paperSize = CRM_Core_BAO_PaperSize::getByName($paperSizeName);
CRM_Utils_JSON::output($paperSize);
}
- static function selectUnselectContacts() {
+ public static function selectUnselectContacts() {
$name = CRM_Utils_Array::value('name', $_REQUEST);
$cacheKey = CRM_Utils_Array::value('qfKey', $_REQUEST);
$state = CRM_Utils_Array::value('state', $_REQUEST, 'checked');
*
* @return string
*/
- static function _convertToId($name) {
+ public static function _convertToId($name) {
if (substr($name, 0, CRM_Core_Form::CB_PREFIX_LEN) == CRM_Core_Form::CB_PREFIX) {
$cId = substr($name, CRM_Core_Form::CB_PREFIX_LEN);
}
return $cId;
}
- static function getAddressDisplay() {
+ public static function getAddressDisplay() {
$contactId = CRM_Utils_Array::value('contact_id', $_REQUEST);
if (!$contactId) {
$addressVal["error_message"] = "no contact id found";
* @return content of the parents run method
*
*/
- function browse() {
+ public function browse() {
$rows = self::info();
$this->assign('rows', $rows);
return parent::run();
*
* @return void
*/
- function run() {
+ public function run() {
$action = CRM_Utils_Request::retrieve('action',
'String',
$this, FALSE, 'browse'
* @return void
* @access public
*/
- function run() {
+ public function run() {
// Add dashboard js and css
$resources = CRM_Core_Resources::singleton();
$resources->addScriptFile('civicrm', 'js/jquery/jquery.dashboard.js', 0, 'html-header', FALSE);
* @return void
* @access public
*/
- function run() {
+ public function run() {
CRM_Utils_System::setTitle(ts('Dashlets'));
$this->assign('admin', CRM_Core_Permission::check('administer CiviCRM'));
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
//fetch the dedupe exception contacts.
$dedupeExceptions = array();
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
return parent::run();
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Dedupe_BAO_RuleGroup';
}
*
* @return array (reference) of action links
*/
- function &links() {}
+ public function &links() {}
/**
* Browse all rule groups
* @return void
* @access public
*/
- function run() {
+ public function run() {
$gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, FALSE, 0);
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 0);
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
* @return void
* @access public
*/
- function browse() {
+ public function browse() {
$this->assign('main_contacts', $this->_mainContacts);
if ($this->_cid) {
*
* @return string classname of edit form
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Contact_Form_DedupeFind';
}
*
* @return string name of this page
*/
- function editName() {
+ public function editName() {
return 'DedupeFind';
}
*
* @return string user context
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/contact/dedupefind';
}
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Dedupe_BAO_RuleGroup';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
$deleteExtra = ts('Are you sure you want to delete this Rule?');
* @access public
*
*/
- function run() {
+ public function run() {
// get the requested action, default to 'browse'
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
* @return void
* @access public
*/
- function browse() {
+ public function browse() {
// get all rule groups
$ruleGroups = array();
$dao = new CRM_Dedupe_DAO_RuleGroup();
*
* @return string classname of edit form
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Contact_Form_DedupeRules';
}
*
* @return string name of this page
*/
- function editName() {
+ public function editName() {
return 'DedupeRules';
}
*
* @return string user context
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/contact/deduperules';
}
/**
* @param int $id
*/
- function delete($id) {
+ public function delete($id) {
$ruleDao = new CRM_Dedupe_DAO_Rule();
$ruleDao->dedupe_rule_group_id = $id;
$ruleDao->delete();
*
*/
class CRM_Contact_Page_ImageFile extends CRM_Core_Page {
- function run() {
+ public function run() {
if (!preg_match('/^[^\/]+\.(jpg|jpeg|png|gif)$/i', $_GET['photo'])) {
CRM_Core_Error::fatal('Malformed photo name');
}
* @access public
*
*/
- function run() {
+ public function run() {
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
$this->assign('contactId', $contactId);
* @access public
*
*/
- function run() {
+ public function run() {
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
$locBlockNo = CRM_Utils_Request::retrieve('locno', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
* @access public
*
*/
- function run() {
+ public function run() {
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
* @access public
*
*/
- function run() {
+ public function run() {
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
* @access public
*
*/
- function run() {
+ public function run() {
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
* @access public
*
*/
- function run() {
+ public function run() {
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
$cgId = CRM_Utils_Request::retrieve('groupID', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
* @access public
*
*/
- function run() {
+ public function run() {
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
* @access public
*
*/
- function run() {
+ public function run() {
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
* @access public
*
*/
- function run() {
+ public function run() {
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
* @access public
*
*/
- function run() {
+ public function run() {
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
* @access public
*
*/
- function run() {
+ public function run() {
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
* @access public
*
*/
- function run() {
+ public function run() {
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
* @return void
*
*/
- function delete($id) {
+ public function delete($id) {
// first delete the group associated with this saved search
$group = new CRM_Contact_DAO_Group();
$group->saved_search_id = $id;
* @return content of the parents run method
*
*/
- function browse() {
+ public function browse() {
$rows = array();
$savedSearch = new CRM_Contact_DAO_SavedSearch();
*
* @return void
*/
- function run() {
+ public function run() {
$action = CRM_Utils_Request::retrieve('action', 'String',
$this, FALSE, 'browse'
);
* @return array (reference) of action links
* @static
*/
- static function &links() {
+ public static function &links() {
if (!(self::$_links)) {
* @return string the title of the page
* @access public
*/
- function getTitle() {
+ public function getTitle() {
return "Task Results";
}
}
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
// process url params
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->assign('id', $this->_id);
* @return array contact fields in fixed order
* @access public
*/
- static function getContactDetails($contactId) {
+ public static function getContactDetails($contactId) {
return list($displayName,
$contactImage,
$contactType,
* @param $page
* @param int $contactID
*/
- static function checkUserPermission($page, $contactID = NULL) {
+ public static function checkUserPermission($page, $contactID = NULL) {
// check for permissions
$page->_permission = NULL;
*
* @return string
*/
- static function setTitle($contactId, $isDeleted = FALSE) {
+ public static function setTitle($contactId, $isDeleted = FALSE) {
static $contactDetails;
$displayName = $contactImage = NULL;
if (!isset($contactDetails[$contactId])) {
* @param CRM_Core_Page $obj
* @param integer $cid
*/
- static function addUrls(&$obj, $cid) {
+ public static function addUrls(&$obj, $cid) {
$uid = CRM_Core_BAO_UFMatch::getUFId($cid);
if ($uid) {
* return null
* @access public
*/
- function browse() {
+ public function browse() {
$in = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Added');
// keep track of all 'added' contact groups so we can remove them from the smart group
}
}
- function preProcess() {
+ public function preProcess() {
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->assign('contactId', $this->_contactId);
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
$this->browse();
return parent::run();
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->assign('contactId', $this->_contactId);
* @return void
* @static
*/
- function run() {
+ public function run() {
$this->preProcess();
//set the userContext stack
* return null
* @access public
*/
- function browse() {
+ public function browse() {
$count = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, NULL, NULL, TRUE);
* return null
* @access public
*/
- function edit($groupId = NULL) {
+ public function edit($groupId = NULL) {
$controller = new CRM_Core_Controller_Simple(
'CRM_Contact_Form_GroupContact',
ts('Contact\'s Groups'),
$controller->run();
}
- function preProcess() {
+ public function preProcess() {
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->assign('contactId', $this->_contactId);
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
$displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId);
*
* @return bool
*/
- static function del($groupContactId, $status, $contactID) {
+ public static function del($groupContactId, $status, $contactID) {
$groupId = CRM_Contact_BAO_GroupContact::getGroupId($groupContactId);
switch ($status) {
* return null
* @access public
*/
- function browse() {
+ public function browse() {
$loggingReport = CRM_Core_BAO_Log::useLoggingReport();
$this->assign('useLogging', $loggingReport);
$this->assign_by_ref('log', $logEntries);
}
- function preProcess() {
+ public function preProcess() {
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->assign('contactId', $this->_contactId);
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
$this->browse();
* @return void
* @access public
*/
- function view() {
+ public function view() {
$note = new CRM_Core_DAO_Note();
$note->id = $this->_id;
if ($note->find(TRUE)) {
* return null
* @access public
*/
- function browse() {
+ public function browse() {
$note = new CRM_Core_DAO_Note();
$note->entity_table = 'civicrm_contact';
$note->entity_id = $this->_contactId;
* return null
* @access public
*/
- function edit() {
+ public function edit() {
$controller = new CRM_Core_Controller_Simple('CRM_Note_Form_Note', ts('Contact Notes'), $this->_action);
$controller->setEmbedded(TRUE);
$controller->run();
}
- function preProcess() {
+ public function preProcess() {
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
if ($this->_id && CRM_Core_BAO_Note::getNotePrivacyHidden($this->_id)) {
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
if ($this->_action & CRM_Core_Action::VIEW) {
* @return void
* @access public
*/
- function delete() {
+ public function delete() {
CRM_Core_BAO_Note::del($this->_id);
}
* @return array (reference) of action links
* @static
*/
- static function &links() {
+ public static function &links() {
if (!(self::$_links)) {
$deleteExtra = ts('Are you sure you want to delete this note?');
* @return array (reference) of action links
* @static
*/
- static function &commentLinks() {
+ public static function &commentLinks() {
if (!(self::$_commentLinks)) {
self::$_commentLinks = array(
CRM_Core_Action::VIEW => array(
* @access public
*
*/
- function run() {
+ public function run() {
$this->_print = CRM_Core_Smarty::PRINT_PAGE;
$this->preProcess();
* @return void
* @access public
*/
- function view() {
+ public function view() {
$params = array();
$defaults = array();
$ids = array();
*
* @access public
*/
- function view() {
+ public function view() {
$viewRelationship = CRM_Contact_BAO_Relationship::getRelationship($this->_contactId, NULL, NULL, NULL, $this->_id);
//To check whether selected contact is a contact_id_a in
//relationship type 'a_b' in relationship table, if yes then
* return null
* @access public
*/
- function browse() {
+ public function browse() {
// do nothing :) we are using datatable for rendering relationship selectors
}
* return null
* @access public
*/
- function edit() {
+ public function edit() {
$controller = new CRM_Core_Controller_Simple('CRM_Contact_Form_Relationship', ts('Contact Relationships'), $this->_action);
$controller->setEmbedded(TRUE);
$controller->run();
}
- function preProcess() {
+ public function preProcess() {
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->assign('contactId', $this->_contactId);
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
$this->setContext();
return parent::run();
}
- function setContext() {
+ public function setContext() {
$context = CRM_Utils_Request::retrieve('context', 'String',
$this, FALSE, 'search'
);
* return null
* @access public
*/
- function delete() {
+ public function delete() {
// calls a function to delete relationship
CRM_Contact_BAO_Relationship::del($this->_id);
}
* @return array (reference) of action links
* @static
*/
- static function &links() {
+ public static function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::VIEW => array(
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
// actions buttom contextMenu
* @access public
*
*/
- function run() {
+ public function run() {
$this->preProcess();
if ($this->_action & CRM_Core_Action::UPDATE) {
* @return void
* @access public
*/
- function edit() {
+ public function edit() {
// set the userContext stack
$session = CRM_Core_Session::singleton();
$url = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $this->_contactId);
* @return void
* @access public
*/
- function view() {
+ public function view() {
// Add js for tabs, in-place editing, and jstree for tags
CRM_Core_Resources::singleton()
->addScriptFile('civicrm', 'templates/CRM/Contact/Page/View/Summary.js', 2, 'html-header')
/**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
if ($this->_contactId) {
$contactSubtypes = $this->get('contactSubtype') ?
explode(CRM_Core_DAO::VALUE_SEPARATOR, $this->get('contactSubtype')) : array();
* return null
* @access public
*/
- function browse() {
+ public function browse() {
// get the primary city, state and zip for the contact
$ids = array($this->_contactId);
$locations = CRM_Contact_BAO_Contact_Location::getMapInfo($ids);
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
$this->browse();
* return null
* @access public
*/
- function browse() {
+ public function browse() {
$controller = new CRM_Core_Controller_Simple('CRM_Tag_Form_Tag', ts('Contact Tags'), $this->_action);
$controller->setEmbedded(TRUE);
$controller->run();
}
- function preProcess() {
+ public function preProcess() {
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->assign('contactId', $this->_contactId);
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
$this->browse();
/**
* @throws Exception
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
$check = CRM_Core_Permission::check('access Contact Dashboard');
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
if (!$this->_contactId) {
CRM_Core_Error::fatal(ts('You must be logged in to view this page.'));
}
* @return void
* @access public
*/
- function buildUserDashBoard() {
+ public function buildUserDashBoard() {
//build component selectors
$dashboardElements = array();
$config = CRM_Core_Config::singleton();
*
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
$this->buildUserDashBoard();
return parent::run();
* @static
*/
static
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
$disableExtra = ts('Are you sure you want to disable this relationship?');
* return null
* @access public
*/
- function browse() {
+ public function browse() {
$count = CRM_Contact_BAO_GroupContact::getContactGroup(
$this->_contactId,
NULL,
* return null
* @access public
*/
- function edit($groupId = NULL) {
+ public function edit($groupId = NULL) {
$this->assign('edit', $this->_edit);
if (!$this->_edit) {
return;
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->edit();
$this->browse();
}
* @access public
*
*/
- function run() {
+ public function run() {
$controller = new CRM_Core_Controller_Simple('CRM_Contact_Form_Task_Useradd',
ts('Add User'),
CRM_Core_Action::ADD
*
* @return void
*/
- function run() {
+ public function run() {
$this->preProcess();
$params = array();
* @access public
*
*/
- static function &links() {
+ public static function &links() {
list($context, $contextMenu, $key) = func_get_args();
$extraParams = ($key) ? "&key={$key}" : NULL;
$searchContext = ($context) ? "&context=$context" : NULL;
*
* @access public
*/
- function getPagerParams($action, &$params) {
+ public function getPagerParams($action, &$params) {
$params['status'] = ts('Contact %%StatusMessage%%');
$params['csvString'] = NULL;
$params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
*
* @return array
*/
- function &getColHeads($action = NULL, $output = NULL) {
+ public function &getColHeads($action = NULL, $output = NULL) {
$colHeads = self::_getColumnHeaders();
$colHeads[] = array('desc' => ts('Actions'), 'name' => ts('Action'));
return $colHeads;
* @return array the column headers that need to be displayed
* @access public
*/
- function &getColumnHeaders($action = NULL, $output = NULL) {
+ public function &getColumnHeaders($action = NULL, $output = NULL) {
$headers = NULL;
// unset return property elements that we don't care
* @return int Total number of rows
* @access public
*/
- function getTotalCount($action) {
+ public function getTotalCount($action) {
// Use count from cache during paging/sorting
if (!empty($_GET['crmPID']) || !empty($_GET['crmSID'])) {
$count = CRM_Core_BAO_Cache::getItem('Search Results Count', $this->_key);
*
* @return int the total number of rows for this action
*/
- function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
+ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
$config = CRM_Core_Config::singleton();
if (($output == CRM_Core_Selector_Controller::EXPORT ||
*
* @return string
*/
- function buildPrevNextCache($sort) {
+ public function buildPrevNextCache($sort) {
$cacheKey = 'civicrm search ' . $this->_key;
// We should clear the cache in following conditions:
/**
* @param $rows
*/
- function addActions(&$rows) {
+ public function addActions(&$rows) {
$config = CRM_Core_Config::singleton();
$permissions = array(CRM_Core_Permission::getPermission());
/**
* @param $rows
*/
- function removeActions(&$rows) {
+ public function removeActions(&$rows) {
foreach ($rows as $rid => & $rValue) {
unset($rValue['contact_type']);
unset($rValue['action']);
* @param int $start
* @param int $end
*/
- function fillupPrevNextCache($sort, $cacheKey, $start = 0, $end = 500) {
+ public function fillupPrevNextCache($sort, $cacheKey, $start = 0, $end = 500) {
$coreSearch = TRUE;
// For custom searches, use the contactIDs method
if (is_a($this, 'CRM_Contact_Selector_Custom')) {
*
* @return void
*/
- function rebuildPreNextCache($start, $end, $sort, $cacheKey) {
+ public function rebuildPreNextCache($start, $end, $sort, $cacheKey) {
// generate full SQL
$sql = $this->_query->searchQuery($start, $end, $sort, FALSE, $this->_query->_includeContactIds,
FALSE, FALSE, TRUE);
*
* @return string name of the file
*/
- function getExportFileName($output = 'csv') {
+ public function getExportFileName($output = 'csv') {
return ts('CiviCRM Contact Search');
}
/**
* @return CRM_Contact_BAO_Query
*/
- function &getQuery() {
+ public function &getQuery() {
return $this->_query;
}
/**
* @return CRM_Contact_DAO_Contact
*/
- function alphabetQuery() {
+ public function alphabetQuery() {
return $this->_query->searchQuery(NULL, NULL, NULL, FALSE, FALSE, TRUE);
}
*
* @return CRM_Contact_DAO_Contact
*/
- function contactIDQuery($params, $action, $sortID, $displayRelationshipType = NULL, $queryOperator = 'AND') {
+ public function contactIDQuery($params, $action, $sortID, $displayRelationshipType = NULL, $queryOperator = 'AND') {
$sortOrder = &$this->getSortOrder($this->_action);
$sort = new CRM_Utils_Sort($sortOrder, $sortID);
*
* @return array
*/
- function &makeProperties(&$returnProperties) {
+ public function &makeProperties(&$returnProperties) {
$properties = array();
foreach ($returnProperties as $name => $value) {
if ($name != 'location') {
/**
* @return string
*/
- function getQill() {
+ public function getQill() {
return $this->_object->getQILL();
}
}
* @access public
*
*/
- static function &links() {
+ public static function &links() {
list($key) = func_get_args();
$searchContext = "&context=custom";
$extraParams = ($key) ? "&key={$key}" : NULL;
*
* @access public
*/
- function getPagerParams($action, &$params) {
+ public function getPagerParams($action, &$params) {
$params['status'] = ts('Contact %%StatusMessage%%');
$params['csvString'] = NULL;
$params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
* @return array the column headers that need to be displayed
* @access public
*/
- function &getColumnHeaders($action = NULL, $output = NULL) {
+ public function &getColumnHeaders($action = NULL, $output = NULL) {
$columns = $this->_search->columns();
if ($output == CRM_Core_Selector_Controller::EXPORT) {
return array_keys($columns);
* @return int Total number of rows
* @access public
*/
- function getTotalCount($action) {
+ public function getTotalCount($action) {
return $this->_search->count();
}
*
* @return int the total number of rows for this action
*/
- function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
+ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
$includeContactIDs = FALSE;
if (($output == CRM_Core_Selector_Controller::EXPORT ||
*
* @return string name of the file
*/
- function getExportFileName($output = 'csv') {
+ public function getExportFileName($output = 'csv') {
return ts('CiviCRM Custom Search');
}
/**
* @return null
*/
- function alphabetQuery() {
+ public function alphabetQuery() {
return NULL;
}
*
* @return Object
*/
- 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
*/
- function addActions(&$rows) {
+ public function addActions(&$rows) {
$links = self::links($this->_key);
$permissions = array(CRM_Core_Permission::getPermission());
/**
* @param $rows
*/
- function removeActions(&$rows) {
+ public function removeActions(&$rows) {
foreach ($rows as $rid => & $rValue) {
unset($rValue['action']);
}
* @return string the name of the form that will handle the task
* @access protected
*/
- function taskName($controller, $formName = 'Search') {
+ public function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
$value = CRM_Utils_Array::value('task', $_POST);
if (!isset($value)) {
* @return string
* @access public
*/
- function getTaskFormName() {
+ public function getTaskFormName() {
if (is_array($this->_task)) {
// return first page
return CRM_Utils_String::getClassName($this->_task[0]);
* we dont want to issue a reset of the state session when we are done processing a task
*
*/
- function shouldReset() {
+ public function shouldReset() {
return FALSE;
}
}
*/
static $_optionalTasks = NULL;
- static function initTasks() {
+ public static function initTasks() {
if (!self::$_tasks) {
self::$_tasks = array(
self::GROUP_CONTACTS => array(
* @static
* @access public
*/
- static function &taskTitles() {
+ public static function &taskTitles() {
self::initTasks();
$titles = array();
* @return array set of tasks that are valid for the user
* @access public
*/
- static function &permissionedTaskTitles($permission, $deletedContacts = FALSE) {
+ public static function &permissionedTaskTitles($permission, $deletedContacts = FALSE) {
self::initTasks();
$tasks = array();
if ($deletedContacts) {
* @static
* @access public
*/
- static function &optionalTaskTitle() {
+ public static function &optionalTaskTitle() {
$tasks = array(
self::SAVE_SEARCH_UPDATE => self::$_tasks[self::SAVE_SEARCH_UPDATE]['title'],
);
*
* @return array
*/
- static function getTask($value) {
+ public static function getTask($value) {
self::initTasks();
if (!CRM_Utils_Array::value($value, self::$_tasks)) {
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function add(&$params, $ids = array()) {
+ public static function add(&$params, $ids = array()) {
if (empty($params)) {
return;
}
* Get defaults for new entity
* @return array
*/
- static function getDefaults() {
+ public static function getDefaults() {
return array(
'payment_instrument_id' => key(CRM_Core_OptionGroup::values('payment_instrument',
FALSE, FALSE, FALSE, 'AND is_default = 1')
* @access public
* @static
*/
- static function &getValues($params, &$values, &$ids) {
+ public static function &getValues($params, &$values, &$ids) {
if (empty($params)) {
return NULL;
}
* @access public
* @static
*/
- static function create(&$params, $ids = array()) {
+ public static function create(&$params, $ids = array()) {
$dateFields = array('receive_date', 'cancel_date', 'receipt_date', 'thankyou_date');
foreach ($dateFields as $df) {
if (isset($params[$df])) {
* @access public
* @static
*/
- static function resolveDefaults(&$defaults, $reverse = FALSE) {
+ public static function resolveDefaults(&$defaults, $reverse = FALSE) {
self::lookupValue($defaults, 'financial_type', CRM_Contribute_PseudoConstant::financialType(), $reverse);
self::lookupValue($defaults, 'payment_instrument', CRM_Contribute_PseudoConstant::paymentInstrument(), $reverse);
self::lookupValue($defaults, 'contribution_status', CRM_Contribute_PseudoConstant::contributionStatus(), $reverse);
* the api needs the name => value conversion, also the view layer typically
* requires value => name conversion
*/
- static function lookupValue(&$defaults, $property, &$lookup, $reverse) {
+ public static function lookupValue(&$defaults, $property, &$lookup, $reverse) {
$id = $property . '_id';
$src = $reverse ? $property : $id;
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults, &$ids) {
+ public static function retrieve(&$params, &$defaults, &$ids) {
$contribution = CRM_Contribute_BAO_Contribution::getValues($params, $defaults, $ids);
return $contribution;
}
* @access public
* @static
*/
- static function &importableFields($contactType = 'Individual', $status = TRUE) {
+ public static function &importableFields($contactType = 'Individual', $status = TRUE) {
if (!self::$_importableFields) {
if (!self::$_importableFields) {
self::$_importableFields = array();
/**
* @return array
*/
- static function &exportableFields() {
+ public static function &exportableFields() {
if (!self::$_exportableFields) {
if (!self::$_exportableFields) {
self::$_exportableFields = array();
*
* @return array|null
*/
- static function getTotalAmountAndCount($status = NULL, $startDate = NULL, $endDate = NULL) {
+ public static function getTotalAmountAndCount($status = NULL, $startDate = NULL, $endDate = NULL) {
$where = array();
switch ($status) {
case 'Valid':
* @return mixed|null $results no of deleted Contribution on success, false otherwise@access public
* @static
*/
- static function deleteContribution($id) {
+ public static function deleteContribution($id) {
CRM_Utils_Hook::pre('delete', 'Contribution', $id, CRM_Core_DAO::$_nullArray);
$transaction = new CRM_Core_Transaction();
* @access public
* static
*/
- static function checkDuplicate($input, &$duplicates, $id = NULL) {
+ public static function checkDuplicate($input, &$duplicates, $id = NULL) {
if (!$id) {
$id = CRM_Utils_Array::value('id', $input);
}
* @access public
* @static
*/
- static function addPremium(&$params) {
+ public static function addPremium(&$params) {
$contributionProduct = new CRM_Contribute_DAO_ContributionProduct();
$contributionProduct->copyValues($params);
return $contributionProduct->save();
* @static
* @access public
*/
- static function getContributionFields($addExtraFields = TRUE) {
+ public static function getContributionFields($addExtraFields = TRUE) {
$contributionFields = CRM_Contribute_DAO_Contribution::export();
$contributionFields = array_merge($contributionFields, CRM_Core_OptionValue::getFields($mode = 'contribute'));
*
* @static
*/
- static function getSpecialContributionFields() {
+ public static function getSpecialContributionFields() {
$extraFields = array(
'contribution_soft_credit_name' => array(
'name' => 'contribution_soft_credit_name',
*
* @return array
*/
- static function getCurrentandGoalAmount($pageID) {
+ public static function getCurrentandGoalAmount($pageID) {
$query = "
SELECT p.goal_amount as goal, sum( c.total_amount ) as total
FROM civicrm_contribution_page p,
* @access public
* @static
*/
- static function getHonorContacts($honorId) {
+ public static function getHonorContacts($honorId) {
$params = array();
$honorDAO = new CRM_Contribute_DAO_ContributionSoft();
$honorDAO->contact_id = $honorId;
* @static
* @access public
*/
- static function sortName($id) {
+ public static function sortName($id) {
$id = CRM_Utils_Type::escape($id, 'Integer');
$query = "
*
* @return array
*/
- static function annual($contactID) {
+ public static function annual($contactID) {
if (is_array($contactID)) {
$contactIDs = implode(',', $contactID);
}
* @access public
* static
*/
- static function checkDuplicateIds($params) {
+ public static function checkDuplicateIds($params) {
$dao = new CRM_Contribute_DAO_Contribution();
$clause = array();
* @static
* @access public
*/
- static function getContributionDetails($exportMode, $componentIds) {
+ public static function getContributionDetails($exportMode, $componentIds) {
$paymentDetails = array();
$componentClause = ' IN ( ' . implode(',', $componentIds) . ' ) ';
* @return address id
* @static
*/
- static function createAddress(&$params, $billingLocationTypeID) {
+ public static function createAddress(&$params, $billingLocationTypeID) {
$billingFields = array(
'street_address',
'city',
* @access public
* @static
*/
- static function deleteAddress($contributionId = NULL, $contactId = NULL) {
+ public static function deleteAddress($contributionId = NULL, $contactId = NULL) {
$clauses = array();
$contactJoin = NULL;
* @return $contributionId pending contribution id.
* @static
*/
- static function checkOnlinePendingContribution($componentId, $componentName) {
+ public static function checkOnlinePendingContribution($componentId, $componentName) {
$contributionId = NULL;
if (!$componentId ||
!in_array($componentName, array('Event', 'Membership'))
/**
* This function update contribution as well as related objects.
*/
- static function transitionComponents($params, $processContributionObject = FALSE) {
+ public static function transitionComponents($params, $processContributionObject = FALSE) {
// get minimum required values.
$contactId = CRM_Utils_Array::value('contact_id', $params);
$componentId = CRM_Utils_Array::value('component_id', $params);
*
* @return null|string
*/
- static function contributionCount($contactId, $includeSoftCredit = TRUE) {
+ public static function contributionCount($contactId, $includeSoftCredit = TRUE) {
if (!$contactId) {
return 0;
}
* @return array $ids containing organization id and individual id
* @access public
*/
- static function getOnbehalfIds($contributionId, $contributorId = NULL) {
+ public static function getOnbehalfIds($contributionId, $contributorId = NULL) {
$ids = array();
* @return array
* @static
*/
- static function getContributionDates() {
+ public static function getContributionDates() {
$config = CRM_Core_Config::singleton();
$currentMonth = date('m');
$currentDay = date('d');
* @return bool
* @throws Exception
*/
- function loadRelatedObjects(&$input, &$ids, $required = FALSE, $loadAll = false) {
+ public function loadRelatedObjects(&$input, &$ids, $required = FALSE, $loadAll = false) {
if($loadAll){
$ids = array_merge($this->getComponentDetails($this->id),$ids);
if(empty($ids['contact']) && isset($this->contact_id)){
*
* @throws Exception
*/
- function composeMessageArray(&$input, &$ids, &$values, $recur = FALSE, $returnMessageText = TRUE) {
+ public function composeMessageArray(&$input, &$ids, &$values, $recur = FALSE, $returnMessageText = TRUE) {
if (empty($this->_relatedObjects)) {
$this->loadRelatedObjects($input, $ids);
}
*
* @return mixed
*/
- function _gatherMessageValues($input, &$values, $ids = array()) {
+ public function _gatherMessageValues($input, &$values, $ids = array()) {
// set display address of contributor
if ($this->address_id) {
$addressParams = array('id' => $this->address_id);
*
* @return mixed
*/
- function _assignMessageVariablesToTemplate(&$values, $input, &$template, $recur = FALSE, $returnMessageText = True) {
+ public function _assignMessageVariablesToTemplate(&$values, $input, &$template, $recur = FALSE, $returnMessageText = True) {
$template->assign('first_name', $this->_relatedObjects['contact']->first_name);
$template->assign('last_name', $this->_relatedObjects['contact']->last_name);
$template->assign('displayName', $this->_relatedObjects['contact']->display_name);
* @access public
* @static
*/
- static function isCancelSubscriptionSupported($contributionId, $isNotCancelled = TRUE) {
+ public static function isCancelSubscriptionSupported($contributionId, $isNotCancelled = TRUE) {
$cacheKeyString = "$contributionId";
$cacheKeyString .= $isNotCancelled ? '_1' : '_0';
* @access public
* @static
*/
- static function isSubscriptionCancelled($contributionId) {
+ public static function isSubscriptionCancelled($contributionId) {
$sql = "
SELECT cr.contribution_status_id
FROM civicrm_contribution_recur cr
* @access public
* @static
*/
- static function recordFinancialAccounts(&$params, $financialTrxnValues = NULL) {
+ public static function recordFinancialAccounts(&$params, $financialTrxnValues = NULL) {
$skipRecords = $update = $return = $isRelatedId = FALSE;
$additionalParticipantId = array();
* @access public
* @static
*/
- static function updateFinancialAccounts(&$params, $context = NULL, $skipTrxn = NULL) {
+ public static function updateFinancialAccounts(&$params, $context = NULL, $skipTrxn = NULL) {
$itemAmount = $trxnID = NULL;
//get all the statuses
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
* @access public
* @static
*/
- static function checkStatusValidation($values, &$fields, &$errors) {
+ public static function checkStatusValidation($values, &$fields, &$errors) {
if (CRM_Utils_System::isNull($values) && !empty($fields['id'])) {
$values['contribution_status_id'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $fields['id'], 'contribution_status_id');
if ($values['contribution_status_id'] == $fields['contribution_status_id']) {
* @access public
* @static
*/
- static function deleteContactContribution($contactId) {
+ public static function deleteContactContribution($contactId) {
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->contact_id = $contactId;
$contribution->find();
* @access public
* @static
*/
- static function validateFinancialType($financialTypeId, $relationName = 'Expense Account is') {
+ public static function validateFinancialType($financialTypeId, $relationName = 'Expense Account is') {
$expenseTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE '{$relationName}' "));
$financialAccount = CRM_Contribute_PseudoConstant::financialAccountType($financialTypeId, $expenseTypeId);
*
* @return null|object
*/
- static function recordAdditionalPayment($contributionId, $trxnsData, $paymentType = 'owed', $participantId = NULL) {
+ public static function recordAdditionalPayment($contributionId, $trxnsData, $paymentType = 'owed', $participantId = NULL) {
$statusId = CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name');
$getInfoOf['id'] = $contributionId;
$defaults = array();
*
* @throws CRM_Core_Exception
*/
- static function addActivityForPayment($entityObj, $trxnObj, $activityType, $component, $contributionId) {
+ public static function addActivityForPayment($entityObj, $trxnObj, $activityType, $component, $contributionId) {
if ($component == 'event') {
$date = CRM_Utils_Date::isoToMysql($trxnObj->trxn_date);
$paymentAmount = CRM_Utils_Money::format($trxnObj->total_amount, $trxnObj->currency);
*
* @return mixed
*/
- static function getPaymentInfo($id, $component, $getTrxnInfo = FALSE, $usingLineTotal = FALSE) {
+ public static function getPaymentInfo($id, $component, $getTrxnInfo = FALSE, $usingLineTotal = FALSE) {
if ($component == 'event') {
$entity = 'participant';
$entityTable = 'civicrm_participant';
*
* @return FinancialAccountId
*/
- static function getFinancialAccountId($financialTypeId) {
+ public static function getFinancialAccountId($financialTypeId) {
$accountRel = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Sales Tax Account is' "));
$searchParams = array(
'entity_table' => 'civicrm_financial_type',
* @static
* @access public
*/
- static function contributionChartMonthly($param) {
+ public static function contributionChartMonthly($param) {
if ($param) {
$param = array(1 => array($param, 'Integer'));
}
* @static
* @access public
*/
- static function contributionChartYearly() {
+ public static function contributionChartYearly() {
$config = CRM_Core_Config::singleton();
$yearClause = "year(contrib.receive_date) as contribYear";
if (!empty($config->fiscalYearStart) && ($config->fiscalYearStart['M'] != 1 || $config->fiscalYearStart['d'] != 1)) {
* @param int $contactID
* @param $mail
*/
- static function createCMSUser(&$params, $contactID, $mail) {
+ public static function createCMSUser(&$params, $contactID, $mail) {
// lets ensure we only create one CMS user
static $created = FALSE;
*
* @return bool
*/
- static function _fillCommonParams(&$params, $type = 'paypal') {
+ public static function _fillCommonParams(&$params, $type = 'paypal') {
if (array_key_exists('transaction', $params)) {
$transaction = &$params['transaction'];
}
*
* @return array
*/
- static function formatAPIParams($apiParams, $mapper, $type = 'paypal', $category = TRUE) {
+ public static function formatAPIParams($apiParams, $mapper, $type = 'paypal', $category = TRUE) {
$type = strtolower($type);
if (!in_array($type, array(
*
* @return bool
*/
- static function processAPIContribution($params) {
+ public static function processAPIContribution($params) {
if (empty($params) || array_key_exists('error', $params)) {
return FALSE;
}
*
* @return mixed
*/
- static function getFirstLastDetails($contactID) {
+ public static function getFirstLastDetails($contactID) {
static $_cache;
if (!$_cache) {
* @return Object DAO object on success, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Contribute_DAO_ContributionPage', $id, 'is_active', $is_active);
}
* @param int $id
* @param $values
*/
- static function setValues($id, &$values) {
+ public static function setValues($id, &$values) {
$params = array(
'id' => $id,
);
* @access public
* @static
*/
- static function sendMail($contactID, $values, $isTest = FALSE, $returnMessageText = FALSE, $fieldTypes = NULL) {
+ public static function sendMail($contactID, $values, $isTest = FALSE, $returnMessageText = FALSE, $fieldTypes = NULL) {
$gIds = $params = array();
$email = NULL;
if (isset($values['custom_pre_id'])) {
*
* @return array
*/
- function composeMessage($tplParams, $contactID, $isTest) {
+ public function composeMessage($tplParams, $contactID, $isTest) {
$sendTemplateParams = array(
'groupName' => $tplParams['membershipID'] ? 'msg_tpl_workflow_membership' : 'msg_tpl_workflow_contribution',
'valueName' => $tplParams['membershipID'] ? 'membership_online_receipt' : 'contribution_online_receipt',
* @access public
* @static
*/
- static function recurringNotify($type, $contactID, $pageID, $recur, $autoRenewMembership = FALSE) {
+ public static function recurringNotify($type, $contactID, $pageID, $recur, $autoRenewMembership = FALSE) {
$value = array();
if ($pageID) {
CRM_Core_DAO::commonRetrieveAll('CRM_Contribute_DAO_ContributionPage', 'id', $pageID, $value, array(
* @access public
* @static
*/
- static function copy($id) {
+ public static function copy($id) {
$fieldsFix = array(
'prefix' => array(
'title' => ts('Copy of') . ' ',
* @access public
* @static
*/
- static function checkRecurPaymentProcessor($contributionPageId) {
+ public static function checkRecurPaymentProcessor($contributionPageId) {
//FIXME
$sql = "
SELECT pp.is_recur
* @access public
* @static
*/
- static function getSectionInfo($contribPageIds = array()) {
+ public static function getSectionInfo($contribPageIds = array()) {
$info = array();
$whereClause = NULL;
if (is_array($contribPageIds) && !empty($contribPageIds)) {
* @param int $userID contact id for contributor
* @return array $pdfHtml
*/
- static function addInvoicePdfToEmail($contributionId, $userID) {
+ public static function addInvoicePdfToEmail($contributionId, $userID) {
$contributionID = array($contributionId);
$contactId = array($userID);
$pdfParams = array(
*
* @return bool isSeparateMembershipPayment
*/
- static function getIsMembershipPayment($id) {
+ public static function getIsMembershipPayment($id) {
$membershipBlocks = civicrm_api3('membership_block', 'get', array('entity_table' => 'civicrm_contribution_page', 'entity_id' => $id, 'sequential' => TRUE));
if(!$membershipBlocks['count']) {
return FALSE;
* @access public
*
*/
- static function create(&$params) {
+ public static function create(&$params) {
return self::add($params);
}
* @static
* @todo move hook calls / extended logic to create - requires changing calls to call create not add
*/
- static function add(&$params) {
+ public static function add(&$params) {
if (!empty($params['id'])) {
CRM_Utils_Hook::pre('edit', 'ContributionRecur', $params['id'], $params);
}
* @access public
* static
*/
- static function checkDuplicate($params, &$duplicates) {
+ public static function checkDuplicate($params, &$duplicates) {
$id = CRM_Utils_Array::value('id', $params);
$trxn_id = CRM_Utils_Array::value('trxn_id', $params);
$invoice_id = CRM_Utils_Array::value('invoice_id', $params);
*
* @return array|null
*/
- static function getPaymentProcessor($id, $mode) {
+ public static function getPaymentProcessor($id, $mode) {
//FIX ME:
$sql = "
SELECT r.payment_processor_id
* @access public
* static
*/
- static function getCount(&$ids) {
+ public static function getCount(&$ids) {
$recurID = implode(',', $ids);
$totalCount = array();
* @access public
* @static
*/
- static function deleteRecurContribution($recurId) {
+ public static function deleteRecurContribution($recurId) {
$result = FALSE;
if (!$recurId) {
return $result;
* @access public
* @static
*/
- static function cancelRecurContribution($recurId, $objects, $activityParams = array()) {
+ public static function cancelRecurContribution($recurId, $objects, $activityParams = array()) {
if (!$recurId) {
return FALSE;
}
* @access public
* @static
*/
- static function getRecurContributions($contactId) {
+ public static function getRecurContributions($contactId) {
$params = array();
$recurDAO = new CRM_Contribute_DAO_ContributionRecur();
$recurDAO->contact_id = $contactId;
*
* @return null|Object
*/
- static function getSubscriptionDetails($entityID, $entity = 'recur') {
+ public static function getSubscriptionDetails($entityID, $entity = 'recur') {
$sql = "
SELECT rec.id as recur_id,
rec.processor_id as subscription_id,
}
}
- static function setSubscriptionContext() {
+ public static function setSubscriptionContext() {
// handle context redirection for subscription url
$session = CRM_Core_Session::singleton();
if ($session->get('userID')) {
/**
* Construct method
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$contributionSoft = new CRM_Contribute_DAO_ContributionSoft();
$contributionSoft->copyValues($params);
if ($contributionSoft->find(TRUE)) {
*
* @static
*/
- static function del($params) {
+ public static function del($params) {
//delete from contribution soft table
$contributionSoft = new CRM_Contribute_DAO_ContributionSoft();
foreach($params as $column => $value) {
*
* @return array
*/
- static function getSoftContributionTotals($contact_id, $isTest = 0) {
+ public static function getSoftContributionTotals($contact_id, $isTest = 0) {
$query = '
SELECT SUM(amount) as amount, AVG(total_amount) as average, cc.currency
FROM civicrm_contribution_soft ccs
* @return array of soft contribution ids, amounts, and associated contact ids
* @static
*/
- static function getSoftContribution($contributionID, $all = FALSE) {
+ public static function getSoftContribution($contributionID, $all = FALSE) {
$pcpFields = array(
'pcp_id',
'pcp_title',
*
* @return array
*/
- static function getSoftCreditIds($contributionID , $isPCP = FALSE) {
+ public static function getSoftCreditIds($contributionID , $isPCP = FALSE) {
$query = "
SELECT id
FROM civicrm_contribution_soft
* @return array
* @static
*/
- static function getSoftContributionList($contact_id, $filter = NULL, $isTest = 0) {
+ public static function getSoftContributionList($contact_id, $filter = NULL, $isTest = 0) {
$query = '
SELECT ccs.id, ccs.amount as amount,
ccs.contribution_id,
* @param int $honoreeprofileId
* @param int $honorId
*/
- static function formatHonoreeProfileFields($form, $params, $honoreeprofileId, $honorId = NULL) {
+ public static function formatHonoreeProfileFields($form, $params, $honoreeprofileId, $honorId = NULL) {
$profileContactType = CRM_Core_BAO_UFGroup::getContactType($honoreeprofileId);
$profileFields = CRM_Core_BAO_UFGroup::getFields($honoreeprofileId);
$honoreeProfileFields = $values = array();
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$premium = new CRM_Contribute_DAO_Product();
$premium->copyValues($params);
if ($premium->find(TRUE)) {
* @return Object DAO object on sucess, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
if (!$is_active) {
$dao = new CRM_Contribute_DAO_PremiumsProduct();
$dao->product_id = $id;
*
* @return object
*/
- static function add(&$params, &$ids) {
+ public static function add(&$params, &$ids) {
// CRM-14283 - strip protocol and domain from image URLs
$image_type = array('image', 'thumbnail');
foreach ($image_type as $key) {
* @static
*/
- static function del($productID) {
+ public static function del($productID) {
//check dependencies
$premiumsProduct = new CRM_Contribute_DAO_PremiumsProduct();
$premiumsProduct->product_id = $productID;
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$premium = new CRM_Contribute_DAO_Product();
$premium->copyValues($params);
if ($premium->find(TRUE)) {
* @return Object DAO object on sucess, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Contribute_DAO_Premium', $id, 'premiums_active ', $is_active);
}
*
* @static
*/
- static function del($premiumID) {
+ public static function del($premiumID) {
//check dependencies
//delete from financial Type table
*
* @static
*/
- static function buildPremiumBlock(&$form, $pageID, $formItems = FALSE, $selectedProductID = NULL, $selectedOption = NULL) {
+ public static function buildPremiumBlock(&$form, $pageID, $formItems = FALSE, $selectedProductID = NULL, $selectedOption = NULL) {
$form->add('hidden', "selectProduct", $selectedProductID, array('id' => 'selectProduct'));
$dao = new CRM_Contribute_DAO_Premium();
*
* @static
*/
- function buildPremiumPreviewBlock($form, $productID, $premiumProductID = NULL) {
+ public function buildPremiumPreviewBlock($form, $productID, $premiumProductID = NULL) {
if ($premiumProductID) {
$dao = new CRM_Contribute_DAO_PremiumsProduct();
$dao->id = $premiumProductID;
*
* @static
*/
- static function deletePremium($contributionPageID) {
+ public static function deletePremium($contributionPageID) {
if (!$contributionPageID) {
return;
}
* @static
* @access public
*/
- static function getPremiumProductInfo() {
+ public static function getPremiumProductInfo() {
if (!self::$productInfo) {
$products = $options = array();
* @return array self::$_contributionFields associative array of contribution fields
* @static
*/
- static function &getFields() {
+ public static function &getFields() {
if (!self::$_contributionFields) {
self::$_contributionFields = array();
* @return void
* @access public
*/
- static function select(&$query) {
+ public static function select(&$query) {
// if contribute mode add contribution id
if ($query->_mode & CRM_Contact_BAO_Query::MODE_CONTRIBUTE) {
$query->_select['contribution_id'] = "civicrm_contribution.id as contribution_id";
/**
* @param $query
*/
- static function where(&$query) {
+ public static function where(&$query) {
$grouping = NULL;
self::initializeAnySoftCreditClause($query);
* @param $values
* @param $query
*/
- static function whereClauseSingle(&$values, &$query) {
+ public static function whereClauseSingle(&$values, &$query) {
list($name, $op, $value, $grouping, $wildcard) = $values;
$quoteValue = NULL;
*
* @return null|string
*/
- static function from($name, $mode, $side) {
+ public static function from($name, $mode, $side) {
$from = NULL;
switch ($name) {
case 'civicrm_contribution':
/**
* @param $query
*/
- static function initializeAnySoftCreditClause(&$query) {
+ public static function initializeAnySoftCreditClause(&$query) {
if (self::isSoftCreditOptionEnabled($query->_params)) {
if ($query->_mode & CRM_Contact_BAO_Query::MODE_CONTRIBUTE) {
unset($query->_distinctComponentClause);
*
* @return bool
*/
- static function isSoftCreditOptionEnabled($queryParams = array()) {
+ public static function isSoftCreditOptionEnabled($queryParams = array()) {
static $tempTableFilled = FALSE;
if (!empty($queryParams)) {
foreach (array_keys($queryParams) as $id) {
*
* @return array
*/
- static function softCreditReturnProperties($isExportMode = False) {
+ public static function softCreditReturnProperties($isExportMode = False) {
$properties = array(
'contribution_soft_credit_name' => 1,
'contribution_soft_credit_amount' => 1,
*
* @return array|null
*/
- static function defaultReturnProperties($mode, $includeCustomFields = TRUE) {
+ public static function defaultReturnProperties($mode, $includeCustomFields = TRUE) {
$properties = NULL;
if ($mode & CRM_Contact_BAO_Query::MODE_CONTRIBUTE) {
$properties = array(
* @return void
* @static
*/
- static function buildSearchForm(&$form) {
+ public static function buildSearchForm(&$form) {
// Added contribution source
$form->addElement('text', 'contribution_source', ts('Contribution Source'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'source'));
* @param $row
* @param int $id
*/
- static function searchAction(&$row, $id) {
+ public static function searchAction(&$row, $id) {
}
/**
* @param $tables
*/
- static function tableNames(&$tables) {
+ public static function tableNames(&$tables) {
// Add contribution table
if (!empty($tables['civicrm_product'])) {
$tables = array_merge(array('civicrm_contribution' => 1), $tables);
*
* @return bool
*/
- static function buildDateWhere(&$values, $query, $name, $field, $title) {
+ public static function buildDateWhere(&$values, $query, $name, $field, $title) {
$fieldPart = strpos($name, $field);
if($fieldPart === FALSE) {
return;
/**
* @return array
*/
- static function getRecurringFields() {
+ public static function getRecurringFields() {
return array(
'contribution_recur_start_date' => ts('Recurring Contribution Start Date'),
'contribution_recur_next_sched_contribution_date' => ts('Next Scheduled Recurring Contribution'),
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
$this->_stateMachine = new CRM_Contribute_StateMachine_Contribution($this, $action);
}
}
- function invalidKey() {
+ public function invalidKey() {
$this->invalidKeyRedirect();
}
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
*
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if (isset($this->_id)) {
*
* @return void
*/
- static function buildPremium(&$form) {
+ public static function buildPremium(&$form) {
//premium section
$form->add('hidden', 'hidden_Premium', 1);
$sel1 = $sel2 = array();
*
* @return void
*/
- static function buildAdditionalDetail(&$form) {
+ public static function buildAdditionalDetail(&$form) {
//Additional information section
$form->add('hidden', 'hidden_AdditionalDetail', 1);
*
* @return void
*/
- static function buildPaymentReminders(&$form) {
+ public static function buildPaymentReminders(&$form) {
//PaymentReminders section
$form->add('hidden', 'hidden_PaymentReminders', 1);
$form->add('text', 'initial_reminder_day', ts('Send Initial Reminder'), array('size' => 3));
* @param null $options
* @return void
*/
- static function processPremium(&$params, $contributionID, $premiumID = NULL, &$options = NULL) {
+ public static function processPremium(&$params, $contributionID, $premiumID = NULL, &$options = NULL) {
$dao = new CRM_Contribute_DAO_ContributionProduct();
$dao->contribution_id = $contributionID;
$dao->product_id = $params['product_name'][0];
*
* @return void
*/
- static function processNote(&$params, $contactID, $contributionID, $contributionNoteID = NULL) {
+ public static function processNote(&$params, $contactID, $contributionID, $contributionNoteID = NULL) {
//process note
$noteParams = array(
'entity_table' => 'civicrm_contribution',
* @param CRM_Core_Form $form
* @return void
*/
- static function postProcessCommon(&$params, &$formatted, &$form) {
+ public static function postProcessCommon(&$params, &$formatted, &$form) {
$fields = array(
'non_deductible_amount',
'total_amount',
*
* @return array
*/
- static function emailReceipt(&$form, &$params, $ccContribution = FALSE) {
+ public static function emailReceipt(&$form, &$params, $ccContribution = FALSE) {
$form->assign('receiptType', 'contribution');
// Retrieve Financial Type Name from financial_type_id
$params['contributionType_name'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType',
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
if ($self->_paymentType == 'owed' && $fields['total_amount'] > $self->_owed) {
$errors['total_amount'] = ts('Payment amount cannot be greater than owed amount');
*
* @return mixed
*/
- function emailReceipt(&$params) {
+ public function emailReceipt(&$params) {
// email receipt sending
// send message template
if ($this->_component == 'event') {
* @return array array of default values
* @access public
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array('is_notify' => 1);
return $defaults;
}
}
}
- function setDefaultValues() {
+ public function setDefaultValues() {
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::setDefaultValues($this);
}
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
//check for Credit Card Contribution.
* @return int
* @access public
*/
- function getAction() {
+ public function getAction() {
if ($this->_action & CRM_Core_Action::PREVIEW) {
return CRM_Core_Action::VIEW | CRM_Core_Action::PREVIEW;
}
*
* @return void
*/
- function setDefaultValues() {}
+ public function setDefaultValues() {}
/**
* Process the form
*
* @return null|string
*/
- function wrangleFinancialTypeID($contributionTypeId) {
+ public function wrangleFinancialTypeID($contributionTypeId) {
if (isset($paymentParams['financial_type'])) {
$contributionTypeId = $paymentParams['financial_type'];
}
*
* @return mixed
*/
- static function processRecurringContribution(&$form, &$params, $contactID, $contributionType, $online = TRUE) {
+ public static function processRecurringContribution(&$form, &$params, $contactID, $contributionType, $online = TRUE) {
// return if this page is not set for recurring
// or the user has not chosen the recurring option
* @return void
* @access public
*/
- static function processOnBehalfOrganization(&$behalfOrganization, &$contactID, &$values, &$params, $fields = NULL) {
+ public static function processOnBehalfOrganization(&$behalfOrganization, &$contactID, &$values, &$params, $fields = NULL) {
$isCurrentEmployer = FALSE;
$dupeIDs = array();
$orgID = NULL;
* @static
* @access public
*/
- static function processPcpSoft(&$params, &$contribution) {
+ public static function processPcpSoft(&$params, &$contribution) {
//add soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin.
if (!empty($params['soft_credit_to'])) {
$contributionSoftParams = array();
* @static
* @access public
*/
- static function processPcp(&$page, $params) {
+ public static function processPcp(&$page, $params) {
$params['pcp_made_through_id'] = $page->_pcpId;
$page->assign('pcpBlock', TRUE);
if (!empty($params['pcp_display_in_roll']) && empty($params['pcp_roll_nickname'])) {
*
* @throws CiviCRM_API3_Exception
*/
- static function submit($params) {
+ public static function submit($params) {
$form = new CRM_Contribute_Form_Contribution_Confirm();
$form->_id = $params['id'];
if (!empty($params['contact_id'])) {
* @return array
* @throws CiviCRM_API3_Exception
*/
- static function getFormParams($id, array $params) {
+ public static function getFormParams($id, array $params) {
if(!isset($params['is_pay_later'])) {
if (!empty($params['payment_processor'])) {
$params['is_pay_later'] = 0;
/**
*
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
// check if the user is registered and we have a contact ID
$contactID = $this->getContactID();
*
* @access public
*/
- function buildOnBehalfOrganization() {
+ public function buildOnBehalfOrganization() {
if ($this->_membershipContactID) {
$entityBlock = array('contact_id' => $this->_membershipContactID);
CRM_Core_BAO_Location::getValues($entityBlock, $this->_defaults);
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
$amount = self::computeAmount($fields, $self);
* @param CRM_Contribute_Form_Contribution_Main|CRM_Event_Form_Registration_Register $form
* @param bool $noFees
*/
- static function preProcessPaymentOptions(&$form, $noFees = FALSE) {
+ public static function preProcessPaymentOptions(&$form, $noFees = FALSE) {
$form->_snippet = CRM_Utils_Array::value('snippet', $_GET);
$form->_paymentProcessors = $noFees ? array() : $form->get('paymentProcessors');
* @return void
* @access public
*/
- static function preProcess(&$form) {
+ public static function preProcess(&$form) {
$session = CRM_Core_Session::singleton();
$contactID = $form->_contactID;
*
* @static
*/
- static function buildQuickForm(&$form) {
+ public static function buildQuickForm(&$form) {
$form->assign('fieldSetTitle', ts('Organization Details'));
$form->assign('buildOnBehalfForm', TRUE);
* @return int
* @access public
*/
- function getAction() {
+ public function getAction() {
if ($this->_action & CRM_Core_Action::PREVIEW) {
return CRM_Core_Action::VIEW | CRM_Core_Action::PREVIEW;
}
* @return void
* @access public
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
return $this->_defaults;
}
* @return void
* @access public
*/
- function assignToTemplate() {
+ public function assignToTemplate() {
$name = CRM_Utils_Array::value('billing_first_name', $this->_params);
if (!empty($this->_params['billing_middle_name'])) {
$name .= " {$this->_params['billing_middle_name']}";
* @return void
* @access public
*/
- function buildCustom($id, $name, $viewOnly = FALSE, $profileContactType = NULL, $fieldTypes = NULL) {
+ public function buildCustom($id, $name, $viewOnly = FALSE, $profileContactType = NULL, $fieldTypes = NULL) {
if ($id) {
$contactID = $this->getContactID();
*
* @return null|string
*/
- function checkTemplateFileExists($suffix = NULL) {
+ public function checkTemplateFileExists($suffix = NULL) {
if ($this->_id) {
$templateFile = "CRM/Contribute/Form/Contribution/{$this->_id}/{$this->_name}.{$suffix}tpl";
$template = CRM_Core_Form::getTemplate();
/**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
$fileName = $this->checkTemplateFileExists();
return $fileName ? $fileName : parent::getTemplateFileName();
}
/**
* @return string
*/
- function overrideExtraTemplateFileName() {
+ public function overrideExtraTemplateFileName() {
$fileName = $this->checkTemplateFileExists('extra.');
return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
}
*/
protected $_chartType = NULL;
- function preProcess() {
+ public function preProcess() {
$this->_year = CRM_Utils_Request::retrieve('year', 'Int', $this);
$this->_chartType = CRM_Utils_Request::retrieve('type', 'String', $this);
*
* @return array defaults
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
//some child classes calling setdefaults directly w/o preprocess.
$this->_values = $this->get('values');
if (!is_array($this->_values)) {
}
}
- function endPostProcess() {
+ public function endPostProcess() {
// make submit buttons keep the current working tab opened, or save and next tab
if ($this->_action & CRM_Core_Action::UPDATE) {
$className = CRM_Utils_String::getClassName($this->_name);
/**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
if ($this->controller->getPrint() || $this->getVar('_id') <= 0 ||
($this->_action & CRM_Core_Action::DELETE) ||
(CRM_Utils_String::getClassName($this->_name) == 'AddProduct')
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if ($this->_pid) {
*
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = parent::setDefaultValues();
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
CRM_Utils_System::setTitle(ts('Contribution Amounts') . " ($title)");
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
//as for separate membership payment we has to have
//contribution amount section enabled, hence to disable it need to
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = parent::setDefaultValues();
if ($this->_id) {
* @access public
* @static
*/
- static function formRule($fields, $files, $contributionPageId) {
+ public static function formRule($fields, $files, $contributionPageId) {
$errors = array();
$preProfileType = $postProfileType = NULL;
// for membership profile make sure Membership section is enabled
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if (isset($this->_id)) {
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = parent::setDefaultValues();
$soft_credit_types = CRM_Core_OptionGroup::values('soft_credit_type', TRUE, FALSE, FALSE, NULL, 'name');
* @static
* @access public
*/
- static function formRule($values, $files, $self) {
+ public static function formRule($values, $files, $self) {
$errors = array();
$contributionPageId = $self->_id;
//CRM-4286
*
* @return array
*/
- static function build(&$form) {
+ public static function build(&$form) {
$tabs = $form->get('tabHeader');
if (!$tabs || empty($_GET['reset'])) {
$tabs = self::process($form);
*
* @return array
*/
- static function process(&$form) {
+ public static function process(&$form) {
if ($form->getVar('_id') <= 0) {
return NULL;
}
/**
* @param $form
*/
- static function reset(&$form) {
+ public static function reset(&$form) {
$tabs = self::process($form);
$form->set('tabHeader', $tabs);
}
*
* @return int|string
*/
- static function getCurrentTab($tabs) {
+ public static function getCurrentTab($tabs) {
static $current = FALSE;
if ($current) {
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
CRM_Utils_System::setTitle(ts('Thank-you and Receipting') . " ($title)");
return parent::setDefaultValues();
* @access public
* @static
*/
- static function formRule($fields, $files, $options) {
+ public static function formRule($fields, $files, $options) {
$errors = array();
// if is_email_receipt is set, the receipt message must be non-empty
protected $_widget;
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$this->_widget = new CRM_Contribute_DAO_Widget();
/**
*
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
// check if there is a widget already created
if ($this->_widget) {
return $defaults;
}
- function buildQuickForm() {
+ public function buildQuickForm() {
$attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Widget');
$this->addElement('checkbox',
return empty($errors) ? TRUE : $errors;
}
- function postProcess() {
+ public function postProcess() {
//to reset quickform elements of next (pcp) page.
if ($this->controller->getNextName('Widget') == 'PCP') {
$this->controller->resetPage('PCP');
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = parent::setDefaultValues();
if ($this->_id) {
$params = array('id' => $this->_id);
$this->assign('contributionSummary', $this->get('summary'));
}
- function setDefaultValues() {
+ public function setDefaultValues() {
if (empty($this->_defaults
['contribution_status'])) {
$this->_defaults['contribution_status'][1] = 1;
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
parent::buildQuickForm();
// text for sort_name
$this->addElement('text',
* @return void
* @access public
*/
- function postProcess() {
+ public function postProcess() {
if ($this->_done) {
return;
}
$controller->run();
}
- function fixFormValues() {
+ public function fixFormValues() {
// if this search has been forced
// then see if there are any get values, and if so over-ride the post values
// note that this means that GET over-rides POST :)
));
}
- function postProcess() {
+ public function postProcess() {
$params = $this->controller->exportValues($this->_name);
$parent = $this->controller->getParent();
$parent->set('searchResult', 1);
* @return void
* @access static
*/
- static function preProcess(&$form) {
+ public static function preProcess(&$form) {
$contriDAO = new CRM_Contribute_DAO_Contribution();
$contriDAO->id = $form->_id;
$contriDAO->find(TRUE);
*
* @return void
*/
- static function buildQuickForm(&$form) {
+ public static function buildQuickForm(&$form) {
if ($form->_mode == 'live' && !empty($form->_honor_block_is_active)) {
$ufJoinDAO = new CRM_Core_DAO_UFJoin();
$ufJoinDAO->module = 'soft_credit';
* @param $defaults
* @param $form
*/
- static function setDefaultValues(&$defaults, &$form) {
+ public static function setDefaultValues(&$defaults, &$form) {
//Used to hide/unhide PCP and/or Soft-credit Panes
$noPCP = $noSoftCredit = TRUE;
if (!empty($form->_softCreditInfo['soft_credit'])) {
* @access public
* @static
*/
- static function formRule($fields, $errors, $self) {
+ public static function formRule($fields, $errors, $self) {
$errors = array();
// if honor roll fields are populated but no PCP is selected
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
self::preProcessCommon($this);
}
* @param CRM_Core_Form $form
* @param bool $useTable
*/
- static function preProcessCommon(&$form, $useTable = FALSE) {
+ public static function preProcessCommon(&$form, $useTable = FALSE) {
$form->_contributionIds = array();
$values = $form->controller->exportValues($form->get('searchFormName'));
* @return void
* @access public
*/
- function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
+ public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
$this->addButtons(array(
array(
'type' => $nextType,
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
/*
* initialize the task and row fields
*/
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$ufGroupId = $this->get('ufGroupId');
if (!$ufGroupId) {
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if (empty($this->_fields)) {
return;
}
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->addDefaultButtons(ts('Delete Contributions'), 'done');
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
if ($id) {
$this->_contributionIds = array($id);
* @static
* @access public
*/
- static function formRule($values) {
+ public static function formRule($values) {
$errors = array();
if ($values['output'] == 'email_invoice' && empty($values['from_email_address'])) {
* @static
*
*/
- static function printPDF($contribIDs, &$params, $contactIds, &$form) {
+ public static function printPDF($contribIDs, &$params, $contactIds, &$form) {
// get all the details needed to generate a invoice
$messageInvoice = array();
$invoiceTemplate = CRM_Core_Smarty::singleton();
/**
* Callback to perform action on Print Invoice button.
*/
- static function getPrintPDF() {
+ public static function getPrintPDF() {
$contributionId = CRM_Utils_Request::retrieve('id', 'Positive', CRM_Core_DAO::$_nullObject, FALSE);
$contributionIDs = array($contributionId);
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, FALSE);
/**
* Set default values
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaultFormat = CRM_Core_BAO_PdfFormat::getDefaultValues();
return array('pdf_format_id' => $defaultFormat['id'], 'receipt_update' => 1, 'override_privacy' => 0);
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->skipOnHold = $this->skipDeceased = FALSE;
CRM_Contact_Form_Task_PDFLetterCommon::preProcess($this);
// store case id if present
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if (isset($this->_activityId)) {
$params = array('id' => $this->_activityId);
*
* @return void
*/
- static function postProcess(&$form) {
+ public static function postProcess(&$form) {
list($formValues, $categories, $html_message, $messageToken, $returnProperties) = self::processMessageTemplate($form);
$isPDF = FALSE;
$emailParams = array();
*
* @return bool
*/
- static function isValidHTMLWithTableSeparator($tokens, $html) {
+ public static function isValidHTMLWithTableSeparator($tokens, $html) {
$relevantEntities = array('contribution');
foreach ($relevantEntities as $entity) {
if (isset($tokens[$entity]) && is_array($tokens[$entity])) {
*
* @return bool
*/
- static function isHtmlTokenInTableCell($token, $entity, $textToSearch) {
+ public static function isHtmlTokenInTableCell($token, $entity, $textToSearch) {
$tokenToMatch = $entity . '.' . $token;
$dontCare = array();
$within = preg_match_all("|<td.+?{".$tokenToMatch."}.+?</td|si", $textToSearch, $dontCare);
*
* @return array:
*/
- static function buildContributionArray($groupBy, $form, $returnProperties, $skipOnHold, $skipDeceased, $messageToken, $task, $separator) {
+ public static function buildContributionArray($groupBy, $form, $returnProperties, $skipOnHold, $skipDeceased, $messageToken, $task, $separator) {
$contributions = $contacts = $notSent = array();
$contributionIDs = $form->getVar('_contributionIds');
if ($form->_includesSoftCredits) {
*
* @return array
*/
- static function combineContributions($existing, $contribution, $separator) {
+ public static function combineContributions($existing, $contribution, $separator) {
foreach ($contribution as $field => $value) {
$existing[$field] = isset($existing[$field]) ? $existing[$field] . $separator : '';
$existing[$field] .= $value;
* @param $groupBy
* @param int $groupByID
*/
- static function assignCombinedContributionValues($contact, $contributions, $groupBy, $groupByID) {
+ public static function assignCombinedContributionValues($contact, $contributions, $groupBy, $groupByID) {
if (!defined('CIVICRM_MAIL_SMARTY') || !CIVICRM_MAIL_SMARTY) {
return;
}
*
* @return bool
*/
- static function emailLetter($contact, $html, $is_pdf, $format = array(), $params = array()) {
+ public static function emailLetter($contact, $html, $is_pdf, $format = array(), $params = array()) {
try {
if(empty($contact['email'])) {
return FALSE;
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
/*
* initialize the task and row fields
*/
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$types = array('Contribution');
$profiles = CRM_Core_BAO_UFGroup::getProfiles($types, TRUE);
*
* @return void
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Contribute_Form_Task_PickProfile', 'formRule'));
}
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
return TRUE;
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preprocess();
// set print view, so that print templates are called
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
//
// just need to add a javacript to popup the window for printing
//
* @return void
* @access public
*/
- function preProcess() {}
+ public function preProcess() {}
/**
* Build the form object
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$rows = array();
// display name and contribution details of all selected contacts
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$id = CRM_Utils_Request::retrieve('id', 'Positive',
$this, FALSE
);
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$seen = $errors = array();
foreach ($fields as $name => $value) {
if (strpos($name, 'trxn_id_') !== FALSE) {
*
* @return array
*/
- static function &getDetails($contributionIDs) {
+ public static function &getDetails($contributionIDs) {
$query = "
SELECT c.id as contribution_id,
c.contact_id as contact_id ,
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$this->_defaults = array();
if ($this->_subscriptionDetails->contact_id) {
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
CRM_Core_Form::validateMandatoryFields($self->_fields, $fields, $errors);
*/
public $_contactID;
- function preProcess() {
+ public function preProcess() {
$this->_crid = CRM_Utils_Request::retrieve('crid', 'Integer', $this, FALSE);
if ($this->_crid) {
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$this->_defaults = array();
$this->_defaults['amount'] = $this->_subscriptionDetails->amount;
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
// lets get around the time limit issue if possible, CRM-2113
* @param string $dataPattern
* @param null $softCreditField
*/
- function __construct($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//', $softCreditField = NULL) {
+ public function __construct($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//', $softCreditField = NULL) {
$this->_name = $name;
$this->_title = $title;
$this->_type = $type;
$this->_value = NULL;
}
- function resetValue() {
+ public function resetValue() {
$this->_value = NULL;
}
* The value is in string format. convert the value to the type of this field
* and set the field value with the appropriate type
*/
- function setValue($value) {
+ public function setValue($value) {
$this->_value = $value;
}
/**
* @return bool
*/
- function validate() {
+ public function validate() {
if (CRM_Utils_System::isNull($this->_value)) {
return TRUE;
* @static
* @access public
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
$fieldMessage = NULL;
$contactORContributionId = $self->_onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE ? 'contribution_id' : 'contribution_contact_id';
* @return void
* @access public
*/
- function setActiveFields($fieldKeys) {
+ public function setActiveFields($fieldKeys) {
$this->_activeFieldCount = count($fieldKeys);
foreach ($fieldKeys as $key) {
if (empty($this->_fields[$key])) {
/**
* @param array $elements
*/
- function setActiveFieldSoftCredit($elements) {
+ public function setActiveFieldSoftCredit($elements) {
for ($i = 0; $i < count($elements); $i++) {
$this->_activeFields[$i]->_softCreditField = $elements[$i];
}
/**
* @param array $elements
*/
- function setActiveFieldSoftCreditType($elements) {
+ public function setActiveFieldSoftCreditType($elements) {
for ($i = 0; $i < count($elements); $i++) {
$this->_activeFields[$i]->_softCreditType = $elements[$i];
}
* @return array (reference ) associative array of name/value pairs
* @access public
*/
- function &getActiveFieldParams() {
+ public function &getActiveFieldParams() {
$params = array();
for ($i = 0; $i < $this->_activeFieldCount; $i++) {
if (isset($this->_activeFields[$i]->_value)) {
* @param string $headerPattern
* @param string $dataPattern
*/
- function addField($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//') {
+ public function addField($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//') {
if (empty($name)) {
$this->_fields['doNotImport'] = new CRM_Contribute_Import_Field($name, $title, $type, $headerPattern, $dataPattern);
}
* @return void
* @access public
*/
- function set($store, $mode = self::MODE_SUMMARY) {
+ public function set($store, $mode = self::MODE_SUMMARY) {
$store->set('fileSize', $this->_fileSize);
$store->set('lineCount', $this->_lineCount);
$store->set('seperator', $this->_seperator);
* @return void
* @access public
*/
- static function exportCSV($fileName, $header, $data) {
+ public static function exportCSV($fileName, $header, $data) {
$output = array();
$fd = fopen($fileName, 'w');
*
* @return string
*/
- static function errorFileName($type) {
+ public static function errorFileName($type) {
$fileName = NULL;
if (empty($type)) {
return $fileName;
*
* @return string
*/
- static function saveFileName($type) {
+ public static function saveFileName($type) {
$fileName = NULL;
if (empty($type)) {
return $fileName;
/**
* Class constructor
*/
- function __construct(&$mapperKeys, $mapperSoftCredit = NULL, $mapperPhoneType = NULL, $mapperSoftCreditType = NULL) {
+ public function __construct(&$mapperKeys, $mapperSoftCredit = NULL, $mapperPhoneType = NULL, $mapperSoftCreditType = NULL) {
parent::__construct();
$this->_mapperKeys = &$mapperKeys;
$this->_mapperSoftCredit = &$mapperSoftCredit;
* @return void
* @access public
*/
- function init() {
+ public function init() {
$fields = CRM_Contribute_BAO_Contribution::importableFields($this->_contactType, FALSE);
$fields = array_merge($fields,
* @return boolean
* @access public
*/
- function mapField(&$values) {
+ public function mapField(&$values) {
return CRM_Import_Parser::VALID;
}
* @return boolean the result of this processing
* @access public
*/
- function preview(&$values) {
+ public function preview(&$values) {
return $this->summary($values);
}
* @return boolean the result of this processing
* @access public
*/
- function summary(&$values) {
+ public function summary(&$values) {
$erroneousField = NULL;
$response = $this->setActiveFieldValues($values, $erroneousField);
* @return boolean the result of this processing
* @access public
*/
- function import($onDuplicate, &$values) {
+ public function import($onDuplicate, &$values) {
// first make sure this is a valid line
$response = $this->summary($values);
if ($response != CRM_Import_Parser::VALID) {
/**
* Process pledge payments
*/
- function processPledgePayments(&$formatted) {
+ public function processPledgePayments(&$formatted) {
if (!empty($formatted['pledge_payment_id']) && !empty($formatted['pledge_id'])) {
//get completed status
$completeStatusID = CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name');
* @return array
* @access public
*/
- function &getImportedContributions() {
+ public function &getImportedContributions() {
return $this->_newContributions;
}
* @return void
* @access public
*/
- function fini() {}
+ public function fini() {}
}
* @return array $_configureActionLinks
*
*/
- function &configureActionLinks() {
+ public function &configureActionLinks() {
// check if variable _actionsLinks is populated
if (!isset(self::$_configureActionLinks)) {
$urlString = 'civicrm/admin/contribute/';
* @return array $_onlineContributionLinks.
*
*/
- function &onlineContributionLinks() {
+ public function &onlineContributionLinks() {
if (!isset(self::$_onlineContributionLinks)) {
$urlString = 'civicrm/contribute/transact';
$urlParams = 'reset=1&id=%%id%%';
* @return array $_contributionLinks
*
*/
- function &contributionLinks() {
+ public function &contributionLinks() {
if (!isset(self::$_contributionLinks)) {
//get contribution dates.
$dates = CRM_Contribute_BAO_Contribution::getContributionDates();
* @access public
*
*/
- function run() {
+ public function run() {
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String',
// default to 'browse'
* @return void
* @access public
*/
- function copy() {
+ public function copy() {
$gid = CRM_Utils_Request::retrieve('gid', 'Positive',
$this, TRUE, 0, 'GET'
);
* @access public
* @static
*/
- function browse($action = NULL) {
+ public function browse($action = NULL) {
$this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter',
'String',
$this
}
}
- function search() {
+ public function search() {
if (isset($this->_action) &
(CRM_Core_Action::ADD |
CRM_Core_Action::UPDATE |
*
* @return int|string
*/
- function whereClause(&$params, $sortBy = TRUE) {
+ public function whereClause(&$params, $sortBy = TRUE) {
$values = $clauses = array();
$title = $this->get('title');
$createdId = $this->get('cid');
* @param $whereClause
* @param array $whereParams
*/
- function pager($whereClause, $whereParams) {
+ public function pager($whereClause, $whereParams) {
$params['status'] = ts('Contribution %%StatusMessage%%');
$params['csvString'] = NULL;
* @param $whereClause
* @param array $whereParams
*/
- function pagerAtoZ($whereClause, $whereParams) {
+ public function pagerAtoZ($whereClause, $whereParams) {
$query = "
SELECT DISTINCT UPPER(LEFT(title, 1)) as sort_name
*
* @return array
*/
- function formatConfigureLinks($sectionsInfo) {
+ public function formatConfigureLinks($sectionsInfo) {
//build the formatted configure links.
$formattedConfLinks = self::configureActionLinks();
foreach ($formattedConfLinks as $act => & $link) {
}
}
- function preProcess() {
+ public function preProcess() {
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'view');
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
if ($this->_action & CRM_Core_Action::VIEW) {
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
CRM_Utils_System::setTitle(ts('CiviContribute'));
$status = array('Valid', 'Cancelled');
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
$controller = new CRM_Core_Controller_Simple('CRM_Contribute_Form_Search',
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Contribute_BAO_ManagePremiums';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
* @access public
*
*/
- function run() {
+ public function run() {
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String',
* @access public
* @static
*/
- function browse() {
+ public function browse() {
// get all custom groups sorted by weight
$premiums = array();
$dao = new CRM_Contribute_DAO_Product();
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Contribute_Form_ManagePremiums';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Manage Premiums';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/contribute/managePremiums';
}
}
*
*/
class CRM_Contribute_Page_PaymentInfo extends CRM_Core_Page {
- function preProcess() {
+ public function preProcess() {
$this->_component = CRM_Utils_Request::retrieve('component', 'String', $this, TRUE);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$this->assign('component', $this->_component);
}
- function browse() {
+ public function browse() {
$getTrxnInfo = $this->_context == 'transaction' ? TRUE : FALSE;
$paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component, $getTrxnInfo, TRUE);
if ($this->_context == 'payment_info') {
/**
* @return string
*/
- function run() {
+ public function run() {
$this->preProcess();
if ($this->_action) {
$this->browse();
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Contribute_BAO_Premium';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
// helper variable for nicer formatting
$deleteExtra = ts('Are you sure you want to remove this product form this page?');
* @access public
*
*/
- function run() {
+ public function run() {
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String',
// default to 'browse'
* @access public
* @static
*/
- function browse() {
+ public function browse() {
// get all custom groups sorted by weight
$premiums = array();
$pageID = CRM_Utils_Request::retrieve('id', 'Positive',
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Contribute_Form_ContributionPage_Premium';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Configure Premiums';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return CRM_Utils_System::currentPath();
}
}
* return null
* @access public
*/
- function run() {
+ public function run() {
$task = CRM_Utils_Request::retrieve('task', 'String', CRM_Core_DAO::$_nullObject);
$result = CRM_Utils_Request::retrieve('result', 'Integer', CRM_Core_DAO::$_nullObject);
* @return array
* @access public
*/
- static function &recurLinks($recurID = FALSE, $context = 'contribution') {
+ public static function &recurLinks($recurID = FALSE, $context = 'contribution') {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::VIEW => array(
* return null
* @access public
*/
- function browse() {
+ public function browse() {
// add annual contribution
$annual = array();
list($annual['count'],
* return null
* @access public
*/
- function view() {
+ public function view() {
$controller = new CRM_Core_Controller_Simple(
'CRM_Contribute_Form_ContributionView',
ts('View Contribution'),
* return null
* @access public
*/
- function edit() {
+ public function edit() {
// set https for offline cc transaction
$mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
if ($mode == 'test' || $mode == 'live') {
return $controller->run();
}
- function preProcess() {
+ public function preProcess() {
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
// check if we can process credit card contribs
return parent::run();
}
- function setContext() {
+ public function setContext() {
$qfKey = CRM_Utils_Request::retrieve('key', 'String', $this);
$context = CRM_Utils_Request::retrieve('context', 'String',
$this, FALSE, 'search'
* return null
* @access public
*/
- function listContribution() {
+ public function listContribution() {
$controller = new CRM_Core_Controller_Simple(
'CRM_Contribute_Form_Search',
ts('Contributions'),
* return null
* @access public
*/
- function run() {
+ public function run() {
$invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$this->assign('invoicing', $invoicing);
* @return array
* @access public
*/
- static function &links($componentId = NULL, $componentAction = NULL, $key = NULL, $compContext = NULL) {
+ public static function &links($componentId = NULL, $componentAction = NULL, $key = NULL, $compContext = NULL) {
$extraParams = NULL;
if ($componentId) {
$extraParams = "&compId={$componentId}&compAction={$componentAction}";
* @param array $params
* @access public
*/
- function getPagerParams($action, &$params) {
+ public function getPagerParams($action, &$params) {
$params['status'] = ts('Contribution') . ' %%StatusMessage%%';
$params['csvString'] = NULL;
if ($this->_limit) {
* @return int Total number of rows
* @access public
*/
- function getTotalCount($action) {
+ public function getTotalCount($action) {
return $this->_query->searchQuery(0, 0, NULL,
TRUE, FALSE,
FALSE, FALSE,
*
* @return int the total number of rows for this action
*/
- function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
+ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
if ($this->_includeSoftCredits) {
// especial sort order when rows include soft credits
$sort = "civicrm_contribution.receive_date DESC, civicrm_contribution.id, civicrm_contribution_soft.id";
/**
* @return mixed
*/
- function alphabetQuery() {
+ public function alphabetQuery() {
return $this->_query->searchQuery(NULL, NULL, NULL, FALSE, FALSE, TRUE);
}
/**
* @return string
*/
- function &getQuery() {
+ public function &getQuery() {
return $this->_query;
}
*
* @return string name of the file
*/
- function getExportFileName($output = 'csv') {
+ public function getExportFileName($output = 'csv') {
return ts('CiviCRM Contribution Search');
}
/**
* @return mixed
*/
- function getSummary() {
+ public function getSummary() {
return $this->_query->summaryContribution($this->_context);
}
}
*
* @return CRM_Contribute_StateMachine_Contribution
*/
- 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 CRM_Contribute_StateMachine_ContributionPage
*/
- function __construct($controller, $action = CRM_Core_Action::NONE) {
+ public function __construct($controller, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);
$session = CRM_Core_Session::singleton();
* @return string the name of the form that will handle the task
* @access protected
*/
- function taskName($controller, $formName = 'Search') {
+ public function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
$value = CRM_Utils_Array::value('task', $_POST);
if (!isset($value)) {
* @return string
* @access public
*/
- function getTaskFormName() {
+ public function getTaskFormName() {
return CRM_Utils_String::getClassName($this->_task);
}
* we dont want to issue a reset of the state session when we are done processing a task
*
*/
- function shouldReset() {
+ public function shouldReset() {
return FALSE;
}
}
* @static
* @access public
*/
- static function &tasks() {
+ public static function &tasks() {
if (!(self::$_tasks)) {
self::$_tasks = array(
1 => array(
* @static
* @access public
*/
- static function &taskTitles() {
+ public static function &taskTitles() {
self::tasks();
$titles = array();
foreach (self::$_tasks as $id => $value) {
* @return array set of tasks that are valid for the user
* @access public
*/
- static function &permissionedTaskTitles($permission, $softCreditFiltering = FALSE) {
+ public static function &permissionedTaskTitles($permission, $softCreditFiltering = FALSE) {
$tasks = array();
if (($permission == CRM_Core_Permission::EDIT)
|| CRM_Core_Permission::check('edit contributions')
* @static
* @access public
*/
- static function getTask($value) {
+ public static function getTask($value) {
self::tasks();
if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) {
// make the print task by default
* @access public
* @static
*/
- static function resolve($str) {
+ public static function resolve($str) {
$action = 0;
if ($str) {
$items = explode('|', $str);
* @static
*
*/
- static function map($item) {
+ public static function map($item) {
$mask = 0;
if (is_array($item)) {
* @static
*
*/
- static function mapItem($item) {
+ public static function mapItem($item) {
$mask = CRM_Utils_Array::value(trim($item), self::$_names);
return $mask ? $mask : 0;
}
* @static
*
*/
- static function description($mask) {
+ public static function description($mask) {
if (!isset($_description)) {
self::$_description = array_flip(self::$_names);
}
* @access public
* @static
*/
- static function &replace(&$str, &$values) {
+ public static function &replace(&$str, &$values) {
foreach ($values as $n => $v) {
$str = str_replace("%%$n%%", $v, $str);
}
* @static
* @access public
*/
- static function mask($permissions) {
+ public static function mask($permissions) {
$mask = NULL;
if (!is_array($permissions) || CRM_Utils_System::isNull($permissions)) {
return $mask;
* @return actionLog array
* @access public
*/
- static function create($params) {
+ public static function create($params) {
$actionLog = new CRM_Core_DAO_ActionLog();
$params['action_date_time'] = CRM_Utils_Array::value('action_date_time', $params, date('YmdHis'));
*
* @return array
*/
- static function getMapping($id = NULL) {
+ public static function getMapping($id = NULL) {
static $_action_mapping;
if ($id && !is_null($_action_mapping) && isset($_action_mapping[$id])) {
* Get all fields of the type Date
*/
- static function getDateFields() {
+ public static function getDateFields() {
$allFields = CRM_Core_BAO_CustomField::getFields('');
$dateFields = array('birth_date' => ts('Birth Date'));
foreach ($allFields as $fieldID => $field) {
* @static
* @access public
*/
- static function getSelection($id = NULL) {
+ public static function getSelection($id = NULL) {
$mapping = self::getMapping();
$activityStatus = CRM_Core_PseudoConstant::activityStatus();
$activityType = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
*
* @return array
*/
- static function getSelection1($id = NULL) {
+ public static function getSelection1($id = NULL) {
$mapping = self::getMapping($id);
$sel4 = $sel5 = array();
$options = array(
* @static
* @access public
*/
- static function &getList($namesOnly = FALSE, $entityValue = NULL, $id = NULL) {
+ public static function &getList($namesOnly = FALSE, $entityValue = NULL, $id = NULL) {
$activity_type = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
$activity_status = CRM_Core_PseudoConstant::activityStatus();
* @return bool|null
* @throws CRM_Core_Exception
*/
- static function sendReminder($contactId, $to, $scheduleID, $from, $tokenParams) {
+ public static function sendReminder($contactId, $to, $scheduleID, $from, $tokenParams) {
$email = $to['email'];
$phoneNumber = $to['phone'];
$schedule = new CRM_Core_DAO_ActionSchedule();
* @static
*
*/
- static function add(&$params, $ids = array()) {
+ public static function add(&$params, $ids = array()) {
$actionSchedule = new CRM_Core_DAO_ActionSchedule();
$actionSchedule->copyValues($params);
* @access public
* @static
*/
- static function retrieve(&$params, &$values) {
+ public static function retrieve(&$params, &$values) {
if (empty($params)) {
return NULL;
}
* @access public
* @static
*/
- static function del($id) {
+ public static function del($id) {
if ($id) {
$dao = new CRM_Core_DAO_ActionSchedule();
$dao->id = $id;
* @return Object DAO object on success, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_ActionSchedule', $id, 'is_active', $is_active);
}
*
* @throws CRM_Core_Exception
*/
- static function sendMailings($mappingID, $now) {
+ public static function sendMailings($mappingID, $now) {
$domainValues = CRM_Core_BAO_Domain::getNameAndEmail();
$fromEmailAddress = "$domainValues[0] <$domainValues[1]>";
*
* @throws API_Exception
*/
- static function buildRecipientContacts($mappingID, $now, $params = array()) {
+ public static function buildRecipientContacts($mappingID, $now, $params = array()) {
$actionSchedule = new CRM_Core_DAO_ActionSchedule();
$actionSchedule->mapping_id = $mappingID;
$actionSchedule->is_active = 1;
*
* @return null|string
*/
- static function permissionedRelationships($field) {
+ public static function permissionedRelationships($field) {
$query = '
SELECT cm.id AS owner_id, cm.contact_id AS owner_contact, m.id AS slave_id, m.contact_id AS slave_contact, cmt.relationship_type_id AS relation_type, rel.contact_id_a, rel.contact_id_b, rel.is_permission_a_b, rel.is_permission_b_a
FROM civicrm_membership m
*
* @return array
*/
- static function processQueue($now = NULL, $params = array()) {
+ public static function processQueue($now = NULL, $params = array()) {
$now = $now ? CRM_Utils_Time::setTime($now) : CRM_Utils_Time::getTime();
$mappings = self::getMapping();
*
* @return null|string
*/
- static function isConfigured($id, $mappingID) {
+ public static function isConfigured($id, $mappingID) {
$queryString = "SELECT count(id) FROM civicrm_action_schedule
WHERE mapping_id = %1 AND
entity_value = %2";
*
* @return array
*/
- static function getRecipientListing($mappingID, $recipientType) {
+ public static function getRecipientListing($mappingID, $recipientType) {
$options = array();
if (!$mappingID || !$recipientType) {
return $options;
* @access public
* @static
*/
- static function create(&$params, $fixAddress = TRUE, $entity = NULL) {
+ public static function create(&$params, $fixAddress = TRUE, $entity = NULL) {
if (!isset($params['address']) || !is_array($params['address'])) {
return;
}
* @access public
* @static
*/
- static function add(&$params, $fixAddress) {
+ public static function add(&$params, $fixAddress) {
static $customFields = NULL;
$address = new CRM_Core_DAO_Address();
* @access public
* @static
*/
- static function fixAddress(&$params) {
+ public static function fixAddress(&$params) {
if (!empty($params['billing_street_address'])) {
//Check address is comming from online contribution / registration page
//Fixed :CRM-5076
* @access public
* @static
*/
- static function dataExists(&$params) {
+ public static function dataExists(&$params) {
//check if location type is set if not return false
if (!isset($params['location_type_id'])) {
return FALSE;
* @access public
* @static
*/
- static function &getValues($entityBlock, $microformat = FALSE, $fieldName = 'contact_id') {
+ public static function &getValues($entityBlock, $microformat = FALSE, $fieldName = 'contact_id') {
if (empty($entityBlock)) {
return NULL;
}
* @return void
* @access public
*/
- function addDisplay($microformat = FALSE) {
+ public function addDisplay($microformat = FALSE) {
$fields = array(
// added this for CRM 1200
'address_id' => $this->id,
* @access public
* @static
*/
- static function allAddress($id, $updateBlankLocInfo = FALSE) {
+ public static function allAddress($id, $updateBlankLocInfo = FALSE) {
if (!$id) {
return NULL;
}
* @access public
* @static
*/
- static function allEntityAddress(&$entityElements) {
+ public static function allEntityAddress(&$entityElements) {
$addresses = array();
if (empty($entityElements)) {
return $addresses;
*
* @return array of address sequence.
*/
- static function addressSequence() {
+ public static function addressSequence() {
$config = CRM_Core_Config::singleton();
$addressSequence = $config->addressSequence();
* @access public
* @static
*/
- static function parseStreetAddress($streetAddress, $locale = NULL) {
+ public static function parseStreetAddress($streetAddress, $locale = NULL) {
$config = CRM_Core_Config::singleton();
/* locales supported include:
* @access public
* @static
*/
- static function validateAddressOptions($fields) {
+ public static function validateAddressOptions($fields) {
static $addressOptions = NULL;
if (!$addressOptions) {
$addressOptions =
* @access public
* @static
*/
- static function checkContactSharedAddress($addressId) {
+ public static function checkContactSharedAddress($addressId) {
$query = 'SELECT count(id) FROM civicrm_address WHERE master_id = %1';
return CRM_Core_DAO::singleValueQuery($query, array(1 => array($addressId, 'Integer')));
}
* @access public
* @static
*/
- static function checkContactSharedAddressFields(&$fields, $contactId) {
+ public static function checkContactSharedAddressFields(&$fields, $contactId) {
if (!$contactId || !is_array($fields) || empty($fields)) {
return;
}
* @access public
* @static
*/
- static function processSharedAddress($addressId, $params) {
+ public static function processSharedAddress($addressId, $params) {
$query = 'SELECT id FROM civicrm_address WHERE master_id = %1';
$dao = CRM_Core_DAO::executeQuery($query, array(1 => array($addressId, 'Integer')));
* @access public
* @static
*/
- static function processSharedAddressRelationship($masterAddressId, $params) {
+ public static function processSharedAddressRelationship($masterAddressId, $params) {
if (!$masterAddressId) {
return;
}
* @access public
* @static
*/
- static function setSharedAddressDeleteStatus($addressId = NULL, $contactId = NULL, $returnStatus = FALSE) {
+ public static function setSharedAddressDeleteStatus($addressId = NULL, $contactId = NULL, $returnStatus = FALSE) {
// check if address that is being deleted has any shared
if ($addressId) {
$entityId = $addressId;
/**
* Call common delete function
*/
- static function del($id) {
+ public static function del($id) {
return CRM_Contact_BAO_Contact::deleteObjectWithPrimary('Address', $id);
}
* @access public
* @static
*/
- static function &getValues($blockName, $params) {
+ public static function &getValues($blockName, $params) {
if (empty($params)) {
return NULL;
}
* @access public
* @static
*/
- static function retrieveBlock(&$block, $blockName) {
+ public static function retrieveBlock(&$block, $blockName) {
// we first get the primary location due to the order by clause
$block->orderBy('is_primary desc, id');
$block->find();
* @access public
* @static
*/
- static function dataExists($blockFields, &$params) {
+ public static function dataExists($blockFields, &$params) {
foreach ($blockFields as $field) {
if (CRM_Utils_System::isNull(CRM_Utils_Array::value($field, $params))) {
return FALSE;
* @access public
* @static
*/
- static function blockExists($blockName, &$params) {
+ public static function blockExists($blockName, &$params) {
// return if no data present
if (empty($params[$blockName]) || !is_array($params[$blockName])) {
return FALSE;
* @access public
* @static
*/
- static function getBlockIds($blockName, $contactId = NULL, $entityElements = NULL, $updateBlankLocInfo = FALSE) {
+ public static function getBlockIds($blockName, $contactId = NULL, $entityElements = NULL, $updateBlankLocInfo = FALSE) {
$allBlocks = array();
$name = ucfirst($blockName);
* @access public
* @static
*/
- static function create($blockName, &$params, $entity = NULL, $contactId = NULL) {
+ public static function create($blockName, &$params, $entity = NULL, $contactId = NULL) {
if (!self::blockExists($blockName, $params)) {
return NULL;
}
* @return void
* @static
*/
- static function blockDelete($blockName, $params) {
+ public static function blockDelete($blockName, $params) {
$name = ucfirst($blockName);
if ($blockName == 'im') {
$name = 'IM';
* @param array $locations
*
*/
- static function sortPrimaryFirst(&$locations){
+ public static function sortPrimaryFirst(&$locations){
uasort($locations, 'self::primaryComparison');
}
* @param array $location2
* @return number
*/
- static function primaryComparison($location1, $location2){
+ public static function primaryComparison($location1, $location2){
$l1 = CRM_Utils_Array::value('is_primary', $location1);
$l2 = CRM_Utils_Array::value('is_primary', $location2);
if ($l1 == $l2) {
* @static
* @access public
*/
- static function synchronize($is_interactive = TRUE) {
+ public static function synchronize($is_interactive = TRUE) {
//start of schronization code
$config = CRM_Core_Config::singleton();
* @access public
* @static
*/
- static function create(&$params, $mail) {
+ public static function create(&$params, $mail) {
$config = CRM_Core_Config::singleton();
$ufID = $config->userSystem->createUser($params, $mail);
* @access public
* @static
*/
- static function buildForm(&$form, $gid, $emailPresent, $action = CRM_Core_Action::NONE) {
+ public static function buildForm(&$form, $gid, $emailPresent, $action = CRM_Core_Action::NONE) {
$config = CRM_Core_Config::singleton();
$showCMS = FALSE;
*
* @return array|bool
*/
- static function formRule($fields, $files, $form) {
+ public static function formRule($fields, $files, $form) {
if (empty($fields['cms_create_account'])) {
return TRUE;
}
* @access public
* @static
*/
- static function userExists(&$contact) {
+ public static function userExists(&$contact) {
$config = CRM_Core_Config::singleton();
$isDrupal = $config->userSystem->is_drupal;
*
* @return object
*/
- static function &dbHandle(&$config) {
+ public static function &dbHandle(&$config) {
$errorScope = CRM_Core_TemporaryErrorScope::ignoreException();
$db_uf = DB::connect($config->userFrameworkDSN);
unset($errorScope);
* @static
* @access public
*/
- static function &getItem($group, $path, $componentID = NULL) {
+ public static function &getItem($group, $path, $componentID = NULL) {
if (self::$_cache === NULL) {
self::$_cache = array();
}
* @static
* @access public
*/
- static function &getItems($group, $componentID = NULL) {
+ public static function &getItems($group, $componentID = NULL) {
if (self::$_cache === NULL) {
self::$_cache = array();
}
* @static
* @access public
*/
- static function setItem(&$data, $group, $path, $componentID = NULL) {
+ public static function setItem(&$data, $group, $path, $componentID = NULL) {
if (self::$_cache === NULL) {
self::$_cache = array();
}
* @static
* @access public
*/
- static function deleteGroup($group = NULL, $path = NULL, $clearAll = TRUE) {
+ public static function deleteGroup($group = NULL, $path = NULL, $clearAll = TRUE) {
$dao = new CRM_Core_DAO_Cache();
if (!empty($group)) {
* @static
* @access private
*/
- static function storeSessionToCache($names, $resetSession = TRUE) {
+ public static function storeSessionToCache($names, $resetSession = TRUE) {
foreach ($names as $key => $sessionName) {
if (is_array($sessionName)) {
$value = null;
/**
* @param string $names
*/
- static function restoreSessionFromCache($names) {
+ public static function restoreSessionFromCache($names) {
foreach ($names as $key => $sessionName) {
if (is_array($sessionName)) {
$value = self::getItem('CiviCRM Session',
* @static
* @access private
*/
- static function cleanup($session = false, $table = false, $prevNext = false) {
+ public static function cleanup($session = false, $table = false, $prevNext = false) {
// clean up the session cache every $cacheCleanUpNumber probabilistically
$cleanUpNumber = 757;
* @return null
* @static
*/
- static function create($params) {
+ public static function create($params) {
self::add($params);
$cache = CRM_Utils_Cache::singleton();
$cache->delete('CRM_Core_Config');
* @return null
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
self::fixParams($params);
// also set a template url so js files can use this
* @return null
* @static
*/
- static function fixParams(&$params) {
+ public static function fixParams(&$params) {
// in our old civicrm.settings.php we were using ISO code for country and
// province limit, now we have changed it to use ids
* @return null
* @static
*/
- static function formatParams(&$params, &$values) {
+ public static function formatParams(&$params, &$values) {
if (empty($params) ||
!is_array($params)
) {
* @return array $defaults
* @static
*/
- static function retrieve(&$defaults) {
+ public static function retrieve(&$defaults) {
$domain = new CRM_Core_DAO_Domain();
//we are initializing config, really can't use, CRM-7863
/**
* @return array
*/
- static function getConfigSettings() {
+ public static function getConfigSettings() {
$config = CRM_Core_Config::singleton();
$url = $dir = $siteName = $siteRoot = NULL;
* - $siteName
* - $siteRoot
*/
- static function getBestGuessSettings() {
+ public static function getBestGuessSettings() {
$config = CRM_Core_Config::singleton();
//CRM-15365 - Fix preg_replace to handle backslash for Windows File Paths
* @return string
* @throws Exception
*/
- static function doSiteMove($defaultValues = array()) {
+ public static function doSiteMove($defaultValues = array()) {
$moveStatus = ts('Beginning site move process...') . '<br />';
// get the current and guessed values
list($oldURL, $oldDir, $oldSiteName, $oldSiteRoot) = self::getConfigSettings();
* @return boolean - true if valid component name and enabling succeeds, else false
* @static
*/
- static function enableComponent($componentName) {
+ public static function enableComponent($componentName) {
$config = CRM_Core_Config::singleton();
if (in_array($componentName, $config->enableComponents)) {
// component is already enabled
return TRUE;
}
- static function disableComponent($componentName) {
+ public static function disableComponent($componentName) {
$config = CRM_Core_Config::singleton();
if (!in_array($componentName, $config->enableComponents) ||
!array_key_exists($componentName, CRM_Core_Component::getComponents())
/**
* @return array
*/
- static function skipVars() {
+ public static function skipVars() {
return array(
'dsn',
'templateCompileDir',
* @access public
* @static
*/
- static function &dataType() {
+ public static function &dataType() {
if (!(self::$_dataType)) {
self::$_dataType = array(
'String' => ts('Alphanumeric'),
/**
* @return array
*/
- static function dataToHtml() {
+ public static function dataToHtml() {
if (!self::$_dataToHtml) {
self::$_dataToHtml = array(
array(
* @access public
* @static
*/
- static function create(&$params) {
+ public static function create(&$params) {
$origParams = array_merge(array(), $params);
if (!isset($params['id'])) {
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
return CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $params, $defaults);
}
* @access public
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
CRM_Utils_System::flushCache();
* @static
* public
*/
- static function getFieldObject($fieldID) {
+ public static function getFieldObject($fieldID) {
$field = new CRM_Core_DAO_CustomField();
// check if we can get the field values from the system cache
* @static
* @access public
*/
- static function getDisplayValue($value, $id, &$options, $contactID = NULL, $fieldID = NULL) {
+ public static function getDisplayValue($value, $id, &$options, $contactID = NULL, $fieldID = NULL) {
$option = &$options[$id];
$attributes = &$option['attributes'];
$html_type = $attributes['html_type'];
*
* @return array
*/
- static function getFileURL($contactID, $cfID, $fileID = NULL, $absolute = FALSE, $multiRecordWhereClause = NULL) {
+ public static function getFileURL($contactID, $cfID, $fileID = NULL, $absolute = FALSE, $multiRecordWhereClause = NULL) {
if ($contactID) {
if (!$fileID) {
$params = array('id' => $cfID);
*
* @return array
*/
- static function &defaultCustomTableSchema(&$params) {
+ public static function &defaultCustomTableSchema(&$params) {
// add the id and extends_id
$table = array(
'name' => $params['name'],
* @param bool $indexExist
* @param bool $triggerRebuild
*/
- static function createField($field, $operation, $indexExist = FALSE, $triggerRebuild = TRUE) {
+ public static function createField($field, $operation, $indexExist = FALSE, $triggerRebuild = TRUE) {
$tableName = CRM_Core_DAO::getFieldValue(
'CRM_Core_DAO_CustomGroup',
$field->custom_group_id,
* @return array(
string) or TRUE
*/
- static function _moveFieldValidate($fieldID, $newGroupID) {
+ public static function _moveFieldValidate($fieldID, $newGroupID) {
$errors = array();
$field = new CRM_Core_DAO_CustomField();
*
* @return void
*/
- static function moveField($fieldID, $newGroupID) {
+ public static function moveField($fieldID, $newGroupID) {
$validation = self::_moveFieldValidate($fieldID, $newGroupID);
if (TRUE !== $validation) {
CRM_Core_Error::fatal(implode(' ', $validation));
* @static
* @public
*/
- static function getTableColumnGroup($fieldID, $force = FALSE) {
+ public static function getTableColumnGroup($fieldID, $force = FALSE) {
$cacheKey = "CRM_Core_DAO_CustomField_CustomGroup_TableColumn_{$fieldID}";
$cache = CRM_Utils_Cache::singleton();
$fieldValues = $cache->get($cacheKey);
* @return void
* @static
*/
- static function fixOptionGroups($customFieldId, $optionGroupId) {
+ public static function fixOptionGroups($customFieldId, $optionGroupId) {
// check if option group belongs to any custom Field else delete
// get the current option group
$currentOptionGroupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField',
* @return void
* @static
*/
- static function checkOptionGroup($optionGroupId) {
+ public static function checkOptionGroup($optionGroupId) {
$query = "
SELECT count(*)
FROM civicrm_custom_field
*
* @return null|string
*/
- static function getOptionGroupDefault($optionGroupId, $htmlType) {
+ public static function getOptionGroupDefault($optionGroupId, $htmlType) {
$query = "
SELECT default_value, html_type
FROM civicrm_custom_field
*
* @throws Exception
*/
- static function buildOption($field, &$options) {
+ public static function buildOption($field, &$options) {
// Fixme - adding anything but options to the $options array is a bad idea
// What if an option had the key 'attributes'?
$options['attributes'] = array(
*
* @return null
*/
- static function getCustomFieldID($fieldLabel, $groupTitle = NULL) {
+ public static function getCustomFieldID($fieldLabel, $groupTitle = NULL) {
$params = array(1 => array($fieldLabel, 'String'));
if ($groupTitle) {
$params[2] = array($groupTitle, 'String');
* Given ID of a custom field, return its name as well as the name of the custom group it belongs to.
*
*/
- static function getNameFromID($ids) {
+ public static function getNameFromID($ids) {
if (is_array($ids)) {
$ids = implode(',', $ids);
}
* @return array $errors validation errors.
* @static
*/
- static function validateCustomData($params) {
+ public static function validateCustomData($params) {
$errors = array();
if (!is_array($params) || empty($params)) {
return $errors;
*
* @return bool
*/
- static function isMultiRecordField($customId) {
+ public static function isMultiRecordField($customId) {
$isMultipleWithGid = FALSE;
if (!is_numeric($customId)) {
$customId = self::getKeyID($customId);
* @param CRM_Core_DAO_CustomField|array $field
* @return bool
*/
- static function isSerialized($field) {
+ public static function isSerialized($field) {
// Fields retrieved via api are an array, or from the dao are an object. We'll accept either.
$field = (array) $field;
// FIXME: Currently the only way to know if data is serialized is by looking at the html_type. It would be cleaner to decouple this.
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function create(&$params) {
+ public static function create(&$params) {
// create custom group dao, populate fields and then save.
$group = new CRM_Core_DAO_CustomGroup();
$group->title = $params['title'];
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
return CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomGroup', $params, $defaults);
}
* @static
* @access public
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
// reset the cache
CRM_Core_BAO_Cache::deleteGroup('contact fields');
*
* @return CRM_Core_DAO_CustomGroup
*/
- static function getAllCustomGroupsByBaseEntity($entityType) {
+ public static function getAllCustomGroupsByBaseEntity($entityType) {
$customGroupDAO = new CRM_Core_DAO_CustomGroup();
self::_addWhereAdd($customGroupDAO, $entityType, NULL, TRUE);
return $customGroupDAO;
* @param bool $inactiveNeeded
* @param int $action
*/
- static function setDefaults(&$groupTree, &$defaults, $viewMode = FALSE, $inactiveNeeded = FALSE, $action = CRM_Core_Action::NONE) {
+ public static function setDefaults(&$groupTree, &$defaults, $viewMode = FALSE, $inactiveNeeded = FALSE, $action = CRM_Core_Action::NONE) {
foreach ($groupTree as $id => $group) {
if (!isset($group['fields'])) {
continue;
* @param array $params
* @param bool $skipFile
*/
- static function postProcess(&$groupTree, &$params, $skipFile = FALSE) {
+ public static function postProcess(&$groupTree, &$params, $skipFile = FALSE) {
// Get the Custom form values and groupTree
// first reset all checkbox and radio data
foreach ($groupTree as $groupID => $group) {
* @access public
* @static
*/
- static function buildQuickForm(&$form, &$groupTree, $inactiveNeeded = FALSE, $prefix = '') {
+ public static function buildQuickForm(&$form, &$groupTree, $inactiveNeeded = FALSE, $prefix = '') {
$form->assign_by_ref("{$prefix}groupTree", $groupTree);
// this is fix for date field
* @access public
* @static
*/
- static function extractGetParams(&$form, $type) {
+ public static function extractGetParams(&$form, $type) {
if (empty($_GET)) {
return array();
}
* @static
* @access public
*/
- static function checkCustomField($customFieldId, &$removeCustomFieldTypes) {
+ public static function checkCustomField($customFieldId, &$removeCustomFieldTypes) {
$query = "SELECT cg.extends as extends
FROM civicrm_custom_group as cg, civicrm_custom_field as cf
WHERE cg.id = cf.custom_group_id
* @return string
* @throws Exception
*/
- static function mapTableName($table) {
+ public static function mapTableName($table) {
switch ($table) {
case 'Contact':
case 'Individual':
/**
* @param $group
*/
- static function createTable($group) {
+ public static function createTable($group) {
$params = array(
'name' => $group->table_name,
'is_multiple' => $group->is_multiple ? 1 : 0,
*
* @return array $formattedGroupTree
*/
- static function formatGroupTree(&$groupTree, $groupCount = 1, &$form) {
+ public static function formatGroupTree(&$groupTree, $groupCount = 1, &$form) {
$formattedGroupTree = array();
$uploadNames = array();
*
* @return array|int
*/
- static function buildCustomDataView(&$form, &$groupTree, $returnCount = FALSE, $gID = NULL, $prefix = NULL, $customValueId = NULL) {
+ public static function buildCustomDataView(&$form, &$groupTree, $returnCount = FALSE, $gID = NULL, $prefix = NULL, $customValueId = NULL) {
$details = array();
foreach ($groupTree as $key => $group) {
if ($key === 'info') {
*
* @return array|null|string
*/
- static function formatCustomValues(&$values, &$field, $dncOptionPerLine = FALSE) {
+ public static function formatCustomValues(&$values, &$field, $dncOptionPerLine = FALSE) {
$value = $values['data'];
//changed isset CRM-4601
return $groupLabels;
}
- static function dropAllTables() {
+ public static function dropAllTables() {
$query = "SELECT table_name FROM civicrm_custom_group";
$dao = CRM_Core_DAO::executeQuery($query);
* @return boolean true if empty otherwise false.
* @access public
*/
- static function isGroupEmpty($gID) {
+ public static function isGroupEmpty($gID) {
if (!$gID) {
return;
}
* @return array of types.
* @access public
*/
- static function getExtendedObjectTypes(&$types = array()) {
+ public static function getExtendedObjectTypes(&$types = array()) {
static $flag = FALSE, $objTypes = array();
if (!$flag) {
*
* @return bool
*/
- static function hasReachedMaxLimit($customGroupId, $entityId) {
+ public static function hasReachedMaxLimit($customGroupId, $entityId) {
//check whether the group is multiple
$isMultiple = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'is_multiple');
$isMultiple = ($isMultiple) ? TRUE : FALSE;
/**
* @return array
*/
- static function getMultipleFieldGroup() {
+ public static function getMultipleFieldGroup() {
$multipleGroup = array();
$dao = new CRM_Core_DAO_CustomGroup();
$dao->is_multiple = 1;
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$customOption = new CRM_Core_DAO_OptionValue();
$customOption->copyValues($params);
if ($customOption->find(TRUE)) {
* @static
* @access public
*/
- static function getOptionLabel($fieldId, $value, $htmlType = NULL, $dataType = NULL) {
+ public static function getOptionLabel($fieldId, $value, $htmlType = NULL, $dataType = NULL) {
if (!$fieldId) {
return NULL;
}
* @static
* @access public
*/
- static function del($optionId) {
+ public static function del($optionId) {
// get the customFieldID
$query = "
SELECT f.id as id, f.data_type as dataType
*
* @throws Exception
*/
- static function updateCustomValues($params) {
+ public static function updateCustomValues($params) {
$optionDAO = new CRM_Core_DAO_OptionValue();
$optionDAO->id = $params['optionId'];
$optionDAO->find(TRUE);
*
* @return array
*/
- static function valuesByID($customFieldID, $optionGroupID = NULL) {
+ public static function valuesByID($customFieldID, $optionGroupID = NULL) {
if (!$optionGroupID) {
$optionGroupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField',
$customFieldID,
*
* @access public
*/
- function __construct($ids, $contactSearch = FALSE, $locationSpecificFields = array()) {
+ public function __construct($ids, $contactSearch = FALSE, $locationSpecificFields = array()) {
$this->_ids = &$ids;
$this->_locationSpecificCustomFields = $locationSpecificFields;
* @return void
* @access public
*/
- function select() {
+ public function select() {
if (empty($this->_fields)) {
return;
}
*
* @access public
*/
- function where() {
+ public function where() {
foreach ($this->_ids as $id => $values) {
// Fixed for Isuue CRM 607
* @return array array of strings
* @access public
*/
- function query() {
+ public function query() {
$this->select();
$this->where();
* @param $value
* @param $grouping
*/
- function searchRange(&$id, &$label, $type, $fieldName, &$value, &$grouping) {
+ public function searchRange(&$id, &$label, $type, $fieldName, &$value, &$grouping) {
$qill = array();
if (isset($value['from'])) {
* @return void
* @static
*/
- static function deleteCustomValue($customValueID, $customGroupID) {
+ public static function deleteCustomValue($customValueID, $customGroupID) {
// first we need to find custom value table, from custom group ID
$tableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupID, 'table_name');
*
* @throws Exception
*/
- static function create(&$customParams) {
+ public static function create(&$customParams) {
if (empty($customParams) ||
!is_array($customParams)
) {
* @param $entityTable
* @param int $entityID
*/
- static function store(&$params, $entityTable, $entityID) {
+ public static function store(&$params, $entityTable, $entityID) {
$cvParams = array();
foreach ($params as $fieldID => $param) {
foreach ($param as $index => $customValue) {
* @param int $entityID
* @param $customFieldExtends
*/
- static function postProcess(&$params, &$customFields, $entityTable, $entityID, $customFieldExtends) {
+ public static function postProcess(&$params, &$customFields, $entityTable, $entityID, $customFieldExtends) {
$customData = CRM_Core_BAO_CustomField::postProcess($params,
$customFields,
$entityID,
* @return array
* @static
*/
- static function setValues(&$params) {
+ public static function setValues(&$params) {
if (!isset($params['entityID']) ||
CRM_Utils_Type::escape($params['entityID'], 'Integer', FALSE) === NULL
* @return array
* @static
*/
- static function &getValues(&$params) {
+ public static function &getValues(&$params) {
if (empty($params)) {
return NULL;
}
*
* @return object
*/
- static function create($params) {
+ public static function create($params) {
$hook = empty($params['id']) ? 'create' : 'edit';
CRM_Utils_Hook::pre($hook, 'Dashboard', CRM_Utils_Array::value('id', $params), $params);
$dao = self::addDashlet($params);
* @access public
* @static
*/
- static function getDashlets($all = TRUE, $checkPermission = TRUE) {
+ public static function getDashlets($all = TRUE, $checkPermission = TRUE) {
$dashlets = array();
$dao = new CRM_Core_DAO_Dashboard();
* @access public
* @static
*/
- static function getContactDashlets($flatFormat = FALSE, $contactID = NULL) {
+ public static function getContactDashlets($flatFormat = FALSE, $contactID = NULL) {
$dashlets = array();
if (!$contactID) {
*
* @return array of dashboard_id's
*/
- static function initializeDashlets() {
+ public static function initializeDashlets() {
$dashlets = array();
$getDashlets = civicrm_api3("Dashboard", "get", array('domain_id' => CRM_Core_Config::domainID(), 'option.limit' => 0));
$contactID = CRM_Core_Session::singleton()->get('userID');
*
* @return boolean true if use has permission else false
*/
- static function checkPermission($permission, $operator) {
+ public static function checkPermission($permission, $operator) {
if ($permission) {
$permissions = explode(',', $permission);
$config = CRM_Core_Config::singleton();
* @access public
* @static
*/
- static function getDashletInfo($dashletID) {
+ public static function getDashletInfo($dashletID) {
$dashletInfo = array();
$params = array(1 => array($dashletID, 'Integer'));
* @access public
* @static
*/
- static function saveDashletChanges($columns, $contactID=NULL) {
+ public static function saveDashletChanges($columns, $contactID=NULL) {
$session = CRM_Core_Session::singleton();
if (!$contactID) {
$contactID = $session->get('userID');
* @access public
* @static
*/
- static function addDashlet(&$params) {
+ public static function addDashlet(&$params) {
// special case to handle duplicate entries for report instances
$dashboardID = CRM_Utils_Array::value('id', $params);
*
* @return string
*/
- static function getDashletName($url) {
+ public static function getDashletName($url) {
$urlElements = explode('/', $url);
if ($urlElements[1] == 'dashlet') {
return $urlElements[2];
* @return void
* @static
*/
- static function addContactDashlet($dashlet) {
+ public static function addContactDashlet($dashlet) {
$admin = CRM_Core_Permission::check('administer CiviCRM');
// if dashlet is created by admin then you need to add it all contacts.
* @param array $params each item is a spec for a dashlet on the contact's dashboard
* @return bool
*/
- static function addContactDashletToDashboard(&$params) {
+ public static function addContactDashletToDashboard(&$params) {
$valuesString = NULL;
$columns = array();
foreach ($params as $dashboardIDs) {
* @return void
* @static
*/
- static function resetDashletCache($contactID = null) {
+ public static function resetDashletCache($contactID = null) {
$whereClause = null;
$params = array();
if ($contactID) {
* @return void
* @static
*/
- static function deleteDashlet($dashletID) {
+ public static function deleteDashlet($dashletID) {
$dashlet = new CRM_Core_DAO_Dashboard();
$dashlet->id = $dashletID;
$dashlet->delete();
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function del($entityId,$entityTable) {
+ public static function del($entityId,$entityTable) {
// delete all discount records with the selected discounted id
$discount = new CRM_Core_DAO_Discount( );
$discount->entity_id = $entityId;
* @access public
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
$discount = new CRM_Core_DAO_Discount( );
$discount->copyValues($params);
$discount->save();
* @return array $optionGroupIDs option group Ids associated with discount
*
*/
- static function getOptionGroup($entityId, $entityTable) {
+ public static function getOptionGroup($entityId, $entityTable) {
$optionGroupIDs = array();
$dao = new CRM_Core_DAO_Discount( );
$dao->entity_id = $entityId;
* @return integer $dao->id discount id of the set which matches
* the date criteria
*/
- static function findSet($entityID, $entityTable) {
+ public static function findSet($entityID, $entityTable) {
if (empty($entityID) || empty($entityTable)) {
// adding this here, to trap errors if values are not sent
CRM_Core_Error::fatal();
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
return CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_Domain', $params, $defaults);
}
* @access public
* @static
*/
- static function &getDomain($reset = null) {
+ public static function &getDomain($reset = null) {
static $domain = NULL;
if (!$domain || $reset) {
$domain = new CRM_Core_BAO_Domain();
* @deprecated
* @see http://issues.civicrm.org/jira/browse/CRM-11204
*/
- static function setDomain($domainID) {
+ public static function setDomain($domainID) {
CRM_Core_Config::domainID($domainID);
self::getDomain($domainID);
CRM_Core_Config::singleton(TRUE, TRUE);
* @deprecated
* @see CRM_Core_BAO_Domain::setDomain
*/
- static function resetDomain() {
+ public static function resetDomain() {
CRM_Core_Config::domainID(null, true);
self::getDomain(null, true);
CRM_Core_Config::singleton(TRUE, TRUE);
*
* @return null|string
*/
- static function version($skipUsingCache = false) {
+ public static function version($skipUsingCache = false) {
return CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Domain',
CRM_Core_Config::domainID(),
'version',
* @return array Location::getValues
* @access public
*/
- function &getLocationValues() {
+ public function &getLocationValues() {
if ($this->_location == NULL) {
$domain = self::getDomain(null);
$params = array(
* @return array domain
* @access public
*/
- static function edit(&$params, &$id) {
+ public static function edit(&$params, &$id) {
$domain = new CRM_Core_DAO_Domain();
$domain->id = $id;
$domain->copyValues($params);
* @return array domain
* @access public
*/
- static function create($params) {
+ public static function create($params) {
$domain = new CRM_Core_DAO_Domain();
$domain->copyValues($params);
$domain->save();
/**
* @return bool
*/
- static function multipleDomains() {
+ public static function multipleDomains() {
$session = CRM_Core_Session::singleton();
$numberDomains = $session->get('numberDomains');
* @return array name & email for domain
* @throws Exception
*/
- static function getNameAndEmail($skipFatal = FALSE) {
+ public static function getNameAndEmail($skipFatal = FALSE) {
$fromEmailAddress = CRM_Core_OptionGroup::values('from_email_address', NULL, NULL, NULL, ' AND is_default = 1');
if (!empty($fromEmailAddress)) {
foreach ($fromEmailAddress as $key => $value) {
*
* @return bool|null|object|string
*/
- static function addContactToDomainGroup($contactID) {
+ public static function addContactToDomainGroup($contactID) {
$groupID = self::getGroupId();
if ($groupID) {
/**
* @return bool|null|object|string
*/
- static function getGroupId() {
+ public static function getGroupId() {
static $groupID = NULL;
if ($groupID) {
*
* @return bool
*/
- static function isDomainGroup($groupId) {
+ public static function isDomainGroup($groupId) {
$domainGroupID = self::getGroupId();
return $domainGroupID == $groupId ? TRUE : FALSE;
}
/**
* @return array
*/
- static function getChildGroupIds() {
+ public static function getChildGroupIds() {
$domainGroupID = self::getGroupId();
$childGrps = array();
*
* @return array
*/
- static function getContactList() {
+ public static function getContactList() {
$siteGroups = CRM_Core_BAO_Domain::getChildGroupIds();
$siteContacts = array();
*
* @return object
*/
- static function create($params) {
+ public static function create($params) {
// if id is set & is_primary isn't we can assume no change
if (is_numeric(CRM_Utils_Array::value('is_primary', $params)) || empty($params['id'])) {
CRM_Core_BAO_Block::handlePrimary($params, get_class());
* @access public
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
$hook = empty($params['id']) ? 'create' : 'edit';
CRM_Utils_Hook::pre($hook, 'Email', CRM_Utils_Array::value('id', $params), $params);
* @access public
* @static
*/
- static function &getValues($entityBlock) {
+ public static function &getValues($entityBlock) {
return CRM_Core_BAO_Block::getValues('email', $entityBlock);
}
* @access public
* @static
*/
- static function allEmails($id, $updateBlankLocInfo = FALSE) {
+ public static function allEmails($id, $updateBlankLocInfo = FALSE) {
if (!$id) {
return NULL;
}
* @access public
* @static
*/
- static function allEntityEmails(&$entityElements) {
+ public static function allEntityEmails(&$entityElements) {
if (empty($entityElements)) {
return NULL;
}
* @return void
* @static
*/
- static function holdEmail(&$email) {
+ public static function holdEmail(&$email) {
//check for update mode
if ($email->id) {
$params = array(1 => array($email->id, 'Integer'));
* @access public
* @static
*/
- static function getFromEmail() {
+ public static function getFromEmail() {
$session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
$fromEmailValues = array();
/**
* @return object
*/
- static function isMultipleBulkMail() {
+ public static function isMultipleBulkMail() {
return CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'civimail_multiple_bulk_emails', NULL, FALSE);
}
/**
* Call common delete function
*/
- static function del($id) {
+ public static function del($id) {
return CRM_Contact_BAO_Contact::deleteObjectWithPrimary('Email', $id);
}
}
* @access public
* @static
*/
- static function &getTag($entityID, $entityTable = 'civicrm_contact') {
+ public static function &getTag($entityID, $entityTable = 'civicrm_contact') {
$tags = array();
$entityTag = new CRM_Core_BAO_EntityTag();
* @access public
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
$dataExists = self::dataExists($params);
if (!$dataExists) {
return NULL;
* @access public
* @static
*/
- static function dataExists($params) {
+ public static function dataExists($params) {
return !($params['tag_id'] == 0);
}
* @static
*
*/
- static function del(&$params) {
+ public static function del(&$params) {
$entityTag = new CRM_Core_BAO_EntityTag();
$entityTag->copyValues($params);
$entityTag->delete();
* @access public
* @static
*/
- static function addEntitiesToTag(&$entityIds, $tagId, $entityTable = 'civicrm_contact') {
+ public static function addEntitiesToTag(&$entityIds, $tagId, $entityTable = 'civicrm_contact') {
$numEntitiesAdded = 0;
$numEntitiesNotAdded = 0;
$entityIdsAdded = array();
* @access public
* @static
*/
- static function removeEntitiesFromTag(&$entityIds, $tagId, $entityTable = 'civicrm_contact') {
+ public static function removeEntitiesFromTag(&$entityIds, $tagId, $entityTable = 'civicrm_contact') {
$numEntitiesRemoved = 0;
$numEntitiesNotRemoved = 0;
$entityIdsRemoved = array();
* @access public
* @static
*/
- static function create(&$params, $entityTable, $entityID) {
+ public static function create(&$params, $entityTable, $entityID) {
// get categories for the entity id
$entityTag = CRM_Core_BAO_EntityTag::getTag($entityID, $entityTable);
* @return array $entityIds array of entity ids
* @access public
*/
- function getEntitiesByTag($tag) {
+ public function getEntitiesByTag($tag) {
$entityIds = array();
$entityTagDAO = new CRM_Core_DAO_EntityTag();
$entityTagDAO->tag_id = $tag->id;
/**
* Get contact tags
*/
- static function getContactTags($contactID, $count = FALSE) {
+ public static function getContactTags($contactID, $count = FALSE) {
$contactTags = array();
if (!$count) {
$select = "SELECT name ";
/**
* Get child contact tags given parentId
*/
- static function getChildEntityTags($parentId, $entityId, $entityTable = 'civicrm_contact') {
+ public static function getChildEntityTags($parentId, $entityId, $entityTable = 'civicrm_contact') {
$entityTags = array();
$query = "SELECT ct.id as tag_id, name FROM civicrm_tag ct
INNER JOIN civicrm_entity_tag et ON ( et.entity_id = {$entityId} AND
/**
* Merge two tags: tag B into tag A.
*/
- function mergeTags($tagAId, $tagBId) {
+ public function mergeTags($tagAId, $tagBId) {
$queryParams = array(1 => array($tagBId, 'Integer'),
2 => array($tagAId, 'Integer'),
);
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$extension = new CRM_Core_DAO_Extension();
$extension->copyValues($params);
if ($extension->find(TRUE)) {
* @access public
* @static
*/
- static function del($id) {
+ public static function del($id) {
$extension = new CRM_Core_DAO_Extension();
$extension->id = $id;
return $extension->delete();
* @param $schemaVersion string
* @return void
*/
- static function setSchemaVersion($fullName, $schemaVersion) {
+ public static function setSchemaVersion($fullName, $schemaVersion) {
$sql = 'UPDATE civicrm_extension SET schema_version = %1 WHERE full_name = %2';
$params = array(
1 => array($schemaVersion, 'String'),
* @param $fullName string, the fully-qualified name (eg "com.example.myextension")
* @return string
*/
- static function getSchemaVersion($fullName) {
+ public static function getSchemaVersion($fullName) {
$sql = 'SELECT schema_version FROM civicrm_extension WHERE full_name = %1';
$params = array(
1 => array($fullName, 'String'),
*
* @return array
*/
- static function path($fileID, $entityID, $entityTable = NULL) {
+ public static function path($fileID, $entityID, $entityTable = NULL) {
$entityFileDAO = new CRM_Core_DAO_EntityFile();
if ($entityTable) {
$entityFileDAO->entity_table = $entityTable;
* Delete all the files and associated object associated with this
* combination
*/
- static function deleteEntityFile($entityTable, $entityID, $fileTypeID = NULL, $fileID = NULL) {
+ public static function deleteEntityFile($entityTable, $entityID, $fileTypeID = NULL, $fileID = NULL) {
if (empty($entityTable) || empty($entityID)) {
return;
}
* Get all the files and associated object associated with this
* combination
*/
- static function getEntityFile($entityTable, $entityID, $addDeleteArgs = FALSE) {
+ public static function getEntityFile($entityTable, $entityID, $addDeleteArgs = FALSE) {
if (empty($entityTable) || !$entityID) {
$results = NULL;
return $results;
*
* @return array
*/
- static function sql($entityTable, $entityID, $fileTypeID = NULL, $fileID = NULL) {
+ public static function sql($entityTable, $entityID, $fileTypeID = NULL, $fileID = NULL) {
if ($entityTable == '*') {
// $entityID is the ID of a specific file
$sql = "
* @param null $numAttachments
* @param bool $ajaxDelete
*/
- static function buildAttachment(&$form, $entityTable, $entityID = NULL, $numAttachments = NULL, $ajaxDelete = FALSE) {
+ public static function buildAttachment(&$form, $entityTable, $entityID = NULL, $numAttachments = NULL, $ajaxDelete = FALSE) {
if (!$numAttachments) {
$numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments');
* @return array An array with 2 elements. The string and the number of attachments
* @static
*/
- static function attachmentInfo($entityTable, $entityID, $separator = '<br />') {
+ public static function attachmentInfo($entityTable, $entityID, $separator = '<br />') {
if (!$entityID) {
return NULL;
}
* @param $entityTable
* @param int $entityID
*/
- static function processAttachment(&$params, $entityTable, $entityID) {
+ public static function processAttachment(&$params, $entityTable, $entityID) {
$numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments');
for ($i = 1; $i <= $numAttachments; $i++) {
/**
* @return array
*/
- static function uploadNames() {
+ public static function uploadNames() {
$numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments');
$names = array();
* @param $newEntityTable
* @param int $newEntityId
*/
- static function copyEntityFile($oldEntityTable, $oldEntityId, $newEntityTable, $newEntityId) {
+ public static function copyEntityFile($oldEntityTable, $oldEntityId, $newEntityTable, $newEntityId) {
$oldEntityFile = new CRM_Core_DAO_EntityFile();
$oldEntityFile->entity_id = $oldEntityId;
$oldEntityFile->entity_table = $oldEntityTable;
*
* @return string
*/
- static function deleteURLArgs($entityTable, $entityID, $fileID) {
+ public static function deleteURLArgs($entityTable, $entityID, $fileID) {
$params['entityTable'] = $entityTable;
$params['entityID'] = $entityID;
$params['fileID'] = $fileID;
* @static
* @access public
*/
- static function deleteAttachment() {
+ public static function deleteAttachment() {
$params = array();
$params['entityTable'] = CRM_Utils_Request::retrieve('entityTable', 'String', CRM_Core_DAO::$_nullObject, TRUE);
$params['entityID'] = CRM_Utils_Request::retrieve('entityID', 'Positive', CRM_Core_DAO::$_nullObject, TRUE);
* @static
* @access public
*/
- static function paperIconAttachment($entityTable, $entityID) {
+ public static function paperIconAttachment($entityTable, $entityID) {
if (empty($entityTable) || !$entityID) {
$results = NULL;
return $results;
*
* @return CRM_Core_FileSearchInterface|NULL
*/
- static function getSearchService() {
+ public static function getSearchService() {
$fileSearches = array();
CRM_Utils_Hook::fileSearches($fileSearches);
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function create(&$params, $trxnEntityTable = null ) {
+ public static function create(&$params, $trxnEntityTable = null ) {
$trxn = new CRM_Financial_DAO_FinancialTrxn();
$trxn->copyValues($params);
$fids = array();
*
* @return array
*/
- static function getBalanceTrxnAmt($contributionId, $contributionFinancialTypeId = NULL) {
+ public static function getBalanceTrxnAmt($contributionId, $contributionFinancialTypeId = NULL) {
if (!$contributionFinancialTypeId) {
$contributionFinancialTypeId = CRM_Core_DAO::getFieldValue('CRM_Contribute_BAO_Contribution', $contributionId, 'financial_type_id');
}
* @access public
* @static
*/
- static function retrieve( &$params, &$defaults ) {
+ public static function retrieve( &$params, &$defaults ) {
$financialItem = new CRM_Financial_DAO_FinancialTrxn( );
$financialItem->copyValues($params);
if ($financialItem->find(true)) {
* @access public
* @static
*/
- static function getFinancialTrxnId($entity_id, $orderBy = 'ASC', $newTrxn = FALSE) {
+ public static function getFinancialTrxnId($entity_id, $orderBy = 'ASC', $newTrxn = FALSE) {
$ids = array('entityFinancialTrxnId' => NULL, 'financialTrxnId' => NULL);
$condition = "";
* @access public
* @static
*/
- static function getFinancialTrxnTotal($entity_id) {
+ public static function getFinancialTrxnTotal($entity_id) {
$query = "
SELECT (ft.amount+SUM(ceft.amount)) AS total FROM civicrm_entity_financial_trxn AS ft
LEFT JOIN civicrm_entity_financial_trxn AS ceft ON ft.financial_trxn_id = ceft.entity_id
* @access public
* @static
*/
- static function getPayments($financial_trxn_id) {
+ public static function getPayments($financial_trxn_id) {
$query = "
SELECT ef1.financial_trxn_id, sum(ef1.amount) amount
FROM civicrm_entity_financial_trxn ef1
* @access public
* @static
*/
- static function getFinancialTrxnLineTotal($entity_id, $entity_table = 'civicrm_contribution') {
+ public static function getFinancialTrxnLineTotal($entity_id, $entity_table = 'civicrm_contribution') {
$query = "SELECT lt.price_field_value_id AS id, ft.financial_trxn_id,ft.amount AS amount FROM civicrm_entity_financial_trxn AS ft
LEFT JOIN civicrm_financial_item AS fi ON fi.id = ft.entity_id AND fi.entity_table = 'civicrm_line_item' AND ft.entity_table = 'civicrm_financial_item'
LEFT JOIN civicrm_line_item AS lt ON lt.id = fi.entity_id AND lt.entity_table = %2
* @access public
* @static
*/
- static function deleteFinancialTrxn($entity_id) {
+ public static function deleteFinancialTrxn($entity_id) {
$query = "DELETE ceft1, cfi, ceft, cft FROM `civicrm_financial_trxn` cft
LEFT JOIN civicrm_entity_financial_trxn ceft
ON ceft.financial_trxn_id = cft.id AND ceft.entity_table = 'civicrm_contribution'
* @access public
* @static
*/
- static function createPremiumTrxn($params) {
+ public static function createPremiumTrxn($params) {
if ((empty($params['financial_type_id']) || empty($params['contributionId'])) && empty($params['oldPremium'])) {
return;
}
* @access public
* @static
*/
- static function recordFees($params) {
+ public static function recordFees($params) {
$expenseTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Expense Account is' "));
$domainId = CRM_Core_Config::domainID();
$amount = 0;
*
* @return array|int|null|string
*/
- static function getPartialPaymentWithType($entityId, $entityName = 'participant', $returnType = TRUE, $lineItemTotal = NULL) {
+ public static function getPartialPaymentWithType($entityId, $entityName = 'participant', $returnType = TRUE, $lineItemTotal = NULL) {
$value = NULL;
if (empty($entityName)) {
return $value;
* @access public
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
$hook = empty($params['id']) ? 'create' : 'edit';
CRM_Utils_Hook::pre($hook, 'IM', CRM_Utils_Array::value('id', $params), $params);
* @access public
* @static
*/
- static function &getValues($entityBlock) {
+ public static function &getValues($entityBlock) {
return CRM_Core_BAO_Block::getValues('im', $entityBlock);
}
* @access public
* @static
*/
- static function allIMs($id, $updateBlankLocInfo = FALSE) {
+ public static function allIMs($id, $updateBlankLocInfo = FALSE) {
if (!$id) {
return NULL;
}
* @access public
* @static
*/
- static function allEntityIMs(&$entityElements) {
+ public static function allEntityIMs(&$entityElements) {
if (empty($entityElements)) {
return NULL;
}
/**
* Call common delete function
*/
- static function del($id) {
+ public static function del($id) {
return CRM_Contact_BAO_Contact::deleteObjectWithPrimary('IM', $id);
}
}
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function create($params) {
+ public static function create($params) {
$job = new CRM_Core_DAO_Job();
$job->copyValues($params);
return $job->save();
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$job = new CRM_Core_DAO_Job();
$job->copyValues($params);
if ($job->find(TRUE)) {
* @access public
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_Job', $id, 'is_active', $is_active);
}
* @access public
* @static
*/
- static function del($jobID) {
+ public static function del($jobID) {
if (!$jobID) {
CRM_Core_Error::fatal(ts('Invalid value passed to delete function.'));
}
*
* CRM-10513
*/
- static function cleanup($maxEntriesToKeep = 1000, $minDaysToKeep = 30) {
+ public static function cleanup($maxEntriesToKeep = 1000, $minDaysToKeep = 30) {
// Prevent the job log from getting too big
// For now, keep last minDays days and at least maxEntries records
$query = 'SELECT COUNT(*) FROM civicrm_job_log';
* @static
* @access public
*/
- static function addOrder(&$list, $returnURL) {
+ public static function addOrder(&$list, $returnURL) {
$filter = "option_group_id = " . self::_getGid();
CRM_Utils_Weight::addOrder($list, 'CRM_Core_DAO_OptionValue', 'id', $returnURL, $filter);
}
* @static
* @access public
*/
- static function &getList($namesOnly = FALSE, $groupName='label_format') {
+ public static function &getList($namesOnly = FALSE, $groupName='label_format') {
static $list = array();
if (self::_getGid($groupName)) {
// get saved label formats from Option Value table
* @static
* @access public
*/
- static function &getDefaultValues($groupName = 'label_format') {
+ public static function &getDefaultValues($groupName = 'label_format') {
$params = array('is_active' => 1, 'is_default' => 1);
$defaults = array();
if (!self::retrieve($params, $defaults, $groupName)) {
* @return array $values (reference) associative array of name/value pairs
* @access public
*/
- static function &getLabelFormat($field, $val, $groupName = 'label_format') {
+ public static function &getLabelFormat($field, $val, $groupName = 'label_format') {
$params = array('is_active' => 1, $field => $val);
$labelFormat = array();
if (self::retrieve($params, $labelFormat, $groupName)) {
* @return array $values (reference) associative array of name/value pairs
* @access public
*/
- static function &getByName($name) {
+ public static function &getByName($name) {
return self::getLabelFormat('name', $name);
}
* @return array $values (reference) associative array of name/value pairs
* @access public
*/
- static function &getById($id, $groupName = 'label_format') {
+ public static function &getById($id, $groupName = 'label_format') {
return self::getLabelFormat('id', $id, $groupName);
}
* @access public
* @static
*/
- static function getValue($field, &$values, $default = NULL) {
+ public static function getValue($field, &$values, $default = NULL) {
if (array_key_exists($field, self::$optionValueFields)) {
switch (self::$optionValueFields[$field]['type']) {
case CRM_Utils_Type::T_INT:
* @access public
* @static
*/
- static function retrieve(&$params, &$values, $groupName='label_format') {
+ public static function retrieve(&$params, &$values, $groupName='label_format') {
$optionValue = new CRM_Core_DAO_OptionValue();
$optionValue->copyValues($params);
$optionValue->option_group_id = self::_getGid($groupName);
* @return void
* @access public
*/
- function saveLabelFormat(&$values, $id = NULL, $groupName = 'label_format') {
+ public function saveLabelFormat(&$values, $id = NULL, $groupName = 'label_format') {
// get the Option Group ID for Label Formats (create one if it doesn't exist)
$group_id = self::_getGid($groupName);
* @access public
* @static
*/
- static function del($id, $groupName) {
+ public static function del($id, $groupName) {
if ($id) {
$dao = new CRM_Core_DAO_OptionValue();
$dao->id = $id;
* @access public
* @static
*/
- static function create(&$params, $fixAddress = TRUE, $entity = NULL) {
+ public static function create(&$params, $fixAddress = TRUE, $entity = NULL) {
$location = array();
if (!self::dataExists($params)) {
return $location;
* Creates the entry in the civicrm_loc_block
*
*/
- static function createLocBlock(&$location, &$entityElements) {
+ public static function createLocBlock(&$location, &$entityElements) {
$locId = self::findExisting($entityElements);
$locBlock = array();
* @access public
* @static
*/
- static function findExisting($entityElements) {
+ public static function findExisting($entityElements) {
$eid = $entityElements['entity_id'];
$etable = $entityElements['entity_table'];
$query = "
* @access public
* @static
*/
- static function addLocBlock(&$params) {
+ public static function addLocBlock(&$params) {
$locBlock = new CRM_Core_DAO_LocBlock();
$locBlock->copyValues($params);
* @access public
* @static
*/
- static function dataExists(&$params) {
+ public static function dataExists(&$params) {
// return if no data present
$dataExists = FALSE;
foreach (self::$blocks as $block) {
* @access public
* @static
*/
- static function &getValues($entityBlock, $microformat = FALSE) {
+ public static function &getValues($entityBlock, $microformat = FALSE) {
if (empty($entityBlock)) {
return NULL;
}
* @access public
* @static
*/
- static function deleteLocationBlocks($contactId, $locationTypeId) {
+ public static function deleteLocationBlocks($contactId, $locationTypeId) {
// ensure that contactId has a value
if (empty($contactId) ||
!CRM_Utils_Rule::positiveInteger($contactId)
*
* @return int newly created/updated location block id.
*/
- static function copyLocBlock($locBlockId, $updateLocBlockId = NULL) {
+ public static function copyLocBlock($locBlockId, $updateLocBlockId = NULL) {
//get the location info.
$defaults = $updateValues = array();
$locBlock = array('id' => $locBlockId);
* @access public
* @static
*/
- static function checkPrimaryBlocks($contactId) {
+ public static function checkPrimaryBlocks($contactId) {
if (!$contactId) {
return;
}
*
* @return array
*/
- static function getChainSelectValues($values, $valueType, $flatten = FALSE) {
+ public static function getChainSelectValues($values, $valueType, $flatten = FALSE) {
if (!$values) {
return array();
}
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$locationType = new CRM_Core_DAO_LocationType();
$locationType->copyValues($params);
if ($locationType->find(TRUE)) {
* @access public
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_LocationType', $id, 'is_active', $is_active);
}
* @static
* @access public
*/
- static function &getDefault() {
+ public static function &getDefault() {
if (self::$_defaultLocationType == NULL) {
$params = array('is_default' => 1);
$defaults = array();
/**
* @return mixed|null
*/
- static function getBilling() {
+ public static function getBilling() {
if (self::$_billingLocationType == NULL) {
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array(), 'validate');
self::$_billingLocationType = array_search('Billing', $locationTypes);
*
* @return object
*/
- static function create(&$params) {
+ public static function create(&$params) {
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['is_default'] = CRM_Utils_Array::value('is_default', $params, FALSE);
$params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, FALSE);
* @access public
* @static
*/
- static function del($locationTypeId) {
+ public static function del($locationTypeId) {
$entity = array('address', 'phone', 'email', 'im');
//check dependencies
foreach ($entity as $key) {
*
* @return array|null
*/
- static function &lastModified($id, $table = 'civicrm_contact') {
+ public static function &lastModified($id, $table = 'civicrm_contact') {
$log = new CRM_Core_DAO_Log();
*
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
$log = new CRM_Core_DAO_Log();
$log->copyValues($params);
* @access public
* @static
*/
- static function getContactLogCount($contactID) {
+ public static function getContactLogCount($contactID) {
$query = "SELECT count(*) FROM civicrm_log
WHERE civicrm_log.entity_table = 'civicrm_contact' AND civicrm_log.entity_id = {$contactID}";
return CRM_Core_DAO::singleValueQuery($query);
* @access public
* @static
*/
- static function useLoggingReport() {
+ public static function useLoggingReport() {
// first check if logging is enabled
$config = CRM_Core_Config::singleton();
if (!$config->logging) {
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
*
* @return CRM_Core_BAO_MailSettings DAO with the default mail settings set
*/
- static function defaultDAO($reset = FALSE) {
+ public static function defaultDAO($reset = FALSE) {
static $mailSettings = array();
$domainID = CRM_Core_Config::domainID();
if (empty($mailSettings[$domainID]) || $reset) {
*
* @return string default domain
*/
- static function defaultDomain() {
+ public static function defaultDomain() {
return self::defaultDAO()->domain;
}
*
* @return string default localpart
*/
- static function defaultLocalpart() {
+ public static function defaultLocalpart() {
return self::defaultDAO()->localpart;
}
*
* @return string default return path
*/
- static function defaultReturnPath() {
+ public static function defaultReturnPath() {
return self::defaultDAO()->return_path;
}
*
* @return boolean default include message ID
*/
- static function includeMessageId() {
+ public static function includeMessageId() {
return CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
'include_message_id',
NULL,
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$mailSettings = new CRM_Core_DAO_MailSettings();
$mailSettings->copyValues($params);
*
* @return object
*/
- static function add(&$params) {
+ public static function add(&$params) {
$result = NULL;
if (empty($params)) {
return $result;
* @access public
* @static
*/
- static function create(&$params) {
+ public static function create(&$params) {
$transaction = new CRM_Core_Transaction();
$mailSettings = self::add($params);
* @static
*
*/
- static function deleteMailSettings($id) {
+ public static function deleteMailSettings($id) {
$results = NULL;
$transaction = new CRM_Core_Transaction();
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$mapping = new CRM_Core_DAO_Mapping();
$mapping->copyValues($params);
if ($mapping->find(TRUE)) {
* @static
*
*/
- static function del($id) {
+ public static function del($id) {
// delete from mapping_field table
$mappingField = new CRM_Core_DAO_MappingField();
$mappingField->mapping_id = $id;
* @access public
* @static
*/
- static function add($params) {
+ public static function add($params) {
$mapping = new CRM_Core_DAO_Mapping();
$mapping->copyValues($params);
$mapping->save();
* @access public
* @static
*/
- static function getMappings($mappingTypeId) {
+ public static function getMappings($mappingTypeId) {
$mapping = array();
$mappingDAO = new CRM_Core_DAO_Mapping();
$mappingDAO->mapping_type_id = $mappingTypeId;
* @access public
* @static
*/
- static function getMappingFields($mappingId) {
+ public static function getMappingFields($mappingId) {
//mapping is to be loaded from database
$mapping = new CRM_Core_DAO_MappingField();
$mapping->mapping_id = $mappingId;
*
* @return boolean
*/
- static function checkMapping($nameField, $mapTypeId) {
+ public static function checkMapping($nameField, $mapTypeId) {
$mapping = new CRM_Core_DAO_Mapping();
$mapping->name = $nameField;
$mapping->mapping_type_id = $mapTypeId;
* @return array $returnFields associated array of elements@static
* @public
*/
- static function getFormattedFields($smartGroupId) {
+ public static function getFormattedFields($smartGroupId) {
$returnFields = array();
//get the fields from mapping table
* @access public
* @static
*/
- static function buildMappingForm(&$form, $mappingType = 'Export', $mappingId = NULL, $columnNo, $blockCount = 3, $exportMode = NULL) {
+ public static function buildMappingForm(&$form, $mappingType = 'Export', $mappingId = NULL, $columnNo, $blockCount = 3, $exportMode = NULL) {
if ($mappingType == 'Export') {
$name = "Map";
$columnCount = array('1' => $columnNo);
*
* @return array all custom field titles
*/
- function getRelationTypeCustomGroupData($relationshipTypeId) {
+ public function getRelationTypeCustomGroupData($relationshipTypeId) {
$customFields = CRM_Core_BAO_CustomField::getFields('Relationship', NULL, NULL, $relationshipTypeId, NULL, NULL);
$groupTitle = array();
*
* @return null|string $customGroupName all custom group names@static
*/
- static function getCustomGroupName($customfieldId) {
+ public static function getCustomGroupName($customfieldId) {
if ($customFieldId = CRM_Core_BAO_CustomField::getKeyID($customfieldId)) {
$customGroupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $customFieldId, 'custom_group_id');
$customGroupName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'title');
* @return array $returnFields formatted associated array of elements@static
* @public
*/
- static function formattedFields(&$params, $row = FALSE) {
+ public static function formattedFields(&$params, $row = FALSE) {
$fields = array();
if (empty($params) || !isset($params['mapper'])) {
*
* @return array
*/
- static function &returnProperties(&$params) {
+ public static function &returnProperties(&$params) {
$fields = array(
'contact_type' => 1,
'contact_sub_type' => 1,
* @static
* @access public
*/
- static function saveMappingFields(&$params, $mappingId) {
+ public static function saveMappingFields(&$params, $mappingId) {
//delete mapping fields records for exixting mapping
$mappingFields = new CRM_Core_DAO_MappingField();
$mappingFields->mapping_id = $mappingId;
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$messageTemplates = new CRM_Core_DAO_MessageTemplate();
$messageTemplates->copyValues($params);
if ($messageTemplates->find(TRUE)) {
* @return Object DAO object on sucess, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_MessageTemplate', $id, 'is_active', $is_active);
}
*
* @return object
*/
- static function add(&$params) {
+ public static function add(&$params) {
$hook = empty($params['id']) ? 'create' : 'edit';
CRM_Utils_Hook::pre($hook, 'MessageTemplate', CRM_Utils_Array::value('id', $params), $params);
*
* @return object
*/
- static function del($messageTemplatesID) {
+ public static function del($messageTemplatesID) {
// make sure messageTemplatesID is an integer
if (!CRM_Utils_Rule::positiveInteger($messageTemplatesID)) {
CRM_Core_Error::fatal(ts('Invalid Message template'));
*
* @return object
*/
- static function getMessageTemplates($all = TRUE, $isSMS = FALSE) {
+ public static function getMessageTemplates($all = TRUE, $isSMS = FALSE) {
$msgTpls = array();
$messageTemplates = new CRM_Core_DAO_MessageTemplate();
*
* @return bool|null
*/
- static function sendReminder($contactId, $email, $messageTemplateID, $from) {
+ public static function sendReminder($contactId, $email, $messageTemplateID, $from) {
$messageTemplates = new CRM_Core_DAO_MessageTemplate();
$messageTemplates->id = $messageTemplateID;
*
* @return void
*/
- static function revert($id) {
+ public static function revert($id) {
$diverted = new self;
$diverted->id = (int) $id;
$diverted->find(1);
*
* @return array of four parameters: a boolean whether the email was sent, and the subject, text and HTML templates
*/
- static function sendTemplate($params) {
+ public static function sendTemplate($params) {
$defaults = array(
// option group name of the template
'groupName' => NULL,
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_Navigation', $id, 'is_active', $is_active);
}
* @static
* @return array associated array
*/
- static function getMenus() {
+ public static function getMenus() {
$menus = array();
$menu = new CRM_Core_DAO_Menu();
* @return object navigation object
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
$navigation = new CRM_Core_DAO_Navigation();
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$navigation = new CRM_Core_DAO_Navigation();
$navigation->copyValues($params);
*
* @return int $weight string@static
*/
- static function calculateWeight($parentID = NULL, $menuID = NULL) {
+ public static function calculateWeight($parentID = NULL, $menuID = NULL) {
$domainID = CRM_Core_Config::domainID();
$weight = 1;
* @return array $navigations returns associated array
* @static
*/
- static function getNavigationList() {
+ public static function getNavigationList() {
$cacheKeyString = "navigationList";
$whereClause = '';
* @param array $navigations navigation menus
* @param string $separator menu separator
*/
- static function _getNavigationLabel($list, &$navigations, $separator = '') {
+ public static function _getNavigationLabel($list, &$navigations, $separator = '') {
$i18n = CRM_Core_I18n::singleton();
foreach ($list as $label => $val) {
if ($label == 'navigation_id') {
* @param array $pidGroups parent menus
* @return array
*/
- static function _getNavigationValue($val, &$pidGroups) {
+ public static function _getNavigationValue($val, &$pidGroups) {
if (array_key_exists($val, $pidGroups)) {
$list = array('navigation_id' => $val);
foreach ($pidGroups[$val] as $label => $id) {
* @return array $navigationTree nested array of menus
* @static
*/
- static function buildNavigationTree(&$navigationTree, $parentID, $navigationMenu = TRUE) {
+ public static function buildNavigationTree(&$navigationTree, $parentID, $navigationMenu = TRUE) {
$whereClause = " parent_id IS NULL";
if ($parentID) {
* @return returns html or json object
* @static
*/
- static function buildNavigation($json = FALSE, $navigationMenu = TRUE) {
+ public static function buildNavigation($json = FALSE, $navigationMenu = TRUE) {
$navigations = array();
self::buildNavigationTree($navigations, $parent = NULL, $navigationMenu);
$navigationString = NULL;
* @param boolean $skipMenuItems
* @return string
*/
- static function recurseNavigation(&$value, &$navigationString, $json, $skipMenuItems) {
+ public static function recurseNavigation(&$value, &$navigationString, $json, $skipMenuItems) {
if ($json) {
if (!empty($value['child'])) {
$navigationString .= ', "children": [ ';
* @param array $skipMenuItems
* @return bool|string
*/
- static function getMenuName(&$value, &$skipMenuItems) {
+ public static function getMenuName(&$value, &$skipMenuItems) {
// we need to localise the menu labels (CRM-5456) and don’t
// want to use ts() as it would throw the ts-extractor off
$i18n = CRM_Core_I18n::singleton();
* @return string $navigation returns navigation html
* @static
*/
- static function createNavigation($contactID) {
+ public static function createNavigation($contactID) {
$config = CRM_Core_Config::singleton();
$navigation = self::buildNavigation();
* @param integer $contactID - reset only entries belonging to that contact ID
* @return string
*/
- static function resetNavigation($contactID = NULL) {
+ public static function resetNavigation($contactID = NULL) {
$newKey = CRM_Utils_String::createRandom(self::CACHE_KEY_STRLEN, CRM_Utils_String::ALPHANUMERIC);
if (!$contactID) {
$query = "UPDATE civicrm_setting SET value = '$newKey' WHERE name='navigation' AND contact_id IS NOT NULL";
* @return void
* @static
*/
- static function processNavigation(&$params) {
+ public static function processNavigation(&$params) {
$nodeID = (int)str_replace("node_", "", $params['id']);
$referenceID = (int)str_replace("node_", "", $params['ref_id']);
$position = $params['ps'];
* @return void
* @static
*/
- static function processMove($nodeID, $referenceID, $position) {
+ public static function processMove($nodeID, $referenceID, $position) {
// based on the new position we need to get the weight of the node after moved node
// 1. update the weight of $position + 1 nodes to weight + 1
// 2. weight of the ( $position -1 ) node - 1 is the new weight of the node being moved
* @param int $nodeID
* @param $label
*/
- static function processRename($nodeID, $label) {
+ public static function processRename($nodeID, $label) {
CRM_Core_DAO::setFieldValue('CRM_Core_DAO_Navigation', $nodeID, 'label', $label);
}
*
* @param int $nodeID
*/
- static function processDelete($nodeID) {
+ public static function processDelete($nodeID) {
$query = "DELETE FROM civicrm_navigation WHERE id = {$nodeID}";
CRM_Core_DAO::executeQuery($query);
}
* @return array associated array
* @static
*/
- static function getNavigationInfo($navigationID) {
+ public static function getNavigationInfo($navigationID) {
$query = "SELECT parent_id, weight FROM civicrm_navigation WHERE id = %1";
$params = array($navigationID, 'Integer');
$dao = CRM_Core_DAO::executeQuery($query, array(1 => $params));
* @param array $newParams new value of params
* @static
*/
- static function processUpdate($params, $newParams) {
+ public static function processUpdate($params, $newParams) {
$dao = new CRM_Core_DAO_Navigation();
$dao->copyValues($params);
if ($dao->find(TRUE)) {
*
* @return object|string
*/
- static function getCacheKey($cid) {
+ public static function getCacheKey($cid) {
$key = CRM_Core_BAO_Setting::getItem(
CRM_Core_BAO_Setting::PERSONAL_PREFERENCES_NAME,
'navigation',
* @access public
* @static
*/
- static function getNoteText($id) {
+ public static function getNoteText($id) {
return CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Note', $id, 'note');
}
* @access public
* @static
*/
- static function getNoteSubject($id) {
+ public static function getNoteSubject($id) {
return CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Note', $id, 'subject');
}
* @access public
* @static
*/
- static function getNotePrivacyHidden($note) {
+ public static function getNotePrivacyHidden($note) {
if (CRM_Core_Permission::check('view all notes')) {
return FALSE;
}
* @access public
* @static
*/
- static function &add(&$params, $ids = array()) {
+ public static function &add(&$params, $ids = array()) {
$dataExists = self::dataExists($params);
if (!$dataExists) {
return CRM_Core_DAO::$_nullObject;
* @access public
* @static
*/
- static function dataExists(&$params) {
+ public static function dataExists(&$params) {
// return if no data present
if (!strlen($params['note'])) {
return FALSE;
* @access public
* @static
*/
- static function &getValues(&$params, &$values, $numNotes = self::MAX_NOTES) {
+ public static function &getValues(&$params, &$values, $numNotes = self::MAX_NOTES) {
if (empty($params)) {
return NULL;
}
* @return mixed|null $return no of deleted notes on success, false otherwise@access public
* @static
*/
- static function del($id, $showStatus = TRUE) {
+ public static function del($id, $showStatus = TRUE) {
$return = NULL;
$recent = array($id);
$note = new CRM_Core_DAO_Note();
* @access public
* @static
*/
- static function getContactNoteCount($contactID) {
+ public static function getContactNoteCount($contactID) {
$note = new CRM_Core_DAO_Note();
$note->entity_id = $contactID;
$note->entity_table = 'civicrm_contact';
* @return void
* @static
*/
- static function cleanContactNotes($contactID) {
+ public static function cleanContactNotes($contactID) {
$params = array(1 => array($contactID, 'Integer'));
// delete all notes related to contribution
* @access public
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
$hook = empty($params['id']) ? 'create' : 'edit';
CRM_Utils_Hook::pre($hook, 'OpenID', CRM_Utils_Array::value('id', $params), $params);
* @access public
* @static
*/
- static function &getValues($entityBlock) {
+ public static function &getValues($entityBlock) {
return CRM_Core_BAO_Block::getValues('openid', $entityBlock);
}
* @access public
* @static
*/
- static function isAllowedToLogin($identity_url) {
+ public static function isAllowedToLogin($identity_url) {
$openId = new CRM_Core_DAO_OpenID();
$openId->openid = $identity_url;
if ($openId->find(TRUE)) {
* @access public
* @static
*/
- static function allOpenIDs($id, $updateBlankLocInfo = FALSE) {
+ public static function allOpenIDs($id, $updateBlankLocInfo = FALSE) {
if (!$id) {
return NULL;
}
/**
* Call common delete function
*/
- static function del($id) {
+ public static function del($id) {
return CRM_Contact_BAO_Contact::deleteObjectWithPrimary('OpenID', $id);
}
}
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$optionGroup = new CRM_Core_DAO_OptionGroup();
$optionGroup->copyValues($params);
if ($optionGroup->find(TRUE)) {
* @return Object DAO object on sucess, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_OptionGroup', $id, 'is_active', $is_active);
}
*
* @return object
*/
- static function add(&$params, $ids = array()) {
+ public static function add(&$params, $ids = array()) {
if(empty($params['id'])){
$params['id'] = CRM_Utils_Array::value('optionGroup', $ids);
}
* @access public
* @static
*/
- static function del($optionGroupId) {
+ public static function del($optionGroupId) {
// need to delete all option value field before deleting group
$optionValue = new CRM_Core_DAO_OptionValue();
$optionValue->option_group_id = $optionGroupId;
* @access public
* @static
*/
- static function getTitle($optionGroupId) {
+ public static function getTitle($optionGroupId) {
$optionGroup = new CRM_Core_DAO_OptionGroup();
$optionGroup->id = $optionGroupId;
$optionGroup->find(TRUE);
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
*
* @return object
*/
- static function create($params) {
+ public static function create($params) {
if (empty($params['id'])){
self::setDefaults($params);
}
*
* @param array $params
*/
- static function setDefaults(&$params){
+ public static function setDefaults(&$params){
if(CRM_Utils_Array::value('label', $params, NULL) === NULL){
$params['label'] = $params['name'];
}
*
* @return int
*/
- static function getDefaultWeight($params){
+ public static function getDefaultWeight($params){
return (int) CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue',
array('option_group_id' => $params['option_group_id']));
}
* more complex decision making
* @param array $params
*/
- static function getDefaultValue($params){
+ public static function getDefaultValue($params){
$bao = new CRM_Core_BAO_OptionValue();
$bao->option_group_id = $params['option_group_id'];
if(isset($params['domain_id'])){
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$optionValue = new CRM_Core_DAO_OptionValue();
$optionValue->copyValues($params);
if ($optionValue->find(TRUE)) {
* @return Object DAO object on sucess, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_OptionValue', $id, 'is_active', $is_active);
}
*
* @return CRM_Core_DAO_OptionValue
*/
- static function add(&$params, &$ids) {
+ public static function add(&$params, &$ids) {
// CRM-10921: do not reset attributes to default if this is an update
//@todo consider if defaults are being set in the right place. 'dumb' defaults like
// these would be usefully set @ the api layer so they are visible to api users
* @access public
* @static
*/
- static function del($optionValueId) {
+ public static function del($optionValueId) {
$optionValue = new CRM_Core_DAO_OptionValue();
$optionValue->id = $optionValueId;
if (self::updateRecords($optionValueId, CRM_Core_Action::DELETE)) {
* @static
* @access public
*/
- static function getActivityTypeDetails($activityTypeId) {
+ public static function getActivityTypeDetails($activityTypeId) {
$query = "SELECT civicrm_option_value.label, civicrm_option_value.description
FROM civicrm_option_value
LEFT JOIN civicrm_option_group ON ( civicrm_option_value.option_group_id = civicrm_option_group.id )
*
* @return bool
*/
- static function updateRecords(&$optionValueId, $action) {
+ public static function updateRecords(&$optionValueId, $action) {
//finding group name
$optionValue = new CRM_Core_DAO_OptionValue();
$optionValue->id = $optionValueId;
* @access public
* @static
*/
- static function updateOptionWeights($opGroupId, $opWeights) {
+ public static function updateOptionWeights($opGroupId, $opWeights) {
if (!is_array($opWeights) || empty($opWeights)) {
return;
}
* @static
* @public
*/
- static function getOptionValuesArray($optionGroupID) {
+ public static function getOptionValuesArray($optionGroupID) {
// check if we can get the field values from the system cache
$cacheKey = "CRM_Core_BAO_OptionValue_OptionGroupID_{$optionGroupID}";
$cache = CRM_Utils_Cache::singleton();
* @static
* @public
*/
- static function getOptionValuesAssocArray($optionGroupID) {
+ public static function getOptionValuesAssocArray($optionGroupID) {
$optionValues = self::getOptionValuesArray($optionGroupID);
$options = array();
* @static
* @public
*/
- static function getOptionValuesAssocArrayFromName($optionGroupName) {
+ public static function getOptionValuesAssocArrayFromName($optionGroupName) {
$dao = new CRM_Core_DAO_OptionGroup();
$dao->name = $optionGroupName;
$dao->selectAdd();
* @static
* @access public
*/
- static function &addOrder(&$list, $returnURL) {
+ public static function &addOrder(&$list, $returnURL) {
$filter = "option_group_id = " . self::_getGid();
CRM_Utils_Weight::addOrder($list, 'CRM_Core_DAO_OptionValue', 'id', $returnURL, $filter);
}
* @static
* @access public
*/
- static function &getList($namesOnly = FALSE) {
+ public static function &getList($namesOnly = FALSE) {
static $list = array();
if (self::_getGid()) {
// get saved Paper Sizes from Option Value table
* @static
* @access public
*/
- static function &getDefaultValues() {
+ public static function &getDefaultValues() {
$params = array('is_active' => 1, 'is_default' => 1);
$defaults = array();
if (!self::retrieve($params, $defaults)) {
* @return array $values (reference) associative array of name/value pairs
* @access public
*/
- static function &getPaperFormat($field, $val) {
+ public static function &getPaperFormat($field, $val) {
$params = array('is_active' => 1, $field => $val);
$paperFormat = array();
if (self::retrieve($params, $paperFormat)) {
* @return array $values (reference) associative array of name/value pairs
* @access public
*/
- static function &getByName($name) {
+ public static function &getByName($name) {
return self::getPaperFormat('name', $name);
}
* @return array $values (reference) associative array of name/value pairs
* @access public
*/
- static function &getById($id) {
+ public static function &getById($id) {
return self::getPaperFormat('id', $id);
}
* @access public
* @static
*/
- static function getValue($field, &$values, $default = NULL) {
+ public static function getValue($field, &$values, $default = NULL) {
if (array_key_exists($field, self::$optionValueFields)) {
switch (self::$optionValueFields[$field]['type']) {
case CRM_Utils_Type::T_INT:
* @access public
* @static
*/
- static function retrieve(&$params, &$values) {
+ public static function retrieve(&$params, &$values) {
$optionValue = new CRM_Core_DAO_OptionValue();
$optionValue->copyValues($params);
$optionValue->option_group_id = self::_getGid();
* @return void
* @access public
*/
- function savePaperSize(&$values, $id) {
+ public function savePaperSize(&$values, $id) {
// get the Option Group ID for Paper Sizes (create one if it doesn't exist)
$group_id = self::_getGid(TRUE);
* @access public
* @static
*/
- static function del($id) {
+ public static function del($id) {
if ($id) {
$dao = new CRM_Core_DAO_OptionValue();
$dao->id = $id;
* @static
* @access public
*/
- static function addOrder(&$list, $returnURL) {
+ public static function addOrder(&$list, $returnURL) {
$filter = "option_group_id = " . self::_getGid();
CRM_Utils_Weight::addOrder($list, 'CRM_Core_DAO_OptionValue', 'id', $returnURL, $filter);
}
* @static
* @access public
*/
- static function &getList($namesOnly = FALSE) {
+ public static function &getList($namesOnly = FALSE) {
static $list = array();
if (self::_getGid()) {
// get saved PDF Page Formats from Option Value table
* @static
* @access public
*/
- static function &getDefaultValues() {
+ public static function &getDefaultValues() {
$params = array('is_active' => 1, 'is_default' => 1);
$defaults = array();
if (!self::retrieve($params, $defaults)) {
* @return array $values (reference) associative array of name/value pairs
* @access public
*/
- static function &getPdfFormat($field, $val) {
+ public static function &getPdfFormat($field, $val) {
$params = array('is_active' => 1, $field => $val);
$pdfFormat = array();
if (self::retrieve($params, $pdfFormat)) {
* @return array $values (reference) associative array of name/value pairs
* @access public
*/
- static function &getByName($name) {
+ public static function &getByName($name) {
return self::getPdfFormat('name', $name);
}
* @return array $values (reference) associative array of name/value pairs
* @access public
*/
- static function &getById($id) {
+ public static function &getById($id) {
return self::getPdfFormat('id', $id);
}
* @access public
* @static
*/
- static function getValue($field, &$values, $default = NULL) {
+ public static function getValue($field, &$values, $default = NULL) {
if (array_key_exists($field, self::$optionValueFields)) {
switch (self::$optionValueFields[$field]['type']) {
case CRM_Utils_Type::T_INT:
* @access public
* @static
*/
- static function retrieve(&$params, &$values) {
+ public static function retrieve(&$params, &$values) {
$optionValue = new CRM_Core_DAO_OptionValue();
$optionValue->copyValues($params);
$optionValue->option_group_id = self::_getGid();
* @return void
* @access public
*/
- function savePdfFormat(&$values, $id = NULL) {
+ public function savePdfFormat(&$values, $id = NULL) {
// get the Option Group ID for PDF Page Formats (create one if it doesn't exist)
$group_id = self::_getGid();
* @access public
* @static
*/
- static function del($id) {
+ public static function del($id) {
if ($id) {
$dao = new CRM_Core_DAO_OptionValue();
$dao->id = $id;
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$dao = new CRM_Core_DAO_Persistent();
$dao->copyValues($params);
*
* @return object
*/
- static function add(&$params, &$ids) {
+ public static function add(&$params, &$ids) {
if (CRM_Utils_Array::value('is_config', $params) == 1) {
$params['data'] = serialize(explode(',', $params['data']));
}
*
* @return mixed
*/
- static function getContext($context, $name = NULL) {
+ public static function getContext($context, $name = NULL) {
static $contextNameData = array();
if (!array_key_exists($context, $contextNameData)) {
* @return object
* @throws API_Exception
*/
- static function create($params) {
+ public static function create($params) {
// Ensure mysql phone function exists
CRM_Core_DAO::checkSqlFunctionsExist();
* @access public
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
// Ensure mysql phone function exists
CRM_Core_DAO::checkSqlFunctionsExist();
* @access public
* @static
*/
- static function &getValues($entityBlock) {
+ public static function &getValues($entityBlock) {
$getValues = CRM_Core_BAO_Block::getValues('phone', $entityBlock);
return $getValues;
}
* @access public
* @static
*/
- static function allPhones($id, $updateBlankLocInfo = FALSE, $type = NULL, $filters = array()) {
+ public static function allPhones($id, $updateBlankLocInfo = FALSE, $type = NULL, $filters = array()) {
if (!$id) {
return NULL;
}
* @access public
* @static
*/
- static function allEntityPhones($entityElements, $type = NULL) {
+ public static function allEntityPhones($entityElements, $type = NULL) {
if (empty($entityElements)) {
return NULL;
}
* return void
* @static
*/
- static function setOptionToNull($optionId) {
+ public static function setOptionToNull($optionId) {
if (!$optionId) {
return;
}
/**
* Call common delete function
*/
- static function del($id) {
+ public static function del($id) {
// Ensure mysql phone function exists
CRM_Core_DAO::checkSqlFunctionsExist();
return CRM_Contact_BAO_Contact::deleteObjectWithPrimary('Phone', $id);
/**
* @param array $params
*/
- static function fixAndStoreDirAndURL(&$params) {
+ public static function fixAndStoreDirAndURL(&$params) {
$sql = "
SELECT v.name as valueName, g.name as optionName
FROM civicrm_option_value v,
* @param array $params
* @param string $type
*/
- static function storeDirectoryOrURLPreferences(&$params, $type = 'directory') {
+ public static function storeDirectoryOrURLPreferences(&$params, $type = 'directory') {
$optionName = ($type == 'directory') ? 'directory_preferences' : 'url_preferences';
$sql = "
* @param array $params
* @param bool $setInConfig
*/
- static function retrieveDirectoryAndURLPreferences(&$params, $setInConfig = FALSE) {
+ public static function retrieveDirectoryAndURLPreferences(&$params, $setInConfig = FALSE) {
if ($setInConfig) {
$config = CRM_Core_Config::singleton();
}
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$dao = new CRM_Core_DAO_PreferencesDate();
$dao->copyValues($params);
if ($dao->find(TRUE)) {
* @access public
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
CRM_Core_Error::fatal();
}
* @access public
* @static
*/
- static function del($id) {
+ public static function del($id) {
CRM_Core_Error::fatal();
}
}
*
* @return array
*/
- static function getPositions($cacheKey, $id1, $id2, &$mergeId = NULL, $join = NULL, $where = NULL, $flip = FALSE) {
+ public static function getPositions($cacheKey, $id1, $id2, &$mergeId = NULL, $join = NULL, $where = NULL, $flip = FALSE) {
if ($flip) {
list($id1, $id2) = array($id2, $id1);
}
* @param null $cacheKey
* @param string $entityTable
*/
- static function deleteItem($id = NULL, $cacheKey = NULL, $entityTable = 'civicrm_contact') {
+ public static function deleteItem($id = NULL, $cacheKey = NULL, $entityTable = 'civicrm_contact') {
//clear cache
$sql = "DELETE FROM civicrm_prevnext_cache WHERE entity_table = %1";
* @param bool $isViceVersa
* @param string $entityTable
*/
- static function deletePair($id1, $id2, $cacheKey = NULL, $isViceVersa = FALSE, $entityTable = 'civicrm_contact') {
+ public static function deletePair($id1, $id2, $cacheKey = NULL, $isViceVersa = FALSE, $entityTable = 'civicrm_contact') {
$sql = "DELETE FROM civicrm_prevnext_cache WHERE entity_table = %1";
$params = array(1 => array($entityTable, 'String'));
*
* @return array
*/
- static function retrieve($cacheKey, $join = NULL, $where = NULL, $offset = 0, $rowCount = 0) {
+ public static function retrieve($cacheKey, $join = NULL, $where = NULL, $offset = 0, $rowCount = 0) {
$query = "
SELECT data
FROM civicrm_prevnext_cache pn
/**
* @param $values
*/
- static function setItem($values) {
+ public static function setItem($values) {
$insert = "INSERT INTO civicrm_prevnext_cache ( entity_table, entity_id1, entity_id2, cacheKey, data ) VALUES \n";
$query = $insert . implode(",\n ", $values);
*
* @return int
*/
- static function getCount($cacheKey, $join = NULL, $where = NULL, $op = "=") {
+ public static function getCount($cacheKey, $join = NULL, $where = NULL, $op = "=") {
$query = "
SELECT COUNT(*) FROM civicrm_prevnext_cache pn
{$join}
* @param int $gid
* @param null $cacheKeyString
*/
- static function refillCache($rgid = NULL, $gid = NULL, $cacheKeyString = NULL) {
+ public static function refillCache($rgid = NULL, $gid = NULL, $cacheKeyString = NULL) {
if (!$cacheKeyString && $rgid) {
$contactType = CRM_Core_DAO::getFieldValue('CRM_Dedupe_DAO_RuleGroup', $rgid, 'contact_type');
$cacheKeyString = "merge {$contactType}";
}
}
- static function cleanupCache() {
+ public static function cleanupCache() {
// clean up all prev next caches older than $cacheTimeIntervalDays days
$cacheTimeIntervalDays = 2;
* @param array $cIds
* @param string $entity_table
*/
- static function markSelection($cacheKey, $action = 'unselect', $cIds = NULL, $entity_table = 'civicrm_contact') {
+ public static function markSelection($cacheKey, $action = 'unselect', $cIds = NULL, $entity_table = 'civicrm_contact') {
if (!$cacheKey) {
return;
}
*
* @return array
*/
- static function getSelection($cacheKey, $action = 'get', $entity_table = 'civicrm_contact') {
+ public static function getSelection($cacheKey, $action = 'get', $entity_table = 'civicrm_contact') {
if (!$cacheKey) {
return;
}
/**
* @return array
*/
- static function getSelectedContacts() {
+ public static function getSelectedContacts() {
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String');
$cacheKey = "civicrm search {$qfKey}";
$query = "
*
* @return mixed
*/
- static function buildSelectedContactPager(&$form, &$params) {
+ public static function buildSelectedContactPager(&$form, &$params) {
$params['status'] = ts('Contacts %%StatusMessage%%');
$params['csvString'] = NULL;
$params['buttonTop'] = 'PagerTopButton';
),\r
);\r
\r
- static function getStatus() {\r
+ public static function getStatus() {\r
return self::$status;\r
}\r
\r
- static function setStatus($status) {\r
+ public static function setStatus($status) {\r
self::$status = $status;\r
}\r
/**\r
*\r
* @return object\r
*/\r
- static function add(&$params) {\r
+ public static function add(&$params) {\r
if (CRM_Utils_Array::value('id', $params)) {\r
CRM_Utils_Hook::pre('edit', 'RecurringEntity', $params['id'], $params);\r
}\r
*\r
* @return object\r
*/\r
- static function quickAdd($parentId, $entityId, $entityTable) {\r
+ public static function quickAdd($parentId, $entityId, $entityTable) {\r
$params =\r
array(\r
'parent_id' => $parentId,\r
*\r
* @return void\r
*/\r
- function mode($mode) {\r
+ public function mode($mode) {\r
if ($this->entity_id && $this->entity_table) {\r
if ($this->find(TRUE)) {\r
$this->mode = $mode;\r
*\r
* @return array\r
*/\r
- function generate() {\r
+ public function generate() {\r
$this->generateRecursiveDates();\r
\r
return $this->generateEntities();\r
*\r
* @return object When object\r
*/\r
- function generateRecursion() {\r
+ public function generateRecursion() {\r
// return if already generated\r
if (is_a($this->recursion, 'When')) {\r
return $this->recursion;\r
*\r
* @return array\r
*/\r
- function generateEntities() {\r
+ public function generateEntities() {\r
self::setStatus(self::RUNNING);\r
\r
$newEntities = array();\r
*\r
* @return array array of dates\r
*/\r
- function generateRecursiveDates() {\r
+ public function generateRecursiveDates() {\r
$this->generateRecursion();\r
\r
$recursionDates = array();\r
*\r
* @return array\r
*/\r
- function mapFormValuesToDB($formParams = array()) {\r
+ public function mapFormValuesToDB($formParams = array()) {\r
$dbParams = array();\r
if (CRM_Utils_Array::value('used_for', $formParams)) {\r
$dbParams['used_for'] = $formParams['used_for'];\r
*\r
* @return array\r
*/\r
- function getScheduleParams($scheduleReminderId) {\r
+ public function getScheduleParams($scheduleReminderId) {\r
$scheduleReminderDetails = array();\r
if ($scheduleReminderId) {\r
//Get all the details from schedule reminder table\r
*\r
* @return object When object\r
*/\r
- function getRecursionFromSchedule($scheduleReminderDetails = array()) {\r
+ public function getRecursionFromSchedule($scheduleReminderDetails = array()) {\r
$r = new When();\r
//If there is some data for this id\r
if ($scheduleReminderDetails['repetition_frequency_unit']) {\r
* @static
* @access public
*/
- static function createTable(&$params) {
+ public static function createTable(&$params) {
$sql = self::buildTableSQL($params);
// do not i18n-rewrite
$dao = CRM_Core_DAO::executeQuery($sql, array(), TRUE, NULL, FALSE, FALSE);
*
* @return string
*/
- static function buildTableSQL(&$params) {
+ public static function buildTableSQL(&$params) {
$sql = "CREATE TABLE {$params['name']} (";
if (isset($params['fields']) &&
is_array($params['fields'])
*
* @return string
*/
- static function buildFieldSQL(&$params, $separator, $prefix) {
+ public static function buildFieldSQL(&$params, $separator, $prefix) {
$sql = '';
$sql .= $separator;
$sql .= str_repeat(' ', 8);
*
* @return null|string
*/
- static function buildPrimaryKeySQL(&$params, $separator, $prefix) {
+ public static function buildPrimaryKeySQL(&$params, $separator, $prefix) {
$sql = NULL;
if (!empty($params['primary'])) {
$sql .= $separator;
*
* @return null|string
*/
- static function buildSearchIndexSQL(&$params, $separator, $prefix, $indexExist = FALSE) {
+ public static function buildSearchIndexSQL(&$params, $separator, $prefix, $indexExist = FALSE) {
$sql = NULL;
// dont index blob
*
* @return string
*/
- static function buildIndexSQL(&$params, $separator, $prefix) {
+ public static function buildIndexSQL(&$params, $separator, $prefix) {
$sql = '';
$sql .= $separator;
$sql .= str_repeat(' ', 8);
*
* @return bool
*/
- static function changeFKConstraint($tableName, $fkTableName) {
+ public static function changeFKConstraint($tableName, $fkTableName) {
$fkName = "{$tableName}_entity_id";
if (strlen($fkName) >= 48) {
$fkName = substr($fkName, 0, 32) . "_" . substr(md5($fkName), 0, 16);
*
* @return null|string
*/
- static function buildForeignKeySQL(&$params, $separator, $prefix, $tableName) {
+ public static function buildForeignKeySQL(&$params, $separator, $prefix, $tableName) {
$sql = NULL;
if (!empty($params['fk_table_name']) && !empty($params['fk_field_name'])) {
$sql .= $separator;
*
* @return bool
*/
- static function alterFieldSQL(&$params, $indexExist = FALSE, $triggerRebuild = TRUE) {
+ public static function alterFieldSQL(&$params, $indexExist = FALSE, $triggerRebuild = TRUE) {
$sql = str_repeat(' ', 8);
$sql .= "ALTER TABLE {$params['table_name']}";
* @static
* @access public
*/
- static function dropTable($tableName) {
+ public static function dropTable($tableName) {
$sql = "DROP TABLE $tableName";
$dao = CRM_Core_DAO::executeQuery($sql);
}
* @param string $tableName
* @param string $columnName
*/
- static function dropColumn($tableName, $columnName) {
+ public static function dropColumn($tableName, $columnName) {
$sql = "ALTER TABLE $tableName DROP COLUMN $columnName";
$dao = CRM_Core_DAO::executeQuery($sql);
}
* @param string $tableName
* @param bool $dropUnique
*/
- static function changeUniqueToIndex($tableName, $dropUnique = TRUE) {
+ public static function changeUniqueToIndex($tableName, $dropUnique = TRUE) {
if ($dropUnique) {
$sql = "ALTER TABLE $tableName
DROP INDEX `unique_entity_id` ,
* @param string $createIndexPrefix
* @param array $substrLenghts
*/
- static function createIndexes(&$tables, $createIndexPrefix = 'index', $substrLenghts = array()) {
+ public static function createIndexes(&$tables, $createIndexPrefix = 'index', $substrLenghts = array()) {
$queries = array();
require_once 'CRM/Core/DAO/Domain.php';
$domain = new CRM_Core_DAO_Domain;
*
* @throws Exception
*/
- static function alterFieldLength($customFieldID, $tableName, $columnName, $length) {
+ public static function alterFieldLength($customFieldID, $tableName, $columnName, $length) {
// first update the custom field tables
$sql = "
UPDATE civicrm_custom_field
* Allow key o be cleared
* @param string $cacheKey
*/
- static function flushCache($cacheKey){
+ public static function flushCache($cacheKey){
unset(self::$_cache[$cacheKey]);
$globalCache = CRM_Utils_Cache::singleton();
$globalCache->delete($cacheKey);
* @static
* @access public
*/
- static function getItems(&$params, $domains = NULL, $settingsToReturn) {
+ public static function getItems(&$params, $domains = NULL, $settingsToReturn) {
$originalDomain = CRM_Core_Config::domainID();
if (empty($domains)) {
$domains[] = $originalDomain;
* @static
* @access public
*/
- static function setItems(&$params, $domains = NULL) {
+ public static function setItems(&$params, $domains = NULL) {
$originalDomain = CRM_Core_Config::domainID();
if (empty($domains)) {
$domains[] = $originalDomain;
* @throws api_Exception
* @return array $fieldstoset name => value array of the fields to be set (with extraneous removed)
*/
- static function validateSettingsInput($params, &$fields, $createMode = TRUE) {
+ public static function validateSettingsInput($params, &$fields, $createMode = TRUE) {
$group = CRM_Utils_Array::value('group', $params);
$ignoredParams = array(
* @value mixed value of the setting to be set
* @fieldSpec array Metadata for given field (drawn from the xml)
*/
- static function validateSetting(&$value, $fieldSpec) {
+ public static function validateSetting(&$value, $fieldSpec) {
if($fieldSpec['type'] == 'String' && is_array($value)){
$value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,$value) . CRM_Core_DAO::VALUE_SEPARATOR;
}
* @value mixed value of the setting to be set
* @fieldSpec array Metadata for given field (drawn from the xml)
*/
- static function validateBoolSetting(&$value, $fieldSpec) {
+ public static function validateBoolSetting(&$value, $fieldSpec) {
if (!CRM_Utils_Rule::boolean($value)) {
throw new api_Exception("Boolean value required for {$fieldSpec['name']}");
}
/**
* Load up settings metadata from files
*/
- static function loadSettingsMetadata($metaDataFolder) {
+ public static function loadSettingsMetadata($metaDataFolder) {
$settingMetaData = array();
$settingsFiles = CRM_Utils_File::findFiles($metaDataFolder, '*.setting.php');
foreach ($settingsFiles as $file) {
* @param array $filters Filters to match against data
* @param array $settingSpec metadata to filter
*/
- static function _filterSettingsSpecification($filters, &$settingSpec) {
+ public static function _filterSettingsSpecification($filters, &$settingSpec) {
if (empty($filters)) {
return;
}
* Multisites have often been overlooked in upgrade scripts so can be expected to be missing
* a number of settings
*/
- static function updateSettingsFromMetaData() {
+ public static function updateSettingsFromMetaData() {
$apiParams = array(
'version' => 3,
'domain_id' => 'all',
*
* Note that where the key name is being changed the 'legacy_key' will give us the old name
*/
- static function convertConfigToSetting($name, $domainID = NULL) {
+ public static function convertConfigToSetting($name, $domainID = NULL) {
// we have to force this here in case more than one domain is in play.
// whenever there is a possibility of more than one domain we must force it
$config = CRM_Core_Config::singleton();
* @param array $params
* @param int $domainID
*/
- static function fixAndStoreDirAndURL(&$params, $domainID = NULL) {
+ public static function fixAndStoreDirAndURL(&$params, $domainID = NULL) {
if (self::isUpgradeFromPreFourOneAlpha1()) {
return;
}
* @param array $params
* @param $group
*/
- static function storeDirectoryOrURLPreferences(&$params, $group) {
+ public static function storeDirectoryOrURLPreferences(&$params, $group) {
foreach ($params as $name => $value) {
// always try to store relative directory or url from CMS root
$value = ($group == self::DIRECTORY_PREFERENCES_NAME) ? CRM_Utils_File::relativeDirectory($value) : CRM_Utils_System::relativeURL($value);
* @param array $params
* @param bool $setInConfig
*/
- static function retrieveDirectoryAndURLPreferences(&$params, $setInConfig = FALSE) {
+ public static function retrieveDirectoryAndURLPreferences(&$params, $setInConfig = FALSE) {
if (CRM_Core_Config::isUpgradeMode()) {
$isJoomla = (defined('CIVICRM_UF') && CIVICRM_UF == 'Joomla') ? TRUE : FALSE;
// hack to set the resource base url so that js/ css etc is loaded correctly
*
* @return boolean
*/
- static function isUpgradeFromPreFourOneAlpha1() {
+ public static function isUpgradeFromPreFourOneAlpha1() {
if (CRM_Core_Config::isUpgradeMode()) {
$currentVer = CRM_Core_BAO_Domain::version();
if (version_compare($currentVer, '4.1.alpha1') < 0) {
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$tag = new CRM_Core_DAO_Tag();
$tag->copyValues($params);
if ($tag->find(TRUE)) {
*
* @return mixed
*/
- function getTree($usedFor = NULL, $excludeHidden = FALSE) {
+ public function getTree($usedFor = NULL, $excludeHidden = FALSE) {
if (!isset($this->tree)) {
$this->buildTree($usedFor, $excludeHidden);
}
* @param null $usedFor
* @param bool $excludeHidden
*/
- function buildTree($usedFor = NULL, $excludeHidden = FALSE) {
+ public function buildTree($usedFor = NULL, $excludeHidden = FALSE) {
$sql = "SELECT id, parent_id, name, description, is_selectable FROM civicrm_tag";
$whereClause = array();
*
* @return array
*/
- static function getTagsUsedFor($usedFor = array('civicrm_contact'),
+ public static function getTagsUsedFor($usedFor = array('civicrm_contact'),
$buildSelect = TRUE,
$all = FALSE,
$parentId = NULL
* @static
*
*/
- static function del($id) {
+ public static function del($id) {
// since this is a destructive operation, lets make sure
// id is a postive number
CRM_Utils_Type::validate($id, 'Positive');
* @access public
* @static
*/
- static function add(&$params, $ids = array()) {
+ public static function add(&$params, $ids = array()) {
$id = CRM_Utils_Array::value('id', $params, CRM_Utils_Array::value('tag', $ids));
if (!$id && !self::dataExists($params)) {
return NULL;
* @access public
* @static
*/
- static function dataExists(&$params) {
+ public static function dataExists(&$params) {
// Disallow empty values except for the number zero.
// TODO: create a utility for this since it's needed in many places
if (!empty($params['name']) || (string) $params['name'] === '0') {
* @access public
* @static
*/
- static function getTagSet($entityTable) {
+ public static function getTagSet($entityTable) {
$tagSets = array();
$query = "SELECT name, id FROM civicrm_tag
WHERE is_tagset=1 AND parent_id IS NULL and used_for LIKE %1";
* @return array $tags associated array of tag name and id@access public
* @static
*/
- static function getTagsNotInTagset() {
+ public static function getTagsNotInTagset() {
$tags = $tagSets = array();
// first get all the tag sets
$query = "SELECT id FROM civicrm_tag WHERE is_tagset=1 AND parent_id IS NULL";
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
return CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_UFField', $params, $defaults);
}
* @access public
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
//check if custom data profile field is disabled
if ($is_active) {
if (CRM_Core_BAO_UFField::checkUFStatus($id)) {
* @static
*
*/
- static function add(&$params, $ids = array()) {
+ public static function add(&$params, $ids = array()) {
// set values for uf field properties and save
$ufField = new CRM_Core_DAO_UFField();
$ufField->field_type = $params['field_name'][0];
* @static
* @access public
*/
- static function setUFField($customFieldId, $is_active) {
+ public static function setUFField($customFieldId, $is_active) {
//find the profile id given custom field
$ufField = new CRM_Core_DAO_UFField();
$ufField->field_name = "custom_" . $customFieldId;
* @static
* @access public
*/
- static function copy($old_id, $new_id) {
+ public static function copy($old_id, $new_id) {
$ufField = new CRM_Core_DAO_UFField();
$ufField->uf_group_id = $old_id;
$ufField->find();
* @static
* @access public
*/
- static function delUFField($customFieldId) {
+ public static function delUFField($customFieldId) {
//find the profile id given custom field id
$ufField = new CRM_Core_DAO_UFField();
$ufField->field_name = "custom_" . $customFieldId;
* @static
* @access public
*/
- static function setUFFieldStatus($customGroupId, $is_active) {
+ public static function setUFFieldStatus($customGroupId, $is_active) {
//find the profile id given custom group id
$queryString = "SELECT civicrm_custom_field.id as custom_field_id
FROM civicrm_custom_field, civicrm_custom_group
* @static
* @access public
*/
- static function checkUFStatus($UFFieldId) {
+ public static function checkUFStatus($UFFieldId) {
$fieldName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFField', $UFFieldId, 'field_name');
// return if field is not a custom field
if (!$customFieldId = CRM_Core_BAO_CustomField::getKeyID($fieldName)) {
* Find out whether given profile group using Activity
* Profile fields with contact fields
*/
- static function checkContactActivityProfileType($ufGroupId) {
+ public static function checkContactActivityProfileType($ufGroupId) {
$ufGroup = new CRM_Core_DAO_UFGroup();
$ufGroup->id = $ufGroupId;
$ufGroup->find(TRUE);
* @return boolean $valid
* @static
*/
- static function checkValidProfileType($ufGroupId, $required, $optional = NULL) {
+ public static function checkValidProfileType($ufGroupId, $required, $optional = NULL) {
if (!is_array($required) || empty($required)) {
return;
}
* @access public
* @static
*/
- static function checkProfileType($ufGroupId) {
+ public static function checkProfileType($ufGroupId) {
$ufGroup = new CRM_Core_DAO_UFGroup();
$ufGroup->id = $ufGroupId;
$ufGroup->find(TRUE);
*
* TODO Why is this function in this class? It seems to be about the UFGroup.
*/
- static function getProfileType($ufGroupId, $returnMixType = TRUE, $onlyPure = FALSE, $skipComponentType = FALSE) {
+ public static function getProfileType($ufGroupId, $returnMixType = TRUE, $onlyPure = FALSE, $skipComponentType = FALSE) {
$ufGroup = new CRM_Core_DAO_UFGroup();
$ufGroup->id = $ufGroupId;
$ufGroup->is_active = 1;
* @access public
* @static
*/
- static function checkProfileGroupType($ctype) {
+ public static function checkProfileGroupType($ctype) {
$ufGroup = new CRM_Core_DAO_UFGroup();
$query = "
*
* @return boolean $result true/false.
*/
- static function checkSearchableORInSelector($profileID) {
+ public static function checkSearchableORInSelector($profileID) {
$result = FALSE;
if (!$profileID) {
return $result;
*
* @return void.
*/
- function resetInSelectorANDSearchable($profileID) {
+ public function resetInSelectorANDSearchable($profileID) {
if (!$profileID) {
return;
}
*
* @return bool Can the address block be hidden safe in the knowledge all fields are elsewhere collected (see CRM-15118)
*/
- static function assignAddressField($key, &$profileAddressFields, $profileFilter) {
+ public static function assignAddressField($key, &$profileAddressFields, $profileFilter) {
$billing_id = CRM_Core_BAO_LocationType::getBilling();
list($prefixName, $index) = CRM_Utils_System::explode('-', $key, 2);
* @param string $fieldName
* @return bool
*/
- static function isValidFieldName($fieldName) {
+ public static function isValidFieldName($fieldName) {
$availableFields = CRM_Core_BAO_UFField::getAvailableFieldsFlat();
return isset($availableFields[$fieldName]);
}
/**
* @return array|null
*/
- static function getContribBatchEntryFields() {
+ public static function getContribBatchEntryFields() {
if (self::$_contriBatchEntryFields === NULL) {
self::$_contriBatchEntryFields = array(
'send_receipt' => array(
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
return CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_UFGroup', $params, $defaults);
}
*
* @return string contact type
*/
- static function getContactType($id) {
+ public static function getContactType($id) {
$validTypes = array_filter(array_keys(CRM_Core_SelectValues::contactType()));
$validSubTypes = CRM_Contact_BAO_ContactType::subTypeInfo();
* @access public
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_UFGroup', $id, 'is_active', $is_active);
}
* @static
* @access public
*/
- static function getRegistrationFields($action, $mode, $ctype = NULL) {
+ public static function getRegistrationFields($action, $mode, $ctype = NULL) {
if ($mode & CRM_Profile_Form::MODE_REGISTER) {
$ufGroups = CRM_Core_BAO_UFGroup::getModuleUFGroup('User Registration');
}
* @static
* @access public
*/
- static function isValid($userID, $title, $register = FALSE, $action = NULL) {
+ public static function isValid($userID, $title, $register = FALSE, $action = NULL) {
if ($register) {
$controller = new CRM_Core_Controller_Simple('CRM_Profile_Form_Dynamic',
ts('Dynamic Form Creator'),
*
* @return object
*/
- static function add(&$params, $ids = array()) {
+ public static function add(&$params, $ids = array()) {
$fields = array('is_active', 'add_captcha', 'is_map', 'is_update_dupe', 'is_edit_link', 'is_uf_link', 'is_cms_user');
foreach ($fields as $field) {
$params[$field] = CRM_Utils_Array::value($field, $params, FALSE);
* @access public
* @static
*/
- static function createUFJoin(&$params, $ufGroupId) {
+ public static function createUFJoin(&$params, $ufGroupId) {
$groupTypes = CRM_Utils_Array::value('uf_group_type', $params);
// get ufjoin records for uf group
* @access public
* @static
*/
- static function addUFJoin(&$params) {
+ public static function addUFJoin(&$params) {
$ufJoin = new CRM_Core_DAO_UFJoin();
$ufJoin->copyValues($params);
$ufJoin->save();
* @access public
* @static
*/
- static function delUFJoin(&$params) {
+ public static function delUFJoin(&$params) {
$ufJoin = new CRM_Core_DAO_UFJoin();
$ufJoin->copyValues($params);
$ufJoin->delete();
* @access public
* @static
*/
- static function getWeight($ufGroupId = NULL) {
+ public static function getWeight($ufGroupId = NULL) {
//calculate the weight
$p = array();
if (!$ufGroupId) {
* @static
* @access public
*/
- static function filterUFGroups($ufGroupId, $contactID = NULL) {
+ public static function filterUFGroups($ufGroupId, $contactID = NULL) {
if (!$contactID) {
$session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
* @static
* @access public
*/
- static function getProfiles($types, $onlyPure = FALSE) {
+ public static function getProfiles($types, $onlyPure = FALSE) {
$profiles = array();
$ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
* @static
* @access public
*/
- static function getValidProfiles($required, $optional = NULL) {
+ public static function getValidProfiles($required, $optional = NULL) {
if (!is_array($required) || empty($required)) {
return;
}
* @static
* @access public
*/
- static function checkValidProfile($ufId, $required = NULL) {
+ public static function checkValidProfile($ufId, $required = NULL) {
$validProfile = FALSE;
if (!$ufId) {
return $validProfile;
* @return mixed $defaults@static
* @access public
*/
- static function setRegisterDefaults(&$fields, &$defaults) {
+ public static function setRegisterDefaults(&$fields, &$defaults) {
$config = CRM_Core_Config::singleton();
foreach ($fields as $name => $field) {
if (substr($name, 0, 8) == 'country-') {
* @return void
* @access public
*/
- static function copy($id) {
+ public static function copy($id) {
$fieldsFix = array('prefix' => array('title' => ts('Copy of ')));
$copy = &CRM_Core_DAO::copyGeneric('CRM_Core_DAO_UFGroup',
array('id' => $id),
* @access public
*/
- static function commonSendMail($contactID, &$values) {
+ public static function commonSendMail($contactID, &$values) {
if (!$contactID || !$values) {
return;
* @return array
* @access public
*/
- function checkFieldsEmptyValues($gid, $cid, $params, $skipCheck = FALSE) {
+ public function checkFieldsEmptyValues($gid, $cid, $params, $skipCheck = FALSE) {
if ($gid) {
if (CRM_Core_BAO_UFGroup::filterUFGroups($gid, $cid) || $skipCheck) {
$values = array();
* @return void
* @access public
*/
- function profileDisplay($gid, $values, $template) {
+ public function profileDisplay($gid, $values, $template) {
$groupTitle = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $gid, 'title');
$template->assign('grouptitle', $groupTitle);
if (count($values)) {
* @access public
* @static
*/
- static function formatFields($params, $contactId = NULL) {
+ public static function formatFields($params, $contactId = NULL) {
if ($contactId) {
// get the primary location type id and email
list($name, $primaryEmail, $primaryLocationType) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactId);
*
* @return array list of calculated group type
*/
- static function calculateGroupType($gId, $includeTypeValues = FALSE, $ignoreFieldId = NULL) {
+ public static function calculateGroupType($gId, $includeTypeValues = FALSE, $ignoreFieldId = NULL) {
//get the profile fields.
$ufFields = self::getFields($gId, FALSE, NULL, NULL, NULL, TRUE, NULL, TRUE);
return self::_calculateGroupType($ufFields, $includeTypeValues, $ignoreFieldId);
*
* @return array list of calculated group type
*/
- static function _calculateGroupType($ufFields, $includeTypeValues = FALSE, $ignoreFieldId = NULL) {
+ public static function _calculateGroupType($ufFields, $includeTypeValues = FALSE, $ignoreFieldId = NULL) {
$groupType = $groupTypeValues = $customFieldIds = array();
if (!empty($ufFields)) {
foreach ($ufFields as $fieldName => $fieldValue) {
*
* @return Boolean
*/
- static function updateGroupTypes($gId, $groupTypes = array()) {
+ public static function updateGroupTypes($gId, $groupTypes = array()) {
if (!is_array($groupTypes) || !$gId) {
return FALSE;
}
* @return string
* @throws CRM_Core_Exception
*/
- static function encodeGroupType($coreTypes, $subTypes, $delim = CRM_Core_DAO::VALUE_SEPARATOR) {
+ public static function encodeGroupType($coreTypes, $subTypes, $delim = CRM_Core_DAO::VALUE_SEPARATOR) {
$groupTypeExpr = '';
if ($coreTypes) {
$groupTypeExpr .= implode(',', $coreTypes);
*
* @return array
*/
- static function getCreateLinks($profiles = '', $appendProfiles = array()) {
+ public static function getCreateLinks($profiles = '', $appendProfiles = array()) {
// Default to contact profiles
if (!$profiles) {
$profiles = array('new_individual', 'new_organization', 'new_household');
* @return array returns array
* @static
*/
- static function profileGroups($profileID) {
+ public static function profileGroups($profileID) {
$groupTypes = array();
$profileTypes = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileID, 'group_type');
if ($profileTypes) {
*
* @return array $subscribeGroupIds This contains array of groups for subscription
*/
- static function getDoubleOptInGroupIds(&$params, $contactId = NULL) {
+ public static function getDoubleOptInGroupIds(&$params, $contactId = NULL) {
$config = CRM_Core_Config::singleton();
$subscribeGroupIds = array();
* @static
* @access public
*/
- static function checkForMixProfiles($profileIds) {
+ public static function checkForMixProfiles($profileIds) {
$mixProfile = FALSE;
$contactTypes = array('Individual', 'Household', 'Organization');
* @static
* @access public
*/
- static function showOverlayProfile() {
+ public static function showOverlayProfile() {
$showOverlay = TRUE;
// get the id of overlay profile
* @static
* @access public
*/
- static function groupTypeValues($profileId, $groupType = NULL) {
+ public static function groupTypeValues($profileId, $groupType = NULL) {
$groupTypeValue = array();
$groupTypes = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileId, 'group_type');
/**
* @return bool|object
*/
- static function isProfileDoubleOptin() {
+ public static function isProfileDoubleOptin() {
// check for double optin
$config = CRM_Core_Config::singleton();
if (in_array('CiviMail', $config->enableComponents)) {
/**
* @return bool|object
*/
- static function isProfileAddToGroupDoubleOptin() {
+ public static function isProfileAddToGroupDoubleOptin() {
// check for add to group double optin
$config = CRM_Core_Config::singleton();
if (in_array('CiviMail', $config->enableComponents)) {
* @return array profileIds profile ids
* @static
*/
- static function getBatchProfiles() {
+ public static function getBatchProfiles() {
$query = "SELECT id
FROM civicrm_uf_group
WHERE name IN ('contribution_batch_entry', 'membership_batch_entry')";
*
* @return array|null
*/
- static function shiftMultiRecordFields(&$source, &$destination, $returnMultiSummaryFields = FALSE) {
+ public static function shiftMultiRecordFields(&$source, &$destination, $returnMultiSummaryFields = FALSE) {
$multiSummaryFields = $returnMultiSummaryFields ? array( ) : NULL;
foreach ($source as $field => $properties) {
if (!CRM_Core_BAO_CustomField::getKeyID($field)) {
*
* @static
*/
- static function reformatProfileFields(&$fields) {
+ public static function reformatProfileFields(&$fields) {
//reformat fields array
foreach ($fields as $name => $field) {
//reformat phone and extension field
*
* @return CRM_Core_DAO_UFMatch
*/
- static function create($params) {
+ public static function create($params) {
$hook = empty($params['id']) ? 'create' : 'edit';
CRM_Utils_Hook::pre($hook, 'UFMatch', CRM_Utils_Array::value('id', $params), $params);
if(empty($params['domain_id'])) {
* @access public
* @static
*/
- static function synchronize(&$user, $update, $uf, $ctype, $isLogin = FALSE) {
+ public static function synchronize(&$user, $update, $uf, $ctype, $isLogin = FALSE) {
$userSystem = CRM_Core_Config::singleton()->userSystem;
$session = CRM_Core_Session::singleton();
if (!is_object($session)) {
* @access public
* @static
*/
- static function &synchronizeUFMatch(&$user, $userKey, $uniqId, $uf, $status = NULL, $ctype = NULL, $isLogin = FALSE) {
+ public static function &synchronizeUFMatch(&$user, $userKey, $uniqId, $uf, $status = NULL, $ctype = NULL, $isLogin = FALSE) {
$config = CRM_Core_Config::singleton();
if (!CRM_Utils_Rule::email($uniqId)) {
* @access public
* @static
*/
- static function updateUFName($contactId) {
+ public static function updateUFName($contactId) {
if (!$contactId) {
return;
}
* @access public
* @static
*/
- static function updateContactEmail($contactId, $emailAddress) {
+ public static function updateContactEmail($contactId, $emailAddress) {
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
$emailAddress = $strtolower($emailAddress);
* @access public
* @static
*/
- static function deleteUser($ufID) {
+ public static function deleteUser($ufID) {
$ufmatch = new CRM_Core_DAO_UFMatch();
$ufmatch->uf_id = $ufID;
* @access public
* @static
*/
- static function getContactId($ufID) {
+ public static function getContactId($ufID) {
if (!isset($ufID)) {
return NULL;
}
* @access public
* @static
*/
- static function getUFId($contactID) {
+ public static function getUFId($contactID) {
if (!isset($contactID)) {
return NULL;
}
/**
* @return bool
*/
- static function isEmptyTable() {
+ public static function isEmptyTable() {
$sql = "SELECT count(id) FROM civicrm_uf_match";
return CRM_Core_DAO::singleValueQuery($sql) > 0 ? FALSE : TRUE;
}
* @access public
* @static
*/
- static function getContactIDs() {
+ public static function getContactIDs() {
$id = array();
$dao = new CRM_Core_DAO_UFMatch();
$dao->find();
* @access public
* @static
*/
- static function getAllowedToLogin($openId) {
+ public static function getAllowedToLogin($openId) {
$ufmatch = new CRM_Core_DAO_UFMatch();
$ufmatch->uf_name = $openId;
$ufmatch->allowed_to_login = 1;
* @access public
* @static
*/
- static function getNextUfIdValue() {
+ public static function getNextUfIdValue() {
$query = "SELECT MAX(uf_id)+1 AS next_uf_id FROM civicrm_uf_match";
$dao = CRM_Core_DAO::executeQuery($query);
if ($dao->fetch()) {
*
* @return bool
*/
- static function isDuplicateUser($email) {
+ public static function isDuplicateUser($email) {
$session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
if (!empty($email) && isset($contactID)) {
*
* @return array
*/
- static function getUFValues($ufID = NULL) {
+ public static function getUFValues($ufID = NULL) {
if (!$ufID) {
//get logged in user uf id.
$ufID = CRM_Utils_System::getLoggedInUfID();
* @access public
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
$hook = empty($params['id']) ? 'create' : 'edit';
CRM_Utils_Hook::pre($hook, 'Website', CRM_Utils_Array::value('id', $params), $params);
* @access public
* @static
*/
- static function create(&$params, $contactID, $skipDelete) {
+ public static function create(&$params, $contactID, $skipDelete) {
if (empty($params)) {
return FALSE;
}
* @return void
* @static
*/
- static function del($ids) {
+ public static function del($ids) {
$query = 'DELETE FROM civicrm_website WHERE id IN ( ' . implode(',', $ids) . ')';
CRM_Core_DAO::executeQuery($query);
// FIXME: we should return false if the del was unsuccessful
* @access public
* @static
*/
- static function &getValues(&$params, &$values) {
+ public static function &getValues(&$params, &$values) {
$websites = array();
$website = new CRM_Core_DAO_Website();
$website->contact_id = $params['contact_id'];
* @access public
* @static
*/
- static function allWebsites($id, $updateBlankLocInfo = FALSE) {
+ public static function allWebsites($id, $updateBlankLocInfo = FALSE) {
if (!$id) {
return NULL;
}
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
return CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_WordRepalcement', $params, $defaults);
}
* @access public
* @static
*/
- static function getWordReplacement($reset = NULL) {
+ public static function getWordReplacement($reset = NULL) {
static $wordReplacement = NULL;
if (!$wordReplacement || $reset) {
$wordReplacement = new CRM_Core_BAO_WordReplacement();
* @return WordReplacement array
* @access public
*/
- static function edit(&$params, &$id) {
+ public static function edit(&$params, &$id) {
$wordReplacement = new CRM_Core_DAO_WordReplacement();
$wordReplacement->id = $id;
$wordReplacement->copyValues($params);
* @return WordReplacement array
* @access public
*/
- static function create($params) {
+ public static function create($params) {
if(array_key_exists("domain_id",$params) === FALSE) {
$params["domain_id"] = CRM_Core_Config::domainID();
}
* @return object
* @static
*/
- static function del($id) {
+ public static function del($id) {
$dao = new CRM_Core_DAO_WordReplacement();
$dao->id = $id;
$dao->delete();
/**
* Rebuild
*/
- static function rebuild($clearCaches = TRUE) {
+ public static function rebuild($clearCaches = TRUE) {
$id = CRM_Core_Config::domainID();
$stringOverride = self::getAllAsConfigArray($id);
$params = array('locale_custom_strings' => serialize($stringOverride));
* @return array Each item is $params for WordReplacement.create
* @see CRM_Core_BAO_WordReplacement::convertConfigArraysToAPIParams
*/
- static function getConfigArraysAsAPIParams($rebuildEach) {
+ public static function getConfigArraysAsAPIParams($rebuildEach) {
$wordReplacementCreateParams = array();
// get all domains
$result = civicrm_api3('domain', 'get', array(
/**
* Constructor
*/
- function __construct() {}
+ public function __construct() {}
}
* Class constructor
*
*/
- function __construct() {}
+ public function __construct() {}
/**
* Initialises the $_properties array
*
* @return void
*/
- static function initProperties() {
+ public static function initProperties() {
if (!defined('BLOCK_CACHE_GLOBAL')) {
define('BLOCK_CACHE_GLOBAL', 0x0008);
}
*
* @return string the value of the desired property
*/
- static function getProperty($id, $property) {
+ public static function getProperty($id, $property) {
if (!(self::$_properties)) {
self::initProperties();
}
*
* @return void
*/
- static function setProperty($id, $property, $value) {
+ public static function setProperty($id, $property, $value) {
if (!(self::$_properties)) {
self::initProperties();
}
*
* @return array the $_properties array
*/
- static function properties() {
+ public static function properties() {
if (!(self::$_properties)) {
self::initProperties();
}
* @return array
* @access public
*/
- static function getInfo() {
+ public static function getInfo() {
$block = array();
foreach (self::properties() as $id => $value) {
* @return array
* @access public
*/
- static function getContent($id) {
+ public static function getContent($id) {
// return if upgrade mode
$config = CRM_Core_Config::singleton();
if ($config->isUpgradeMode()) {
* @return array
* @access public
*/
- static function fetch($id, $fileName, $properties) {
+ public static function fetch($id, $fileName, $properties) {
$template = CRM_Core_Smarty::singleton();
if ($properties) {
*
* @return object
*/
- static function &singleton($force = FALSE) {
+ public static function &singleton($force = FALSE) {
if ($force || self::$_singleton === NULL) {
self::$_singleton = new CRM_Core_ClassLoader();
}
*
* @api
*/
- function register($prepend = FALSE) {
+ public function register($prepend = FALSE) {
if ($this->_registered) {
return;
}
require_once "$civicrm_base_path/packages/vendor/autoload.php";
}
- function initHtmlPurifier($prepend) {
+ public function initHtmlPurifier($prepend) {
if (class_exists('HTMLPurifier_Bootstrap')) {
// HTMLPurifier is already initialized, e.g. by the Drupal module.
return;
/**
* @param $class
*/
- function loadClass($class) {
+ public function loadClass($class) {
if (
// Only load classes that clearly belong to CiviCRM.
// Note: api/v3 does not use classes, but api_v3's test-suite does
/**
*
*/
- function __construct() {
+ public function __construct() {
}
// TODO: this is the most rudimentary possible hack. CG config should
/**
* @param is $config
*/
- function setConfig($config) {
+ public function setConfig($config) {
$this->config = $config;
$this->tables = $this->config->tables;
}
* Generate configuration files
*/
class CRM_Core_CodeGen_Config extends CRM_Core_CodeGen_BaseTask {
- function run() {
+ public function run() {
$this->generateTemplateVersion();
$this->setupCms();
}
- function generateTemplateVersion() {
+ public function generateTemplateVersion() {
file_put_contents($this->config->tplCodePath . "/CRM/common/version.tpl", $this->config->db_version);
}
- function setupCms() {
+ public function setupCms() {
if (!in_array($this->config->cms, array(
'drupal', 'joomla', 'wordpress'))) {
echo "Config file for '{$this->config->cms}' not known.";
* Create DAO ORM classes.
*/
class CRM_Core_CodeGen_DAO extends CRM_Core_CodeGen_BaseTask {
- function run() {
+ public function run() {
$this->generateDAOs();
}
- function generateDAOs() {
+ public function generateDAOs() {
foreach (array_keys($this->tables) as $name) {
echo "Generating $name as " . $this->tables[$name]['fileName'] . "\n";
* Generate language files and classes
*/
class CRM_Core_CodeGen_I18n extends CRM_Core_CodeGen_BaseTask {
- function run() {
+ public function run() {
$this->generateInstallLangs();
$this->generateSchemaStructure();
}
- function generateInstallLangs() {
+ public function generateInstallLangs() {
// CRM-7161: generate install/langs.php from the languages template
// grep it for enabled languages and create a 'xx_YY' => 'Language name' $langs mapping
$matches = array();
file_put_contents('../install/langs.php', "<?php \$langs = " . var_export($langs, true) . ";");
}
- function generateSchemaStructure() {
+ public function generateSchemaStructure() {
echo "Generating CRM_Core_I18n_SchemaStructure...\n";
$columns = array();
$indices = array();
*
* @param $config is currently the CRM_Core_CodeGen_Main object.
*/
- function setConfig($config);
+ public function setConfig($config);
/**
* Perform the task.
*/
- function run();
+ public function run();
}
* @param $schemaPath
* @param $digestPath
*/
- function __construct($CoreDAOCodePath, $sqlCodePath, $phpCodePath, $tplCodePath, $smartyPluginDirs, $argCms, $argVersion, $schemaPath, $digestPath) {
+ public function __construct($CoreDAOCodePath, $sqlCodePath, $phpCodePath, $tplCodePath, $smartyPluginDirs, $argCms, $argVersion, $schemaPath, $digestPath) {
$this->CoreDAOCodePath = $CoreDAOCodePath;
$this->sqlCodePath = $sqlCodePath;
$this->phpCodePath = $phpCodePath;
* Automatically generate a variety of files
*
*/
- function main() {
+ public function main() {
if (!empty($this->digestPath) && file_exists($this->digestPath) && $this->hasExpectedFiles()) {
if ($this->getDigest() === file_get_contents($this->digestPath)) {
echo "GenCode has previously executed. To force execution, please (a) omit CIVICRM_GENCODE_DIGEST\n";
}
}
- function runAllTasks() {
+ public function runAllTasks() {
// TODO: This configuration can be manipulated dynamically.
$components = $this->getTasks();
foreach ($components as $component) {
*
* @return string
*/
- function getDigest() {
+ public function getDigest() {
if ($this->digest === NULL) {
$srcDir = CRM_Core_CodeGen_Util_File::findCoreSourceDir();
$files = CRM_Core_CodeGen_Util_File::findManyFiles(array(
/**
* @return array
*/
- function getExpectedFiles() {
+ public function getExpectedFiles() {
return array(
$this->sqlCodePath . '/civicrm.mysql',
$this->phpCodePath . '/CRM/Contact/DAO/Contact.php',
/**
* @return bool
*/
- function hasExpectedFiles() {
+ public function hasExpectedFiles() {
foreach ($this->getExpectedFiles() as $file) {
if (!file_exists($file)) {
return FALSE;
* Create classes which are used for schema introspection.
*/
class CRM_Core_CodeGen_Reflection extends CRM_Core_CodeGen_BaseTask {
- function run() {
+ public function run() {
$this->generateListAll();
}
- function generateListAll() {
+ public function generateListAll() {
$template = new CRM_Core_CodeGen_Util_Template('php');
$template->assign('tables', $this->tables);
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
$this->locales = $this->findLocales();
}
- function run() {
+ public function run() {
CRM_Core_CodeGen_Util_File::createDir($this->config->sqlCodePath);
$this->generateCreateSql();
/**
* @param string $fileName
*/
- function generateCreateSql($fileName = 'civicrm.mysql') {
+ public function generateCreateSql($fileName = 'civicrm.mysql') {
echo "Generating sql file\n";
$template = new CRM_Core_CodeGen_Util_Template('sql');
/**
* @param string $fileName
*/
- function generateDropSql($fileName = 'civicrm_drop.mysql') {
+ public function generateDropSql($fileName = 'civicrm_drop.mysql') {
echo "Generating sql drop tables file\n";
$dropOrder = array_reverse(array_keys($this->tables));
$template = new CRM_Core_CodeGen_Util_Template('sql');
$template->run('drop.tpl', $this->config->sqlCodePath . $fileName);
}
- function generateNavigation() {
+ public function generateNavigation() {
echo "Generating navigation file\n";
$template = new CRM_Core_CodeGen_Util_Template('sql');
$template->run('civicrm_navigation.tpl', $this->config->sqlCodePath . "civicrm_navigation.mysql");
}
- function generateLocaleDataSql() {
+ public function generateLocaleDataSql() {
$template = new CRM_Core_CodeGen_Util_Template('sql');
global $tsLocale;
$tsLocale = $oldTsLocale;
}
- function generateSample() {
+ public function generateSample() {
$template = new CRM_Core_CodeGen_Util_Template('sql');
$sections = array(
'civicrm_sample.tpl',
/**
* @return array
*/
- function findLocales() {
+ public function findLocales() {
require_once 'CRM/Core/Config.php';
$config = CRM_Core_Config::singleton(FALSE);
$locales = array();
* @param $schemaPath
* @param string $buildVersion which version of the schema to build
*/
- function parse($schemaPath, $buildVersion) {
+ public function parse($schemaPath, $buildVersion) {
$this->buildVersion = $buildVersion;
echo "Parsing schema description ".$schemaPath."\n";
*
* @return array
*/
- function &getDatabase(&$dbXML) {
+ public function &getDatabase(&$dbXML) {
$database = array('name' => trim((string ) $dbXML->name));
$attributes = '';
*
* @return array
*/
- function getTables($dbXML, &$database) {
+ public function getTables($dbXML, &$database) {
$tables = array();
foreach ($dbXML->tables as $tablesXML) {
foreach ($tablesXML->table as $tableXML) {
* @param $tables
* @param string $classNames
*/
- function resolveForeignKeys(&$tables, &$classNames) {
+ public function resolveForeignKeys(&$tables, &$classNames) {
foreach (array_keys($tables) as $name) {
$this->resolveForeignKey($tables, $classNames, $name);
}
* @param string $classNames
* @param string $name
*/
- function resolveForeignKey(&$tables, &$classNames, $name) {
+ public function resolveForeignKey(&$tables, &$classNames, $name) {
if (!array_key_exists('foreignKey', $tables[$name])) {
return;
}
*
* @return array
*/
- function orderTables(&$tables) {
+ public function orderTables(&$tables) {
$ordered = array();
while (!empty($tables)) {
*
* @return bool
*/
- function validTable(&$tables, &$valid, $name) {
+ public function validTable(&$tables, &$valid, $name) {
if (!array_key_exists('foreignKey', $tables[$name])) {
return TRUE;
}
* @param $database
* @param $tables
*/
- function getTable($tableXML, &$database, &$tables) {
+ public function getTable($tableXML, &$database, &$tables) {
$name = trim((string ) $tableXML->name);
$klass = trim((string ) $tableXML->class);
$base = $this->value('base', $tableXML);
* @param $fieldXML
* @param $fields
*/
- function getField(&$fieldXML, &$fields) {
+ public function getField(&$fieldXML, &$fields) {
$name = trim((string ) $fieldXML->name);
$field = array('name' => $name, 'localizable' => $fieldXML->localizable);
$type = (string ) $fieldXML->type;
*
* @return string
*/
- function composeTitle($name) {
+ public function composeTitle($name) {
$names = explode('_', strtolower($name));
$title = '';
for ($i = 0; $i < count($names); $i++) {
* @param $fields
* @param $table
*/
- function getPrimaryKey(&$primaryXML, &$fields, &$table) {
+ public function getPrimaryKey(&$primaryXML, &$fields, &$table) {
$name = trim((string ) $primaryXML->name);
/** need to make sure there is a field of type name */
* @param $fields
* @param $indices
*/
- function getIndex(&$indexXML, &$fields, &$indices) {
+ public function getIndex(&$indexXML, &$fields, &$indices) {
//echo "\n\n*******************************************************\n";
//echo "entering getIndex\n";
* @param $foreignKeys
* @param string $currentTableName
*/
- function getForeignKey(&$foreignXML, &$fields, &$foreignKeys, &$currentTableName) {
+ public function getForeignKey(&$foreignXML, &$fields, &$foreignKeys, &$currentTableName) {
$name = trim((string ) $foreignXML->name);
/** need to make sure there is a field of type name */
* @param $foreignXML
* @param $dynamicForeignKeys
*/
- function getDynamicForeignKey(&$foreignXML, &$dynamicForeignKeys) {
+ public function getDynamicForeignKey(&$foreignXML, &$dynamicForeignKeys) {
$foreignKey = array(
'idColumn' => trim($foreignXML->idColumn),
'typeColumn' => trim($foreignXML->typeColumn),
* Generate files used during testing.
*/
class CRM_Core_CodeGen_Test extends CRM_Core_CodeGen_BaseTask {
- function run() {
+ public function run() {
$this->generateCiviTestTruncate();
}
- function generateCiviTestTruncate() {
+ public function generateCiviTestTruncate() {
echo "Generating tests truncate file\n";
# TODO template
* @param $dir
* @param int $perm
*/
- static function createDir($dir, $perm = 0755) {
+ public static function createDir($dir, $perm = 0755) {
if (!is_dir($dir)) {
mkdir($dir, $perm, TRUE);
}
/**
* @param $dir
*/
- static function cleanTempDir($dir) {
+ public static function cleanTempDir($dir) {
foreach (glob("$dir/*") as $tempFile) {
unlink($tempFile);
}
*
* @return string
*/
- static function createTempDir($prefix) {
+ public static function createTempDir($prefix) {
$newTempDir = tempnam(sys_get_temp_dir(), $prefix) . '.d';
if (file_exists($newTempDir)) {
self::removeDir($newTempDir);
*
* @return string
*/
- static function digestAll($files, $digest = 'md5') {
+ public static function digestAll($files, $digest = 'md5') {
$buffer = '';
foreach ($files as $file) {
$buffer .= $digest(file_get_contents($file));
* @return string
* @throws RuntimeException
*/
- static function findCoreSourceDir() {
+ public static function findCoreSourceDir() {
$path = str_replace(DIRECTORY_SEPARATOR, '/', __DIR__);
if (!preg_match(':(.*)/CRM/Core/CodeGen/Util:', $path, $matches)) {
throw new RuntimeException("Failed to determine path of code-gen");
* @param array $pairs each item is an array(0 => $searchBaseDir, 1 => $filePattern)
* @return array of file paths
*/
- static function findManyFiles($pairs) {
+ public static function findManyFiles($pairs) {
$files = array();
foreach ($pairs as $pair) {
list ($dir, $pattern) = $pair;
private $compileDir;
- function __destruct() {
+ public function __destruct() {
if ($this->compileDir) {
CRM_Core_CodeGen_Util_File::cleanTempDir($this->compileDir);
}
}
- function setPluginDirs($pluginDirs) {
+ public function setPluginDirs($pluginDirs) {
$this->smartyPluginDirs = $pluginDirs;
$this->smarty = NULL;
}
- function getCompileDir() {
+ public function getCompileDir() {
if ($this->compileDir === NULL) {
$this->compileDir = CRM_Core_CodeGen_Util_File::createTempDir('templates_c_');
}
return $this->compileDir;
}
- function getSmarty() {
+ public function getSmarty() {
if ($this->smarty === NULL) {
require_once 'Smarty/Smarty.class.php';
$this->smarty = new Smarty();
/**
* @param string $filetype
*/
- function __construct($filetype) {
+ public function __construct($filetype) {
$this->filetype = $filetype;
$this->smarty = CRM_Core_CodeGen_Util_Smarty::singleton()->getSmarty();
* @param array $inputs template filenames
* @param string $outpath full path to the desired output file
*/
- function runConcat($inputs, $outpath) {
+ public function runConcat($inputs, $outpath) {
if (file_exists($outpath)) {
unlink($outpath);
}
* @param string $infile filename of the template, without a path
* @param string $outpath full path to the desired output file
*/
- function run($infile, $outpath) {
+ public function run($infile, $outpath) {
$renderedContents = $this->smarty->fetch($infile);
if ($this->filetype === 'php') {
* @param $key
* @param $value
*/
- function assign($key, $value) {
+ public function assign($key, $value) {
$this->smarty->assign_by_ref($key, $value);
}
*
* @return SimpleXMLElement|bool
*/
- static function parse($file) {
+ public static function parse($file) {
$dom = new DomDocument();
$dom->load($file);
$dom->xinclude();
*
* @return mixed
*/
- static function get($name, $attribute = NULL) {
+ public static function get($name, $attribute = NULL) {
$comp = CRM_Utils_Array::value($name, self::_info());
if ($attribute) {
return CRM_Utils_Array::value($attribute, $comp->info);
*
* @return bool
*/
- static function invoke(&$args, $type) {
+ public static function invoke(&$args, $type) {
$info = self::_info();
$config = CRM_Core_Config::singleton();
/**
* @return array
*/
- static function xmlMenu() {
+ public static function xmlMenu() {
// lets build the menu for all components
$info = self::getComponents(TRUE);
/**
* @return array
*/
- static function &menu() {
+ public static function &menu() {
$info = self::_info();
$items = array();
foreach ($info as $name => $comp) {
* @param $config
* @param bool $oldMode
*/
- static function addConfig(&$config, $oldMode = FALSE) {
+ public static function addConfig(&$config, $oldMode = FALSE) {
$info = self::_info();
foreach ($info as $name => $comp) {
*
* @return mixed
*/
- static function getComponentID($componentName) {
+ public static function getComponentID($componentName) {
$info = self::_info();
if (!empty($info[$componentName])) {
return $info[$componentName]->componentID;
*
* @return int|null|string
*/
- static function getComponentName($componentID) {
+ public static function getComponentName($componentID) {
$info = self::_info();
$componentName = NULL;
/**
* @return array
*/
- static function &getQueryFields() {
+ public static function &getQueryFields() {
$info = self::_info();
$fields = array();
foreach ($info as $name => $comp) {
* @param $query
* @param string $fnName
*/
- static function alterQuery(&$query, $fnName) {
+ public static function alterQuery(&$query, $fnName) {
$info = self::_info();
foreach ($info as $name => $comp) {
*
* @return null
*/
- static function from($fieldName, $mode, $side) {
+ public static function from($fieldName, $mode, $side) {
$info = self::_info();
$from = NULL;
/**
* @param CRM_Core_Form $form
*/
- static function &buildSearchForm(&$form) {
+ public static function &buildSearchForm(&$form) {
$info = self::_info();
foreach ($info as $name => $comp) {
* @param $row
* @param int $id
*/
- static function searchAction(&$row, $id) {
+ public static function searchAction(&$row, $id) {
$info = self::_info();
foreach ($info as $name => $comp) {
/**
* @return array|null
*/
- static function &contactSubTypes() {
+ public static function &contactSubTypes() {
if (self::$_contactSubTypes == NULL) {
self::$_contactSubTypes = array();
}
*
* @return null
*/
- static function &contactSubTypeProperties($subType, $op) {
+ public static function &contactSubTypeProperties($subType, $op) {
$properties = self::contactSubTypes();
if (array_key_exists($subType, $properties) &&
array_key_exists($op, $properties[$subType])
/**
* FIXME: This function does not appear to do anything. The is_array() check runs on a bunch of objects and (always?) returns false
*/
- static function &taskList() {
+ public static function &taskList() {
$info = self::_info();
$tasks = array();
* @access public
* @static
*/
- static function tableNames(&$tables) {
+ public static function tableNames(&$tables) {
$info = self::_info();
foreach ($info as $name => $comp) {
* Get components info from info file
*
*/
- static function getComponentsFromFile($crmFolderDir) {
+ public static function getComponentsFromFile($crmFolderDir) {
$components = array();
//traverse CRM folder and check for Info file
if (is_dir($crmFolderDir)) {
* @return CRM_Core_Config
* @static
*/
- static function &singleton($loadFromDB = TRUE, $force = FALSE) {
+ public static function &singleton($loadFromDB = TRUE, $force = FALSE) {
if (self::$_singleton === NULL || $force) {
// goto a simple error handler
$GLOBALS['civicrm_default_error_scope'] = CRM_Core_TemporaryErrorScope::create(array('CRM_Core_Error', 'handle'));
* @access private
* @return object
*/
- static function &getMailer($persist = FALSE) {
+ public static function &getMailer($persist = FALSE) {
if (!isset(self::$_mail)) {
$mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
'mailing_backend'
* @static
* @access public
*/
- static function check(&$config, &$required) {
+ public static function check(&$config, &$required) {
foreach ($required as $name) {
if (CRM_Utils_System::isNull($config->$name)) {
return FALSE;
* Reset the serialized array and recompute
* use with care
*/
- function reset() {
+ public function reset() {
$query = "UPDATE civicrm_domain SET config_backend = null";
CRM_Core_DAO::executeQuery($query);
}
// This method should initialize auth sources
- function initAuthSrc() {
+ public function initAuthSrc() {
$session = CRM_Core_Session::singleton();
if ($session->get('userID') && !$session->get('authSrc')) {
$session->set('authSrc', CRM_Core_Permission::AUTH_SRC_LOGIN);
/**
* One function to get domain ID
*/
- static function domainID($domainID = NULL, $reset = FALSE) {
+ public static function domainID($domainID = NULL, $reset = FALSE) {
static $domain;
if ($domainID) {
$domain = $domainID;
* Do general cleanup of caches, temp directories and temp tables
* CRM-8739
*/
- function cleanupCaches($sessionReset = TRUE) {
+ public function cleanupCaches($sessionReset = TRUE) {
// cleanup templates_c directory
$this->cleanup(1, FALSE);
/**
* Do general cleanup of module permissions.
*/
- function cleanupPermissions() {
+ public function cleanupPermissions() {
$module_files = CRM_Extension_System::singleton()->getMapper()->getActiveModuleFiles();
if ($this->userPermissionClass->isModulePermissionSupported()) {
// Can store permissions -- so do it!
/**
* Flush information about loaded modules
*/
- function clearModuleList() {
+ public function clearModuleList() {
CRM_Extension_System::singleton()->getCache()->flush();
CRM_Utils_Hook::singleton(TRUE);
CRM_Core_PseudoConstant::getModuleExtensions(TRUE);
/**
* Check if running in upgrade mode
*/
- static function isUpgradeMode($path = NULL) {
+ public static function isUpgradeMode($path = NULL) {
if (defined('CIVICRM_UPGRADE_ACTIVE')) {
return TRUE;
}
* it?
* @return bool
*/
- static function isEnabledBackOfficeCreditCardPayments() {
+ public static function isEnabledBackOfficeCreditCardPayments() {
return CRM_Financial_BAO_PaymentProcessor::hasPaymentProcessorSupporting(array('BackOffice'));
}
}
*/
class CRM_Core_Config_Defaults {
- function setCoreVariables() {
+ public function setCoreVariables() {
global $civicrm_root;
// set of base directories relying on $civicrm_root
);
}
- function fini() {
+ public function fini() {
CRM_Core_BAO_Cache::storeSessionToCache(array(
"_{$this->_name}_container",
array('CiviCRM', $this->_scope),
*
* @return mixed|string
*/
- function key($name, $addSequence = FALSE, $ignoreKey = FALSE) {
+ public function key($name, $addSequence = FALSE, $ignoreKey = FALSE) {
$config = CRM_Core_Config::singleton();
if (
* jump action
*
*/
- function run() {
+ public function run() {
// the names of the action and page should be saved
// note that this is split into two, because some versions of
// php 5.x core dump on the triple assignment :)
/**
* @return bool
*/
- function validate() {
+ public function validate() {
$this->_actionName = $this->getActionName();
list($pageName, $action) = $this->_actionName;
* @return void
*
*/
- function addActions($uploadDirectory = NULL, $uploadNames = NULL) {
+ public function addActions($uploadDirectory = NULL, $uploadNames = NULL) {
$names = array(
'display' => 'CRM_Core_QuickForm_Action_Display',
'next' => 'CRM_Core_QuickForm_Action_Next',
* @return CRM_Core_StateMachine
* @access public
*/
- function getStateMachine() {
+ public function getStateMachine() {
return $this->_stateMachine;
}
* @return void
* @access public
*/
- function setStateMachine($stateMachine) {
+ public function setStateMachine($stateMachine) {
$this->_stateMachine = $stateMachine;
}
* @return void
* @access public
*/
- function addPages(&$stateMachine, $action = CRM_Core_Action::NONE) {
+ public function addPages(&$stateMachine, $action = CRM_Core_Action::NONE) {
$pages = $stateMachine->getPages();
foreach ($pages as $name => $value) {
$className = CRM_Utils_Array::value('className', $value, $name);
* @return string the name of the button that has been pressed by the user
* @access public
*/
- function getButtonName() {
+ public function getButtonName() {
$data = &$this->container();
return CRM_Utils_Array::value('_qf_button_name', $data);
}
*
* @return void
*/
- function reset() {
+ public function reset() {
$this->container(TRUE);
self::$_session->resetScope($this->_scope);
}
* @return void
* @access public
*/
- function process() {}
+ public function process() {}
/**
* Store the variable with the value in the form scope
* @return void
*
*/
- function set($name, $value = NULL) {
+ public function set($name, $value = NULL) {
self::$_session->set($name, $value, $this->_scope);
}
* @return mixed
*
*/
- function get($name) {
+ public function get($name) {
return self::$_session->get($name, $this->_scope);
}
* @return array
* @access public
*/
- function wizardHeader($currentPageName) {
+ public function wizardHeader($currentPageName) {
$wizard = array();
$wizard['steps'] = array();
$count = 0;
/**
* @param array $wizard
*/
- function addWizardStyle(&$wizard) {
+ public function addWizardStyle(&$wizard) {
$wizard['style'] = array(
'barClass' => '',
'stepPrefixCurrent' => '»',
* @return void
* @access public
*/
- function assign($var, $value = NULL) {
+ public function assign($var, $value = NULL) {
self::$_template->assign($var, $value);
}
* @return void
* @access public
*/
- function assign_by_ref($var, &$value) {
+ public function assign_by_ref($var, &$value) {
self::$_template->assign_by_ref($var, $value);
}
* @param mixed $value the value to append
* @param bool $merge
*/
- function append($tpl_var, $value=NULL, $merge=FALSE) {
+ public function append($tpl_var, $value=NULL, $merge=FALSE) {
self::$_template->append($tpl_var, $value, $merge);
}
*
* @return array
*/
- function get_template_vars($name=null) {
+ public function get_template_vars($name=null) {
return self::$_template->get_template_vars($name);
}
* @return void
* @access public
*/
- function setEmbedded($embedded) {
+ public function setEmbedded($embedded) {
$this->_embedded = $embedded;
}
* @return boolean return the embedded value
* @access public
*/
- function getEmbedded() {
+ public function getEmbedded() {
return $this->_embedded;
}
* @return void
* @access public
*/
- function setSkipRedirection($skipRedirection) {
+ public function setSkipRedirection($skipRedirection) {
$this->_skipRedirection = $skipRedirection;
}
* @return boolean return the skipRedirection value
* @access public
*/
- function getSkipRedirection() {
+ public function getSkipRedirection() {
return $this->_skipRedirection;
}
/**
* @param null $fileName
*/
- function setWord($fileName = NULL) {
+ public function setWord($fileName = NULL) {
//Mark as a CSV file.
header('Content-Type: application/vnd.ms-word');
/**
* @param null $fileName
*/
- function setExcel($fileName = NULL) {
+ public function setExcel($fileName = NULL) {
//Mark as an excel file.
header('Content-Type: application/vnd.ms-excel');
* @return void
* @access public
*/
- function setPrint($print) {
+ public function setPrint($print) {
if ($print == "xls") {
$this->setExcel();
}
* @return boolean return the print value
* @access public
*/
- function getPrint() {
+ public function getPrint() {
return $this->_print;
}
/**
* @return string
*/
- function getTemplateFile() {
+ public function getTemplateFile() {
if ($this->_print) {
if ($this->_print == CRM_Core_Smarty::PRINT_PAGE) {
return 'CRM/common/print.tpl';
* A wrapper for getTemplateFileName that includes calling the hook to
* prevent us from having to copy & paste the logic of calling the hook
*/
- function getHookedTemplateFileName() {
+ public function getHookedTemplateFileName() {
$pageTemplateFile = $this->getTemplateFileName();
CRM_Utils_Hook::alterTemplateFile(get_class($this), $this, 'page', $pageTemplateFile);
return $pageTemplateFile;
* @return \CRM_Core_DAO
@access public
*/
- function __construct() {
+ public function __construct() {
$this->initialize();
$this->__table = $this->getTableName();
}
/**
* Empty definition for virtual function
*/
- static function getTableName() {
+ public static function getTableName() {
return NULL;
}
* @access private
* @static
*/
- static function init($dsn) {
+ public static function init($dsn) {
$options = &PEAR::getStaticProperty('DB_DataObject', 'options');
$options['database'] = $dsn;
if (defined('CIVICRM_DAO_DEBUG')) {
* @access public
*
*/
- function reset() {
+ public function reset() {
foreach (array_keys($this->table()) as $field) {
unset($this->$field);
*
* @return string
*/
- static function getLocaleTableName($tableName) {
+ public static function getLocaleTableName($tableName) {
global $dbLocale;
if ($dbLocale) {
$tables = CRM_Core_I18n_Schema::schemaStructureTables();
*
* @return object the current DAO object after the query execution
*/
- function query($query, $i18nRewrite = TRUE) {
+ public function query($query, $i18nRewrite = TRUE) {
// rewrite queries that should use $dbLocale-based views for multi-language installs
global $dbLocale;
if ($i18nRewrite and $dbLocale) {
* @access public
* @static
*/
- static function setFactory(&$factory) {
+ public static function setFactory(&$factory) {
self::$_factory = &$factory;
}
* @return void
* @access public
*/
- function factory($table = '') {
+ public function factory($table = '') {
if (!isset(self::$_factory)) {
return parent::factory($table);
}
* @return void
* @access protected
*/
- function initialize() {
+ public function initialize() {
$this->_connect();
$this->query("SET NAMES utf8");
}
*
* @return array
*/
- function keys() {
+ public function keys() {
static $keys;
if (!isset($keys)) {
$keys = array('id');
*
* @return array
*/
- function sequenceKey() {
+ public function sequenceKey() {
static $sequenceKeys;
if (!isset($sequenceKeys)) {
$sequenceKeys = array('id', TRUE);
*
* @return array of CRM_Core_Reference_Interface
*/
- static function getReferenceColumns() {
+ public static function getReferenceColumns() {
return array();
}
* @param array key=>type array
* @return array (associative)
*/
- function table() {
+ public function table() {
$fields = &$this->fields();
$table = array();
/**
* @return $this
*/
- function save() {
+ public function save() {
if (!empty($this->id)) {
$this->update();
return $this;
}
- function delete($useWhere = FALSE) {
+ public function delete($useWhere = FALSE) {
$result = parent::delete($useWhere);
$event = new \Civi\Core\DAO\Event\PostDelete($this, $result);
/**
* @param bool $created
*/
- function log($created = FALSE) {
+ public function log($created = FALSE) {
static $cid = NULL;
if (!$this->getLog()) {
* @return boolean did we copy all null values into the object
* @access public
*/
- function copyValues(&$params) {
+ public function copyValues(&$params) {
$fields = &$this->fields();
$allNull = TRUE;
foreach ($fields as $name => $value) {
* @access public
* @static
*/
- static function storeValues(&$object, &$values) {
+ public static function storeValues(&$object, &$values) {
$fields = &$object->fields();
foreach ($fields as $name => $value) {
$dbName = $value['name'];
* @access public
* @static
*/
- static function makeAttribute($field) {
+ public static function makeAttribute($field) {
if ($field) {
if (CRM_Utils_Array::value('type', $field) == CRM_Utils_Type::T_STRING) {
$maxLength = CRM_Utils_Array::value('maxlength', $field);
* @access public
* @static
*/
- static function getAttribute($class, $fieldName = NULL) {
+ public static function getAttribute($class, $fieldName = NULL) {
$object = new $class( );
$fields = &$object->fields();
if ($fieldName != NULL) {
*
* @throws Exception
*/
- static function transaction($type) {
+ public static function transaction($type) {
CRM_Core_Error::fatal('This function is obsolete, please use CRM_Core_Transaction');
}
* @access public
* @static
*/
- static function objectExists($value, $daoName, $daoID, $fieldName = 'name') {
+ public static function objectExists($value, $daoName, $daoID, $fieldName = 'name') {
$object = new $daoName( );
$object->$fieldName = $value;
* @return boolean true if exists, else false
* @static
*/
- static function checkFieldExists($tableName, $columnName, $i18nRewrite = TRUE) {
+ public static function checkFieldExists($tableName, $columnName, $i18nRewrite = TRUE) {
$query = "
SHOW COLUMNS
FROM $tableName
* @return array
* @static
*/
- static function getStorageValues($tableName = NULL, $maxTablesToCheck = 10, $fieldName = 'Engine') {
+ public static function getStorageValues($tableName = NULL, $maxTablesToCheck = 10, $fieldName = 'Engine') {
$values = array();
$query = "SHOW TABLE STATUS LIKE %1";
*
* @return bool
*/
- static function isDBMyISAM($maxTablesToCheck = 10) {
+ public static function isDBMyISAM($maxTablesToCheck = 10) {
// show error if any of the tables, use 'MyISAM' storage engine.
$engines = self::getStorageValues(NULL, $maxTablesToCheck);
if (array_key_exists('MyISAM', $engines)) {
* @return boolean true if constraint exists, false otherwise
* @static
*/
- static function checkConstraintExists($tableName, $constraint) {
+ public static function checkConstraintExists($tableName, $constraint) {
static $show = array();
if (!array_key_exists($tableName, $show)) {
*
* @return boolean true if CONSTRAINT keyword exists, false otherwise
*/
- static function schemaRequiresRebuilding($tables = array("civicrm_contact")) {
+ public static function schemaRequiresRebuilding($tables = array("civicrm_contact")) {
$show = array();
foreach($tables as $tableName){
if (!array_key_exists($tableName, $show)) {
* @return boolean true if in format, false otherwise
* @static
*/
- static function checkFKConstraintInFormat($tableName, $columnName) {
+ public static function checkFKConstraintInFormat($tableName, $columnName) {
static $show = array();
if (!array_key_exists($tableName, $show)) {
* @return boolean true if the value is always $columnValue, false otherwise
* @static
*/
- static function checkFieldHasAlwaysValue($tableName, $columnName, $columnValue) {
+ public static function checkFieldHasAlwaysValue($tableName, $columnName, $columnValue) {
$query = "SELECT * FROM $tableName WHERE $columnName != '$columnValue'";
$dao = CRM_Core_DAO::executeQuery($query);
$result = $dao->fetch() ? FALSE : TRUE;
* @return boolean true if if the value is always NULL, false otherwise
* @static
*/
- static function checkFieldIsAlwaysNull($tableName, $columnName) {
+ public static function checkFieldIsAlwaysNull($tableName, $columnName) {
$query = "SELECT * FROM $tableName WHERE $columnName IS NOT NULL";
$dao = CRM_Core_DAO::executeQuery($query);
$result = $dao->fetch() ? FALSE : TRUE;
* @return boolean true if exists, else false
* @static
*/
- static function checkTableExists($tableName) {
+ public static function checkTableExists($tableName) {
$query = "
SHOW TABLES
LIKE %1
*
* @return bool
*/
- function checkVersion($version) {
+ public function checkVersion($version) {
$query = "
SELECT version
FROM civicrm_domain
*
* @return object Object of the type of the class that called this function.
*/
- static function findById($id) {
+ public static function findById($id) {
$object = new static();
$object->id = $id;
if (!$object->find(TRUE)) {
* @static
* @access public
*/
- static function getFieldValue($daoName, $searchValue, $returnColumn = 'name', $searchColumn = 'id', $force = FALSE) {
+ public static function getFieldValue($daoName, $searchValue, $returnColumn = 'name', $searchColumn = 'id', $force = FALSE) {
if (
empty($searchValue) ||
trim(strtolower($searchValue)) == 'null'
* @static
* @access public
*/
- static function setFieldValue($daoName, $searchValue, $setColumn, $setValue, $searchColumn = 'id') {
+ public static function setFieldValue($daoName, $searchValue, $setColumn, $setValue, $searchColumn = 'id') {
$object = new $daoName( );
$object->selectAdd();
$object->selectAdd("$searchColumn, $setColumn");
* @access public
* @static
*/
- static function getSortString($sort, $default = NULL) {
+ public static function getSortString($sort, $default = NULL) {
// check if sort is of type CRM_Utils_Sort
if (is_a($sort, 'CRM_Utils_Sort')) {
return $sort->orderBy();
* @access public
* @static
*/
- static function commonRetrieve($daoName, &$params, &$defaults, $returnProperities = NULL) {
+ public static function commonRetrieve($daoName, &$params, &$defaults, $returnProperities = NULL) {
$object = new $daoName( );
$object->copyValues($params);
* @access public
* @static
*/
- static function deleteEntityContact($daoName, $contactId) {
+ public static function deleteEntityContact($daoName, $contactId) {
$object = new $daoName( );
$object->entity_table = 'civicrm_contact';
* @return string
* @throws Exception
*/
- static function composeQuery($query, &$params, $abort = TRUE) {
+ public static function composeQuery($query, &$params, $abort = TRUE) {
$tr = array();
foreach ($params as $key => $item) {
if (is_numeric($key)) {
/**
* @param null $ids
*/
- static function freeResult($ids = NULL) {
+ public static function freeResult($ids = NULL) {
global $_DB_DATAOBJECT;
if (!$ids) {
return $newObject;
}
- static function cascadeUpdate($daoName, $fromId, $toId, $newData = array()) {
+ public static function cascadeUpdate($daoName, $fromId, $toId, $newData = array()) {
$object = new $daoName( );
$object->id = $fromId;
* @access public
* @static
*/
- static function commonRetrieveAll($daoName, $fieldIdName = 'id', $fieldId, &$details, $returnProperities = NULL) {
+ public static function commonRetrieveAll($daoName, $fieldIdName = 'id', $fieldId, &$details, $returnProperities = NULL) {
require_once (str_replace('_', DIRECTORY_SEPARATOR, $daoName) . ".php");
$object = new $daoName( );
$object->$fieldIdName = $fieldId;
return $details;
}
- static function dropAllTables() {
+ public static function dropAllTables() {
// first drop all the custom tables we've created
CRM_Core_BAO_CustomGroup::dropAllTables();
*
* @return string
*/
- static function escapeString($string) {
+ public static function escapeString($string) {
static $_dao = NULL;
if (!$_dao) {
* @param $default string the value to use if $strings has no elements
* @return string eg "abc","def","ghi"
*/
- static function escapeStrings($strings, $default = NULL) {
+ public static function escapeStrings($strings, $default = NULL) {
static $_dao = NULL;
if (!$_dao) {
$_dao = new CRM_Core_DAO();
*
* @return string
*/
- static function escapeWildCardString($string) {
+ public static function escapeWildCardString($string) {
// CRM-9155
// ensure we escape the single characters % and _ which are mysql wild
// card characters and could come in via sortByCharacter
* @param string $daoName
* @param array $params
*/
- static function deleteTestObjects($daoName, $params = array()) {
+ public static function deleteTestObjects($daoName, $params = array()) {
//this is a test function also backtrace is set for the test suite it sometimes unsets itself
// so we re-set here in case
$config = CRM_Core_Config::singleton();
* @param array $params
* @param $defaults
*/
- static function setCreateDefaults(&$params, $defaults) {
+ public static function setCreateDefaults(&$params, $defaults) {
if (isset($params['id'])) {
return;
}
*
* @return string
*/
- static function createTempTableName($prefix = 'civicrm', $addRandomString = TRUE, $string = NULL) {
+ public static function createTempTableName($prefix = 'civicrm', $addRandomString = TRUE, $string = NULL) {
$tableName = $prefix . "_temp";
if ($addRandomString) {
*
* @return bool
*/
- static function checkTriggerViewPermission($view = TRUE, $trigger = TRUE) {
+ public static function checkTriggerViewPermission($view = TRUE, $trigger = TRUE) {
// test for create view and trigger permissions and if allowed, add the option to go multilingual
// and logging
// I'm not sure why we use the getStaticProperty for an error, rather than checking for DB_Error
* @param null $message
* @param bool $printDAO
*/
- static function debugPrint($message = NULL, $printDAO = TRUE) {
+ public static function debugPrint($message = NULL, $printDAO = TRUE) {
CRM_Utils_System::xMemory("{$message}: ");
if ($printDAO) {
*
* @see CRM-9716
*/
- static function triggerRebuild($tableName = NULL, $force = FALSE) {
+ public static function triggerRebuild($tableName = NULL, $force = FALSE) {
$info = array();
$logging = new CRM_Logging_Schema;
* * Stop using functions and find another way to strip numeric characters from phones
* * Give better error messages (currently a missing fn fatals with "unknown error")
*/
- static function checkSqlFunctionsExist() {
+ public static function checkSqlFunctionsExist() {
if (!self::$_checkedSqlFunctionsExist) {
self::$_checkedSqlFunctionsExist = TRUE;
$dao = CRM_Core_DAO::executeQuery("SHOW function status WHERE db = database() AND name = 'civicrm_strip_non_numeric'");
*
* @param $tableName string the specific table requiring a rebuild; or NULL to rebuild all tables
*/
- static function dropTriggers($tableName = NULL) {
+ public static function dropTriggers($tableName = NULL) {
$info = array();
$logging = new CRM_Logging_Schema;
* @param $info array per hook_civicrm_triggerInfo
* @param $onlyTableName string the specific table requiring a rebuild; or NULL to rebuild all tables
*/
- static function createTriggers(&$info, $onlyTableName = NULL) {
+ public static function createTriggers(&$info, $onlyTableName = NULL) {
// Validate info array, should probably raise errors?
if (is_array($info) == FALSE) {
return;
* @param string $className BAO/DAO class name
* @return array<CRM_Core_Reference_Interface>
*/
- static function createReferenceColumns($className) {
+ public static function createReferenceColumns($className) {
$result = array();
$fields = $className::fields();
foreach ($fields as $field) {
*
* @return array of objects referencing this
*/
- function findReferences() {
+ public function findReferences() {
$links = self::getReferencesToTable(static::getTableName());
$occurrences = array();
* - table: string|null SQL table name
* - key: string|null SQL column name
*/
- function getReferenceCounts() {
+ public function getReferenceCounts() {
$links = self::getReferencesToTable(static::getTableName());
$counts = array();
* @return array structure of table and column, listing every table with a
* foreign key reference to $tableName, and the column where the key appears.
*/
- static function getReferencesToTable($tableName) {
+ public static function getReferencesToTable($tableName) {
$refsFound = array();
foreach (CRM_Core_DAO_AllCoreTables::getClasses() as $daoClassName) {
$links = $daoClassName::getReferenceColumns();
* @param string $fieldName
* @return bool|array
*/
- function getFieldSpec($fieldName) {
+ public function getFieldSpec($fieldName) {
$fields = $this->fields();
$fieldKeys = $this->fieldKeys();
/**
* @param array $params
*/
- function setApiFilter(&$params) {}
+ public function setApiFilter(&$params) {}
}
* @return object
* @static
*/
- static function &singleton($package = NULL, $msgCallback = FALSE, $contextCallback = FALSE, $throwPEAR_Error = FALSE, $stackClass = 'PEAR_ErrorStack') {
+ public static function &singleton($package = NULL, $msgCallback = FALSE, $contextCallback = FALSE, $throwPEAR_Error = FALSE, $stackClass = 'PEAR_ErrorStack') {
if (self::$_singleton === NULL) {
self::$_singleton = new CRM_Core_Error('CiviCRM');
}
/**
* Constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct('CiviCRM');
$log = CRM_Core_Config::getLog();
* @param $error
* @param string $separator
*/
- static function displaySessionError(&$error, $separator = '<br />') {
+ public static function displaySessionError(&$error, $separator = '<br />') {
$message = self::getMessages($error, $separator);
if ($message) {
$status = ts("Payment Processor Error message") . "{$separator} $message";
* @static
* @access public
*/
- static function fatal($message = NULL, $code = NULL, $email = NULL) {
+ public static function fatal($message = NULL, $code = NULL, $email = NULL) {
$vars = array(
'message' => $message,
'code' => $code,
* @static
* @access public
*/
- static function handleUnhandledException($exception) {
+ public static function handleUnhandledException($exception) {
$config = CRM_Core_Config::singleton();
$vars = array(
'message' => $exception->getMessage(),
* @access public
* @static
*/
- static function debug($name, $variable = NULL, $log = TRUE, $html = TRUE, $checkPermission = TRUE) {
+ public static function debug($name, $variable = NULL, $log = TRUE, $html = TRUE, $checkPermission = TRUE) {
$error = self::singleton();
if ($variable === NULL) {
*
* @static
*/
- static function debug_log_message($message, $out = FALSE, $comp = '') {
+ public static function debug_log_message($message, $out = FALSE, $comp = '') {
$config = CRM_Core_Config::singleton();
$file_log = self::createDebugLogger($comp);
/**
* Append to the query log (if enabled)
*/
- static function debug_query($string) {
+ public static function debug_query($string) {
if ( defined( 'CIVICRM_DEBUG_LOG_QUERY' ) ) {
if ( CIVICRM_DEBUG_LOG_QUERY == 'backtrace' ) {
CRM_Core_Error::backtrace( $string, true );
*
* @param string $query
*/
- static function debug_query_result($query) {
+ public static function debug_query_result($query) {
$dao = CRM_Core_DAO::executeQuery($query);
$results = array();
while ($dao->fetch()) {
*
* @return Log
*/
- static function createDebugLogger($comp = '') {
+ public static function createDebugLogger($comp = '') {
$config = CRM_Core_Config::singleton();
if ($comp) {
* @param string $msg
* @param bool $log
*/
- static function backtrace($msg = 'backTrace', $log = FALSE) {
+ public static function backtrace($msg = 'backTrace', $log = FALSE) {
$backTrace = debug_backtrace();
$message = self::formatBacktrace($backTrace);
if (!$log) {
* @param int $maxArgLen maximum number of characters to show from each argument string
* @return string printable plain-text
*/
- static function formatBacktrace($backTrace, $showArgs = TRUE, $maxArgLen = 80) {
+ public static function formatBacktrace($backTrace, $showArgs = TRUE, $maxArgLen = 80) {
$message = '';
foreach (self::parseBacktrace($backTrace, $showArgs, $maxArgLen) as $idx => $trace) {
$message .= sprintf("#%s %s\n", $idx, $trace);
* @see debug_backtrace
* @see Exception::getTrace()
*/
- static function parseBacktrace($backTrace, $showArgs = TRUE, $maxArgLen = 80) {
+ public static function parseBacktrace($backTrace, $showArgs = TRUE, $maxArgLen = 80) {
$ret = array();
foreach ($backTrace as $trace) {
$args = array();
* @param Exception $e
* @return string printable HTML text
*/
- static function formatHtmlException(Exception $e) {
+ public static function formatHtmlException(Exception $e) {
$msg = '';
// Exception metadata
* @param Exception $e
* @return string printable plain text
*/
- static function formatTextException(Exception $e) {
+ public static function formatTextException(Exception $e) {
$msg = get_class($e) . ": \"" . $e->getMessage() . "\"\n";
$ei = $e;
*
* @return object
*/
- static function createError($message, $code = 8000, $level = 'Fatal', $params = NULL) {
+ public static function createError($message, $code = 8000, $level = 'Fatal', $params = NULL) {
$error = CRM_Core_Error::singleton();
$error->push($code, $level, array($params), $message);
return $error;
* - xparent_table: string - business-entity to which file is attached (directly or indirectly)
* - xparent_id: int - business-entity to which file is attached (directly or indirectly)
*/
- function search($query, $limit = self::DEFAULT_SEARCH_LIMIT, $offset = self::DEFAULT_SEARCH_OFFSET);
+ public function search($query, $limit = self::DEFAULT_SEARCH_LIMIT, $offset = self::DEFAULT_SEARCH_OFFSET);
}
\ No newline at end of file
$this->assign('snippet', CRM_Utils_Array::value('snippet', $_GET));
}
- static function generateID() {
+ public static function generateID() {
}
/**
* @access private
*
*/
- function registerRules() {
+ public function registerRules() {
static $rules = array(
'title', 'longTitle', 'variable', 'qfVariable',
'phone', 'integer', 'query',
* @return void
*
*/
- function preProcess() {}
+ public function preProcess() {}
/**
* This function is called after the form is validated. Any
* @return void
*
*/
- function postProcess() {}
+ public function postProcess() {}
/**
* This function is just a wrapper, so that we can call all the hook functions
* @param bool $allowAjax - FIXME: This feels kind of hackish, ideally we would take the json-related code from this function
* and bury it deeper down in the controller
*/
- function mainProcess($allowAjax = TRUE) {
+ public function mainProcess($allowAjax = TRUE) {
$this->postProcess();
$this->postProcessHook();
* better way is to do setUserContext so the framework does the redirect
*
*/
- function postProcessHook() {
+ public function postProcessHook() {
CRM_Utils_Hook::postProcess(get_class($this), $this);
}
* @return void
*
*/
- function buildQuickForm() {}
+ public function buildQuickForm() {}
/**
* This virtual function is used to set the default values of
* @return array reference to the array of default values
*
*/
- function setDefaultValues() {}
+ public function setDefaultValues() {}
/**
* This is a virtual function that adds group and global rules to
* @return void
*
*/
- function addRules() {}
+ public function addRules() {}
/**
* Performs the server side validation
* @return boolean true if no error found
* @throws HTML_QuickForm_Error
*/
- function validate() {
+ public function validate() {
$error = parent::validate();
$this->validateChainSelectFields();
* buildQuickForm.
*
*/
- function buildForm() {
+ public function buildForm() {
$this->_formBuilt = TRUE;
$this->preProcess();
* @access public
*
*/
- function addButtons($params) {
+ public function addButtons($params) {
$prevnext = array();
$spacing = array();
foreach ($params as $button) {
* @return string
* @access public
*/
- function getName() {
+ public function getName() {
return $this->_name;
}
* @return object
* @access public
*/
- function &getState() {
+ public function &getState() {
return $this->_state;
}
* @return int
* @access public
*/
- function getStateType() {
+ public function getStateType() {
return $this->_state->getType();
}
* @return string
* @access public
*/
- function getTitle() {
+ public function getTitle() {
return $this->_title ? $this->_title : ts('ERROR: Title is not Set');
}
* @return void
* @access public
*/
- function setTitle($title) {
+ public function setTitle($title) {
$this->_title = $title;
}
* @return void
* @access public
*/
- function setOptions($options) {
+ public function setOptions($options) {
$this->_options = $options;
}
* @return string
* @access public
*/
- function getLink() {
+ public function getLink() {
$config = CRM_Core_Config::singleton();
return CRM_Utils_System::url($_GET[$config->userFrameworkURLVar],
'_qf_' . $this->_name . '_display=true'
* @return boolean
* @access public
*/
- function isSimpleForm() {
+ public function isSimpleForm() {
return $this->_state->getType() & (CRM_Core_State::START | CRM_Core_State::FINISH);
}
* @return string
* @access public
*/
- function getFormAction() {
+ public function getFormAction() {
return $this->_attributes['action'];
}
* @return void
* @access public
*/
- function setFormAction($action) {
+ public function setFormAction($action) {
$this->_attributes['action'] = $action;
}
* @return string
* @access public
*/
- function toSmarty() {
+ public function toSmarty() {
$this->preProcessChainSelectFields();
$renderer = $this->getRenderer();
$this->accept($renderer);
* @return object
* @access public
*/
- function &getRenderer() {
+ public function &getRenderer() {
if (!isset($this->_renderer)) {
$this->_renderer = CRM_Core_Form_Renderer::singleton();
}
* @return string
* @access public
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
$ext = CRM_Extension_System::singleton()->getMapper();
if ($ext->isExtensionClass(CRM_Utils_System::getClassName($this))) {
$filename = $ext->getTemplateName(CRM_Utils_System::getClassName($this));
* A wrapper for getTemplateFileName that includes calling the hook to
* prevent us from having to copy & paste the logic of calling the hook
*/
- function getHookedTemplateFileName() {
+ public function getHookedTemplateFileName() {
$pageTemplateFile = $this->getTemplateFileName();
CRM_Utils_Hook::alterTemplateFile(get_class($this), $this, 'page', $pageTemplateFile);
return $pageTemplateFile;
* @return string
* @access public
*/
- function overrideExtraTemplateFileName() {
+ public function overrideExtraTemplateFileName() {
return NULL;
}
* @return void
* @access public
*/
- function error($message, $code = NULL, $dao = NULL) {
+ public function error($message, $code = NULL, $dao = NULL) {
if ($dao) {
$dao->query('ROLLBACK');
}
* @return void
*
*/
- function set($name, $value) {
+ public function set($name, $value) {
$this->controller->set($name, $value);
}
* @return mixed
*
*/
- function get($name) {
+ public function get($name) {
return $this->controller->get($name);
}
* @return int
* @access public
*/
- function getAction() {
+ public function getAction() {
return $this->_action;
}
* @return void
* @access public
*/
- function setAction($action) {
+ public function setAction($action) {
$this->_action = $action;
}
* @return void
* @access public
*/
- function assign($var, $value = NULL) {
+ public function assign($var, $value = NULL) {
self::$_template->assign($var, $value);
}
* @return void
* @access public
*/
- function assign_by_ref($var, &$value) {
+ public function assign_by_ref($var, &$value) {
self::$_template->assign_by_ref($var, $value);
}
* @param mixed $value the value to append
* @param bool $merge
*/
- function append($tpl_var, $value=NULL, $merge=FALSE) {
+ public function append($tpl_var, $value=NULL, $merge=FALSE) {
self::$_template->append($tpl_var, $value, $merge);
}
*
* @return array
*/
- function get_template_vars($name=null) {
+ public function get_template_vars($name=null) {
return self::$_template->get_template_vars($name);
}
*
* @return HTML_QuickForm_group
*/
- function &addRadio($name, $title, $values, $attributes = array(), $separator = NULL, $required = FALSE) {
+ public function &addRadio($name, $title, $values, $attributes = array(), $separator = NULL, $required = FALSE) {
$options = array();
$attributes = $attributes ? $attributes : array();
$allowClear = !empty($attributes['allowClear']);
* @param null $required
* @param array $attributes
*/
- function addYesNo($id, $title, $allowClear = FALSE, $required = NULL, $attributes = array()) {
+ public function addYesNo($id, $title, $allowClear = FALSE, $required = NULL, $attributes = array()) {
$attributes += array('id_suffix' => $id);
$choice = array();
$choice[] = $this->createElement('radio', NULL, '11', ts('Yes'), '1', $attributes);
}
}
- function resetValues() {
+ public function resetValues() {
$data = $this->controller->container();
$data['values'][$this->_name] = array();
}
* @return void
* @access public
*/
- function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
+ public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
$buttons = array();
if ($backType != NULL) {
$buttons[] = array(
* @param bool $required
* @param bool $displayTime
*/
- function addDateRange($name, $from = '_from', $to = '_to', $label = 'From:', $dateFormat = 'searchDate', $required = FALSE, $displayTime = FALSE) {
+ public function addDateRange($name, $from = '_from', $to = '_to', $label = 'From:', $dateFormat = 'searchDate', $required = FALSE, $displayTime = FALSE) {
if ($displayTime) {
$this->addDateTime($name . $from, $label, $required, array('formatType' => $dateFormat));
$this->addDateTime($name . $to, ts('To:'), $required, array('formatType' => $dateFormat));
* @throws CRM_Core_Exception
* @return HTML_QuickForm_Element
*/
- function addSelect($name, $props = array(), $required = FALSE) {
+ public function addSelect($name, $props = array(), $required = FALSE) {
if (!isset($props['entity'])) {
$props['entity'] = CRM_Utils_Api::getEntityName($this);
}
* @param array $entities
* @param bool $default //CRM-15427
*/
- function addProfileSelector($name, $label, $allowCoreTypes, $allowSubTypes, $entities, $default = FALSE) {
+ public function addProfileSelector($name, $label, $allowCoreTypes, $allowSubTypes, $entities, $default = FALSE) {
// Output widget
// FIXME: Instead of adhoc serialization, use a single json_encode()
CRM_UF_Page_ProfileEditor::registerProfileScripts();
* @param $attributes
* @param bool $forceTextarea
*/
- function addWysiwyg($name, $label, $attributes, $forceTextarea = FALSE) {
+ public function addWysiwyg($name, $label, $attributes, $forceTextarea = FALSE) {
// 1. Get configuration option for editor (tinymce, ckeditor, pure textarea)
// 2. Based on the option, initialise proper editor
$editorID = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
* @param null $required
* @param null $extra
*/
- function addCountry($id, $title, $required = NULL, $extra = NULL) {
+ public function addCountry($id, $title, $required = NULL, $extra = NULL) {
$this->addElement('select', $id, $title,
array(
'' => ts('- select -')) + CRM_Core_PseudoConstant::country(), $extra
* @param null $required
* @param null $javascriptMethod
*/
- function addSelectOther($name, $label, $options, $attributes, $required = NULL, $javascriptMethod = NULL) {
+ public function addSelectOther($name, $label, $options, $attributes, $required = NULL, $javascriptMethod = NULL) {
$this->addElement('select', $name . '_id', $label, $options, $javascriptMethod);
/**
* @return CRM_Core_Smarty
*/
- static function &getTemplate() {
+ public static function &getTemplate() {
return self::$_template;
}
/**
* @param $elementName
*/
- function addUploadElement($elementName) {
+ public function addUploadElement($elementName) {
$uploadNames = $this->get('uploadNames');
if (!$uploadNames) {
$uploadNames = array();
/**
* @return string
*/
- function buttonType() {
+ public function buttonType() {
$uploadNames = $this->get('uploadNames');
$buttonType = (is_array($uploadNames) && !empty($uploadNames)) ? 'upload' : 'next';
$this->assign('buttonType', $buttonType);
*
* @return null
*/
- function getVar($name) {
+ public function getVar($name) {
return isset($this->$name) ? $this->$name : NULL;
}
* @param $name
* @param $value
*/
- function setVar($name, $value) {
+ public function setVar($name, $value) {
$this->$name = $value;
}
* @param boolean $required true if required
*
*/
- function addDate($name, $label, $required = FALSE, $attributes = NULL) {
+ public function addDate($name, $label, $required = FALSE, $attributes = NULL) {
if (!empty($attributes['formatType'])) {
// get actual format
$params = array('name' => $attributes['formatType']);
/**
* Function that will add date and time
*/
- function addDateTime($name, $label, $required = FALSE, $attributes = NULL) {
+ public function addDateTime($name, $label, $required = FALSE, $attributes = NULL) {
$addTime = array('addTime' => TRUE);
if (is_array($attributes)) {
$attributes = array_merge($attributes, $addTime);
* @access public
* @return HTML_QuickForm_Element
*/
- function addEntityRef($name, $label = '', $props = array(), $required = FALSE) {
+ public function addEntityRef($name, $label = '', $props = array(), $required = FALSE) {
require_once "api/api.php";
$config = CRM_Core_Config::singleton();
// Default properties
* @todo standardise the format which dates are passed to the BAO layer in & remove date
* handling from BAO
*/
- function convertDateFieldsToMySQL(&$params){
+ public function convertDateFieldsToMySQL(&$params){
foreach ($this->_dateFields as $fieldName => $specs){
if(!empty($params[$fieldName])){
$params[$fieldName] = CRM_Utils_Date::isoToMysql(
/**
* @param $elementName
*/
- function removeFileRequiredRules($elementName) {
+ public function removeFileRequiredRules($elementName) {
$this->_required = array_diff($this->_required, array($elementName));
if (isset($this->_rules[$elementName])) {
foreach ($this->_rules[$elementName] as $index => $ruleInfo) {
*
* @access public
*/
- function cancelAction() {}
+ public function cancelAction() {}
/**
* Helper function to verify that required fields have been filled
* Typically called within the scope of a FormRule function
*/
- static function validateMandatoryFields($fields, $values, &$errors) {
+ public static function validateMandatoryFields($fields, $values, &$errors) {
foreach ($fields as $name => $fld) {
if (!empty($fld['is_required']) && CRM_Utils_System::isNull(CRM_Utils_Array::value($name, $values))) {
$errors[$name] = ts('%1 is a required field.', array(1 => $fld['title']));
*
* @return mixed NULL|integer
*/
- function getContactID() {
+ public function getContactID() {
$tempID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
if(isset($this->_params) && isset($this->_params['select_contact_id'])) {
$tempID = $this->_params['select_contact_id'];
/**
* Get the contact id of the logged in user
*/
- function getLoggedInUserContactID() {
+ public function getLoggedInUserContactID() {
// check if the user is logged in and has a contact ID
$session = CRM_Core_Session::singleton();
return $session->get('userID');
*
* @todo add data attributes so we can deal with multiple instances on a form
*/
- function addAutoSelector($profiles = array(), $autoCompleteField = array()) {
+ public function addAutoSelector($profiles = array(), $autoCompleteField = array()) {
$autoCompleteField = array_merge(array(
'id_field' => 'select_contact_id',
'placeholder' => ts('Select someone else ...'),
/**
*
*/
- function canUseAjaxContactLookups() {
+ public function canUseAjaxContactLookups() {
if (0 < (civicrm_api3('contact', 'getcount', array('check_permissions' => 1))) &&
CRM_Core_Permission::check(array(array('access AJAX API', 'access CiviCRM')))) {
return TRUE;
* is this form. Inserting a class FrontEndForm.php between the contribution & event & this class would allow functions like this
* and a dozen other small ones to be refactored into a shared parent with the reduction of much code duplication
*/
- function addCIDZeroOptions($onlinePaymentProcessorEnabled) {
+ public function addCIDZeroOptions($onlinePaymentProcessorEnabled) {
$this->assign('nocid', TRUE);
$profiles = array();
if($this->_values['custom_pre_id']) {
*
* @return array
*/
- function getProfileDefaults($profile_id = 'Billing', $contactID = NULL) {
+ public function getProfileDefaults($profile_id = 'Billing', $contactID = NULL) {
try{
$defaults = civicrm_api3('profile', 'getsingle', array(
'profile_id' => (array) $profile_id,
* Sets form attribute
* @see CRM.loadForm
*/
- function preventAjaxSubmit() {
+ public function preventAjaxSubmit() {
$this->setAttribute('data-no-ajax-submit', 'true');
}
* Sets form attribute
* @see CRM.loadForm
*/
- function allowAjaxSubmit() {
+ public function allowAjaxSubmit() {
$this->removeAttribute('data-no-ajax-submit');
}
* Sets page title based on entity and action
* @param string $entityLabel
*/
- function setPageTitle($entityLabel) {
+ public function setPageTitle($entityLabel) {
switch ($this->_action) {
case CRM_Core_Action::ADD:
CRM_Utils_System::setTitle(ts('New %1', array(1 => $entityLabel)));
* @static
* @access public
*/
- static function buildAllowedDateFormats(&$form) {
+ public static function buildAllowedDateFormats(&$form) {
$dateOptions = array();
*
* @return null
*/
- static function addDateRangeToForm(&$form, $fieldName, $selector, $from = '_from', $to = '_to', $fromLabel = 'From:', $required = FALSE, $dateFormat = 'searchDate', $displayTime = FALSE) {
+ public static function addDateRangeToForm(&$form, $fieldName, $selector, $from = '_from', $to = '_to', $fromLabel = 'From:', $required = FALSE, $dateFormat = 'searchDate', $displayTime = FALSE) {
$form->add('select',
"{$fieldName}_relative",
ts('Relative Date Range'),
*/\r
public static $_hasParent = FALSE;\r
\r
- static function preProcess($entityTable) {\r
+ public static function preProcess($entityTable) {\r
self::$_entityId = (int) CRM_Utils_Request::retrieve('id', 'Positive');\r
self::$_entityTable = $entityTable;\r
\r
*\r
* @return None\r
*/\r
- static function setDefaultValues() {\r
+ public static function setDefaultValues() {\r
$defaults = array();\r
if (self::$_scheduleReminderID) {\r
$defaults['repetition_frequency_unit'] = self::$_scheduleReminderDetails->repetition_frequency_unit;\r
return $defaults;\r
}\r
\r
- static function buildQuickForm(&$form) {\r
+ public static function buildQuickForm(&$form) {\r
if (self::$_entityTable) {\r
$entityType = explode("_", self::$_entityTable);\r
if ($entityType[1]) {\r
* @static\r
* @access public\r
*/\r
- static function formRule($values) {\r
+ public static function formRule($values) {\r
$errors = array();\r
//Process this function only when you get this variable\r
if ($values['allowRepeatConfigToSubmit'] == 1) {\r
*\r
* @return None\r
*/\r
- static function postProcess($params = array(), $type, $linkedEntities = array()) {\r
+ public static function postProcess($params = array(), $type, $linkedEntities = array()) {\r
//Check entity_id not present in params take it from class variable\r
if (!CRM_Utils_Array::value('entity_id', $params)) {\r
$params['entity_id'] = self::$_entityId;\r
*
* Method providing static instance of as in Singleton pattern.
*/
- static function &singleton() {
+ public static function &singleton() {
if (!isset(self::$_singleton)) {
self::$_singleton = new CRM_Core_Form_Renderer();
}
*
* @return array
*/
- function _elementToArray(&$element, $required, $error) {
+ public function _elementToArray(&$element, $required, $error) {
self::updateAttributes($element, $required, $error);
$el = parent::_elementToArray($element, $required, $error);
* @return array
* @static
*/
- static function updateAttributes(&$element, $required, $error) {
+ public static function updateAttributes(&$element, $required, $error) {
// lets create an id for all input elements, so we can generate nice label tags
// to make it nice and clean, we'll just use the elementName if it is non null
$attributes = array();
*
* @param $field HTML_QuickForm_element
*/
- static function preProcessEntityRef($field) {
+ public static function preProcessEntityRef($field) {
$val = $field->getValue();
// Support array values
if (is_array($val)) {
* @param $el array
* @param $field HTML_QuickForm_element
*/
- function renderFrozenEntityRef(&$el, $field) {
+ public function renderFrozenEntityRef(&$el, $field) {
$entity = $field->getAttribute('data-api-entity');
$vals = json_decode($field->getAttribute('data-entity-value'), TRUE);
$display = array();
*
* @param $field HTML_QuickForm_element
*/
- static function preprocessContactReference($field) {
+ public static function preprocessContactReference($field) {
$val = $field->getValue();
if ($val && is_numeric($val)) {
* @param array $el
* @param HTML_QuickForm_element $field
*/
- function addOptionsEditLink(&$el, $field) {
+ public function addOptionsEditLink(&$el, $field) {
if (CRM_Core_Permission::check('administer CiviCRM')) {
// NOTE: $path is used on the client-side to know which option lists need rebuilding,
// that's why we need that bit of data both in the link and in the form element
* @param array $el
* @param HTML_QuickForm_element $field
*/
- function appendUnselectButton(&$el, $field) {
+ public function appendUnselectButton(&$el, $field) {
// Initially hide if not needed
// Note: visibility:hidden prevents layout jumping around unlike display:none
$display = $field->getValue() !== NULL ? '' : ' style="visibility:hidden;"';
/**
* Common buildform tasks required by all searches
*/
- function buildQuickform() {
+ public function buildQuickform() {
$resources = CRM_Core_Resources::singleton();
if ($resources->ajaxPopupsEnabled) {
/**
* Add checkboxes for each row plus a master checkbox
*/
- function addRowSelectors($rows) {
+ public function addRowSelectors($rows) {
$this->addElement('checkbox', 'toggleSelect', NULL, NULL, array('class' => 'select-rows'));
foreach ($rows as $row) {
$this->addElement('checkbox', $row['checkbox'], NULL, NULL, array('class' => 'select-row'));
* Add actions menu to search results form
* @param $tasks
*/
- function addTaskMenu($tasks) {
+ public function addTaskMenu($tasks) {
if (is_array($tasks) && !empty($tasks)) {
$tasks = array('' => ts('Actions')) + $tasks;
$this->add('select', 'task', NULL, $tasks, FALSE, array('class' => 'crm-select2 crm-action-menu huge crm-search-result-actions'));
* @access public
* @static
*/
- static function postProcess(&$params, $entityId, $entityTable = 'civicrm_contact', &$form) {
+ public static function postProcess(&$params, $entityId, $entityTable = 'civicrm_contact', &$form) {
if ($form && !empty($form->_entityTagValues)) {
$existingTags = $form->_entityTagValues;
}
*
* @return \CRM_Core_I18n
*/
- function __construct($locale) {
+ public function __construct($locale) {
if ($locale != '' and $locale != 'en_US') {
$config = CRM_Core_Config::singleton();
*
* @return bool True if gettext is native
*/
- function isNative() {
+ public function isNative() {
return $this->_nativegettext;
}
*
* @return array of code/language name mappings
*/
- static function languages($justEnabled = FALSE) {
+ public static function languages($justEnabled = FALSE) {
static $all = NULL;
static $enabled = NULL;
*
* @return string modified string
*/
- function strarg($str) {
+ public function strarg($str) {
$tr = array();
$p = 0;
for ($i = 1; $i < func_num_args(); $i++) {
*
* @return string the translated string
*/
- function crm_translate($text, $params = array()) {
+ public function crm_translate($text, $params = array()) {
if (isset($params['escape'])) {
$escape = $params['escape'];
unset($params['escape']);
*
* @return string the translated string
*/
- function translate($string) {
+ public function translate($string) {
return ($this->_phpgettext) ? $this->_phpgettext->translate($string) : $string;
}
*
* @return void
*/
- function localizeTitles(&$array) {
+ public function localizeTitles(&$array) {
foreach ($array as $key => $value) {
if (is_array($value)) {
$this->localizeTitles($value);
*
* @return Boolean True if the domain was changed for an extension.
*/
- function setGettextDomain($key) {
+ public function setGettextDomain($key) {
/* No domain changes for en_US */
if (! $this->_phpgettext) {
return FALSE;
/**
* Static instance provider - return the instance for the current locale.
*/
- static function &singleton() {
+ public static function &singleton() {
static $singleton = array();
global $tsLocale;
*
* @return string the final LC_TIME that got set
*/
- static function setLcTime() {
+ public static function setLcTime() {
static $locales = array();
global $tsLocale;
*
*/
class CRM_Core_I18n_Form extends CRM_Core_Form {
- function buildQuickForm() {
+ public function buildQuickForm() {
$config = CRM_Core_Config::singleton();
global $tsLocale;
$this->_locales = array_keys($config->languageLimit);
* @return array reference to the array of default values
*
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
return $this->_defaults;
}
- function postProcess() {
+ public function postProcess() {
$values = $this->exportValues();
$table = $values['table'];
$field = $values['field'];
*
* @return string
*/
- function translate($string) {
+ public function translate($string) {
return gettext($string);
}
/**
* Based on php-gettext, since native gettext does not support this as is.
*/
- function pgettext($context, $text) {
+ public function pgettext($context, $text) {
$key = $context . chr(4) . $text;
$ret = $this->translate($key);
*
* @return string
*/
- function ngettext($text, $plural, $count) {
+ public function ngettext($text, $plural, $count) {
return ngettext($text, $plural, $count);
}
}
*
* @return mixed
*/
- static function longForShort($short) {
+ public static function longForShort($short) {
$longForShortMapping = self::longForShortMapping();
return $longForShortMapping[$short];
}
/**
* @return array
*/
- static function &longForShortMapping() {
+ public static function &longForShortMapping() {
static $longForShortMapping = NULL;
if ($longForShortMapping === NULL) {
$rows = array();
*
* @return string
*/
- static function shortForLong($long) {
+ public static function shortForLong($long) {
return substr($long, 0, 2);
}
}
*
* @return void
*/
- static function dropAllViews() {
+ public static function dropAllViews() {
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
if (!$domain->locales) {
*
* @return void
*/
- static function makeMultilingual($locale) {
+ public static function makeMultilingual($locale) {
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
*
* @return void
*/
- static function makeSinglelingual($retain) {
+ public static function makeSinglelingual($retain) {
$domain = new CRM_Core_DAO_Domain;
$domain->find(TRUE);
$locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales);
*
* @return void
*/
- static function addLocale($locale, $source) {
+ public static function addLocale($locale, $source) {
// get the current supported locales
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
*
* @return void
*/
- static function rebuildMultilingualSchema($locales, $version = NULL) {
+ public static function rebuildMultilingualSchema($locales, $version = NULL) {
if ($version) {
$latest = self::getLatestSchema($version);
require_once "CRM/Core/I18n/SchemaStructure_{$latest}.php";
*
* @return string the rewritten query
*/
- static function rewriteQuery($query) {
+ public static function rewriteQuery($query) {
global $dbLocale;
$tables = self::schemaStructureTables();
foreach ($tables as $table) {
*
* @return array
*/
- static function schemaStructureTables($version = NULL, $force = FALSE) {
+ public static function schemaStructureTables($version = NULL, $force = FALSE) {
static $_tables = NULL;
if ($_tables === NULL || $force) {
if ($version) {
*
* @return mixed
*/
- static function getLatestSchema($version) {
+ public static function getLatestSchema($version) {
// remove any .upgrade sub-str from version. Makes it easy to do version_compare & give right result
$version = str_ireplace(".upgrade", "", $version);
* @param $info
* @param null $tableName
*/
- static function triggerInfo(&$info, $tableName = NULL) {
+ public static function triggerInfo(&$info, $tableName = NULL) {
// get the current supported locales
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
/**
* @return mixed
*/
- static function &columns() {
+ public static function &columns() {
static $result = NULL;
if (!$result) {
$result = unserialize('a:17:{s:20:"civicrm_custom_group";a:3:{s:5:"title";s:11:"varchar(64)";s:8:"help_pre";s:4:"text";s:9:"help_post";s:4:"text";}s:20:"civicrm_custom_field";a:3:{s:5:"label";s:12:"varchar(255)";s:8:"help_pre";s:4:"text";s:9:"help_post";s:4:"text";}s:20:"civicrm_option_group";a:2:{s:5:"label";s:12:"varchar(255)";s:11:"description";s:12:"varchar(255)";}s:17:"civicrm_price_set";a:3:{s:5:"title";s:12:"varchar(255)";s:8:"help_pre";s:4:"text";s:9:"help_post";s:4:"text";}s:15:"civicrm_contact";a:7:{s:9:"sort_name";s:12:"varchar(128)";s:12:"display_name";s:12:"varchar(128)";s:10:"first_name";s:11:"varchar(64)";s:11:"middle_name";s:11:"varchar(64)";s:9:"last_name";s:11:"varchar(64)";s:14:"household_name";s:12:"varchar(128)";s:17:"organization_name";s:12:"varchar(128)";}s:16:"civicrm_premiums";a:2:{s:20:"premiums_intro_title";s:12:"varchar(255)";s:19:"premiums_intro_text";s:4:"text";}s:15:"civicrm_product";a:3:{s:4:"name";s:12:"varchar(255)";s:11:"description";s:4:"text";s:7:"options";s:4:"text";}s:23:"civicrm_membership_type";a:2:{s:4:"name";s:12:"varchar(128)";s:11:"description";s:12:"varchar(255)";}s:25:"civicrm_membership_status";a:1:{s:4:"name";s:12:"varchar(128)";}s:19:"civicrm_tell_friend";a:5:{s:5:"title";s:12:"varchar(255)";s:5:"intro";s:4:"text";s:17:"suggested_message";s:4:"text";s:14:"thankyou_title";s:12:"varchar(255)";s:13:"thankyou_text";s:4:"text";}s:20:"civicrm_option_value";a:2:{s:5:"label";s:12:"varchar(255)";s:11:"description";s:12:"varchar(255)";}s:19:"civicrm_price_field";a:3:{s:5:"label";s:12:"varchar(255)";s:8:"help_pre";s:4:"text";s:9:"help_post";s:4:"text";}s:25:"civicrm_contribution_page";a:13:{s:5:"title";s:12:"varchar(255)";s:10:"intro_text";s:4:"text";s:14:"pay_later_text";s:4:"text";s:17:"pay_later_receipt";s:4:"text";s:14:"thankyou_title";s:12:"varchar(255)";s:13:"thankyou_text";s:4:"text";s:15:"thankyou_footer";s:4:"text";s:16:"for_organization";s:4:"text";s:17:"receipt_from_name";s:12:"varchar(255)";s:12:"receipt_text";s:4:"text";s:11:"footer_text";s:4:"text";s:17:"honor_block_title";s:12:"varchar(255)";s:16:"honor_block_text";s:4:"text";}s:24:"civicrm_membership_block";a:4:{s:9:"new_title";s:12:"varchar(255)";s:8:"new_text";s:4:"text";s:13:"renewal_title";s:12:"varchar(255)";s:12:"renewal_text";s:4:"text";}s:16:"civicrm_uf_group";a:3:{s:5:"title";s:11:"varchar(64)";s:8:"help_pre";s:4:"text";s:9:"help_post";s:4:"text";}s:16:"civicrm_uf_field";a:2:{s:9:"help_post";s:4:"text";s:5:"label";s:12:"varchar(255)";}s:13:"civicrm_event";a:18:{s:5:"title";s:12:"varchar(255)";s:7:"summary";s:4:"text";s:11:"description";s:4:"text";s:22:"registration_link_text";s:12:"varchar(255)";s:15:"event_full_text";s:4:"text";s:9:"fee_label";s:12:"varchar(255)";s:10:"intro_text";s:4:"text";s:11:"footer_text";s:4:"text";s:13:"confirm_title";s:12:"varchar(255)";s:12:"confirm_text";s:4:"text";s:19:"confirm_footer_text";s:4:"text";s:18:"confirm_email_text";s:4:"text";s:17:"confirm_from_name";s:12:"varchar(255)";s:14:"thankyou_title";s:12:"varchar(255)";s:13:"thankyou_text";s:4:"text";s:20:"thankyou_footer_text";s:4:"text";s:14:"pay_later_text";s:4:"text";s:17:"pay_later_receipt";s:4:"text";}}');
/**
* @return array
*/
- static function &tables() {
+ public static function &tables() {
static $result = NULL;
if (!$result) {
$result = array_keys(self::columns());
/**
* @return array
*/
- static function &columns() {
+ public static function &columns() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &indices() {
+ public static function &indices() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &columns() {
+ public static function &columns() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &indices() {
+ public static function &indices() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &tables() {
+ public static function &tables() {
static $result = NULL;
if (!$result) {
$result = array_keys(self::columns());
/**
* @return array
*/
- static function &columns() {
+ public static function &columns() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &indices() {
+ public static function &indices() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &tables() {
+ public static function &tables() {
static $result = NULL;
if (!$result) {
$result = array_keys(self::columns());
/**
* @return array
*/
- static function &indices() {
+ public static function &indices() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &tables() {
+ public static function &tables() {
static $result = NULL;
if (!$result) {
$result = array_keys(self::columns());
/**
* @return array
*/
- static function &columns() {
+ public static function &columns() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &indices() {
+ public static function &indices() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &tables() {
+ public static function &tables() {
static $result = NULL;
if (!$result) {
$result = array_keys(self::columns());
/**
* @return array
*/
- static function &columns() {
+ public static function &columns() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &indices() {
+ public static function &indices() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &tables() {
+ public static function &tables() {
static $result = NULL;
if (!$result) {
$result = array_keys(self::columns());
* @return array
*/
static
- function &columns() {
+ public function &columns() {
static $result = NULL;
if (!$result) {
$result = array(
* @return array
*/
static
- function &indices() {
+ public function &indices() {
static $result = NULL;
if (!$result) {
$result = array(
* @return array
*/
static
- function &tables() {
+ public function &tables() {
static $result = NULL;
if (!$result) {
$result = array_keys(self::columns());
/**
* @return array
*/
- static function &columns() {
+ public static function &columns() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &indices() {
+ public static function &indices() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &tables() {
+ public static function &tables() {
static $result = NULL;
if (!$result) {
$result = array_keys(self::columns());
/**
* @return array
*/
- static function &columns() {
+ public static function &columns() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &indices() {
+ public static function &indices() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &tables() {
+ public static function &tables() {
static $result = NULL;
if (!$result) {
$result = array_keys(self::columns());
/**
* @return array
*/
- static function &columns() {
+ public static function &columns() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &indices() {
+ public static function &indices() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &tables() {
+ public static function &tables() {
static $result = NULL;
if (!$result) {
$result = array_keys(self::columns());
/**
* @return array
*/
- static function &columns() {
+ public static function &columns() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &indices() {
+ public static function &indices() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &tables() {
+ public static function &tables() {
static $result = NULL;
if (!$result) {
$result = array_keys(self::columns());
/**
* @return array
*/
- static function &columns() {
+ public static function &columns() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &indices() {
+ public static function &indices() {
static $result = NULL;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &tables() {
+ public static function &tables() {
static $result = NULL;
if (!$result) {
$result = array_keys(self::columns());
/**
* @return array
*/
- static function &columns()
+ public static function &columns()
{
static $result = null;
if (!$result) {
/**
* @return array
*/
- static function &indices()
+ public static function &indices()
{
static $result = null;
if (!$result) {
/**
* @return array
*/
- static function &tables()
+ public static function &tables()
{
static $result = null;
if (!$result) {
/**
* @return array
*/
- static function &columns()
+ public static function &columns()
{
static $result = null;
if (!$result) {
/**
* @return array
*/
- static function &indices()
+ public static function &indices()
{
static $result = null;
if (!$result) {
/**
* @return array
*/
- static function &tables()
+ public static function &tables()
{
static $result = null;
if (!$result) {
/**
* @return array
*/
- static function &columns() {
+ public static function &columns() {
static $result = null;
if (!$result) {
$result = array(
/**
* @return array
*/
- static function &indices()
+ public static function &indices()
{
static $result = null;
if (!$result) {
/**
* @return array
*/
- static function &tables()
+ public static function &tables()
{
static $result = null;
if (!$result) {
*/
class CRM_Core_I18n_SchemaStructure_4_5_beta2
{
- static function &columns()
+ public static function &columns()
{
static $result = null;
if (!$result) {
}
return $result;
}
- static function &indices()
+ public static function &indices()
{
static $result = null;
if (!$result) {
}
return $result;
}
- static function &tables()
+ public static function &tables()
{
static $result = null;
if (!$result) {
* @return string the full path to the config file
* @static
*/
- static function createConfigFile($force = FALSE) {
+ public static function createConfigFile($force = FALSE) {
$config = CRM_Core_Config::singleton();
$configFile = $config->configAndLogDir . 'Config.IDS.ini';
if (!$force && file_exists($configFile)) {
* @static
* @access public
*/
- static function invoke($args) {
+ public static function invoke($args) {
try {
return self::_invoke($args);
}
* @static
* @access public
*/
- static function form($action, $contact_type, $contact_sub_type) {
+ public static function form($action, $contact_type, $contact_sub_type) {
CRM_Utils_System::setUserContext(array('civicrm/contact/search/basic', 'civicrm/contact/view'));
$wrapper = new CRM_Utils_Wrapper();
*
* @param CRM_Core_Smarty $template
*/
- static function versionCheck($template) {
+ public static function versionCheck($template) {
if (CRM_Core_Config::isUpgradeMode()) {
return;
}
*
* @throws Exception
*/
- static function rebuildMenuAndCaches($triggerRebuild = FALSE, $sessionReset = FALSE) {
+ public static function rebuildMenuAndCaches($triggerRebuild = FALSE, $sessionReset = FALSE) {
$config = CRM_Core_Config::singleton();
$config->clearModuleList();
* @access public
* @static
*/
- static function sidebarLeft() {
+ public static function sidebarLeft() {
$config = CRM_Core_Config::singleton();
if ($config->userFrameworkFrontend) {
* @static
* @access private
*/
- static function privateKey() {
+ public static function privateKey() {
if (!self::$_key) {
$session = CRM_Core_Session::singleton();
self::$_key = $session->get('qfPrivateKey');
/**
* @return mixed|null|string
*/
- static function sessionID() {
+ public static function sessionID() {
if (!self::$_sessionID) {
$session = CRM_Core_Session::singleton();
self::$_sessionID = $session->get('qfSessionID');
* @static
* @access public
*/
- static function get($name, $addSequence = FALSE) {
+ public static function get($name, $addSequence = FALSE) {
$privateKey = self::privateKey();
$sessionID = self::sessionID();
$key = md5($sessionID . $name . $privateKey);
* @static
* @access public
*/
- static function validate($key, $name, $addSequence = FALSE) {
+ public static function validate($key, $name, $addSequence = FALSE) {
if (!is_string($key)) {
return NULL;
}
*
* @return bool
*/
- static function valid($key) {
+ public static function valid($key) {
// a valid key is a 32 digit hex number
// followed by an optional _ and a number between 1 and 10000
if (strpos('_', $key) !== FALSE) {
*
* @return \CRM_Core_Lock the lock object
*/
- function __construct($name, $timeout = NULL, $serverWideLock = FALSE) {
+ public function __construct($name, $timeout = NULL, $serverWideLock = FALSE) {
$config = CRM_Core_Config::singleton();
$dsnArray = DB::parseDSN($config->dsn);
$database = $dsnArray['database'];
$this->acquire();
}
- function __destruct() {
+ public function __destruct() {
$this->release();
}
/**
* @return bool
*/
- function acquire() {
+ public function acquire() {
if (defined('CIVICRM_LOCK_DEBUG')) {
CRM_Core_Error::debug_log_message('acquire lock for ' . $this->_name);
}
/**
* @return null|string
*/
- function release() {
+ public function release() {
if ($this->_hasLock) {
$this->_hasLock = FALSE;
/**
* @return null|string
*/
- function isFree() {
+ public function isFree() {
$query = "SELECT IS_FREE_LOCK( %1 )";
$params = array(1 => array($this->_name, 'String'));
return CRM_Core_DAO::singleValueQuery($query, $params);
/**
* @return bool
*/
- function isAcquired() {
+ public function isAcquired() {
return $this->_hasLock;
}
* @throws CRM_Core_Exception
* @return boolean
*/
- function hackyHandleBrokenCode($jobLog) {
+ public function hackyHandleBrokenCode($jobLog) {
if (stristr($this->_name, 'job')) {
throw new CRM_Core_Exception('lock aquisition for ' . $this->_name . 'attempted when ' . $jobLog . 'is not released');
}
*
* @return array
*/
- static function &xmlItems($fetchFromXML = FALSE) {
+ public static function &xmlItems($fetchFromXML = FALSE) {
if (!self::$_items || $fetchFromXML) {
$config = CRM_Core_Config::singleton();
*
* @throws Exception
*/
- static function read($name, &$menu) {
+ public static function read($name, &$menu) {
$config = CRM_Core_Config::singleton();
* @static
* @access public
*/
- static function &items($fetchFromXML = FALSE) {
+ public static function &items($fetchFromXML = FALSE) {
return self::xmlItems($fetchFromXML);
}
*
* @return bool
*/
- static function isArrayTrue(&$values) {
+ public static function isArrayTrue(&$values) {
foreach ($values as $name => $value) {
if (!$value) {
return FALSE;
*
* @throws Exception
*/
- static function fillMenuValues(&$menu, $path) {
+ public static function fillMenuValues(&$menu, $path) {
$fieldsToPropagate = array(
'access_callback',
'access_arguments',
* 4. Build the global navigation block
*
*/
- static function build(&$menu) {
+ public static function build(&$menu) {
foreach ($menu as $path => $menuItems) {
self::buildBreadcrumb($menu, $path);
self::fillMenuValues($menu, $path);
* This function recomputes menu from xml and populates civicrm_menu
* @param bool $truncate
*/
- static function store($truncate = TRUE) {
+ public static function store($truncate = TRUE) {
// first clean up the db
if ($truncate) {
$query = 'TRUNCATE civicrm_menu';
/**
* @param $menu
*/
- static function buildAdminLinks(&$menu) {
+ public static function buildAdminLinks(&$menu) {
$values = array();
foreach ($menu as $path => $item) {
* @return mixed
* @throws Exception
*/
- static function &getNavigation($all = FALSE) {
+ public static function &getNavigation($all = FALSE) {
CRM_Core_Error::fatal();
if (!self::$_menuCache) {
/**
* @return null
*/
- static function &getAdminLinks() {
+ public static function &getAdminLinks() {
$links = self::get('admin');
if (!$links ||
* @static
* @access public
*/
- static function buildBreadcrumb(&$menu, $path) {
+ public static function buildBreadcrumb(&$menu, $path) {
$crumbs = array();
$pathElements = explode('/', $path);
* @param $menu
* @param $path
*/
- static function buildReturnUrl(&$menu, $path) {
+ public static function buildReturnUrl(&$menu, $path) {
if (!isset($menu[$path]['return_url'])) {
list($menu[$path]['return_url'], $menu[$path]['return_url_args']) = self::getReturnUrl($menu, $path);
}
*
* @return array
*/
- static function getReturnUrl(&$menu, $path) {
+ public static function getReturnUrl(&$menu, $path) {
if (!isset($menu[$path]['return_url'])) {
$pathElements = explode('/', $path);
array_pop($pathElements);
* @param $menu
* @param $path
*/
- static function fillComponentIds(&$menu, $path) {
+ public static function fillComponentIds(&$menu, $path) {
static $cache = array();
if (array_key_exists('component_id', $menu[$path])) {
*
* @return null
*/
- static function get($path) {
+ public static function get($path) {
// return null if menu rebuild
$config = CRM_Core_Config::singleton();
*
* @return mixed
*/
- static function getArrayForPathArgs($pathArgs) {
+ public static function getArrayForPathArgs($pathArgs) {
if (!is_string($pathArgs)) {
return;
}
* @static
* @void
*/
- static function &valuesByID($id, $flip = FALSE, $grouping = FALSE, $localize = FALSE, $labelColumnName = 'label', $onlyActive = TRUE, $fresh = FALSE) {
+ public static function &valuesByID($id, $flip = FALSE, $grouping = FALSE, $localize = FALSE, $labelColumnName = 'label', $onlyActive = TRUE, $fresh = FALSE) {
$cacheKey = self::createCacheKey($id, $flip, $grouping, $localize, $labelColumnName, $onlyActive);
$cache = CRM_Utils_Cache::singleton();
* @access public
* @static
*/
- static function lookupValues(&$params, &$names, $flip = FALSE) {
+ public static function lookupValues(&$params, &$names, $flip = FALSE) {
foreach ($names as $postName => $value) {
// See if $params field is in $names array (i.e. is a value that we need to lookup)
if ($postalName = CRM_Utils_Array::value($postName, $params)) {
*
* @return null
*/
- static function getLabel($groupName, $value, $onlyActiveValue = TRUE) {
+ public static function getLabel($groupName, $value, $onlyActiveValue = TRUE) {
if (empty($groupName) ||
empty($value)
) {
*
* @return string the value from the row where is_default = true
*/
- static function getDefaultValue($groupName) {
+ public static function getDefaultValue($groupName) {
if (empty($groupName)) {
return NULL;
}
*
* @return int the option group ID
*/
- static function createAssoc($groupName, &$values, &$defaultID, $groupTitle = NULL) {
+ public static function createAssoc($groupName, &$values, &$defaultID, $groupTitle = NULL) {
self::deleteAssoc($groupName);
if (!empty($values)) {
$group = new CRM_Core_DAO_OptionGroup();
* @param bool $flip
* @param string $field
*/
- static function getAssoc($groupName, &$values, $flip = FALSE, $field = 'name') {
+ public static function getAssoc($groupName, &$values, $flip = FALSE, $field = 'name') {
$query = "
SELECT v.id as amount_id, v.value, v.label, v.name, v.description, v.weight
FROM civicrm_option_group g,
* @param string $groupName
* @param string $operator
*/
- static function deleteAssoc($groupName, $operator = "=") {
+ public static function deleteAssoc($groupName, $operator = "=") {
$query = "
DELETE g, v
FROM civicrm_option_group g,
*
* @return null|string
*/
- static function optionLabel($groupName, $value) {
+ public static function optionLabel($groupName, $value) {
$query = "
SELECT v.label
FROM civicrm_option_group g,
* @param $name
* @param array $params
*/
- static function flush($name, $params = array()){
+ public static function flush($name, $params = array()){
$defaults = array(
'flip' => FALSE,
'grouping' => FALSE,
);
}
- static function flushAll() {
+ public static function flushAll() {
self::$_values = array();
self::$_cache = array();
CRM_Utils_Cache::singleton()->flush();
* @access public
* @static
*/
- static function getRows($groupParams, $links, $orderBy = 'weight') {
+ public static function getRows($groupParams, $links, $orderBy = 'weight') {
$optionValue = array();
$optionGroupID = NULL;
* @access public
* @static
*/
- static function addOptionValue(&$params, &$groupParams, &$action, &$optionValueID) {
+ public static function addOptionValue(&$params, &$groupParams, &$action, &$optionValueID) {
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
// checking if the group name with the given id or name (in $groupParams) exists
if (!empty($groupParams)) {
* @access public
* @static
*/
- static function optionExists($value, $daoName, $daoID, $optionGroupID, $fieldName = 'name') {
+ public static function optionExists($value, $daoName, $daoID, $optionGroupID, $fieldName = 'name') {
$object = new $daoName();
$object->$fieldName = $value;
$object->option_group_id = $optionGroupID;
* @access public
* @static
*/
- static function getFields($mode = '', $contactType = 'Individual') {
+ public static function getFields($mode = '', $contactType = 'Individual') {
$key = "$mode $contactType";
if (empty(self::$_fields[$key]) || !self::$_fields[$key]) {
self::$_fields[$key] = array();
* @return void
* @access public
*/
- static function select(&$query) {
+ public static function select(&$query) {
if (!empty($query->_params) || !empty($query->_returnProperties)) {
$field = self::getFields();
foreach ($field as $name => $values) {
* @access public
* @static
*/
- static function getValues($groupParams, &$values, $orderBy = 'weight', $isActive = FALSE) {
+ public static function getValues($groupParams, &$values, $orderBy = 'weight', $isActive = FALSE) {
if (empty($groupParams)) {
return NULL;
}
*
* @return CRM_Core_Page
*/
- function __construct($title = NULL, $mode = NULL) {
+ public function __construct($title = NULL, $mode = NULL) {
$this->_name = CRM_Utils_System::getClassName($this);
$this->_title = $title;
$this->_mode = $mode;
*
* @return string The content generated by running this page
*/
- function run() {
+ public function run() {
if ($this->_embedded) {
return;
}
* @return void
*
*/
- function set($name, $value = NULL) {
+ public function set($name, $value = NULL) {
self::$_session->set($name, $value, $this->_name);
}
* @return mixed
*
*/
- function get($name) {
+ public function get($name) {
return self::$_session->get($name, $this->_name);
}
* @return void
* @access public
*/
- function assign($var, $value = NULL) {
+ public function assign($var, $value = NULL) {
self::$_template->assign($var, $value);
}
* @return void
* @access public
*/
- function assign_by_ref($var, &$value) {
+ public function assign_by_ref($var, &$value) {
self::$_template->assign_by_ref($var, $value);
}
* @param mixed $value the value to append
* @param bool $merge
*/
- function append($tpl_var, $value=NULL, $merge=FALSE) {
+ public function append($tpl_var, $value=NULL, $merge=FALSE) {
self::$_template->append($tpl_var, $value, $merge);
}
*
* @return array
*/
- function get_template_vars($name=null) {
+ public function get_template_vars($name=null) {
return self::$_template->get_template_vars($name);
}
*
* @return void
*/
- function reset() {
+ public function reset() {
self::$_session->resetScope($this->_name);
}
* @return string
* @access public
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
return str_replace('_',
DIRECTORY_SEPARATOR,
CRM_Utils_System::getClassName($this)
* A wrapper for getTemplateFileName that includes calling the hook to
* prevent us from having to copy & paste the logic of calling the hook
*/
- function getHookedTemplateFileName() {
+ public function getHookedTemplateFileName() {
$pageTemplateFile = $this->getTemplateFileName();
CRM_Utils_Hook::alterTemplateFile(get_class($this), $this, 'page', $pageTemplateFile);
return $pageTemplateFile;
* @return string
* @access public
*/
- function overrideExtraTemplateFileName() {
+ public function overrideExtraTemplateFileName() {
return NULL;
}
* @return void
* @access public
*/
- function setEmbedded($embedded) {
+ public function setEmbedded($embedded) {
$this->_embedded = $embedded;
}
* @return boolean return the embedded value
* @access public
*/
- function getEmbedded() {
+ public function getEmbedded() {
return $this->_embedded;
}
* @return void
* @access public
*/
- function setPrint($print) {
+ public function setPrint($print) {
$this->_print = $print;
}
* @return boolean return the print value
* @access public
*/
- function getPrint() {
+ public function getPrint() {
return $this->_print;
}
/**
* @return CRM_Core_Smarty
*/
- static function &getTemplate() {
+ public static function &getTemplate() {
return self::$_template;
}
*
* @return null
*/
- function getVar($name) {
+ public function getVar($name) {
return isset($this->$name) ? $this->$name : NULL;
}
* @param string $name
* @param $value
*/
- function setVar($name, $value) {
+ public function setVar($name, $value) {
$this->$name = $value;
}
}
* @static
* @access public
*/
- static function run() {
+ public static function run() {
$className = CRM_Utils_Type::escape($_REQUEST['class_name'], 'String');
$type = '';
if (!empty($_REQUEST['type'])) {
* @static
* @access public
*/
- static function setIsQuickConfig() {
+ public static function setIsQuickConfig() {
$id = $context = NULL;
if (!empty($_REQUEST['id'])) {
$id = CRM_Utils_Type::escape($_REQUEST['id'], 'Integer');
*
* @return bool
*/
- static function checkAuthz($type, $className, $fnName = null) {
+ public static function checkAuthz($type, $className, $fnName = null) {
switch ($type) {
case 'method':
if (!preg_match('/^CRM_[a-zA-Z0-9]+_Page_AJAX$/', $className)) {
* Outputs the CiviCRM standard json-formatted page/form response
* @param array|string $response
*/
- static function returnJsonResponse($response) {
+ public static function returnJsonResponse($response) {
// Allow lazy callers to not wrap content in an array
if (is_string($response)) {
$response = array('content' => $response);
/**
* Set headers appropriate for a js file
*/
- static function setJsHeaders() {
+ public static function setJsHeaders() {
// Encourage browsers to cache for a long time - 1 year
$year = 60*60*24*364;
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + $year));
* @param string $key - array key to use as the key
* @deprecated
*/
- static function autocompleteResults($results, $val='label', $key='id') {
+ public static function autocompleteResults($results, $val='label', $key='id') {
$output = array();
if (is_array($results)) {
foreach ($results as $k => $v) {
* This method is used by on-behalf-of form to dynamically generate poulate the
* location field values for selected permissioned contact.
*/
- static function getPermissionedLocation() {
+ public static function getPermissionedLocation() {
$cid = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject, TRUE);
$ufId = CRM_Utils_Request::retrieve('ufId', 'Integer', CRM_Core_DAO::$_nullObject, TRUE);
CRM_Utils_JSON::output($elements);
}
- static function jqState() {
+ public static function jqState() {
CRM_Utils_JSON::output(CRM_Core_BAO_Location::getChainSelectValues($_GET['_value'], 'country'));
}
- static function jqCounty() {
+ public static function jqCounty() {
CRM_Utils_JSON::output(CRM_Core_BAO_Location::getChainSelectValues($_GET['_value'], 'stateProvince'));
}
- static function getLocBlock() {
+ public static function getLocBlock() {
// i wish i could retrieve loc block info based on loc_block_id,
// Anyway, lets retrieve an event which has loc_block_id set to 'lbid'.
if ($_REQUEST['lbid']) {
*
* @return string The content generated by running this page
*/
- function run() {
+ public function run() {
$this->registerResources(CRM_Core_Resources::singleton());
return parent::run();
}
* @return string
* @access public
*/
- function userContextParams($mode = NULL) {
+ public function userContextParams($mode = NULL) {
return 'reset=1&action=browse';
}
* @return void
* @access public
*/
- function addValues($controller) {}
+ public function addValues($controller) {}
/**
* Class constructor
*
* @return \CRM_Core_Page_Basic
*/
- function __construct($title = NULL, $mode = NULL) {
+ public function __construct($title = NULL, $mode = NULL) {
parent::__construct($title, $mode);
}
*
* @return void
*/
- function run() {
+ public function run() {
// CRM-9034
// dont see args or pageArgs being used, so we should
// consider eliminating them in a future version
/**
* @return string
*/
- function superRun() {
+ public function superRun() {
return parent::run();
}
* @return void
* @access public
*/
- function browse() {
+ public function browse() {
$n = func_num_args();
$action = ($n > 0) ? func_get_arg(0) : NULL;
$sort = ($n > 0) ? func_get_arg(1) : NULL;
* @return void
* @access private
*/
- function action(&$object, $action, &$values, &$links, $permission, $forceAction = FALSE) {
+ public function action(&$object, $action, &$values, &$links, $permission, $forceAction = FALSE) {
$values['class'] = '';
$newAction = $action;
$hasDelete = $hasDisable = TRUE;
*
* @return void
*/
- function edit($mode, $id = NULL, $imageUpload = FALSE, $pushUserContext = TRUE) {
+ public function edit($mode, $id = NULL, $imageUpload = FALSE, $pushUserContext = TRUE) {
$controller = new CRM_Core_Controller_Simple($this->editForm(),
$this->editName(),
$mode,
*/
class CRM_Core_Page_File extends CRM_Core_Page {
- function run() {
+ public function run() {
$eid = CRM_Utils_Request::retrieve('eid', 'Positive', $this, TRUE);
$fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this, FALSE);
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
* This loads a smarty help file via ajax and returns as html
*/
class CRM_Core_Page_Inline_Help {
- function run() {
+ public function run() {
$args = $_REQUEST;
if (!empty($args['file']) && strpos($args['file'], '..') === FALSE) {
$file = $args['file'] . '.hlp';
class CRM_Core_Page_QUnit extends CRM_Core_Page {
protected $tplFile = NULL;
- function run() {
+ public function run() {
list ($ext, $suite) = $this->getRequestExtAndSuite();
if (empty($ext) || empty($suite)) {
throw new CRM_Core_Exception("FIXME: Not implemented: QUnit browser");
*
* @return array
*/
- function getRequestExtAndSuite() {
+ public function getRequestExtAndSuite() {
$config = CRM_Core_Config::singleton();
$arg = explode('/', $_GET[$config->userFrameworkURLVar]);
* @endcoe
*/
class CRM_Core_Page_Redirect extends CRM_Core_Page {
- function run($path = NULL, $pageArgs = array()) {
+ public function run($path = NULL, $pageArgs = array()) {
$url = self::createUrl($path, $_REQUEST, $pageArgs, TRUE);
// return $url;
CRM_Utils_System::redirect($url);
* @static
*
*/
- static function &singleton($mode = 'test', &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
+ public static function &singleton($mode = 'test', &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
// make sure paymentProcessor is not empty
// CRM-7424
if (empty($paymentProcessor)) {
* @param CRM_Core_Form $paymentForm
*
*/
- function setForm(&$paymentForm) {
+ public function setForm(&$paymentForm) {
$this->_paymentForm = $paymentForm;
}
*
* @return CRM_Core_Form A form object
*/
- function getForm() {
+ public function getForm() {
return $this->_paymentForm;
}
*
* @return null
*/
- function getVar($name) {
+ public function getVar($name) {
return isset($this->$name) ? $this->$name : NULL;
}
*
* @return bool
*/
- static function paypalRedirect(&$paymentProcessor) {
+ public static function paypalRedirect(&$paymentProcessor) {
if (!$paymentProcessor) {
return FALSE;
}
* Page callback for civicrm/payment/ipn
* @public
*/
- static function handleIPN() {
+ public static function handleIPN() {
self::handlePaymentMethod(
'PaymentNotification',
array(
* @param $method
* @param array $params
*/
- static function handlePaymentMethod($method, $params = array()) {
+ public static function handlePaymentMethod($method, $params = array()) {
if (!isset($params['processor_id']) && !isset($params['processor_name'])) {
CRM_Core_Error::fatal("Either 'processor_id' or 'processor_name' param is required for payment callback");
}
* @return boolean
* @public
*/
- function isSupported($method = 'cancelSubscription') {
+ public function isSupported($method = 'cancelSubscription') {
return method_exists(CRM_Utils_System::getClassName($this), $method);
}
*
* @return string
*/
- function subscriptionURL($entityID = NULL, $entity = NULL, $action = 'cancel') {
+ public function subscriptionURL($entityID = NULL, $entity = NULL, $action = 'cancel') {
// Set URL
switch ($action) {
case 'cancel' :
*
* @return \CRM_Core_Payment_AuthorizeNet
*/
- function __construct($mode, &$paymentProcessor) {
+ public function __construct($mode, &$paymentProcessor) {
$this->_mode = $mode;
$this->_paymentProcessor = $paymentProcessor;
$this->_processorName = ts('Authorize.net');
* @static
*
*/
- static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
+ public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
$processorName = $paymentProcessor['name'];
if (!isset(self::$_singleton[$processorName]) || self::$_singleton[$processorName] === NULL) {
self::$_singleton[$processorName] = new CRM_Core_Payment_AuthorizeNet($mode, $paymentProcessor);
* @return array the result in a nice formatted array (or an error object)
* @public
*/
- function doDirectPayment(&$params) {
+ public function doDirectPayment(&$params) {
if (!defined('CURLOPT_SSLCERT')) {
return self::error(9001, 'Authorize.Net requires curl with SSL support');
}
*
* @public
*/
- function doRecurPayment() {
+ public function doRecurPayment() {
$template = CRM_Core_Smarty::singleton();
$intervalLength = $this->_getParam('frequency_interval');
/**
* @return array
*/
- function _getAuthorizeNetFields() {
+ public function _getAuthorizeNetFields() {
$amount = $this->_getParam('total_amount');//Total amount is from the form contribution field
if(empty($amount)){//CRM-9894 would this ever be the case??
$amount = $this->_getParam('amount');
*
* @return bool True if ID exists, else false
*/
- function _checkDupe($invoiceId) {
+ public function _checkDupe($invoiceId) {
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->invoice_id = $invoiceId;
return $contribution->find();
*
* @return string the HMAC_MD5 encoding string
**/
- function hmac($key, $data) {
+ public function hmac($key, $data) {
if (function_exists('mhash')) {
// Use PHP mhash extension
return (bin2hex(mhash(MHASH_MD5, $data, $key)));
*
* @return bool
*/
- function checkMD5($responseMD5, $transaction_id, $amount, $ipn = FALSE) {
+ public function checkMD5($responseMD5, $transaction_id, $amount, $ipn = FALSE) {
// cannot check if no MD5 hash
$md5Hash = $this->_getParam('md5Hash');
if (empty($md5Hash)) {
*
* @return string fingerprint
**/
- function CalculateFP() {
+ public function CalculateFP() {
$x_tran_key = $this->_getParam('paymentKey');
$loginid = $this->_getParam('apiLogin');
$sequence = $this->_getParam('sequence');
*
* @return array CSV fields
*/
- function explode_csv($data) {
+ public function explode_csv($data) {
$data = trim($data);
//make it easier to parse fields with quotes in them
$data = str_replace('""', "''", $data);
*
* @return array refId, resultCode, code, text, subscriptionId
*/
- function _parseArbReturn($content) {
+ public function _parseArbReturn($content) {
$refId = $this->_substring_between($content, '<refId>', '</refId>');
$resultCode = $this->_substring_between($content, '<resultCode>', '</resultCode>');
$code = $this->_substring_between($content, '<code>', '</code>');
* Function is from Authorize.Net sample code, and used to avoid using
* PHP5 XML functions
*/
- function _substring_between(&$haystack, $start, $end) {
+ public function _substring_between(&$haystack, $start, $end) {
if (strpos($haystack, $start) === FALSE || strpos($haystack, $end) === FALSE) {
return FALSE;
}
* @return mixed value of the field, or empty string if the field is
* not set
*/
- function _getParam($field, $xmlSafe = FALSE) {
+ public function _getParam($field, $xmlSafe = FALSE) {
$value = CRM_Utils_Array::value($field, $this->_params, '');
if ($xmlSafe) {
$value = str_replace(array( '&', '"', "'", '<', '>' ), '', $value);
*
* @return object
*/
- function &error($errorCode = NULL, $errorMessage = NULL) {
+ public function &error($errorCode = NULL, $errorMessage = NULL) {
$e = CRM_Core_Error::singleton();
if ($errorCode) {
$e->push($errorCode, 0, array( ), $errorMessage);
*
* @return bool false if value is not a scalar, true if successful
*/
- function _setParam($field, $value) {
+ public function _setParam($field, $value) {
if (!is_scalar($value)) {
return FALSE;
}
* @return string the error message if any
* @public
*/
- function checkConfig() {
+ public function checkConfig() {
$error = array();
if (empty($this->_paymentProcessor['user_name'])) {
$error[] = ts('APILogin is not set for this payment processor');
/**
* @return string
*/
- function accountLoginURL() {
+ public function accountLoginURL() {
return ($this->_mode == 'test') ? 'https://test.authorize.net' : 'https://authorize.net';
}
*
* @return bool|object
*/
- function cancelSubscription(&$message = '', $params = array()) {
+ public function cancelSubscription(&$message = '', $params = array()) {
$template = CRM_Core_Smarty::singleton();
$template->assign('subscriptionType', 'cancel');
*
* @return bool|object
*/
- function updateSubscriptionBillingInfo(&$message = '', $params = array()) {
+ public function updateSubscriptionBillingInfo(&$message = '', $params = array()) {
$template = CRM_Core_Smarty::singleton();
$template->assign('subscriptionType', 'updateBilling');
*
* @return bool|object
*/
- function changeSubscriptionAmount(&$message = '', $params = array()) {
+ public function changeSubscriptionAmount(&$message = '', $params = array()) {
$template = CRM_Core_Smarty::singleton();
$template->assign('subscriptionType', 'update');
*
* @throws CRM_Core_Exception
*/
- function __construct($inputData) {
+ public function __construct($inputData) {
$this->setInputParameters($inputData);
parent::__construct();
}
*
* @return bool|void
*/
- function main($component = 'contribute') {
+ public function main($component = 'contribute') {
//we only get invoice num as a key player from payment gateway response.
//for ARB we get x_subscription_id and x_subscription_paynum
*
* @return bool
*/
- function recur(&$input, &$ids, &$objects, $first) {
+ public function recur(&$input, &$ids, &$objects, $first) {
$this->_isRecurring = TRUE;
$recur = &$objects['contributionRecur'];
* @param $input
* @param $ids
*/
- function getInput(&$input, &$ids) {
+ public function getInput(&$input, &$ids) {
$input['amount'] = $this->retrieve('x_amount', 'String');
$input['subscription_id'] = $this->retrieve('x_subscription_id', 'Integer');
$input['response_code'] = $this->retrieve('x_response_code', 'Integer');
* @param $ids
* @param $input
*/
- function getIDs(&$ids, &$input) {
+ public function getIDs(&$ids, &$input) {
$ids['contact'] = $this->retrieve('x_cust_id', 'Integer', FALSE, 0);
$ids['contribution'] = $this->retrieve('x_invoice_num', 'Integer');
* @throws CRM_Core_Exception
* @return mixed
*/
- function retrieve($name, $type, $abort = TRUE, $default = NULL) {
+ public function retrieve($name, $type, $abort = TRUE, $default = NULL) {
$value = CRM_Utils_Type::validate(
empty($this->_inputParameters[$name]) ? $default : $this->_inputParameters[$name],
$type,
*
* @return bool
*/
- function checkMD5($ids, $input) {
+ public function checkMD5($ids, $input) {
$paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($ids['paymentProcessor'],
$input['is_test'] ? 'test' : 'live'
);
/**
* Constructor
*/
- function __construct() {
+ public function __construct() {
self::$_now = date('YmdHis');
}
*
* @throws CRM_Core_Exception
*/
- function setInputParameters($parameters) {
+ public function setInputParameters($parameters) {
if(!is_array($parameters)) {
throw new CRM_Core_Exception('Invalid input parameters');
}
* @param integer $paymentProcessorID Id of the payment processor ID in use
* @return boolean
*/
- function validateData(&$input, &$ids, &$objects, $required = TRUE, $paymentProcessorID = NULL) {
+ public function validateData(&$input, &$ids, &$objects, $required = TRUE, $paymentProcessorID = NULL) {
// make sure contact exists and is valid
$contact = new CRM_Contact_BAO_Contact();
*
* @return multitype:number NULL |boolean
*/
- function loadObjects(&$input, &$ids, &$objects, $required, $paymentProcessorID, $error_handling = NULL) {
+ public function loadObjects(&$input, &$ids, &$objects, $required, $paymentProcessorID, $error_handling = NULL) {
if (empty($error_handling)) {
// default options are that we log an error & echo it out
// note that we should refactor this error handling into error code @ some point
* @param array $input
* @return boolean
*/
- function failed(&$objects, &$transaction, $input = array()) {
+ public function failed(&$objects, &$transaction, $input = array()) {
$contribution = &$objects['contribution'];
$memberships = array();
if (!empty($objects['membership'])) {
* @param object $transaction
* @return boolean
*/
- function pending(&$objects, &$transaction) {
+ public function pending(&$objects, &$transaction) {
$transaction->commit();
CRM_Core_Error::debug_log_message("returning since contribution status is pending");
echo "Success: Returning since contribution status is pending<p>";
*
* @return bool
*/
- function cancelled(&$objects, &$transaction, $input = array()) {
+ public function cancelled(&$objects, &$transaction, $input = array()) {
$contribution = &$objects['contribution'];
$memberships = &$objects['membership'];
if (is_numeric($memberships)) {
*
* @return bool
*/
- function unhandled(&$objects, &$transaction) {
+ public function unhandled(&$objects, &$transaction) {
$transaction->rollback();
CRM_Core_Error::debug_log_message("returning since contribution status: is not handled");
echo "Failure: contribution status is not handled<p>";
* @param $transaction
* @param bool $recur
*/
- function completeTransaction(&$input, &$ids, &$objects, &$transaction, $recur = FALSE) {
+ public function completeTransaction(&$input, &$ids, &$objects, &$transaction, $recur = FALSE) {
$contribution = &$objects['contribution'];
$primaryContributionID = isset($contribution->id) ? $contribution->id : $objects['first_contribution']->id;
*
* @return bool
*/
- function getBillingID(&$ids) {
+ public function getBillingID(&$ids) {
// get the billing location type
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array(), 'validate');
// CRM-8108 remove the ts around the Billing locationtype
*
* @return array
*/
- function sendMail(&$input, &$ids, &$objects, &$values, $recur = FALSE, $returnMessageText = FALSE) {
+ public function sendMail(&$input, &$ids, &$objects, &$values, $recur = FALSE, $returnMessageText = FALSE) {
$contribution = &$objects['contribution'];
$input['is_recur'] = $recur;
// set receipt from e-mail and name in value
* @param $ids
* @param $recur
*/
- function sendRecurringStartOrEndNotification($ids, $recur) {
+ public function sendRecurringStartOrEndNotification($ids, $recur) {
if ($this->_isFirstOrLastRecurringPayment) {
$autoRenewMembership = FALSE;
if ($recur->id &&
* @param unknown_type $params
* @return void|Ambigous <value, unknown, array>
*/
- function updateContributionStatus(&$params) {
+ public function updateContributionStatus(&$params) {
// get minimum required values.
$statusId = CRM_Utils_Array::value('contribution_status_id', $params);
$componentId = CRM_Utils_Array::value('component_id', $params);
/**
* @param $contribution
*/
- function updateRecurLinkedPledge(&$contribution) {
+ public function updateRecurLinkedPledge(&$contribution) {
$returnProperties = array('id', 'pledge_id');
$paymentDetails = $paymentIDs = array();
*
* @return array
*/
- function addRecurLineItems($recurId, $contribution) {
+ public function addRecurLineItems($recurId, $contribution) {
$lineSets = array();
$originalContributionID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $recurId, 'id', 'contribution_recur_id');
* @param int $recurId
* @param int $targetContributionId
*/
- function copyCustomValues($recurId, $targetContributionId) {
+ public function copyCustomValues($recurId, $targetContributionId) {
if ($recurId && $targetContributionId) {
// get the initial contribution id of recur id
$sourceContributionId = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $recurId, 'id', 'contribution_recur_id');
* @param int $recurId
* @param int $targetContributionId
*/
- function addrecurSoftCredit($recurId, $targetContributionId) {
+ public function addrecurSoftCredit($recurId, $targetContributionId) {
$contriID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $recurId, 'id', 'contribution_recur_id');
$soft_contribution = new CRM_Contribute_DAO_ContributionSoft();
*
* @return \CRM_Core_Payment_Dummy
*/
- function __construct($mode, &$paymentProcessor) {
+ public function __construct($mode, &$paymentProcessor) {
$this->_mode = $mode;
$this->_paymentProcessor = $paymentProcessor;
$this->_processorName = ts('Dummy Processor');
* @return object
* @static
*/
- static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
+ public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
$processorName = $paymentProcessor['name'];
if (CRM_Utils_Array::value($processorName, self::$_singleton) === NULL) {
self::$_singleton[$processorName] = new CRM_Core_Payment_Dummy($mode, $paymentProcessor);
* @return array the result in a nice formatted array (or an error object)
* @public
*/
- function doDirectPayment(&$params) {
+ public function doDirectPayment(&$params) {
// Invoke hook_civicrm_paymentProcessor
// In Dummy's case, there is no translation of parameters into
// the back-end's canonical set of parameters. But if a processor
*
* @return object
*/
- function &error($errorCode = NULL, $errorMessage = NULL) {
+ public function &error($errorCode = NULL, $errorMessage = NULL) {
$e = CRM_Core_Error::singleton();
if ($errorCode) {
$e->push($errorCode, 0, NULL, $errorMessage);
* @return string the error message if any
* @public
*/
- function checkConfig() {
+ public function checkConfig() {
return NULL;
}
}
*
* @return \CRM_Core_Payment_Elavon *******************************************************
*/
- function __construct($mode, &$paymentProcessor) {
+ public function __construct($mode, &$paymentProcessor) {
// live or test
$this->_mode = $mode;
$this->_paymentProcessor = $paymentProcessor;
* @return object
* @static
*/
- static function &singleton($mode, &$paymentProcessor) {
+ public static function &singleton($mode, &$paymentProcessor) {
$processorName = $paymentProcessor['name'];
if (self::$_singleton[$processorName] === NULL) {
self::$_singleton[$processorName] = new CRM_Core_Payment_Elavon($mode, $paymentProcessor);
*
* Comment out irrelevant fields
**********************************************************/
- function mapProcessorFieldstoParams($params) {
+ public function mapProcessorFieldstoParams($params) {
/**********************************************************
* compile array
* This function sends request and receives response from
* the processor
**********************************************************/
- function doDirectPayment(&$params) {
+ public function doDirectPayment(&$params) {
if (isset($params['is_recur']) && $params['is_recur'] == TRUE) {
CRM_Core_Error::fatal(ts('Elavon - recurring payments not implemented'));
}
*
* @return bool True if ID exists, else false
*/
- function _checkDupe($invoiceId) {
+ public function _checkDupe($invoiceId) {
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->invoice_id = $invoiceId;
return $contribution->find();
/**************************************************
* Produces error message and returns from class
**************************************************/
- function &errorExit($errorCode = NULL, $errorMessage = NULL) {
+ public function &errorExit($errorCode = NULL, $errorMessage = NULL) {
$e = CRM_Core_Error::singleton();
if ($errorCode) {
$e->push($errorCode, 0, NULL, $errorMessage);
/**************************************************
* NOTE: 'doTransferCheckout' not implemented
**************************************************/
- function doTransferCheckout(&$params, $component) {
+ public function doTransferCheckout(&$params, $component) {
CRM_Core_Error::fatal(ts('This function is not implemented'));
}
*/
// function checkConfig( $mode ) // CiviCRM V1.9 Declaration
// CiviCRM V2.0 Declaration
- function checkConfig() {
+ public function checkConfig() {
$errorMsg = array();
if (empty($this->_paymentProcessor['user_name'])) {
*
* @return string
*/
- function buildXML($requestFields) {
+ public function buildXML($requestFields) {
$xmlFieldLength['ssl_first_name'] = 15;
// credit card name
$xmlFieldLength['ssl_last_name'] = 15;
*
* @return string
*/
- function tidyStringforXML($value, $fieldlength) {
+ public function tidyStringforXML($value, $fieldlength) {
// the xml is posted to a url so must not contain spaces etc. It also needs to be cut off at a certain
// length to match the processor's field length. The cut needs to be made after spaces etc are
// transformed but must not include a partial transformed character e.g. %20 must be in or out not half-way
* It returns the NodeValue for a given NodeName
* or returns an empty string.
************************************************************************/
- function GetNodeValue($NodeName, &$strXML) {
+ public function GetNodeValue($NodeName, &$strXML) {
$OpeningNodeName = "<" . $NodeName . ">";
$ClosingNodeName = "</" . $NodeName . ">";
*
* @return mixed
*/
- function decodeXMLresponse($Xml) {
+ public function decodeXMLresponse($Xml) {
/**
* $xtr = simplexml_load_string($Xml) or die ("Unable to load XML string!");
*
* @return \CRM_Core_Payment_FirstData *******************************************************
*/
- function __construct($mode, &$paymentProcessor) {
+ public function __construct($mode, &$paymentProcessor) {
// live or test
$this->_mode = $mode;
$this->_paymentProcessor = $paymentProcessor;
* @return object
* @static
*/
- static function &singleton($mode, &$paymentProcessor) {
+ public static function &singleton($mode, &$paymentProcessor) {
$processorName = $paymentProcessor['name'];
if (self::$_singleton[$processorName] === NULL) {
self::$_singleton[$processorName] = new CRM_Core_Payment_FirstData($mode, $paymentProcessor);
*
* Comment out irrelevant fields
**********************************************************/
- function mapProcessorFieldstoParams($params) {
+ public function mapProcessorFieldstoParams($params) {
/*concatenate full customer name first - code from EWAY gateway
*/
* This function sends request and receives response from
* the processor
**********************************************************/
- function doDirectPayment(&$params) {
+ public function doDirectPayment(&$params) {
if ($params['is_recur'] == TRUE) {
CRM_Core_Error::fatal(ts('%1 - recurring payments not implemented', array(1 => $paymentProcessor)));
}
*
* @return bool True if ID exists, else false
*/
- function _checkDupe($invoiceId) {
+ public function _checkDupe($invoiceId) {
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->invoice_id = $invoiceId;
return $contribution->find();
/**************************************************
* Produces error message and returns from class
**************************************************/
- function &errorExit($errorCode = NULL, $errorMessage = NULL) {
+ public function &errorExit($errorCode = NULL, $errorMessage = NULL) {
$e = CRM_Core_Error::singleton();
if ($errorCode) {
/**************************************************
* NOTE: 'doTransferCheckout' not implemented
**************************************************/
- function doTransferCheckout(&$params, $component) {
+ public function doTransferCheckout(&$params, $component) {
CRM_Core_Error::fatal(ts('This function is not implemented'));
}
*/
// function checkConfig( $mode ) // CiviCRM V1.9 Declaration
// CiviCRM V2.0 Declaration
- function checkConfig() {
+ public function checkConfig() {
$errorMsg = array();
if (empty($this->_paymentProcessor['user_name'])) {
*
* @return array
*/
- static function getPaymentFields($paymentProcessor) {
+ public static function getPaymentFields($paymentProcessor) {
$paymentProcessorObject = CRM_Core_Payment::singleton(($paymentProcessor['is_test'] ? 'test' : 'live'), $paymentProcessor);
return $paymentProcessorObject->getPaymentFormFields();
}
*
* @return array
*/
- static function getPaymentFieldMetadata($paymentProcessor) {
+ public static function getPaymentFieldMetadata($paymentProcessor) {
$paymentProcessorObject = CRM_Core_Payment::singleton(($paymentProcessor['is_test'] ? 'test' : 'live'), $paymentProcessor);
return $paymentProcessorObject->getPaymentFormFieldsMetadata();
}
*
* @return string
*/
- static function getPaymentTypeName($paymentProcessor) {
+ public static function getPaymentTypeName($paymentProcessor) {
$paymentProcessorObject = CRM_Core_Payment::singleton(($paymentProcessor['is_test'] ? 'test' : 'live'), $paymentProcessor);
return $paymentProcessorObject->getPaymentTypeName();
}
*
* @return string
*/
- static function getPaymentTypeLabel($paymentProcessor) {
+ public static function getPaymentTypeLabel($paymentProcessor) {
$paymentProcessorObject = CRM_Core_Payment::singleton(($paymentProcessor['is_test'] ? 'test' : 'live'), $paymentProcessor);
return ts(($paymentProcessorObject->getPaymentTypeLabel()) . ' Information');
}
*
* @return bool
*/
- static function buildPaymentForm($form, $processor, $isBillingDataOptional){
+ public static function buildPaymentForm($form, $processor, $isBillingDataOptional){
//if the form has address fields assign to the template so the js can decide what billing fields to show
$profileAddressFields = $form->get('profileAddressFields');
if (!empty($profileAddressFields)) {
* The credit card pseudo constant results only the CC label, not the key ID
* So we normalize the name to use it as a CSS class.
*/
- static function getCreditCardCSSNames() {
+ public static function getCreditCardCSSNames() {
$creditCardTypes = array();
foreach (CRM_Contribute_PseudoConstant::creditCard() as $key => $name) {
// Replace anything not css-friendly by an underscore
* Make sure that credit card number and cvv are valid
* Called within the scope of a QF formRule function
*/
- static function validateCreditCard($values, &$errors) {
+ public static function validateCreditCard($values, &$errors) {
if (!empty($values['credit_card_type'])) {
if (!empty($values['credit_card_number']) &&
!CRM_Utils_Rule::creditCardNumber($values['credit_card_number'], $values['credit_card_type'])
* @return void
* @static
*/
- static function mapParams($id, &$src, &$dst, $reverse = FALSE) {
+ public static function mapParams($id, &$src, &$dst, $reverse = FALSE) {
static $map = NULL;
if (!$map) {
$map = array(
* @return int
* @static
*/
- static function getCreditCardExpirationMonth($src) {
+ public static function getCreditCardExpirationMonth($src) {
if ($month = CRM_Utils_Array::value('M', $src['credit_card_exp_date'])) {
return $month;
}
* @return int
* @static
*/
- static function getCreditCardExpirationYear($src) {
+ public static function getCreditCardExpirationYear($src) {
return CRM_Utils_Array::value('Y', $src['credit_card_exp_date']);
}
}
*
* @return \CRM_Core_Payment_Google
*/
- function __construct($mode, &$paymentProcessor) {
+ public function __construct($mode, &$paymentProcessor) {
$this->_mode = $mode;
$this->_paymentProcessor = $paymentProcessor;
$this->_processorName = ts('Google Checkout');
* @return object
* @static
*/
- static function &singleton($mode, &$paymentProcessor) {
+ public static function &singleton($mode, &$paymentProcessor) {
$processorName = $paymentProcessor['name'];
if (!isset(self::$_singleton[$processorName]) || self::$_singleton[$processorName] === NULL) {
self::$_singleton[$processorName] = new CRM_Core_Payment_Google($mode, $paymentProcessor);
* @return string the error message if any
* @public
*/
- function checkConfig() {
+ public function checkConfig() {
$config = CRM_Core_Config::singleton();
$error = array();
* @return array the result in an nice formatted array (or an error object)
* @abstract
*/
- function doDirectPayment(&$params) {
+ public function doDirectPayment(&$params) {
CRM_Core_Error::fatal(ts('This function is not implemented'));
}
* @return void
* @access public
*/
- function doTransferCheckout(&$params, $component) {
+ public function doTransferCheckout(&$params, $component) {
$component = strtolower($component);
if (!empty($params['is_recur']) &&
* @param array $params
* @param $component
*/
- function doRecurCheckout(&$params, $component) {
+ public function doRecurCheckout(&$params, $component) {
$intervalUnit = CRM_Utils_Array::value('frequency_unit', $params);
if ($intervalUnit == 'week') {
$intervalUnit = 'WEEKLY';
* @access public
*
*/
- function submitPostParams($params, $component, $cart) {
+ public function submitPostParams($params, $component, $cart) {
$url = rtrim($this->_paymentProcessor['url_site'], '/') . '/cws/v2/Merchant/' . $this->_paymentProcessor['user_name'] . '/checkout';
if ($component == "event") {
* @searchParamsnvpStr is the array of search params.
* returns an associtive array containing the response from the server.
*/
- function invokeAPI($paymentProcessor, $searchParams) {
+ public function invokeAPI($paymentProcessor, $searchParams) {
$merchantID = $paymentProcessor['user_name'];
$merchantKey = $paymentProcessor['password'];
$siteURL = rtrim(str_replace('https://', '', $paymentProcessor['url_site']), '/');
*
* @return string
*/
- static function buildXMLQuery($searchParams) {
+ public static function buildXMLQuery($searchParams) {
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<notification-history-request xmlns="http://checkout.google.com/schema/2">';
*
* @return array
*/
- static function getArrayFromXML($xmlData) {
+ public static function getArrayFromXML($xmlData) {
require_once 'Google/library/xml-processing/gc_xmlparser.php';
$xmlParser = new gc_XmlParser($xmlData);
$root = $xmlParser->GetRoot();
*
* @return object
*/
- function &error($errorCode = NULL, $errorMessage = NULL) {
+ public function &error($errorCode = NULL, $errorMessage = NULL) {
$e = &CRM_Core_Error::singleton();
if ($errorCode) {
$e->push($errorCode, 0, NULL, $errorMessage);
/**
* @return string
*/
- function accountLoginURL() {
+ public function accountLoginURL() {
return ($this->_mode == 'test') ? 'https://sandbox.google.com/checkout/sell' : 'https://checkout.google.com/';
}
*
* @return bool|object
*/
- function cancelSubscription(&$message = '', $params = array()) {
+ public function cancelSubscription(&$message = '', $params = array()) {
$orderNo = CRM_Utils_Array::value('subscriptionId', $params);
$merchant_id = $this->_paymentProcessor['user_name'];
*
* @return mixed
*/
- static function retrieve($name, $type, $object, $abort = TRUE) {
+ public static function retrieve($name, $type, $object, $abort = TRUE) {
$value = CRM_Utils_Array::value($name, $object);
if ($abort && $value === NULL) {
CRM_Core_Error::debug_log_message("Could not find an entry for $name");
*
* @return \CRM_Core_Payment_GoogleIPN
*/
- function __construct($mode, &$paymentProcessor) {
+ public function __construct($mode, &$paymentProcessor) {
parent::__construct();
$this->_mode = $mode;
*
* @return void
*/
- function newOrderNotify($dataRoot, $privateData, $component) {
+ public function newOrderNotify($dataRoot, $privateData, $component) {
$ids = $input = $params = array();
$input['component'] = strtolower($component);
*
* @return void
*/
- function orderStateChange($status, $dataRoot, $privateData, $component) {
+ public function orderStateChange($status, $dataRoot, $privateData, $component) {
$input = $objects = $ids = array();
$input['component'] = strtolower($component);
* @param $ids
* @param $objects
*/
- function completeRecur($input, $ids, $objects) {
+ public function completeRecur($input, $ids, $objects) {
if ($ids['contributionRecur']) {
$recur = &$objects['contributionRecur'];
$contributionCount = CRM_Core_DAO::singleValueQuery("
* @return object
* @static
*/
- static function &singleton($mode, $component, &$paymentProcessor) {
+ public static function &singleton($mode, $component, &$paymentProcessor) {
if (self::$_singleton === NULL) {
self::$_singleton = new CRM_Core_Payment_GoogleIPN($mode, $paymentProcessor);
}
* @return amount
* @access public
*/
- function getAmount($orderNo) {
+ public function getAmount($orderNo) {
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->invoice_id = $orderNo;
if (!$contribution->find(TRUE)) {
* @return array context of this call (test, module, payment processor id)
* @static
*/
- function getContext($privateData, $orderNo, $root, $response, $serial) {
+ public function getContext($privateData, $orderNo, $root, $response, $serial) {
$contributionID = CRM_Utils_Array::value('contributionID', $privateData);
$contribution = new CRM_Contribute_DAO_Contribution();
if ($root == 'new-order-notification') {
* a notification or request is sent by the Google Server.
*
*/
- static function main($xml_response) {
+ public static function main($xml_response) {
require_once 'Google/library/googleresponse.php';
require_once 'Google/library/googlerequest.php';
require_once 'Google/library/googlemerchantcalculations.php';
*
* @return bool
*/
- function getInput(&$input, &$ids, $dataRoot) {
+ public function getInput(&$input, &$ids, $dataRoot) {
if (!$this->getBillingID($ids)) {
return FALSE;
}
* Converts the comma separated name-value pairs in <merchant-private-data>
* to an array of name-value pairs.
*/
- static function stringToArray($str) {
+ public static function stringToArray($str) {
$vars = $labels = array();
$labels = explode(',', $str);
foreach ($labels as $label) {
*
* @return \CRM_Core_Payment_IATS
*/
- function __construct($mode, &$paymentProcessor) {
+ public function __construct($mode, &$paymentProcessor) {
$this->_paymentProcessor = $paymentProcessor;
$this->_processorName = ts('IATS');
*
* @return mixed
*/
- static function &singleton($mode, &$paymentProcessor) {
+ public static function &singleton($mode, &$paymentProcessor) {
$processorName = $paymentProcessor['name'];
if (self::$_singleton[$processorName] === NULL) {
self::$_singleton[$processorName] = new CRM_Core_Payment_IATS($mode, $paymentProcessor);
* @return array the result in an nice formatted array (or an error object)
* @abstract
*/
- function doDirectPayment(&$params) {
+ public function doDirectPayment(&$params) {
// $result = '';
// foreach($params as $key => $value) {
// $result .= "<strong>$key</strong>: $value<br />";
*
* @return object
*/
- function &error($error = NULL) {
+ public function &error($error = NULL) {
$e = CRM_Core_Error::singleton();
if (is_object($error)) {
$e->push($error->getResponseCode(),
*
* @return string
*/
- function errorString($error_id) {
+ public function errorString($error_id) {
$errors = array(
1 => 'Agent Code has not been set up on the authorization system.',
2 => 'Unable to process transaction. Verify and re-enter credit card information.',
* @return string the error message if any
* @public
*/
- function checkConfig() {
+ public function checkConfig() {
$error = array();
if (empty($this->_paymentProcessor['signature'])) {
*
* @return \CRM_Core_Payment_Moneris
*/
- function __construct($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
+ public function __construct($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
$this->_mode = $mode;
$this->_paymentProcessor = $paymentProcessor;
$this->_processorName = ts('Moneris');
* @return object
* @static
*/
- static function &singleton($mode, &$paymentProcessor) {
+ public static function &singleton($mode, &$paymentProcessor) {
$processorName = $paymentProcessor['name'];
if (self::$_singleton[$processorName] === NULL) {
self::$_singleton[$processorName] = new CRM_Core_Payment_Moneris($mode, $paymentProcessor);
* @return array the result in an nice formatted array (or an error object)
* @abstract
*/
- function doDirectPayment(&$params) {
+ public function doDirectPayment(&$params) {
//make sure i've been called correctly ...
if (!$this->_profile) {
return self::error('Unexpected error, missing profile');
*
* @return bool
*/
- function isError(&$response) {
+ public function isError(&$response) {
$responseCode = $response->getResponseCode();
if (is_null($responseCode)) {
return TRUE;
*
* @return object
*/
- function &checkResult(&$response) {
+ public function &checkResult(&$response) {
return $response;
$errors = $response->getErrors();
*
* @return object
*/
- function &error($error = NULL) {
+ public function &error($error = NULL) {
$e = CRM_Core_Error::singleton();
if (is_object($error)) {
$e->push($error->getResponseCode(),
* @return string the error message if any
* @public
*/
- function checkConfig() {
+ public function checkConfig() {
$error = array();
if (empty($this->_paymentProcessor['signature'])) {
*
* @return \CRM_Core_Payment_PayJunction
*/
- function __construct($mode, &$paymentProcessor) {
+ public function __construct($mode, &$paymentProcessor) {
//require PayJunction API library
require_once 'PayJunction/pjClasses.php';
* @return object
* @static
*/
- static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = false) {
+ public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = false) {
$processorName = $paymentProcessor['name'];
if (self::$_singleton[$processorName] === NULL) {
self::$_singleton[$processorName] = new CRM_Core_Payment_PayJunction($mode, $paymentProcessor);
* @return array the result in an nice formatted array (or an error object)
* @abstract
*/
- function doDirectPayment(&$params) {
+ public function doDirectPayment(&$params) {
$logon = $this->_paymentProcessor['user_name'];
$password = $this->_paymentProcessor['password'];
$url_site = $this->_paymentProcessor['url_site'];
*
* @return bool
*/
- function isError(&$response) {
+ public function isError(&$response) {
$responseCode = $response['dc_response_code'];
if ($responseCode == "00" || $responseCode == "85") {
*
* @return mixed
*/
- function &checkResult(&$response) {
+ public function &checkResult(&$response) {
return $response;
}
* @return mixed value of the field, or empty string if the field is
* not set
*/
- function _getParam($field) {
+ public function _getParam($field) {
if (isset($this->_params[$field])) {
return $this->_params[$field];
}
*
* @return object
*/
- function &error($error = NULL) {
+ public function &error($error = NULL) {
$e = CRM_Core_Error::singleton();
if ($error) {
$e->push($error['dc_response_code'],
*
* @return bool false if value is not a scalar, true if successful
*/
- function _setParam($field, $value) {
+ public function _setParam($field, $value) {
if (!is_scalar($value)) {
return FALSE;
}
* @return string the error message if any
* @public
*/
- function checkConfig() {
+ public function checkConfig() {
$error = array();
if (empty($this->_paymentProcessor['user_name'])) {
$error[] = ts('Username is not set for this payment processor');
/**
* Constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
*
* @return mixed
*/
- static function retrieve($name, $type, $location = 'POST', $abort = TRUE) {
+ public static function retrieve($name, $type, $location = 'POST', $abort = TRUE) {
static $store = NULL;
$value = CRM_Utils_Request::retrieve($name, $type, $store,
FALSE, NULL, $location
* @param $objects
* @param $first
*/
- function recur(&$input, &$ids, &$objects, $first) {
+ public function recur(&$input, &$ids, &$objects, $first) {
if (!isset($input['txnType'])) {
CRM_Core_Error::debug_log_message("Could not find txn_type in input request");
echo "Failure: Invalid parameters<p>";
$this->completeTransaction($input, $ids, $objects, $transaction, $recur);
}
- function main() {
+ public function main() {
//@todo - this could be refactored like PayPalProIPN & a test could be added
$objects = $ids = $input = array();
* @param $input
* @param $ids
*/
- function getInput(&$input, &$ids) {
+ public function getInput(&$input, &$ids) {
if (!$this->getBillingID($ids)) {
return FALSE;
}
*
* @return \CRM_Core_Payment_PayPalImpl
*/
- function __construct($mode, &$paymentProcessor) {
+ public function __construct($mode, &$paymentProcessor) {
$this->_mode = $mode;
$this->_paymentProcessor = $paymentProcessor;
$this->_processorName = ts('PayPal Pro');
* @return object
* @static
*/
- static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
+ public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
$processorName = $paymentProcessor['name'];
if (!isset(self::$_singleton[$processorName]) || self::$_singleton[$processorName] === NULL) {
self::$_singleton[$processorName] = new CRM_Core_Payment_PaypalImpl($mode, $paymentProcessor);
* @return array the result in an nice formatted array (or an error object)
* @public
*/
- function setExpressCheckOut(&$params) {
+ public function setExpressCheckOut(&$params) {
$args = array();
$this->initialize($args, 'SetExpressCheckout');
* @return array the result in an nice formatted array (or an error object)
* @public
*/
- function getExpressCheckoutDetails($token) {
+ public function getExpressCheckoutDetails($token) {
$args = array();
$this->initialize($args, 'GetExpressCheckoutDetails');
* @return array the result in an nice formatted array (or an error object)
* @public
*/
- function doExpressCheckout(&$params) {
+ public function doExpressCheckout(&$params) {
$args = array();
$this->initialize($args, 'DoExpressCheckoutPayment');
*
* @return mixed
*/
- function createRecurringPayments(&$params) {
+ public function createRecurringPayments(&$params) {
$args = array();
$this->initialize($args, 'CreateRecurringPaymentsProfile');
* @param $args
* @param $method
*/
- function initialize(&$args, $method) {
+ public function initialize(&$args, $method) {
$args['user'] = $this->_paymentProcessor['user_name'];
$args['pwd'] = $this->_paymentProcessor['password'];
$args['version'] = 3.0;
* @return array the result in an nice formatted array (or an error object)
* @public
*/
- function doDirectPayment(&$params, $component = 'contribute') {
+ public function doDirectPayment(&$params, $component = 'contribute') {
$args = array();
$this->initialize($args, 'DoDirectPayment');
* @return string the error message if any
* @public
*/
- function checkConfig() {
+ public function checkConfig() {
$error = array();
$paymentProcessorType = CRM_Core_PseudoConstant::paymentProcessorType(false, null, 'name');
if (
/**
* @return null|string
*/
- function cancelSubscriptionURL() {
+ public function cancelSubscriptionURL() {
if ($this->_paymentProcessor['payment_processor_type'] == 'PayPal_Standard') {
return "{$this->_paymentProcessor['url_site']}cgi-bin/webscr?cmd=_subscr-find&alias=" . urlencode($this->_paymentProcessor['user_name']);
}
* @return boolean
* @public
*/
- function isSupported($method = 'cancelSubscription') {
+ public function isSupported($method = 'cancelSubscription') {
if ($this->_paymentProcessor['payment_processor_type'] != 'PayPal') {
// since subscription methods like cancelSubscription or updateBilling is not yet implemented / supported
// by standard or express.
*
* @return array|bool|object
*/
- function cancelSubscription(&$message = '', $params = array()) {
+ public function cancelSubscription(&$message = '', $params = array()) {
if ($this->_paymentProcessor['payment_processor_type'] == 'PayPal') {
$args = array();
$this->initialize($args, 'ManageRecurringPaymentsProfileStatus');
*
* @return array|bool|object
*/
- function updateSubscriptionBillingInfo(&$message = '', $params = array()) {
+ public function updateSubscriptionBillingInfo(&$message = '', $params = array()) {
if ($this->_paymentProcessor['payment_processor_type'] == 'PayPal') {
$config = CRM_Core_Config::singleton();
$args = array();
*
* @return array|bool|object
*/
- function changeSubscriptionAmount(&$message = '', $params = array()) {
+ public function changeSubscriptionAmount(&$message = '', $params = array()) {
if ($this->_paymentProcessor['payment_processor_type'] == 'PayPal') {
$config = CRM_Core_Config::singleton();
$args = array();
*
* @throws Exception
*/
- function doTransferCheckout(&$params, $component = 'contribute') {
+ public function doTransferCheckout(&$params, $component = 'contribute') {
$config = CRM_Core_Config::singleton();
if ($component != 'contribute' && $component != 'event') {
* @nvpStr is nvp string.
* returns an associtive array containing the response from the server.
*/
- function invokeAPI($args, $url = NULL) {
+ public function invokeAPI($args, $url = NULL) {
if ($url === NULL) {
if (empty($this->_paymentProcessor['url_api'])) {
* @nvpstr is NVPString.
* @nvpArray is Associative Array.
*/
- static function deformat($str) {
+ public static function deformat($str) {
$result = array();
while (strlen($str)) {
*
* @throws CRM_Core_Exception
*/
- function __construct($inputData) {
+ public function __construct($inputData) {
$this->setInputParameters($inputData);
$this->setInvoiceData();
parent::__construct();
* @throws CRM_Core_Exception
* @return unknown
*/
- function getValue($name, $abort = TRUE) {
+ public function getValue($name, $abort = TRUE) {
if ($abort && empty($this->_invoiceData[$name])) {
throw new CRM_Core_Exception("Failure: Missing Parameter $name");
}
/**
* Set $this->_invoiceData from the input array
*/
- function setInvoiceData() {
+ public function setInvoiceData() {
if(empty($this->_inputParameters['rp_invoice_id'])) {
$this->_isPaymentExpress = TRUE;
return;
* @throws CRM_Core_Exception
* @return Ambigous <mixed, NULL, value, unknown, array, number>
*/
- function retrieve($name, $type, $location = 'POST', $abort = TRUE) {
+ public function retrieve($name, $type, $location = 'POST', $abort = TRUE) {
$value = CRM_Utils_Type::validate(
CRM_Utils_Array::value($name, $this->_inputParameters),
$type,
* @param boolean $first
* @return void|boolean
*/
- function recur(&$input, &$ids, &$objects, $first) {
+ public function recur(&$input, &$ids, &$objects, $first) {
if (!isset($input['txnType'])) {
CRM_Core_Error::debug_log_message("Could not find txn_type in input request");
echo "Failure: Invalid parameters<p>";
* @param bool $recur
* @param bool $first
*/
- function single(&$input, &$ids, &$objects, $recur = FALSE, $first = FALSE) {
+ public function single(&$input, &$ids, &$objects, $recur = FALSE, $first = FALSE) {
$contribution = &$objects['contribution'];
// make sure the invoice is valid and matches what we have in the contribution record
* @todo the references to POST throughout this class need to be removed
* @return void|boolean|Ambigous <void, boolean>
*/
- function main() {
+ public function main() {
CRM_Core_Error::debug_var('GET', $_GET, TRUE, TRUE);
CRM_Core_Error::debug_var('POST', $_POST, TRUE, TRUE);
if($this->_isPaymentExpress) {
*
* @throws CRM_Core_Exception
*/
- function getInput(&$input, &$ids) {
+ public function getInput(&$input, &$ids) {
if (!$this->getBillingID($ids)) {
return FALSE;
* but let's assume knowledge on invoice id & schedule is enough for now esp for donations
* only contribute is handled
*/
- function handlePaymentExpress() {
+ public function handlePaymentExpress() {
//@todo - loads of copy & paste / code duplication but as this not going into core need to try to
// keep discreet
// also note that a lot of the complexity above could be removed if we used
* Function check if transaction already exists
* @param string $trxn_id
*/
- function transactionExists($trxn_id) {
+ public function transactionExists($trxn_id) {
if(CRM_Core_DAO::singleValueQuery("SELECT count(*) FROM civicrm_contribution WHERE trxn_id = %1",
array(
1 => array($trxn_id, 'String')
* @param $mode
* @param $paymentProcessor
*/
- function __construct($mode, &$paymentProcessor) {
+ public function __construct($mode, &$paymentProcessor) {
// live or test
$this->_mode = $mode;
$this->_paymentProcessor = $paymentProcessor;
* @return object
* @static
*/
- static function &singleton($mode, &$paymentProcessor) {
+ public static function &singleton($mode, &$paymentProcessor) {
$processorName = $paymentProcessor['name'];
if (self::$_singleton[$processorName] === NULL) {
self::$_singleton[$processorName] = new CRM_Core_Payment_PayflowPro($mode, $paymentProcessor);
* @return array the result in an nice formatted array (or an error object)
* @abstract
*/
- function doDirectPayment(&$params) {
+ public function doDirectPayment(&$params) {
if (!defined('CURLOPT_SSLCERT')) {
CRM_Core_Error::fatal(ts('PayFlowPro requires curl with SSL support'));
}
*
* @return bool True if ID exists, else false
*/
- function _checkDupe($invoiceId) {
+ public function _checkDupe($invoiceId) {
//copied from Eway but not working and not really sure it should!
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->invoice_id = $invoiceId;
*
* @return object
*/
- function &errorExit($errorCode = NULL, $errorMessage = NULL) {
+ public function &errorExit($errorCode = NULL, $errorMessage = NULL) {
$e = CRM_Core_Error::singleton();
if ($errorCode) {
$e->push($errorCode, 0, NULL, $errorMessage);
*
* @throws Exception
*/
- function doTransferCheckout(&$params, $component) {
+ public function doTransferCheckout(&$params, $component) {
CRM_Core_Error::fatal(ts('This function is not implemented'));
}
* @return string the error message if any
* @public
*/
- function checkConfig() {
+ public function checkConfig() {
$errorMsg = array();
if (empty($this->_paymentProcessor['user_name'])) {
$errorMsg[] = ' ' . ts('ssl_merchant_id is not set for this payment processor');
*
* @return array|string
*/
- function convert_to_nvp($payflow_query_array) {
+ public function convert_to_nvp($payflow_query_array) {
foreach ($payflow_query_array as $key => $value) {
$payflow_query[] = $key . '[' . strlen($value) . ']=' . $value;
}
*
* @return mixed|object
*/
- function submit_transaction($submiturl, $payflow_query) {
+ public function submit_transaction($submiturl, $payflow_query) {
/*
* Submit transaction using CuRL
*/
*
* @throws Exception
*/
- function getRecurringTransactionStatus($recurringProfileID, $processorID) {
+ public function getRecurringTransactionStatus($recurringProfileID, $processorID) {
if (!defined('CURLOPT_SSLCERT')) {
CRM_Core_Error::fatal(ts('PayFlowPro requires curl with SSL support'));
}
*
* @return \CRM_Core_Payment_PaymentExpress
*/
- function __construct($mode, &$paymentProcessor) {
+ public function __construct($mode, &$paymentProcessor) {
$this->_mode = $mode;
$this->_paymentProcessor = $paymentProcessor;
* @return object
* @static
*/
- static function &singleton($mode = 'test', &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
+ public static function &singleton($mode = 'test', &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
$processorName = $paymentProcessor['name'];
if (self::$_singleton[$processorName] === NULL) {
self::$_singleton[$processorName] = new CRM_Core_Payment_PaymentExpress($mode, $paymentProcessor);
* @return string the error message if any
* @public
*/
- function checkConfig() {
+ public function checkConfig() {
$config = CRM_Core_Config::singleton();
$error = array();
*
* @throws Exception
*/
- function setExpressCheckOut(&$params) {
+ public function setExpressCheckOut(&$params) {
CRM_Core_Error::fatal(ts('This function is not implemented'));
}
*
* @throws Exception
*/
- function getExpressCheckoutDetails($token) {
+ public function getExpressCheckoutDetails($token) {
CRM_Core_Error::fatal(ts('This function is not implemented'));
}
*
* @throws Exception
*/
- function doExpressCheckout(&$params) {
+ public function doExpressCheckout(&$params) {
CRM_Core_Error::fatal(ts('This function is not implemented'));
}
* @return array the result in an nice formatted array (or an error object)
* @abstract
*/
- function doDirectPayment(&$params) {
+ public function doDirectPayment(&$params) {
CRM_Core_Error::fatal(ts('This function is not implemented'));
}
* @return void
* @access public
*/
- function doTransferCheckout(&$params, $component) {
+ public function doTransferCheckout(&$params, $component) {
$component = strtolower($component);
$config = CRM_Core_Config::singleton();
if ($component != 'contribute' && $component != 'event') {
*
* @return mixed
*/
- static function retrieve($name, $type, $object, $abort = TRUE) {
+ public static function retrieve($name, $type, $object, $abort = TRUE) {
$value = CRM_Utils_Array::value($name, $object);
if ($abort && $value === NULL) {
CRM_Core_Error::debug_log_message("Could not find an entry for $name");
*
* @return \CRM_Core_Payment_PaymentExpressIPN
*/
- function __construct($mode, &$paymentProcessor) {
+ public function __construct($mode, &$paymentProcessor) {
parent::__construct();
$this->_mode = $mode;
* @return object
* @static
*/
- static function &singleton($mode = 'test', &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
+ public static function &singleton($mode = 'test', &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
if (self::$_singleton === NULL) {
self::$_singleton = new CRM_Core_Payment_PaymentExpressIPN($mode, $paymentProcessor);
}
* @internal param \xml $dataRoot response send by google in xml format
* @return void
*/
- function newOrderNotify($success, $privateData, $component, $amount, $transactionReference) {
+ public function newOrderNotify($success, $privateData, $component, $amount, $transactionReference) {
$ids = $input = $params = array();
$input['component'] = strtolower($component);
* @return array context of this call (test, component, payment processor id)
* @static
*/
- static function getContext($privateData, $orderNo) {
+ public static function getContext($privateData, $orderNo) {
$component = NULL;
$isTest = NULL;
* mac_key is only passed if the processor is pxaccess as it is used for decryption
* $dps_method is either pxaccess or pxpay
*/
- static function main($dps_method, $rawPostData, $dps_url, $dps_user, $dps_key, $mac_key) {
+ public static function main($dps_method, $rawPostData, $dps_url, $dps_user, $dps_key, $mac_key) {
$config = CRM_Core_Config::singleton();
define('RESPONSE_HANDLER_LOG_FILE', $config->uploadDir . 'CiviCRM.PaymentExpress.log');
* Converts the comma separated name-value pairs in <TxnData2>
* to an array of values.
*/
- static function stringToArray($str) {
+ public static function stringToArray($str) {
$vars = $labels = array();
$labels = explode(',', $str);
foreach ($labels as $label) {
*
* @return string
*/
- static function _valueXml($element, $value = NULL) {
+ public static function _valueXml($element, $value = NULL) {
$nl = "\n";
if (is_array($element)) {
*
* @return mixed
*/
- static function _xmlElement($xml, $name) {
+ public static function _xmlElement($xml, $name) {
$value = preg_replace('/.*<' . $name . '[^>]*>(.*)<\/' . $name . '>.*/', '\1', $xml);
return $value;
}
*
* @return mixed|null
*/
- static function _xmlAttribute($xml, $name) {
+ public static function _xmlAttribute($xml, $name) {
$value = preg_replace('/<.*' . $name . '="([^"]*)".*>/', '\1', $xml);
return $value != $xml ? $value : NULL;
}
*
* @return resource
*/
- static function &_initCURL($query, $url) {
+ public static function &_initCURL($query, $url) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
*
* @throws Exception
*/
- static function preProcess(&$form, $type = NULL, $mode = NULL ) {
+ public static function preProcess(&$form, $type = NULL, $mode = NULL ) {
if ($type) {
$form->_type = $type;
}
/**
* @param $form
*/
- static function buildQuickform(&$form) {
+ public static function buildQuickform(&$form) {
//@todo document why this addHidden is here
//CRM-15743 - we should not set/create hidden element for pay later
// because payment processor is not selected
*
* @return \CRM_Core_Payment_Realex
*/
- function __construct($mode, &$paymentProcessor) {
+ public function __construct($mode, &$paymentProcessor) {
$this->_mode = $mode;
$this->_paymentProcessor = $paymentProcessor;
$this->_processorName = ts('Realex');
* @return object
* @static
*/
- static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = false) {
+ public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = false) {
$processorName = $paymentProcessor['name'];
if (self::$_singleton[$processorName] === NULL) {
self::$_singleton[$processorName] = new CRM_Core_Payment_Realex($mode, $paymentProcessor);
*
* @throws Exception
*/
- function setExpressCheckOut(&$params) {
+ public function setExpressCheckOut(&$params) {
CRM_Core_Error::fatal(ts('This function is not implemented'));
}
*
* @throws Exception
*/
- function getExpressCheckoutDetails($token) {
+ public function getExpressCheckoutDetails($token) {
CRM_Core_Error::fatal(ts('This function is not implemented'));
}
*
* @throws Exception
*/
- function doExpressCheckout(&$params) {
+ public function doExpressCheckout(&$params) {
CRM_Core_Error::fatal(ts('This function is not implemented'));
}
*
* @throws Exception
*/
- function doTransferCheckout(&$params) {
+ public function doTransferCheckout(&$params) {
CRM_Core_Error::fatal(ts('This function is not implemented'));
}
* @return array the result in a nice formatted array (or an error object)
* @public
*/
- function doDirectPayment(&$params) {
+ public function doDirectPayment(&$params) {
if (!defined('CURLOPT_SSLCERT')) {
return self::error(9001, ts('RealAuth requires curl with SSL support'));
*
* @return array An array of the result with following keys:
*/
- function xml_parse_into_assoc($xml) {
+ public function xml_parse_into_assoc($xml) {
$input = array();
$result = array();
*
* @return array
*/
- function _xml_parse($input, $depth = 1) {
+ public function _xml_parse($input, $depth = 1) {
$output = array();
$children = array();
/**
* Format the params from the form ready for sending to Realex. Also perform some validation
*/
- function setRealexFields(&$params) {
+ public function setRealexFields(&$params) {
if ((int)$params['amount'] <= 0) {
return self::error(9001, ts('Amount must be positive'));
}
*
* @return bool True if ID exists, else false
*/
- function _checkDupe($invoiceId) {
+ public function _checkDupe($invoiceId) {
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->invoice_id = $invoiceId;
return $contribution->find();
* @return mixed value of the field, or empty string if the field is
* not set
*/
- function _getParam($field) {
+ public function _getParam($field) {
if (isset($this->_params[$field])) {
return $this->_params[$field];
}
*
* @return bool false if value is not a scalar, true if successful
*/
- function _setParam($field, $value) {
+ public function _setParam($field, $value) {
if (!is_scalar($value)) {
return FALSE;
}
*
* @return object
*/
- function &error($errorCode = NULL, $errorMessage = NULL) {
+ public function &error($errorCode = NULL, $errorMessage = NULL) {
$e = CRM_Core_Error::singleton();
if ($errorCode) {
* @return string the error message if any
* @public
*/
- function checkConfig() {
+ public function checkConfig() {
$error = array();
if (empty($this->_paymentProcessor['user_name'])) {
$error[] = ts('Merchant ID is not set for this payment processor');
*
* @return \CRM_Core_Payment_eWAY *******************************************************
*/
- function __construct($mode, &$paymentProcessor) {
+ public function __construct($mode, &$paymentProcessor) {
// require Standaard eWAY API libraries
require_once 'eWAY/eWAY_GatewayRequest.php';
require_once 'eWAY/eWAY_GatewayResponse.php';
* @return object
* @static
*/
- static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = false) {
+ public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = false) {
$processorName = $paymentProcessor['name'];
if (self::$_singleton[$processorName] === NULL) {
self::$_singleton[$processorName] = new CRM_Core_Payment_eWAY($mode, $paymentProcessor);
* This function sends request and receives response from
* eWAY payment process
**********************************************************/
- function doDirectPayment(&$params) {
+ public function doDirectPayment(&$params) {
if (CRM_Utils_Array::value('is_recur', $params) == TRUE) {
CRM_Core_Error::fatal(ts('eWAY - recurring payments not implemented'));
}
*
* @return bool True if ID exists, else false
*/
- function _checkDupe($invoiceId) {
+ public function _checkDupe($invoiceId) {
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->invoice_id = $invoiceId;
return $contribution->find();
/*************************************************************************************************
* This function checks the eWAY response status - returning a boolean false if status != 'true'
*************************************************************************************************/
- function isError(&$response) {
+ public function isError(&$response) {
$status = $response->Status();
if ((stripos($status, "true")) === FALSE) {
/**************************************************
* Produces error message and returns from class
**************************************************/
- function &errorExit($errorCode = NULL, $errorMessage = NULL) {
+ public function &errorExit($errorCode = NULL, $errorMessage = NULL) {
$e = CRM_Core_Error::singleton();
if ($errorCode) {
/**************************************************
* NOTE: 'doTransferCheckout' not implemented
**************************************************/
- function doTransferCheckout(&$params, $component) {
+ public function doTransferCheckout(&$params, $component) {
CRM_Core_Error::fatal(ts('This function is not implemented'));
}
*/
//function checkConfig( $mode ) // CiviCRM V1.9 Declaration
// CiviCRM V2.0 Declaration
- function checkConfig() {
+ public function checkConfig() {
$errorMsg = array();
if (empty($this->_paymentProcessor['user_name'])) {
* @param $p_request
* @param $p_response
*/
- function send_alert_email($p_eWAY_tran_num, $p_trxn_out, $p_trxn_back, $p_request, $p_response) {
+ public function send_alert_email($p_eWAY_tran_num, $p_trxn_out, $p_trxn_back, $p_request, $p_response) {
// Initialization call is required to use CiviCRM APIs.
civicrm_initialize(TRUE);
* @static
* @access public
*/
- static function check($permissions) {
+ public static function check($permissions) {
$permissions = (array) $permissions;
foreach ($permissions as $permission) {
* @static
* @access public
*/
- static function checkGroupRole($array) {
+ public static function checkGroupRole($array) {
$config = CRM_Core_Config::singleton();
return $config->userPermissionClass->checkGroupRole($array);
}
*
* @return string
*/
- static function customGroupClause($type = CRM_Core_Permission::VIEW, $prefix = NULL, $reset = FALSE) {
+ public static function customGroupClause($type = CRM_Core_Permission::VIEW, $prefix = NULL, $reset = FALSE) {
if (self::customGroupAdmin()) {
return ' ( 1 ) ';
}
*
* @return array|string
*/
- static function ufGroupClause($type = CRM_Core_Permission::VIEW, $prefix = NULL, $returnUFGroupIds = FALSE) {
+ public static function ufGroupClause($type = CRM_Core_Permission::VIEW, $prefix = NULL, $returnUFGroupIds = FALSE) {
$groups = self::ufGroup($type);
if ($returnUFGroupIds) {
return $groups;
*
* @return string
*/
- static function eventClause($type = CRM_Core_Permission::VIEW, $prefix = NULL) {
+ public static function eventClause($type = CRM_Core_Permission::VIEW, $prefix = NULL) {
$events = self::event($type);
if (empty($events)) {
return ' ( 0 ) ';
*
* @return bool
*/
- static function access($module, $checkPermission = TRUE) {
+ public static function access($module, $checkPermission = TRUE) {
$config = CRM_Core_Config::singleton();
if (!in_array($module, $config->enableComponents)) {
*
* @return bool
*/
- static function checkActionPermission($module, $action) {
+ public static function checkActionPermission($module, $action) {
//check delete related permissions.
if ($action & CRM_Core_Action::DELETE) {
$permissionName = "delete in $module";
*
* @return bool
*/
- static function checkMenu(&$args, $op = 'and') {
+ public static function checkMenu(&$args, $op = 'and') {
if (!is_array($args)) {
return $args;
}
* @return bool|mixed
* @throws Exception
*/
- static function checkMenuItem(&$item) {
+ public static function checkMenuItem(&$item) {
if (!array_key_exists('access_callback', $item)) {
CRM_Core_Error::backtrace();
CRM_Core_Error::fatal();
*
* @return array
*/
- static function &basicPermissions($all = FALSE) {
+ public static function &basicPermissions($all = FALSE) {
static $permissions = NULL;
if (!$permissions) {
/**
* @return array
*/
- static function getAnonymousPermissionsWarnings() {
+ public static function getAnonymousPermissionsWarnings() {
static $permissions = array();
if (empty($permissions)) {
$permissions = array(
*
* @return array
*/
- static function validateForPermissionWarnings($anonymous_perms) {
+ public static function validateForPermissionWarnings($anonymous_perms) {
return array_intersect($anonymous_perms, self::getAnonymousPermissionsWarnings());
}
/**
* @return array
*/
- static function getCorePermissions() {
+ public static function getCorePermissions() {
$prefix = ts('CiviCRM') . ': ';
$permissions = array(
'add contacts' => $prefix . ts('add contacts'),
*
* return boolean true/false.
**/
- static function giveMeAllACLs() {
+ public static function giveMeAllACLs() {
if (CRM_Core_Permission::check('view all contacts') ||
CRM_Core_Permission::check('edit all contacts')
) {
* @return int|null|string
* @static
*/
- static function getComponentName($permission) {
+ public static function getComponentName($permission) {
$componentName = NULL;
$permission = trim($permission);
if (empty($permission)) {
/**
* @return bool
*/
- static function isMultisiteEnabled() {
+ public static function isMultisiteEnabled() {
return CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME,
'is_enabled'
) ? TRUE : FALSE;
* @access public
*/
- function check($str) {
+ public function check($str) {
//no default behaviour
}
* @access public
*/
- function checkGroupRole($array) {
+ public function checkGroupRole($array) {
return FALSE;
}
* @throws CRM_Core_Exception
* @see CRM_Core_Permission::getCorePermissions
*/
- function upgradePermissions($permissions) {
+ public function upgradePermissions($permissions) {
throw new CRM_Core_Exception("Unimplemented method: CRM_Core_Permission_*::upgradePermissions");
}
* @return Array of permissions, in the same format as CRM_Core_Permission::getCorePermissions().
* @see CRM_Core_Permission::getCorePermissions
*/
- static function getModulePermissions($module) {
+ public static function getModulePermissions($module) {
$return_permissions = array();
$fn_name = "{$module}_civicrm_permission";
if (function_exists($fn_name)) {
*
* @return Array of permissions, in the same format as CRM_Core_Permission::getCorePermissions().
*/
- function getAllModulePermissions() {
+ public function getAllModulePermissions() {
$permissions = array();
CRM_Utils_Hook::permission($permissions);
return $permissions;
* @return boolean true if yes, else false
* @access public
*/
- function check($str, $contactID = NULL) {
+ public function check($str, $contactID = NULL) {
$str = $this->translatePermission($str, 'Drupal', array(
'view user account' => 'access user profiles',
'administer users' => 'administer users',
* @return boolean true if yes, else false
* @access public
*/
- function checkGroupRole($array) {
+ public function checkGroupRole($array) {
if (function_exists('user_load') && isset($array)) {
$user = user_load( $GLOBALS['user']->uid);
//if giver roles found in user roles - return true
/**
* {@inheritdoc}
*/
- function upgradePermissions($permissions) {
+ public function upgradePermissions($permissions) {
if (empty($permissions)) {
throw new CRM_Core_Exception("Cannot upgrade permissions: permission list missing");
}
* @return boolean true if yes, else false
* @access public
*/
- function check($str, $contactID = NULL) {
+ public function check($str, $contactID = NULL) {
$str = $this->translatePermission($str, 'Drupal6', array(
'view user account' => 'access user profiles',
'administer users' => 'administer users',
* @access public
*/
- function checkGroupRole($array) {
+ public function checkGroupRole($array) {
if (function_exists('user_load') && isset($array)) {
$user = user_load(array('uid' => $GLOBALS['user']->uid));
//if giver roles found in user roles - return true
*
* Does nothing in Drupal 6.
*/
- function upgradePermissions($permissions) {
+ public function upgradePermissions($permissions) {
// D6 allows us to be really lazy... things get cleaned up when the admin form is next submitted...
}
*
* @return Array of permissions, in the same format as CRM_Core_Permission::getCorePermissions().
*/
- static function getModulePermissions($module) {
+ public static function getModulePermissions($module) {
$return_permissions = array();
$fn_name = "{$module}_civicrm_permission";
if (function_exists($fn_name)) {
*
* @return bool
*/
- function check($str, $contactID = NULL) {
+ public function check($str, $contactID = NULL) {
$str = $this->translatePermission($str, 'Drupal', array(
'view user account' => 'access user profiles',
));
*
* @return string
*/
- function getContactEmails($uids) {
+ public function getContactEmails($uids) {
if (empty($uids)) {
return '';
}
* @access public
*
*/
- function checkGroupRole($array) {
+ public function checkGroupRole($array) {
if (function_exists('user_load') && isset($array)) {
$user = user_load( $GLOBALS['user']->uid);
//if giver roles found in user roles - return true
* {@inheritdoc}
*
*/
- function upgradePermissions($permissions) {
+ public function upgradePermissions($permissions) {
if (empty($permissions)) {
throw new CRM_Core_Exception("Cannot upgrade permissions: permission list missing");
}
* @return boolean true if yes, else false
* @access public
*/
- function check($str) {
+ public function check($str) {
$config = CRM_Core_Config::singleton();
$translated = $this->translateJoomlaPermission($str);
* @internal param string $name e.g. "administer CiviCRM", "cms:access user record", "Drupal:administer content", "Joomla:example.action:com_some_asset"
* @return ALWAYS_DENY_PERMISSION|ALWAYS_ALLOW_PERMISSION|array(0 => $joomlaAction, 1 => $joomlaAsset)
*/
- function translateJoomlaPermission($perm) {
+ public function translateJoomlaPermission($perm) {
if ($perm === CRM_Core_Permission::ALWAYS_DENY_PERMISSION || $perm === CRM_Core_Permission::ALWAYS_ALLOW_PERMISSION) {
return $perm;
}
* @static
* @access public
*/
- function checkGroupRole($array) {
+ public function checkGroupRole($array) {
return FALSE;
}
}
* @access public
*/
- function check($str) {
+ public function check($str) {
return TRUE;
}
}
* @return boolean true if yes, else false
* @access public
*/
- function check($str) {
+ public function check($str) {
if ($str == CRM_Core_Permission::ALWAYS_DENY_PERMISSION) {
return FALSE;
}
* @return boolean true if yes, else false
* @access public
*/
- function check($str) {
+ public function check($str) {
// Generic cms 'administer users' role tranlates to 'administrator' WordPress role
$str = $this->translatePermission($str, 'WordPress', array(
'administer users' => 'administrator',
/**
* {@inheritdoc}
*/
- function upgradePermissions($permissions) {
+ public function upgradePermissions($permissions) {
return;
}
}
* NULL if the given key has no corresponding option
* String if label is found
*/
- static function getLabel($baoName, $fieldName, $key) {
+ public static function getLabel($baoName, $fieldName, $key) {
$values = $baoName::buildOptions($fieldName, 'get');
if ($values === FALSE) {
return FALSE;
* NULL if the given key has no corresponding option
* String if label is found
*/
- static function getName($baoName, $fieldName, $key) {
+ public static function getName($baoName, $fieldName, $key) {
$values = $baoName::buildOptions($fieldName, 'validate');
if ($values === FALSE) {
return FALSE;
* NULL if the given key has no corresponding option
* String|Number if key is found
*/
- static function getKey($baoName, $fieldName, $value) {
+ public static function getKey($baoName, $fieldName, $value) {
$values = $baoName::buildOptions($fieldName, 'validate');
if ($values === FALSE) {
return FALSE;
* @param $fieldSpec
* @return string|null
*/
- static function getOptionEditUrl($fieldSpec) {
+ public static function getOptionEditUrl($fieldSpec) {
// If it's an option group, that's easy
if (!empty($fieldSpec['pseudoconstant']['optionGroupName'])) {
return 'civicrm/admin/options/' . $fieldSpec['pseudoconstant']['optionGroupName'];
* @static
* @public
*/
- static function countryIDForStateID($stateID) {
+ public static function countryIDForStateID($stateID) {
if (empty($stateID)) {
return CRM_Core_DAO::$_nullObject;
}
* @return \CRM_Core_QuickForm_Action
@access public
*/
- function __construct(&$stateMachine) {
+ public function __construct(&$stateMachine) {
$this->_stateMachine = &$stateMachine;
}
* @return void
* @access public
*/
- function popUserContext() {
+ public function popUserContext() {
$session = CRM_Core_Session::singleton();
$config = CRM_Core_Config::singleton();
* @return \CRM_Core_QuickForm_Action_Back
* @access public
*/
- function __construct(&$stateMachine) {
+ public function __construct(&$stateMachine) {
parent::__construct($stateMachine);
}
* @return void
* @access public
*/
- function perform(&$page, $actionName) {
+ public function perform(&$page, $actionName) {
$this->_stateMachine->perform($page, $actionName, 'Back');
}
}
* @return \CRM_Core_QuickForm_Action_Cancel
@access public
*/
- function __construct(&$stateMachine) {
+ public function __construct(&$stateMachine) {
parent::__construct($stateMachine);
}
* @return void
* @access public
*/
- function perform(&$page, $actionName) {
+ public function perform(&$page, $actionName) {
// conditional actions if cancelAction is defined
$this->_stateMachine->cancelAction();
* @return \CRM_Core_QuickForm_Action_Display
@access public
*/
- function __construct(&$stateMachine) {
+ public function __construct(&$stateMachine) {
parent::__construct($stateMachine);
}
* @return void
* @access public
*/
- function perform(&$page, $actionName) {
+ public function perform(&$page, $actionName) {
$pageName = $page->getAttribute('id');
// If the original action was 'display' and we have values in container then we load them
* @return void
* @access public
*/
- function renderForm(&$page) {
+ public function renderForm(&$page) {
$this->_setRenderTemplates($page);
$template = CRM_Core_Smarty::singleton();
$form = $page->toSmarty();
* @return void
* @access public
*/
- function _setRenderTemplates(&$page) {
+ public function _setRenderTemplates(&$page) {
if (self::$_requiredTemplate === NULL) {
$this->initializeTemplates();
}
* @return void
* @access public
*/
- function initializeTemplates() {
+ public function initializeTemplates() {
if (self::$_requiredTemplate !== NULL) {
return;
}
* @return \CRM_Core_QuickForm_Action_Done
@access public
*/
- function __construct(&$stateMachine) {
+ public function __construct(&$stateMachine) {
parent::__construct($stateMachine);
}
* @return void
* @access public
*/
- function perform(&$page, $actionName) {
+ public function perform(&$page, $actionName) {
$page->isFormBuilt() or $page->buildForm();
$pageName = $page->getAttribute('name');
* @return \CRM_Core_QuickForm_Action_Jump
@access public
*/
- function __construct(&$stateMachine) {
+ public function __construct(&$stateMachine) {
parent::__construct($stateMachine);
}
* @return void
* @access public
*/
- function perform(&$page, $actionName) {
+ public function perform(&$page, $actionName) {
// check whether the page is valid before trying to go to it
if ($page->controller->isModal()) {
// we check whether *all* pages up to current are valid
* @return \CRM_Core_QuickForm_Action_Next
@access public
*/
- function __construct(&$stateMachine) {
+ public function __construct(&$stateMachine) {
parent::__construct($stateMachine);
}
* @return void
* @access public
*/
- function perform(&$page, $actionName) {
+ public function perform(&$page, $actionName) {
$this->_stateMachine->perform($page, $actionName, 'Next');
}
}
* @return \CRM_Core_QuickForm_Action_Process
@access public
*/
- function __construct(&$stateMachine) {
+ public function __construct(&$stateMachine) {
parent::__construct($stateMachine);
}
* @return void
* @access public
*/
- function perform(&$page, $actionName) {
+ public function perform(&$page, $actionName) {
if ($this->_stateMachine->shouldReset()) {
$this->_stateMachine->reset();
}
* @return \CRM_Core_QuickForm_Action_Refresh
@access public
*/
- function __construct(&$stateMachine) {
+ public function __construct(&$stateMachine) {
parent::__construct($stateMachine);
}
* @return void
* @access public
*/
- function perform(&$page, $actionName) {
+ public function perform(&$page, $actionName) {
// save the form values and validation status to the session
$page->isFormBuilt() or $page->buildForm();
* @return \CRM_Core_QuickForm_Action_Reload
@access public
*/
- function __construct(&$stateMachine) {
+ public function __construct(&$stateMachine) {
parent::__construct($stateMachine);
}
* @return void
* @access public
*/
- function perform(&$page, $actionName) {
+ public function perform(&$page, $actionName) {
// save the form values and validation status to the session
$page->isFormBuilt() or $page->buildForm();
* @return \CRM_Core_QuickForm_Action_Submit
@access public
*/
- function __construct(&$stateMachine) {
+ public function __construct(&$stateMachine) {
parent::__construct($stateMachine);
}
* @return void
* @access public
*/
- function perform(&$page, $actionName) {
+ public function perform(&$page, $actionName) {
$page->isFormBuilt() or $page->buildForm();
$pageName = $page->getAttribute('name');
* @return \CRM_Core_QuickForm_Action_Upload
@access public
*/
- function __construct(&$stateMachine, $uploadDir, $uploadNames) {
+ public function __construct(&$stateMachine, $uploadDir, $uploadNames) {
parent::__construct($stateMachine);
$this->_uploadDir = $uploadDir;
* @return void
* @access private
*/
- function upload(&$page, &$data, $pageName, $uploadName) {
+ public function upload(&$page, &$data, $pageName, $uploadName) {
// make sure uploadName exists in the QF array
// else we skip, CRM-3427
if (empty($uploadName) ||
* @return void
* @access public
*/
- function perform(&$page, $actionName) {
+ public function perform(&$page, $actionName) {
// like in Action_Next
$page->isFormBuilt() or $page->buildForm();
*
* @return mixed
*/
- function realPerform(&$page, $actionName) {
+ public function realPerform(&$page, $actionName) {
$pageName = $page->getAttribute('name');
$data = &$page->controller->container();
$data['values'][$pageName] = $page->exportValues();
* @return string
* @since version 0.4.0 (2005-06-25)
*/
- function toHtml() {
+ public function toHtml() {
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
}
* @param string $targetKey
* @param null $refTypeColumn
*/
- function __construct($refTable, $refKey, $targetTable = NULL, $targetKey = 'id', $refTypeColumn = NULL) {
+ public function __construct($refTable, $refKey, $targetTable = NULL, $targetKey = 'id', $refTypeColumn = NULL) {
$this->refTable = $refTable;
$this->refKey = $refKey;
$this->targetTable = $targetTable;
/**
* @return mixed
*/
- function getReferenceTable() {
+ public function getReferenceTable() {
return $this->refTable;
}
/**
* @return mixed
*/
- function getReferenceKey() {
+ public function getReferenceKey() {
return $this->refKey;
}
/**
* @return null
*/
- function getTypeColumn() {
+ public function getTypeColumn() {
return $this->refTypeColumn;
}
/**
* @return null
*/
- function getTargetTable() {
+ public function getTargetTable() {
return $this->targetTable;
}
/**
* @return string
*/
- function getTargetKey() {
+ public function getTargetKey() {
return $this->targetKey;
}
* @param string $targetKey
* @param null $optionGroupName
*/
- function __construct($refTable, $refKey, $targetTable = NULL, $targetKey = 'id', $optionGroupName) {
+ public function __construct($refTable, $refKey, $targetTable = NULL, $targetKey = 'id', $optionGroupName) {
parent::__construct($refTable, $refKey, $targetTable, $targetKey, NULL);
$this->targetOptionGroupName = $optionGroupName;
}
* @param bool $autocreate whether to automatically create an empty region
* @return CRM_Core_Region
*/
- static function &instance($name, $autocreate = TRUE) {
+ public static function &instance($name, $autocreate = TRUE) {
if ( $autocreate && ! isset( self::$_instances[$name] ) ) {
self::$_instances[$name] = new CRM_Core_Region($name);
}
*
* @return int
*/
- static function _cmpSnippet($a, $b) {
+ public static function _cmpSnippet($a, $b) {
if ($a['weight'] < $b['weight']) return -1;
if ($a['weight'] > $b['weight']) return 1;
// fallback to name sort; don't really want to do this, but it makes results more stable
* @access public
* @static
*/
- static function makeCSVTable(&$header, &$rows, $titleHeader = NULL, $print = TRUE, $outputHeader = TRUE) {
+ public static function makeCSVTable(&$header, &$rows, $titleHeader = NULL, $print = TRUE, $outputHeader = TRUE) {
if ($titleHeader) {
echo $titleHeader;
}
* @param null $titleHeader
* @param bool $outputHeader
*/
- function writeHTMLFile($fileName, &$header, &$rows, $titleHeader = NULL, $outputHeader = TRUE) {
+ public function writeHTMLFile($fileName, &$header, &$rows, $titleHeader = NULL, $outputHeader = TRUE) {
if ($outputHeader) {
CRM_Utils_System::download(CRM_Utils_String::munge($fileName),
'application/vnd.ms-excel',
* @public
* @static
*/
- static function writeCSVFile($fileName, &$header, &$rows, $titleHeader = NULL, $outputHeader = TRUE, $saveFile = NULL) {
+ public static function writeCSVFile($fileName, &$header, &$rows, $titleHeader = NULL, $outputHeader = TRUE, $saveFile = NULL) {
if ($outputHeader && !$saveFile) {
CRM_Utils_System::download(CRM_Utils_String::munge($fileName),
'text/x-csv',
*
* @return string javascript content
*/
- static function outputLocalizationJS() {
+ public static function outputLocalizationJS() {
CRM_Core_Page_AJAX::setJsHeaders();
$config = CRM_Core_Config::singleton();
$vars = array(
/**
* @return bool - is this page request an ajax snippet?
*/
- static function isAjaxMode() {
+ public static function isAjaxMode() {
return in_array(CRM_Utils_Array::value('snippet', $_REQUEST), array(CRM_Core_Smarty::PRINT_SNIPPET, CRM_Core_Smarty::PRINT_NOFORM, CRM_Core_Smarty::PRINT_JSON));
}
* @TODO: Provide a sane way to extend this list for other entities - a hook or??
* @return array
*/
- static function getEntityRefFilters() {
+ public static function getEntityRefFilters() {
$filters = array();
$filters['event'] = array(
* Preferred mail format
* @static
*/
- static function pmf() {
+ public static function pmf() {
return array(
'Both' => ts('Both'),
'HTML' => ts('HTML'),
* Privacy options
* @static
*/
- static function privacy() {
+ public static function privacy() {
return array(
'do_not_phone' => ts('Do not phone'),
'do_not_email' => ts('Do not email'),
* Various pre defined contact super types
* @static
*/
- static function contactType() {
+ public static function contactType() {
static $contactType = NULL;
if (!$contactType) {
$contactType = CRM_Contact_BAO_ContactType::basicTypePairs();
* Various pre defined unit list
* @static
*/
- static function unitList($unitType = NULL) {
+ public static function unitList($unitType = NULL) {
$unitList = array(
'day' => ts('day'),
'month' => ts('month'),
* Membership type unit
* @static
*/
- static function membershipTypeUnitList( ) {
+ public static function membershipTypeUnitList( ) {
return self::unitList('duration');
}
* Various pre defined period types
* @static
*/
- static function periodType() {
+ public static function periodType() {
return array(
'rolling' => ts('Rolling'),
'fixed' => ts('Fixed'),
* Various pre defined email selection methods
* @static
*/
- static function emailSelectMethods() {
+ public static function emailSelectMethods() {
return array(
'automatic' => ts("Automatic"),
'location-only' => ts("Only send to email addresses assigned to the specified location"),
* Various pre defined member visibility options
* @static
*/
- static function memberVisibility() {
+ public static function memberVisibility() {
return array(
'Public' => ts('Public'),
'Admin' => ts('Admin'),
* Various pre defined event dates
* @static
*/
- static function eventDate() {
+ public static function eventDate() {
return array(
'start_date' => ts('start date'),
'end_date' => ts('end date'),
* Custom form field types
* @static
*/
- static function customHtmlType() {
+ public static function customHtmlType() {
return array(
'Text' => ts('Single-line input field (text or numeric)'),
'TextArea' => ts('Multi-line text box (textarea)'),
*
* @static
*/
- static function customGroupExtends() {
+ public static function customGroupExtends() {
$customGroupExtends = array(
'Activity' => ts('Activities'),
'Relationship' => ts('Relationships'),
*
* @static
*/
- static function customGroupStyle() {
+ public static function customGroupStyle() {
return array(
'Tab' => ts('Tab'),
'Inline' => ts('Inline'),
*
* @static
*/
- static function ufGroupTypes() {
+ public static function ufGroupTypes() {
$ufGroupType = array(
'Profile' => ts('Standalone Form or Directory'),
'Search Profile' => ts('Search Views'),
*
* @static
*/
- static function groupContactStatus() {
+ public static function groupContactStatus() {
return array(
'Added' => ts('Added'),
'Removed' => ts('Removed'),
* List of Group Types
* @static
*/
- static function groupType() {
+ public static function groupType() {
return array(
'query' => ts('Dynamic'),
'static' => ts('Static'),
* @return array the date array
* @static
*/
- static function date($type = NULL, $format = NULL, $minOffset = NULL, $maxOffset = NULL) {
+ public static function date($type = NULL, $format = NULL, $minOffset = NULL, $maxOffset = NULL) {
$date = array(
'addEmptyOption' => TRUE,
*
* @static
*/
- static function ufVisibility() {
+ public static function ufVisibility() {
return array(
'User and User Admin Only' => ts('User and User Admin Only'),
'Public Pages' => ts('Public Pages'),
*
* @static
*/
- static function groupVisibility() {
+ public static function groupVisibility() {
return array(
'User and User Admin Only' => ts('User and User Admin Only'),
'Public Pages' => ts('Public Pages'),
* @static
* return array
*/
- static function mailingComponents() {
+ public static function mailingComponents() {
return array('Header' => ts('Header'),
'Footer' => ts('Footer'),
'Reply' => ts('Reply Auto-responder'),
*
* @static
*/
- function getHours() {
+ public function getHours() {
$hours = array();
for ($i = 0; $i <= 6; $i++) {
$hours[$i] = $i;
*
* @static
*/
- function getMinutes() {
+ public function getMinutes() {
$minutes = array();
for ($i = 0; $i < 60; $i = $i + 15) {
$minutes[$i] = $i;
* @return array $map array of map providers
* @static
*/
- static function mapProvider() {
+ public static function mapProvider() {
static $map = NULL;
if (!$map) {
$map = CRM_Utils_System::getPluginList('templates/CRM/Contact/Form/Task/Map', ".tpl");
* @return array $geo array of geocoder providers
* @static
*/
- static function geoProvider() {
+ public static function geoProvider() {
static $geo = NULL;
if (!$geo) {
$geo = CRM_Utils_System::getPluginList('CRM/Utils/Geocode');
* @return array $addr array of address standardization providers
* @static
*/
- static function addressProvider() {
+ public static function addressProvider() {
static $addr = NULL;
if (!$addr) {
$addr = CRM_Utils_System::getPluginList('CRM/Utils/Address', '.php', array('BatchUpdate'));
* @static
* return array
*/
- static function mailingTokens() {
+ public static function mailingTokens() {
return array(
'{action.unsubscribe}' => ts('Unsubscribe via email'),
'{action.unsubscribeUrl}' => ts('Unsubscribe via web page'),
* @static
* return array
*/
- static function activityTokens() {
+ public static function activityTokens() {
return array(
'{activity.activity_id}' => ts('Activity ID'),
'{activity.subject}' => ts('Activity Subject'),
* @static
* return array
*/
- static function membershipTokens() {
+ public static function membershipTokens() {
return array(
'{membership.id}' => ts('Membership ID'),
'{membership.status}' => ts('Membership Status'),
* @static
* return array
*/
- static function eventTokens() {
+ public static function eventTokens() {
return array(
'{event.event_id}' => ts('Event ID'),
'{event.title}' => ts('Event Title'),
* @static
* return array
*/
- static function contributionTokens() {
+ public static function contributionTokens() {
return array(
'{contribution.contribution_id}' => ts('Contribution ID'),
'{contribution.total_amount}' => ts('Total Amount'),
* @static
* return array
*/
- static function contactTokens() {
+ public static function contactTokens() {
static $tokens = NULL;
if (!$tokens) {
$additionalFields = array('checksum' => array('title' => ts('Checksum')),
* @static
* return array
*/
- static function participantTokens() {
+ public static function participantTokens() {
static $tokens = NULL;
if (!$tokens) {
$exportFields = CRM_Event_BAO_Participant::exportableFields();
/**
* CiviCRM supported date input formats
*/
- static function getDatePluginInputFormats() {
+ public static function getDatePluginInputFormats() {
$dateInputFormats = array(
"mm/dd/yy" => ts('mm/dd/yyyy (12/31/2009)'),
"dd/mm/yy" => ts('dd/mm/yyyy (31/12/2009)'),
/**
* Map date plugin and actual format that is used by PHP
*/
- static function datePluginToPHPFormats() {
+ public static function datePluginToPHPFormats() {
$dateInputFormats = array(
"mm/dd/yy" => 'm/d/Y',
"dd/mm/yy" => 'd/m/Y',
/**
* Time formats
*/
- static function getTimeFormats() {
+ public static function getTimeFormats() {
return array(
'1' => ts('12 Hours'),
'2' => ts('24 Hours'),
* Barcode types
* @static
*/
- static function getBarcodeTypes() {
+ public static function getBarcodeTypes() {
return array(
'barcode' => ts('Linear (1D)'),
'qrcode' => ts('QR code'),
/**
* Dedupe rule types
*/
- static function getDedupeRuleTypes() {
+ public static function getDedupeRuleTypes() {
return array(
'Unsupervised' => ts('Unsupervised'),
'Supervised' => ts('Supervised'),
/**
* Campaign group types
*/
- static function getCampaignGroupTypes() {
+ public static function getCampaignGroupTypes() {
return array(
'Include' => ts('Include'),
'Exclude' => ts('Exclude'),
/**
* Subscription history method
*/
- static function getSubscriptionHistoryMethods() {
+ public static function getSubscriptionHistoryMethods() {
return array(
'Admin' => ts('Admin'),
'Email' => ts('Email'),
/**
* Premium units
*/
- static function getPremiumUnits() {
+ public static function getPremiumUnits() {
return array(
'day' => ts('Day'),
'week' => ts('Week'),
/**
* Extension types
*/
- static function getExtensionTypes() {
+ public static function getExtensionTypes() {
return array(
'payment' => ts('Payment'),
'search' => ts('Search'),
/**
* Job frequency
*/
- static function getJobFrequency() {
+ public static function getJobFrequency() {
return array(
'Daily' => ts('Daily'),
'Hourly' => ts('Hourly'),
/**
* Search builder operators
*/
- static function getSearchBuilderOperators() {
+ public static function getSearchBuilderOperators() {
return array(
'=' => '=',
'!=' => '≠',
*
* @static
*/
- static function getProfileGroupType() {
+ public static function getProfileGroupType() {
$profileGroupType = array(
'Activity' => ts('Activities'),
'Contribution' => ts('Contributions'),
/**
* Word replacement match type
*/
- static function getWordReplacementMatchType() {
+ public static function getWordReplacementMatchType() {
return array(
'exactMatch' => ts('Exact Match'),
'wildcardMatch' => ts('Wildcard Match'),
/**
* Mailing group types
*/
- static function getMailingGroupTypes() {
+ public static function getMailingGroupTypes() {
return array(
'Include' => ts('Include'),
'Exclude' => ts('Exclude'),
/**
* Mailing Job Status
*/
- static function getMailingJobStatus() {
+ public static function getMailingJobStatus() {
return array(
'Scheduled' => ts('Scheduled'),
'Running' => ts('Running'),
);
}
- static function billingMode() {
+ public static function billingMode() {
return array(
CRM_Core_Payment::BILLING_MODE_FORM => 'form',
CRM_Core_Payment::BILLING_MODE_BUTTON => 'button',
/**
* Frequency unit for schedule reminders
*/
- static function getScheduleReminderFrequencyUnits() {
+ public static function getScheduleReminderFrequencyUnits() {
//@todo update schema to refer to option group direct & remove this
static $scheduleReminderFrequencyUnits = NULL;
if (!$scheduleReminderFrequencyUnits) {
* @access public
*
*/
- function getPagerParams($action, &$params);
+ public function getPagerParams($action, &$params);
/**
* Returns the sort order array for the given action
* @access public
*
*/
- function &getSortOrder($action);
+ public function &getSortOrder($action);
/**
* Returns the column headers as an array of tuples:
* @return array the column headers that need to be displayed
* @access public
*/
- function &getColumnHeaders($action = NULL, $type = NULL);
+ public function &getColumnHeaders($action = NULL, $type = NULL);
/**
* Returns the number of rows for this action
* @access public
*
*/
- function getTotalCount($action);
+ public function getTotalCount($action);
/**
* Returns all the rows in the given offset and rowCount
* @return int the total number of rows for this action
* @access public
*/
- function &getRows($action, $offset, $rowCount, $sort, $type = NULL);
+ public function &getRows($action, $offset, $rowCount, $sort, $type = NULL);
/**
* Return the template (.tpl) filename
* @access public
*
*/
- function getTemplateFileName($action = NULL);
+ public function getTemplateFileName($action = NULL);
/**
* Return the filename for the exported CSV
* special characters to avoid various browser issues
*
*/
- function getExportFileName($type = 'csv');
+ public function getExportFileName($type = 'csv');
}
* @access public
*
*/
- function getActionAttribute($match, $attribute = 'name') {
+ public function getActionAttribute($match, $attribute = 'name') {
$links = &$this->links();
foreach ($link as $action => $item) {
* qs : the parameters to the above url along with any dynamic substitutions
* title : A more descriptive name, typically used in breadcrumbs / navigation
*/
- static function &links() {
+ public static function &links() {
return NULL;
}
* @return string template file name
* @access public
*/
- function getTemplateFileName($action = NULL) {
+ public function getTemplateFileName($action = NULL) {
return (str_replace('_', DIRECTORY_SEPARATOR, CRM_Utils_System::getClassName($this)) . ".tpl");
}
* @return array the elements that can be sorted along with their properties
* @access public
*/
- function &getSortOrder($action) {
+ public function &getSortOrder($action) {
$columnHeaders = &$this->getColumnHeaders(NULL);
if (!isset($this->_order)) {
* @return \CRM_Core_Selector_Controller
@access public
*/
- function __construct($object, $pageID, $sortID, $action, $store = NULL, $output = self::TEMPLATE, $prefix = NULL, $case = NULL) {
+ public function __construct($object, $pageID, $sortID, $action, $store = NULL, $output = self::TEMPLATE, $prefix = NULL, $case = NULL) {
$this->_object = $object;
$this->_pageID = $pageID ? $pageID : 1;
* @return boolean if the GET params are different from the session params
* @access public
*/
- function hasChanged($reset) {
+ public function hasChanged($reset) {
/**
* if we are in reset state, i.e the store is cleaned out, we return false
* @return void
*
*/
- function run() {
+ public function run() {
// get the column headers
$columnHeaders = &$this->_object->getColumnHeaders($this->_action, $this->_output);
* @return CRM_Utils_Pager
* @access public
*/
- function getPager() {
+ public function getPager() {
return $this->_pager;
}
* @return CRM_Utils_Sort
* @access public
*/
- function getSort() {
+ public function getSort() {
return $this->_sort;
}
* @return void
* @access public
*/
- function moveFromSessionToTemplate() {
+ public function moveFromSessionToTemplate() {
self::$_template->assign_by_ref("{$this->_prefix}pager", $this->_pager);
$rows = $this->_store->get("{$this->_prefix}rows");
* @return void
* @access public
*/
- function setEmbedded($embedded) {
+ public function setEmbedded($embedded) {
$this->_embedded = $embedded;
}
* @return boolean return the embedded value
* @access public
*/
- function getEmbedded() {
+ public function getEmbedded() {
return $this->_embedded;
}
* @return void
* @access public
*/
- function setPrint($print) {
+ public function setPrint($print) {
$this->_print = $print;
}
* @return boolean return the print value
* @access public
*/
- function getPrint() {
+ public function getPrint() {
return $this->_print;
}
/**
* @param $value
*/
- function setDynamicAction($value) {
+ public function setDynamicAction($value) {
$this->_dynamicAction = $value;
}
/**
* @return bool
*/
- function getDynamicAction() {
+ public function getDynamicAction() {
return $this->_dynamicAction;
}
}
*
* @return CRM_Core_Session
*/
- function __construct() {
+ public function __construct() {
$this->_session = null;
}
* @return CRM_Core_Session
* @static
*/
- static function &singleton() {
+ public static function &singleton() {
if (self::$_singleton === NULL) {
self::$_singleton = new CRM_Core_Session;
}
*
* @return void
*/
- function initialize($isRead = FALSE) {
+ public function initialize($isRead = FALSE) {
// lets initialize the _session variable just before we need it
// hopefully any bootstrapping code will actually load the session from the CMS
if (!isset($this->_session)) {
*
* @return void
*/
- function reset($all = 1) {
+ public function reset($all = 1) {
if ($all != 1) {
$this->initialize();
*
* @return void
*/
- function createScope($prefix, $isRead = FALSE) {
+ public function createScope($prefix, $isRead = FALSE) {
$this->initialize($isRead);
if ($isRead || empty($prefix)) {
*
* @return void
*/
- function resetScope($prefix) {
+ public function resetScope($prefix) {
$this->initialize();
if (empty($prefix)) {
* @return void
*
*/
- function set($name, $value = NULL, $prefix = NULL) {
+ public function set($name, $value = NULL, $prefix = NULL) {
// create session scope
$this->createScope($prefix);
* @return mixed
*
*/
- function get($name, $prefix = NULL) {
+ public function get($name, $prefix = NULL) {
// create session scope
$this->createScope($prefix, TRUE);
* @return void
*
*/
- function getVars(&$vars, $prefix = '') {
+ public function getVars(&$vars, $prefix = '') {
// create session scope
$this->createScope($prefix, TRUE);
* @return mixed
*
*/
- function timer($name, $expire) {
+ public function timer($name, $expire) {
$ts = $this->get($name, 'timer');
if (!$ts || $ts < time() - $expire) {
$this->set($name, time(), 'timer');
* @access public
*
*/
- function pushUserContext($userContext, $check = TRUE) {
+ public function pushUserContext($userContext, $check = TRUE) {
if (empty($userContext)) {
return;
}
* @access public
*
*/
- function replaceUserContext($userContext) {
+ public function replaceUserContext($userContext) {
if (empty($userContext)) {
return;
}
* @return string the top of the userContext stack (also pops the top element)
*
*/
- function popUserContext() {
+ public function popUserContext() {
$this->createScope(self::USER_CONTEXT);
return array_pop($this->_session[$this->_key][self::USER_CONTEXT]);
* @return string the top of the userContext stack
*
*/
- function readUserContext() {
+ public function readUserContext() {
$this->createScope(self::USER_CONTEXT);
$config = CRM_Core_Config::singleton();
* Dumps the session to the log
* @param int $all
*/
- function debug($all = 1) {
+ public function debug($all = 1) {
$this->initialize();
if ($all != 1) {
CRM_Core_Error::debug('CRM Session', $this->_session);
*
* @return string the status message if any
*/
- function getStatus($reset = FALSE) {
+ public function getStatus($reset = FALSE) {
$this->initialize();
$status = NULL;
*
* @return void
*/
- static function setStatus($text, $title = '', $type = 'alert', $options = array()) {
+ public static function setStatus($text, $title = '', $type = 'alert', $options = array()) {
// make sure session is initialized, CRM-8120
$session = self::singleton();
$session->initialize();
/**
* @param string|array $names
*/
- static function registerAndRetrieveSessionObjects($names) {
+ public static function registerAndRetrieveSessionObjects($names) {
if (!is_array($names)) {
$names = array($names);
}
/**
* @param bool $reset
*/
- static function storeSessionObjects($reset = TRUE) {
+ public static function storeSessionObjects($reset = TRUE) {
if (empty(self::$_managedNames)) {
return;
}
* Retrieve contact id of the logged in user
* @return integer|NULL contact ID of logged in user
*/
- static function getLoggedInContactID() {
+ public static function getLoggedInContactID() {
$session = CRM_Core_Session::singleton();
if (!is_numeric($session->get('userID'))) {
return NULL;
/**
* @return bool
*/
- function isEmpty() {
+ public function isEmpty() {
// check if session is empty, if so we don't cache
// stuff that we can get away with
// helps proxies like varnish
*
* @return \CRM_Core_ShowHideBlocks the newly created object@access public
*/
- function __construct($show = NULL, $hide = NULL) {
+ public function __construct($show = NULL, $hide = NULL) {
if (!empty($show)) {
$this->_show = $show;
}
* @access public
* @static
*/
- static function setIcons() {
+ public static function setIcons() {
if (!isset(self::$_showIcon)) {
$config = CRM_Core_Config::singleton();
self::$_showIcon = '<img src="' . $config->resourceBase . 'i/TreePlus.gif" class="action-icon" alt="' . ts('show field or section') . '"/>';
* @return void
* @access public
*/
- function addToTemplate() {
+ public function addToTemplate() {
$hide = $show = '';
$first = TRUE;
* @return void
* @access public
*/
- function addShow($name) {
+ public function addShow($name) {
$this->_show[$name] = 1;
if (array_key_exists($name, $this->_hide)) {
unset($this->_hide[$name]);
* @return void
* @access public
*/
- function addHide($name) {
+ public function addHide($name) {
$this->_hide[$name] = 1;
if (array_key_exists($name, $this->_show)) {
unset($this->_show[$name]);
* @return string the formatted html link
* @access public
*/
- static function linkHtml($name, $href, $text, $js) {
+ public static function linkHtml($name, $href, $text, $js) {
return '<a name="' . $name . '" id="' . $name . '" href="' . $href . '" ' . $js . ">$text</a>";
}
* @return void
* @access public
*/
- static function links(&$form, $prefix, $showLinkText, $hideLinkText, $assign = TRUE) {
+ public static function links(&$form, $prefix, $showLinkText, $hideLinkText, $assign = TRUE) {
$showCode = "cj('#id_{$prefix}').show(); cj('#id_{$prefix}_show').hide();";
$hideCode = "cj('#id_{$prefix}').hide(); cj('#id_{$prefix}_show').show(); return false;";
* @return void
* @access public
*/
- function linksForArray(&$form, $index, $maxIndex, $prefix, $showLinkText, $hideLinkText, $elementType = NULL, $hideLink = NULL) {
+ public function linksForArray(&$form, $index, $maxIndex, $prefix, $showLinkText, $hideLinkText, $elementType = NULL, $hideLink = NULL) {
$showHidePrefix = str_replace(array("]", "["), array("", "_"), $prefix);
$showHidePrefix = "id_" . $showHidePrefix;
if ($index == $maxIndex) {
* Method providing static instance of SmartTemplate, as
* in Singleton pattern.
*/
- static function &singleton() {
+ public static function &singleton() {
if (!isset(self::$_singleton)) {
self::$_singleton = new CRM_Core_Smarty( );
self::$_singleton->initialize( );
*
* @return bool|mixed|string
*/
- function fetch($resource_name, $cache_id = NULL, $compile_id = NULL, $display = FALSE) {
+ public function fetch($resource_name, $cache_id = NULL, $compile_id = NULL, $display = FALSE) {
if (preg_match( '/^(\s+)?string:/', $resource_name)) {
$old_security = $this->security;
$this->security = TRUE;
* @throws Exception
* @return bool|mixed|string
*/
- function fetchWith($resource_name, $vars) {
+ public function fetchWith($resource_name, $vars) {
$this->pushScope($vars);
try {
$result = $this->fetch($resource_name);
* @param string $name
* @param $value
*/
- function appendValue($name, $value) {
+ public function appendValue($name, $value) {
$currentValue = $this->get_template_vars($name);
if (!$currentValue) {
$this->assign($name, $value);
}
}
- function clearTemplateVars() {
+ public function clearTemplateVars() {
foreach (array_keys($this->_tpl_vars) as $key) {
if ($key == 'config' || $key == 'session') {
continue;
}
}
- static function registerStringResource() {
+ public static function registerStringResource() {
require_once 'CRM/Core/Smarty/resources/String.php';
civicrm_smarty_register_string_resource();
}
/**
* @param $path
*/
- function addTemplateDir($path) {
+ public function addTemplateDir($path) {
if ( is_array( $this->template_dir ) ) {
array_unshift( $this->template_dir, $path );
} else {
*
* @return bool
*/
- function check($offset) {
+ public function check($offset) {
return CRM_Core_Permission::check($offset);
}
* @return CRM_Core_State
* @access public
*/
- function __construct($name, $type, $back, $next, &$stateMachine) {
+ public function __construct($name, $type, $back, $next, &$stateMachine) {
$this->_name = $name;
$this->_type = $type;
$this->_back = $back;
$this->_stateMachine = &$stateMachine;
}
- function debugPrint() {
+ public function debugPrint() {
CRM_Core_Error::debug("{$this->_name}, {$this->_type}", "{$this->_back}, {$this->_next}");
}
* @return mixed does a jump to the back state
* @access public
*/
- function handleBackState(&$page) {
+ public function handleBackState(&$page) {
if ($this->_type & self::START) {
$page->handle('display');
}
* @return mixed does a jump to the nextstate
* @access public
*/
- function handleNextState(&$page) {
+ public function handleNextState(&$page) {
if ($this->_type & self::FINISH) {
$page->handle('process');
}
* @return string
* @access public
*/
- function getNextState() {
+ public function getNextState() {
if ($this->_type & self::FINISH) {
return NULL;
}
* @return void
* @access public
*/
- function validate(&$data) {
+ public function validate(&$data) {
$data['valid'][$this->_name] = TRUE;
}
* @return void
* @access public
*/
- function invalidate(&$data) {
+ public function invalidate(&$data) {
$data['valid'][$this->_name] = NULL;
}
* @return string
* @access public
*/
- function getName() {
+ public function getName() {
return $this->_name;
}
* @return void
* @access public
*/
- function setName($name) {
+ public function setName($name) {
$this->_name = $name;
}
* @return int
* @access public
*/
- function getType() {
+ public function getType() {
return $this->_type;
}
}
* @return \CRM_Core_StateMachine
@access public
*/
- function __construct(&$controller, $action = CRM_Core_Action::NONE) {
+ public function __construct(&$controller, $action = CRM_Core_Action::NONE) {
$this->_controller = &$controller;
$this->_action = $action;
* @return void
* @access public
*/
- function perform(&$page, $actionName, $type = 'Next') {
+ public function perform(&$page, $actionName, $type = 'Next') {
// save the form values and validation status to the session
$page->isFormBuilt() or $page->buildForm();
* @return void
* @access public
*/
- function addState($name, $type, $prev, $next) {
+ public function addState($name, $type, $prev, $next) {
$this->_states[$name] = new CRM_Core_State($name, $type, $prev, $next, $this);
}
* @return object the state object
* @access public
*/
- function find($name) {
+ public function find($name) {
if (array_key_exists($name, $this->_states)) {
return $this->_states[$name];
}
* @return array array of states in the state machine
* @access public
*/
- function getStates() {
+ public function getStates() {
return $this->_states;
}
* @return CRM_Core_State state object matching the name
* @access public
*/
- function &getState($name) {
+ public function &getState($name) {
if (isset($this->_states[$name])) {
return $this->_states[$name];
}
* @return array array of pages in the state machine
* @access public
*/
- function getPages() {
+ public function getPages() {
return $this->_pages;
}
*
* @return void
*/
- function addSequentialPages(&$pages) {
+ public function addSequentialPages(&$pages) {
$this->_pages = &$pages;
$numPages = count($pages);
* @return void
* @access public
*/
- function reset() {
+ public function reset() {
$this->_controller->reset();
}
* @return int
* @access public
*/
- function getAction() {
+ public function getAction() {
return $this->_action;
}
* @return void
* @access public
*/
- function setContent(&$content) {
+ public function setContent(&$content) {
$this->_controller->setContent($content);
}
* @return string
* @access public
*/
- function &getContent() {
+ public function &getContent() {
return $this->_controller->getContent();
}
/**
* @return mixed
*/
- function getDestination() {
+ public function getDestination() {
return $this->_controller->getDestination();
}
/**
* @return mixed
*/
- function getSkipRedirection() {
+ public function getSkipRedirection() {
return $this->_controller->getSkipRedirection();
}
/**
* @return mixed
*/
- function fini() {
+ public function fini() {
return $this->_controller->fini();
}
/**
* @return mixed
*/
- function cancelAction() {
+ public function cancelAction() {
return $this->_controller->cancelAction();
}
*
* @return boolean
*/
- function shouldReset() {
+ public function shouldReset() {
return TRUE;
}
/**
* @return array
*/
- static function &info() {
+ public static function &info() {
//get the campaign related tables.
CRM_Campaign_BAO_Query::info(self::$info);
* - If true, then make a new nested transaction ("SAVEPOINT")
* - If false, then attach to the existing transaction
*/
- function __construct($nest = FALSE) {
+ public function __construct($nest = FALSE) {
\Civi\Core\Transaction\Manager::singleton()->inc($nest);
}
- function __destruct() {
+ public function __destruct() {
$this->commit();
}
*
* @return \CRM_Core_Exception this
*/
- function commit() {
+ public function commit() {
if (!$this->_pseudoCommitted) {
$this->_pseudoCommitted = TRUE;
\Civi\Core\Transaction\Manager::singleton()->dec();
* @return void
* @acess protected
*/
- function preProcess() {
+ public function preProcess() {
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive',
$this, TRUE
);
*
* @return array|null
*/
- static function fieldTypeTransitions($dataType, $htmlType) {
+ public static function fieldTypeTransitions($dataType, $htmlType) {
// Text field is single value field,
// can not be change to other single value option which contains option group
if ($htmlType == 'Text') {
*
* @return array
*/
- static function explode($str) {
+ public static function explode($str) {
if (empty($str) || $str == CRM_Core_DAO::VALUE_SEPARATOR . CRM_Core_DAO::VALUE_SEPARATOR) {
return array();
}
*
* @return array
*/
- static function setDefaultValues(&$form) {
+ public static function setDefaultValues(&$form) {
$defaults = array();
CRM_Core_BAO_CustomGroup::setDefaults($form->_groupTree, $defaults, FALSE, FALSE, $form->get('action'));
return $defaults;
* @param CRM_Core_Form $form
* @return void
*/
- static function buildQuickForm(&$form) {
+ public static function buildQuickForm(&$form) {
$form->addElement('hidden', 'hidden_custom', 1);
$form->addElement('hidden', "hidden_custom_group_count[{$form->_groupID}]", $form->_groupCount);
CRM_Core_BAO_CustomGroup::buildQuickForm($form, $form->_groupTree);
* @return void
* @acess protected
*/
- function preProcess() {
+ public function preProcess() {
$this->_id = $this->get('id');
* @return void
* @acess protected
*/
- function preProcess() {
+ public function preProcess() {
$this->_id = $this->get('id');
$defaults = array();
* @return array array of default values
* @access public
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = $this->_values;
if ($this->_id) {
* @static
* @access public
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$default = CRM_Utils_Array::value('default_value', $fields);
$errors = array();
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
//validate group title as well as name.
* @access public
* @see valid_date
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Custom_Form_Group', 'formRule'), $this);
}
* @return array array of default values
* @access public
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = &$this->_defaults;
$this->assign('showMaxMultiple', TRUE);
if ($this->_action == CRM_Core_Action::ADD) {
*
* @return array of relationship name.
*/
- static function getFormattedList(&$list) {
+ public static function getFormattedList(&$list) {
$relName = array();
foreach ($list as $listItemKey => $itemValue) {
* @return void
* @acess protected
*/
- function preProcess() {
+ public function preProcess() {
$this->_srcFID = CRM_Utils_Request::retrieve('fid', 'Positive',
$this, TRUE
);
*
* @return array|bool
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$self->_dstGID = $fields['dst_group_id'];
$tmp = CRM_Core_BAO_CustomField::_moveFieldValidate($self->_srcFID, $self->_dstGID);
$errors = array();
* @return array array of default values
* @access public
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = $fieldDefaults = array();
if (isset($this->_id)) {
$params = array('id' => $this->_id);
* @static
* @access public
*/
- static function formRule($fields, $files, $form) {
+ public static function formRule($fields, $files, $form) {
$optionLabel = $fields['label'];
$optionValue = $fields['value'];
$fieldId = $form->_fid;
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
// get the controller vars
$this->_groupId = $this->get('groupId');
$this->_fieldId = $this->get('fieldId');
* @return array the default array reference
* @access protected
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
CRM_Core_BAO_CustomGroup::setDefaults($this->_groupTree, $defaults, FALSE, FALSE);
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
// lets get around the time limit issue if possible, CRM-2113
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$config = CRM_Core_Config::singleton();
$defaults = array(
'contactType' => CRM_Import_Parser::CONTACT_INDIVIDUAL,
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$errors = array();
$fieldMessage = NULL;
if (!array_key_exists('savedMapping', $fields)) {
* @return void
* @access public
*/
- function setActiveFields($fieldKeys) {
+ public function setActiveFields($fieldKeys) {
$this->_activeFieldCount = count($fieldKeys);
foreach ($fieldKeys as $key) {
if (empty($this->_fields[$key])) {
* @return array (reference ) associative array of name/value pairs
* @access public
*/
- function &getActiveFieldParams() {
+ public function &getActiveFieldParams() {
$params = array();
for ($i = 0; $i < $this->_activeFieldCount; $i++) {
if (isset($this->_activeFields[$i]->_value)
* @return void
* @access public
*/
- function set($store, $mode = self::MODE_SUMMARY) {
+ public function set($store, $mode = self::MODE_SUMMARY) {
$store->set('fileSize', $this->_fileSize);
$store->set('lineCount', $this->_lineCount);
$store->set('seperator', $this->_separator);
/**
* Class constructor
*/
- function __construct(&$mapperKeys, $mapperLocType = NULL, $mapperPhoneType = NULL) {
+ public function __construct(&$mapperKeys, $mapperLocType = NULL, $mapperPhoneType = NULL) {
parent::__construct();
$this->_mapperKeys = &$mapperKeys;
}
- function setFields() {
+ public function setFields() {
$customGroupID = $this->_multipleCustomData;
$importableFields = $this->getGroupFieldsForImport($customGroupID, $this);
$this->_fields = array_merge(array('do_not_import' => array('title' => ts('- do not import -')), 'contact_id' => array('title' => ts('Contact ID'))), $importableFields);
* @return void
* @access public
*/
- function init() {
+ public function init() {
$this->setFields();
$fields = $this->_fields;
$hasLocationType = FALSE;
* @return boolean
* @access public
*/
- function mapField(&$values) {
+ public function mapField(&$values) {
return CRM_Import_Parser::VALID;
}
* @return boolean the result of this processing
* @access public
*/
- function preview(&$values) {
+ public function preview(&$values) {
return $this->summary($values);
}
* (non-PHPdoc)
* @see CRM_Custom_Import_Parser_BaseClass::summary()
*/
- function summary(&$values) {
+ public function summary(&$values) {
$erroneousField = NULL;
$response = $this->setActiveFieldValues($values, $erroneousField);
$errorRequired = FALSE;
* @return boolean the result of this processing
* @access public
*/
- function import($onDuplicate, &$values) {
+ public function import($onDuplicate, &$values) {
$response = $this->summary($values);
if ($response != CRM_Import_Parser::VALID) {
$importRecordParams = array(
* Although the api will accept any strtotime valid string CiviCRM accepts at least one date format
* not supported by strtotime so we should run this through a conversion
*/
- function formatDateParams() {
+ public function formatDateParams() {
$session = CRM_Core_Session::singleton();
$dateType = $session->get('dateTypes');
$setDateFields = array_intersect_key($this->_params, array_flip($this->_dateFields));
* Set import entity
* @param string $entity
*/
- function setEntity($entity) {
+ public function setEntity($entity) {
$this->_entity = $entity;
$this->_multipleCustomData = $entity;
}
* @return void
* @access public
*/
- function fini() {}
+ public function fini() {}
/**
* Return the field ids and names (with groups) for import purpose.
* @access public
* @static
*/
- function getGroupFieldsForImport( $id ) {
+ public function getGroupFieldsForImport( $id ) {
$importableFields = array();
$params = array('custom_group_id' => $id);
$allFields = civicrm_api3('custom_field', 'get', $params);
* @return array array of action links that we need to display for the browse screen
* @access public
*/
- function &actionLinks() {
+ public function &actionLinks() {
if (!isset(self::$_actionLinks)) {
self::$_actionLinks = array(
CRM_Core_Action::UPDATE => array(
* @return void
* @access public
*/
- function browse() {
+ public function browse() {
$resourceManager = CRM_Core_Resources::singleton();
if (!empty($_GET['new']) && $resourceManager->ajaxPopupsEnabled) {
$resourceManager->addScriptFile('civicrm', 'js/crm.addNew.js', 999, 'html-header');
* @return void
* @access public
*/
- function edit($action) {
+ public function edit($action) {
// create a simple controller for editing custom dataCRM/Custom/Page/Field.php
$controller = new CRM_Core_Controller_Simple('CRM_Custom_Form_Field', ts('Custom Field'), $action);
* @return void
* @access public
*/
- function run() {
+ public function run() {
$id = CRM_Utils_Request::retrieve('id', 'Positive',
* @return void
* @access public
*/
- function preview($id) {
+ public function preview($id) {
$controller = new CRM_Core_Controller_Simple('CRM_Custom_Form_Preview', ts('Preview Custom Data'), CRM_Core_Action::PREVIEW);
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/admin/custom/group/field', 'reset=1&action=browse&gid=' . $this->_gid));
* @return array array of action links that we need to display for the browse screen
* @access public
*/
- function &actionLinks() {
+ public function &actionLinks() {
// check if variable _actionsLinks is populated
if (!isset(self::$_actionLinks)) {
self::$_actionLinks = array(
* @access public
*
*/
- function run() {
+ public function run() {
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String',
// default to 'browse'
* @return void
* @access public
*/
- function edit($id, $action) {
+ public function edit($id, $action) {
// create a simple controller for editing custom data
$controller = new CRM_Core_Controller_Simple('CRM_Custom_Form_Group', ts('Custom Set'), $action);
* @return void
* @access public
*/
- function preview($id) {
+ public function preview($id) {
$controller = new CRM_Core_Controller_Simple('CRM_Custom_Form_Preview', ts('Preview Custom Data'), NULL);
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/admin/custom/group', 'action=browse'));
* @return void
* @access public
*/
- function browse($action = NULL) {
+ public function browse($action = NULL) {
// get all custom groups sorted by weight
$customGroup = array();
$dao = new CRM_Core_DAO_CustomGroup();
* @return array array of action links that we need to display for the browse screen
* @access public
*/
- function &actionLinks() {
+ public function &actionLinks() {
if (!isset(self::$_actionLinks)) {
self::$_actionLinks = array(
CRM_Core_Action::UPDATE => array(
* @return void
* @access public
*/
- function browse() {
+ public function browse() {
//get the default value from custom fields
$customFieldBAO = new CRM_Core_BAO_CustomField();
$customFieldBAO->id = $this->_fid;
* @return void
* @access public
*/
- function edit($action) {
+ public function edit($action) {
// create a simple controller for editing custom data
$controller = new CRM_Core_Controller_Simple('CRM_Custom_Form_Option', ts('Custom Option'), $action);
* @return void
* @access public
*/
- function run() {
+ public function run() {
// get the field id
$this->_fid = CRM_Utils_Request::retrieve('fid', 'Positive',
*
* @access public
*/
- function run() {
+ public function run() {
$session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
$this->assign('contactID', $contactID);
*
* @access public
*/
- function run() {
+ public function run() {
$context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'dashlet');
$this->assign('context', $context);
*
* @access public
*/
- function run() {
+ public function run() {
$context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'dashlet');
$this->assign('context', $context);
*
* @access public
*/
- function run() {
+ public function run() {
//check for civicase access.
if (!CRM_Case_BAO_Case::accessCiviCase()) {
*
* @access public
*/
- function run() {
+ public function run() {
$context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'dashlet');
$this->assign('context', $context);
*
* @return string
*/
- static function internalFilters( $rg, $strID1 = 'contact1.id', $strID2 = 'contact2.id' ) {
+ public static function internalFilters( $rg, $strID1 = 'contact1.id', $strID2 = 'contact2.id' ) {
// Add a contact id filter for dedupe by group requests and add logic
// to remove duplicate results with opposing orders, i.e. 1,2 and 2,1
if( !empty($rg->contactIds) ) {
*
* @return array
*/
- static function record($rg) {
+ public static function record($rg) {
$civicrm_contact = CRM_Utils_Array::value('civicrm_contact', $rg->params);
$civicrm_address = CRM_Utils_Array::value('civicrm_address', $rg->params);
*
* @return array
*/
- static function internal($rg) {
+ public static function internal($rg) {
$query = "
SELECT contact1.id id1, contact2.id id2, {$rg->threshold} weight
FROM civicrm_contact AS contact1
*
* @return array
*/
- static function record($rg) {
+ public static function record($rg) {
$civicrm_contact = CRM_Utils_Array::value('civicrm_contact', $rg->params, array());
$civicrm_email = CRM_Utils_Array::value('civicrm_email', $rg->params, array());
*
* @return array
*/
- static function internal($rg) {
+ public static function internal($rg) {
$query = "
SELECT contact1.id as id1, contact2.id as id2, {$rg->threshold} as weight
FROM civicrm_contact as contact1
*
* @return array
*/
- static function record($rg) {
+ public static function record($rg) {
$civicrm_email = CRM_Utils_Array::value('civicrm_email', $rg->params, array());
$params = array(
*
* @return array
*/
- static function internal($rg) {
+ public static function internal($rg) {
$query = "
SELECT contact1.id as id1, contact2.id as id2, {$rg->threshold} as weight
FROM civicrm_contact as contact1
* An alternative version which might perform a lot better
* than the above. Will need to do some testing
*/
- static function internalOptimized($rg) {
+ public static function internalOptimized($rg) {
$sql = "
CREATE TEMPORARY TABLE emails (
email varchar(255),
*
* @return string SQL query performing the search
*/
- function sql() {
+ public function sql() {
if ($this->params &&
(!array_key_exists($this->rule_table, $this->params) ||
!array_key_exists($this->rule_field, $this->params[$this->rule_table])
* @return rule fields array associated to rule group
* @access public
*/
- static function dedupeRuleFields($params) {
+ public static function dedupeRuleFields($params) {
$rgBao = new CRM_Dedupe_BAO_RuleGroup();
$rgBao->used = $params['used'];
$rgBao->contact_type = $params['contact_type'];
*
* @return bool
*/
- static function validateContacts($cid, $oid) {
+ public static function validateContacts($cid, $oid) {
if (!$cid || !$oid) {
return;
}
*
* @return array a table-keyed array of field-keyed arrays holding supported fields' titles
*/
- static function &supportedFields($requestedType) {
+ public static function &supportedFields($requestedType) {
static $fields = NULL;
if (!$fields) {
// this is needed, as we're piggy-backing importableFields() below
/**
* Return the SQL query for dropping the temporary table.
*/
- function tableDropQuery() {
+ public function tableDropQuery() {
return 'DROP TEMPORARY TABLE IF EXISTS dedupe';
}
* Return a set of SQL queries whose cummulative weights will mark matched
* records for the RuleGroup::threasholdQuery() to retrieve.
*/
- function tableQuery() {
+ public function tableQuery() {
// make sure we've got a fetched dbrecord, not sure if this is enforced
if (!$this->name == NULL || $this->is_reserved == NULL) {
$this->find(TRUE);
return $queries;
}
- function fillTable() {
+ public function fillTable() {
// get the list of queries handy
$tableQueries = $this->tableQuery();
*
* @return array
*/
- static function isQuerySetInclusive($tableQueries, $threshold, $exclWeightSum = array()) {
+ public static function isQuerySetInclusive($tableQueries, $threshold, $exclWeightSum = array()) {
$input = array();
foreach ($tableQueries as $key => $query) {
$input[] = substr($key, strrpos($key, '.') + 1);
/**
* @param $tableQueries
*/
- static function orderByTableCount(&$tableQueries) {
+ public static function orderByTableCount(&$tableQueries) {
static $tableCount = array();
$tempArray = array();
* Multi-Site dedupe for public pages.
*
*/
- function thresholdQuery($checkPermission = TRUE) {
+ public function thresholdQuery($checkPermission = TRUE) {
$this->_aclFrom = '';
// CRM-6603: anonymous dupechecks side-step ACLs
$this->_aclWhere = ' AND is_deleted = 0 ';
*
* @return array (rule field => weight) array and threshold associated to rule group@access public
*/
- static function dedupeRuleFieldsWeight($params) {
+ public static function dedupeRuleFieldsWeight($params) {
$rgBao = new CRM_Dedupe_BAO_RuleGroup();
$rgBao->contact_type = $params['contact_type'];
if (CRM_Utils_Array::value('id', $params)) {
* Get all of the combinations of fields that would work with a rule
*/
- static function combos($rgFields, $threshold, &$combos, $running = array()) {
+ public static function combos($rgFields, $threshold, &$combos, $running = array()) {
foreach ($rgFields as $rgField => $weight) {
unset($rgFields[$rgField]);
$diff = $threshold - $weight;
*
* @return array id => "nice name" of rule group
*/
- static function getByType($contactType = NULL) {
+ public static function getByType($contactType = NULL) {
$dao = new CRM_Dedupe_DAO_RuleGroup();
if ($contactType) {
*
* @return array array of (cid1, cid2, weight) dupe triples
*/
- static function dupes($rgid, $cids = array()) {
+ public static function dupes($rgid, $cids = array()) {
$rgBao = new CRM_Dedupe_BAO_RuleGroup();
$rgBao->id = $rgid;
$rgBao->contactIds = $cids;
*
* @return array array of (cid1, cid2, weight) dupe triples
*/
- static function dupesInGroup($rgid, $gid) {
+ public static function dupesInGroup($rgid, $gid) {
$cids = array_keys(CRM_Contact_BAO_Group::getMember($gid));
if ( !empty($cids) ) {
return self::dupes($rgid, $cids);
*
* @return array array of dupe contact_ids
*/
- static function dupesOfContact($cid, $used = 'Unsupervised', $ctype = NULL) {
+ public static function dupesOfContact($cid, $used = 'Unsupervised', $ctype = NULL) {
// if not provided, fetch the contact type from the database
if (!$ctype) {
$dao = new CRM_Contact_DAO_Contact();
*
* @return array valid $params array for dedupe
*/
- static function formatParams($fields, $ctype) {
+ public static function formatParams($fields, $ctype) {
$flat = array();
CRM_Utils_Array::flatten($fields, $flat);
/**
* @return array
*/
- static function relTables() {
+ public static function relTables() {
static $relTables;
$config = CRM_Core_Config::singleton();
/**
* Returns the related tables groups for which a contact has any info entered
*/
- static function getActiveRelTables($cid) {
+ public static function getActiveRelTables($cid) {
$cid = (int) $cid;
$groups = array();
/**
* Return tables and their fields referencing civicrm_contact.contact_id explicitly
*/
- static function cidRefs() {
+ public static function cidRefs() {
static $cidRefs;
if (!$cidRefs) {
$sql = "
/**
* Return tables and their fields referencing civicrm_contact.contact_id with entity_id
*/
- static function eidRefs() {
+ public static function eidRefs() {
static $eidRefs;
if (!$eidRefs) {
// FIXME: this should be generated dynamically from the schema
/**
* Return tables using locations
*/
- static function locTables() {
+ public static function locTables() {
static $locTables;
if (!$locTables) {
$locTables = array( 'civicrm_email', 'civicrm_address', 'civicrm_phone' );
* @param string $request 'relTables' or 'cidRefs'
* @see CRM-13836
*/
- static function getMultiValueCustomSets($request) {
+ public static function getMultiValueCustomSets($request) {
static $data = NULL;
if ($data === NULL) {
$data = array(
* Tables which require custom processing should declare functions to call here.
* Doing so will override normal processing.
*/
- static function cpTables() {
+ public static function cpTables() {
static $tables;
if (!$tables) {
$tables = array(
/**
* Return payment related table.
*/
- static function paymentTables() {
+ public static function paymentTables() {
static $tables;
if (!$tables) {
$tables = array('civicrm_pledge', 'civicrm_membership', 'civicrm_participant');
/**
* Return payment update Query.
*/
- static function paymentSql($tableName, $mainContactId, $otherContactId) {
+ public static function paymentSql($tableName, $mainContactId, $otherContactId) {
$sqls = array();
if (!$tableName || !$mainContactId || !$otherContactId) {
return $sqls;
*
* @return array
*/
- static function operationSql($mainId, $otherId, $tableName, $tableOperations = array(), $mode = 'add') {
+ public static function operationSql($mainId, $otherId, $tableName, $tableOperations = array(), $mode = 'add') {
$sqls = array();
if (!$tableName || !$mainId || !$otherId) {
return $sqls;
*
* @static
*/
- static function moveContactBelongings($mainId, $otherId, $tables = FALSE, $tableOperations = array()) {
+ public static function moveContactBelongings($mainId, $otherId, $tables = FALSE, $tableOperations = array()) {
$cidRefs = self::cidRefs();
$eidRefs = self::eidRefs();
$cpTables = self::cpTables();
* @return array
* @static
*/
- static function findDifferences($main, $other) {
+ public static function findDifferences($main, $other) {
$result = array(
'contact' => array(),
'custom' => array(),
* @static
* @access public
*/
- static function batchMerge($rgid, $gid = NULL, $mode = 'safe', $autoFlip = TRUE, $redirectForPerformance = FALSE) {
+ public static function batchMerge($rgid, $gid = NULL, $mode = 'safe', $autoFlip = TRUE, $redirectForPerformance = FALSE) {
$contactType = CRM_Core_DAO::getFieldValue('CRM_Dedupe_DAO_RuleGroup', $rgid, 'contact_type');
$cacheKeyString = "merge {$contactType}";
$cacheKeyString .= $rgid ? "_{$rgid}" : '_0';
* @static
* @access public
*/
- static function merge($dupePairs = array(), $cacheParams = array(), $mode = 'safe',
+ public static function merge($dupePairs = array(), $cacheParams = array(), $mode = 'safe',
$autoFlip = TRUE, $redirectForPerformance = FALSE
) {
$cacheKeyString = CRM_Utils_Array::value('cache_key_string', $cacheParams);
* @static
* @access public
*/
- static function skipMerge($mainId, $otherId, &$migrationInfo, $mode = 'safe') {
+ public static function skipMerge($mainId, $otherId, &$migrationInfo, $mode = 'safe') {
$conflicts = array();
$migrationData = array(
'old_migration_info' => $migrationInfo,
* @static
* @access public
*/
- static function getRowsElementsAndInfo($mainId, $otherId) {
+ public static function getRowsElementsAndInfo($mainId, $otherId) {
$qfZeroBug = 'e8cddb72-a257-11dc-b9cc-0016d3330ee9';
// Fetch contacts
* @static
* @access public
*/
- static function moveAllBelongings($mainId, $otherId, $migrationInfo) {
+ public static function moveAllBelongings($mainId, $otherId, $migrationInfo) {
if (empty($migrationInfo)) {
return FALSE;
}
/**
* @return array of field names which will be compared, so everything except ID.
*/
- static function getContactFields() {
+ public static function getContactFields() {
$contactFields = CRM_Contact_DAO_Contact::fields();
$invalidFields = array('api_key', 'contact_is_deleted', 'created_date', 'display_name', 'hash', 'id', 'modified_date',
'primary_contact_id', 'sort_name', 'user_unique_id');
*
* @param contactId
*/
- static function addMembershipToRealtedContacts($contactID) {
+ public static function addMembershipToRealtedContacts($contactID) {
$dao = new CRM_Member_DAO_Membership();
$dao->contact_id = $contactID;
$dao->is_test = 0;
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$event = new CRM_Event_DAO_Event();
$event->copyValues($params);
if ($event->find(TRUE)) {
* @return Object DAO object on sucess, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Event_DAO_Event', $id, 'is_active', $is_active);
}
*
* @return object
*/
- static function add(&$params) {
+ public static function add(&$params) {
CRM_Utils_System::flushCache();
$financialTypeId = NULL;
if (!empty($params['id'])) {
* @static
*
*/
- static function del($id) {
+ public static function del($id) {
if (!$id) {
return NULL;
}
* @access public
* @static
*/
- static function deleteEventLocBlock($locBlockId, $eventId = NULL) {
+ public static function deleteEventLocBlock($locBlockId, $eventId = NULL) {
$query = "SELECT count(ce.id) FROM civicrm_event ce WHERE ce.loc_block_id = $locBlockId";
if ($eventId) {
*
* @return array Array of event summary values
*/
- static function getEventSummary() {
+ public static function getEventSummary() {
$eventSummary = $eventIds = array();
$config = CRM_Core_Config::singleton();
* @static
* @access public
*/
- static function &getMapInfo(&$id) {
+ public static function &getMapInfo(&$id) {
$sql = "
SELECT
* @return void
* @access public
*/
- static function copy($id, $newEvent = NULL, $afterCreate = FALSE) {
+ public static function copy($id, $newEvent = NULL, $afterCreate = FALSE) {
$defaults = $eventValues = array();
* This is sometimes called in a loop (during event search)
* hence we cache the values to prevent repeated calls to the db
*/
- static function isMonetary($id) {
+ public static function isMonetary($id) {
static $isMonetary = array();
if (!array_key_exists($id, $isMonetary)) {
$isMonetary[$id] = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event',
* This is sometimes called in a loop (during event search)
* hence we cache the values to prevent repeated calls to the db
*/
- static function usesPriceSet($id) {
+ public static function usesPriceSet($id) {
static $usesPriceSet = array();
if (!array_key_exists($id, $usesPriceSet)) {
$usesPriceSet[$id] = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $id);
* @return void
* @access public
*/
- static function sendMail($contactID, &$values, $participantId, $isTest = FALSE, $returnMessageText = FALSE) {
+ public static function sendMail($contactID, &$values, $participantId, $isTest = FALSE, $returnMessageText = FALSE) {
$template = CRM_Core_Smarty::singleton();
$gIds = array(
* @access public
* @static
*/
- static function displayProfile(&$params, $gid, &$groupTitle, &$values, &$profileFields = array()) {
+ public static function displayProfile(&$params, $gid, &$groupTitle, &$values, &$profileFields = array()) {
if ($gid) {
$config = CRM_Core_Config::singleton();
$session = CRM_Core_Session::singleton();
/**
* @return array
*/
- static function getLocationEvents() {
+ public static function getLocationEvents() {
$events = array();
$query = "
*
* @return int|null|string
*/
- static function countEventsUsingLocBlockId($locBlockId) {
+ public static function countEventsUsingLocBlockId($locBlockId) {
if (!$locBlockId) {
return 0;
}
* @param integer $eventID
* @return boolean
*/
- static function validRegistrationRequest($values, $eventID) {
+ public static function validRegistrationRequest($values, $eventID) {
// check that the user has permission to register for this event
$hasPermission = CRM_Core_Permission::event(CRM_Core_Permission::EDIT,
$eventID, 'register for events'
*
* @return bool
*/
- static function validRegistrationDate(&$values) {
+ public static function validRegistrationDate(&$values) {
// make sure that we are between registration start date and registration end date
$startDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('registration_start_date', $values));
$endDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('registration_end_date', $values));
*
* @return bool
*/
- static function showHideRegistrationLink($values) {
+ public static function showHideRegistrationLink($values) {
$session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
*
* @return bool
*/
- static function checkRegistration($params) {
+ public static function checkRegistration($params) {
$alreadyRegistered = FALSE;
if (empty($params['contact_id'])) {
return $alreadyRegistered;
* @access public
* @static
*/
- static function checkPermission($eventId = NULL, $type = CRM_Core_Permission::VIEW) {
+ public static function checkPermission($eventId = NULL, $type = CRM_Core_Permission::VIEW) {
static $permissions = NULL;
if (empty($permissions)) {
* @access public
* @static
*/
- static function getFromEmailIds($eventId = NULL) {
+ public static function getFromEmailIds($eventId = NULL) {
$fromEmailValues['from_email_id'] = CRM_Core_BAO_Email::getFromEmail();
if ($eventId) {
* @access public
* @static
*/
- static function eventTotalSeats($eventId, $extraWhereClause = NULL) {
+ public static function eventTotalSeats($eventId, $extraWhereClause = NULL) {
if (empty($eventId)) {
return 0;
}
*
* @return array of custom data defaults.
*/
- static function getTemplateDefaultValues($templateId) {
+ public static function getTemplateDefaultValues($templateId) {
$defaults = array();
if (!$templateId) {
return $defaults;
*
* @return object
*/
- static function get_sub_events($event_id) {
+ public static function get_sub_events($event_id) {
$params = array('parent_event_id' => $event_id);
$defaults = array();
return CRM_Event_BAO_Event::retrieve($params, $defaults);
* @param int $eventID event id.
* @param int $eventCampaignID campaign id of that event
*/
- static function updateParticipantCampaignID($eventID, $eventCampaignID) {
+ public static function updateParticipantCampaignID($eventID, $eventCampaignID) {
$params = array();
$params[1] = array($eventID, 'Integer');
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function &add(&$params) {
+ public static function &add(&$params) {
if (!empty($params['id'])) {
CRM_Utils_Hook::pre('edit', 'Participant', $params['id'], $params);
* @access public
* @static
*/
- static function getValues(&$params, &$values, &$ids) {
+ public static function getValues(&$params, &$values, &$ids) {
if (empty($params)) {
return NULL;
}
* @access public
* @static
*/
- static function create(&$params) {
+ public static function create(&$params) {
$transaction = new CRM_Core_Transaction();
$status = NULL;
* @static
* @access public
*/
- static function pendingToConfirmSpaces($eventId) {
+ public static function pendingToConfirmSpaces($eventId) {
$emptySeats = 0;
if (!$eventId) {
return $emptySeats;
* @access public
* @static
*/
- static function &importableFields($contactType = 'Individual', $status = TRUE, $onlyParticipant = FALSE) {
+ public static function &importableFields($contactType = 'Individual', $status = TRUE, $onlyParticipant = FALSE) {
if (!self::$_importableFields) {
if (!$onlyParticipant) {
if (!$status) {
* @access public
* @static
*/
- static function &exportableFields() {
+ public static function &exportableFields() {
if (!self::$_exportableFields) {
if (!self::$_exportableFields) {
self::$_exportableFields = array();
* @static
* @access public
*/
- static function participantDetails($participantId) {
+ public static function participantDetails($participantId) {
$query = "
SELECT civicrm_contact.sort_name as name, civicrm_event.title as title, civicrm_contact.id as cid
FROM civicrm_participant
* @access public
* @static
*/
- static function resolveDefaults(&$defaults, $reverse = FALSE) {
+ public static function resolveDefaults(&$defaults, $reverse = FALSE) {
self::lookupValue($defaults, 'event', CRM_Event_PseudoConstant::event(), $reverse);
self::lookupValue($defaults, 'status', CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label'), $reverse);
self::lookupValue($defaults, 'role', CRM_Event_PseudoConstant::participantRole(), $reverse);
* the api needs the name => value conversion, also the view layer typically
* requires value => name conversion
*/
- static function lookupValue(&$defaults, $property, $lookup, $reverse) {
+ public static function lookupValue(&$defaults, $property, $lookup, $reverse) {
$id = $property . '_id';
$src = $reverse ? $property : $id;
* @access public
* @static
*/
- static function deleteParticipant($id) {
+ public static function deleteParticipant($id) {
CRM_Utils_Hook::pre('delete', 'Participant', $id, CRM_Core_DAO::$_nullArray);
$transaction = new CRM_Core_Transaction();
* @access public
* @static
*/
- static function checkDuplicate($input, &$duplicates) {
+ public static function checkDuplicate($input, &$duplicates) {
$eventId = CRM_Utils_Array::value('event_id', $input);
$contactId = CRM_Utils_Array::value('contact_id', $input);
*
* @return void
*/
- static function fixEventLevel(&$eventLevel) {
+ public static function fixEventLevel(&$eventLevel) {
if ((substr($eventLevel, 0, 1) == CRM_Core_DAO::VALUE_SEPARATOR) &&
(substr($eventLevel, -1, 1) == CRM_Core_DAO::VALUE_SEPARATOR)
) {
* @return array $additionalParticipantIds
* @static
*/
- static function getAdditionalParticipantIds($primaryParticipantId, $excludeCancel = TRUE, $oldStatusId = NULL) {
+ public static function getAdditionalParticipantIds($primaryParticipantId, $excludeCancel = TRUE, $oldStatusId = NULL) {
$additionalParticipantIds = array();
if (!$primaryParticipantId) {
return $additionalParticipantIds;
* @return array $feeDetails
* @static
*/
- function getFeeDetails($participantIds, $hasLineItems = FALSE) {
+ public function getFeeDetails($participantIds, $hasLineItems = FALSE) {
$feeDetails = array();
if (!is_array($participantIds) || empty($participantIds)) {
return $feeDetails;
* @return array $additionalParticipants $displayName => $viewUrl
* @static
*/
- static function getAdditionalParticipants($primaryParticipantID) {
+ public static function getAdditionalParticipants($primaryParticipantID) {
$additionalParticipantIDs = array();
$additionalParticipantIDs = self::getAdditionalParticipantIds($primaryParticipantID);
if (!empty($additionalParticipantIDs)) {
* @access public
* @static
*/
- static function updateParticipantStatus($participantID, $oldStatusID, $newStatusID = NULL, $updatePrimaryStatus = FALSE) {
+ public static function updateParticipantStatus($participantID, $oldStatusID, $newStatusID = NULL, $updatePrimaryStatus = FALSE) {
if (!$participantID || !$oldStatusID) {
return;
}
* @access public
* @static
*/
- static function updateStatus($participantIds, $statusId, $updateRegisterDate = FALSE) {
+ public static function updateStatus($participantIds, $statusId, $updateRegisterDate = FALSE) {
if (!is_array($participantIds) || empty($participantIds) || !$statusId) {
return;
}
* @return string
* @access public
*/
- function updateStatusMessage($participantId, $statusChangeTo, $fromStatusId) {
+ public function updateStatusMessage($participantId, $statusChangeTo, $fromStatusId) {
$statusMsg = NULL;
$results = self::transitionParticipants(array($participantId),
$statusChangeTo, $fromStatusId, TRUE
* @return string
* @access public
*/
- static function eventFullMessage($eventId, $participantId = NULL) {
+ public static function eventFullMessage($eventId, $participantId = NULL) {
$eventfullMsg = $dbStatusId = NULL;
$checkEventFull = TRUE;
if ($participantId) {
* @return true if participant is primary
* @access public
*/
- static function isPrimaryParticipant($participantId) {
+ public static function isPrimaryParticipant($participantId) {
$participant = new CRM_Event_DAO_Participant();
$participant->registered_by_id = $participantId;
* @return true if allowed
* @access public
*/
- static function getValidAdditionalIds($participantId, $oldStatusId, $newStatusId) {
+ public static function getValidAdditionalIds($participantId, $oldStatusId, $newStatusId) {
$additionalParticipantIds = array();
* @access public
* @static
*/
- static function getContactParticipantCount($contactID) {
+ public static function getContactParticipantCount($contactID) {
$query = "SELECT count(*)
FROM civicrm_participant
WHERE civicrm_participant.contact_id = {$contactID} AND
* @access public
* @static
*/
- static function getParticipantIds($contributionId, $excludeCancelled = FALSE) {
+ public static function getParticipantIds($contributionId, $excludeCancelled = FALSE) {
$ids = array();
if (!$contributionId) {
* @access public
* @static
*/
- static function getAdditionalParticipantUrl($participantIds) {
+ public static function getAdditionalParticipantUrl($participantIds) {
foreach ($participantIds as $value) {
$links = array();
$details = self::participantDetails($value);
*
* @static
*/
- static function createDiscountTrxn($eventID, $contributionParams, $feeLevel) {
+ public static function createDiscountTrxn($eventID, $contributionParams, $feeLevel) {
// CRM-11124
$checkDiscount = CRM_Core_BAO_Discount::findSet($eventID,'civicrm_event');
if (!empty($checkDiscount)) {
* @access public
* @static
*/
- static function deleteContactParticipant($contactId) {
+ public static function deleteContactParticipant($contactId) {
$participant = new CRM_Event_DAO_Participant();
$participant->contact_id = $contactId;
$participant->find();
* @param $paidAmount
* @param int $priceSetId
*/
- static function changeFeeSelections($params, $participantId, $contributionId, $feeBlock, $lineItems, $paidAmount, $priceSetId) {
+ public static function changeFeeSelections($params, $participantId, $contributionId, $feeBlock, $lineItems, $paidAmount, $priceSetId) {
$contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$partiallyPaidStatusId = array_search('Partially paid', $contributionStatuses);
$pendingRefundStatusId = array_search('Pending refund', $contributionStatuses);
* @param $paidAmount
* @param int $contributionId
*/
- static function recordAdjustedAmt($updatedAmount, $paidAmount, $contributionId, $taxAmount = NULL) {
+ public static function recordAdjustedAmt($updatedAmount, $paidAmount, $contributionId, $taxAmount = NULL) {
$balanceAmt = $updatedAmount - $paidAmount;
$contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$partiallyPaidStatusId = array_search('Partially paid', $contributionStatuses);
*
* @throws CRM_Core_Exception
*/
- static function addActivityForSelection($participantId, $activityType) {
+ public static function addActivityForSelection($participantId, $activityType) {
$eventId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $participantId, 'event_id');
$contactId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $participantId, 'contact_id');
* @return object the partcipant payment record
* @static
*/
- static function create(&$params, &$ids) {
+ public static function create(&$params, &$ids) {
if (isset($ids['id'])) {
CRM_Utils_Hook::pre('edit', 'ParticipantPayment', $ids['id'], $params);
}
* @static
* @access public
*/
- static function deleteParticipantPayment($params) {
+ public static function deleteParticipantPayment($params) {
$participantPayment = new CRM_Event_DAO_ParticipantPayment();
$valid = FALSE;
*
* @return $this|null
*/
- static function add(&$params) {
+ public static function add(&$params) {
if (empty($params)) {
return NULL;
}
*
* @return $this|null
*/
- static function &create(&$params) {
+ public static function &create(&$params) {
$transaction = new CRM_Core_Transaction();
$statusType = self::add($params);
if (is_a($statusType, 'CRM_Core_Error')) {
*
* @return bool
*/
- static function deleteParticipantStatusType($id) {
+ public static function deleteParticipantStatusType($id) {
// return early if there are participants with this status
$participant = new CRM_Event_DAO_Participant;
$participant->status_id = $id;
*
* @return CRM_Event_DAO_ParticipantStatusType|null
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$result = NULL;
$dao = new CRM_Event_DAO_ParticipantStatusType;
*
* @return bool
*/
- static function setIsActive($id, $isActive) {
+ public static function setIsActive($id, $isActive) {
return CRM_Core_DAO::setFieldValue('CRM_Event_BAO_ParticipantStatusType', $id, 'is_active', $isActive);
}
/**
* @return array
*/
- static function &getFields() {
+ public static function &getFields() {
$fields = array();
$fields = array_merge($fields, CRM_Event_DAO_Event::import());
$fields = array_merge($fields, self::getParticipantFields());
/**
* @return array
*/
- static function &getParticipantFields() {
+ public static function &getParticipantFields() {
$fields = CRM_Event_BAO_Participant::importableFields('Individual', TRUE, TRUE);
return $fields;
}
* @return void
* @access public
*/
- static function select(&$query) {
+ public static function select(&$query) {
if (($query->_mode & CRM_Contact_BAO_Query::MODE_EVENT) ||
CRM_Contact_BAO_Query::componentPresent($query->_returnProperties, 'participant_')
) {
/**
* @param $query
*/
- static function where(&$query) {
+ public static function where(&$query) {
$grouping = NULL;
foreach (array_keys($query->_params) as $id) {
if (empty($query->_params[$id][0])) {
* @param $values
* @param $query
*/
- static function whereClauseSingle(&$values, &$query) {
+ public static function whereClauseSingle(&$values, &$query) {
list($name, $op, $value, $grouping, $wildcard) = $values;
switch ($name) {
case 'event_start_date_low':
*
* @return null|string
*/
- static function from($name, $mode, $side) {
+ public static function from($name, $mode, $side) {
$from = NULL;
switch ($name) {
case 'civicrm_participant':
* @return string
* @access public
*/
- function qill() {
+ public function qill() {
return (isset($this->_qill)) ? $this->_qill : "";
}
/**
* @param CRM_Core_Form $form
*/
- static function buildSearchForm(&$form) {
+ public static function buildSearchForm(&$form) {
$dataURLEventFee = CRM_Utils_System::url('civicrm/ajax/eventFee',
"reset=1",
FALSE, NULL, FALSE
* @param $row
* @param int $id
*/
- static function searchAction(&$row, $id) {}
+ public static function searchAction(&$row, $id) {}
/**
* @param $tables
*/
- static function tableNames(&$tables) {
+ public static function tableNames(&$tables) {
//add participant table
if (!empty($tables['civicrm_event'])) {
$tables = array_merge(array('civicrm_participant' => 1), $tables);
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->style = array('width' => 0.1, 'cap' => 'round', 'join' => 'round', 'dash' => '2,2', 'color' => array(0, 0, 200));
$this->format = '5160';
$this->imgExtension = 'png';
/**
* @param bool $debug
*/
- function setDebug($debug = TRUE) {
+ public function setDebug($debug = TRUE) {
if (!$debug) {
$this->debug = FALSE;
$this->border = 0;
*
* @return string
*/
- function getImageFileName($eventID, $img = FALSE) {
+ public function getImageFileName($eventID, $img = FALSE) {
global $civicrm_root;
$path = "CRM/Event/Badge";
if ($img == FALSE) {
/**
* @param bool $img
*/
- function printBackground($img = FALSE) {
+ public function printBackground($img = FALSE) {
$x = $this->pdf->GetAbsX();
$y = $this->pdf->GetY();
if ($this->debug) {
$this->pdf->MultiCell($this->pdf->width, $this->pdf->lineHeight, $txt);
}
- function pdfExtraFormat() {}
+ public function pdfExtraFormat() {}
/**
* Create labels (pdf)
* @return null
* @access public
*/
- function createLabels(&$participants) {
+ public function createLabels(&$participants) {
$this->pdf = new CRM_Utils_PDF_Label($this->format, 'mm');
$this->pdfExtraFormat();
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
// A4
$pw = 210;
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
// A4
$pw = 210;
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
// A4
$pw = 297;
// $this->setDebug ();
}
- function pdfExtraFormat() {
+ public function pdfExtraFormat() {
$this->pdf->setPageFormat('A4', 'L');
}
/**
* @param $participant
*/
- function add_participant_to_cart($participant) {
+ public function add_participant_to_cart($participant) {
$event_in_cart = $this->get_event_in_cart_by_event_id($participant->event_id);
if (!$event_in_cart) {
$event_in_cart = $this->add_event($participant->event_id);
*
* @return int
*/
- static function compare_event_dates($event_in_cart_1, $event_in_cart_2) {
+ public static function compare_event_dates($event_in_cart_1, $event_in_cart_2) {
$date_1 = CRM_Utils_Date::unixTime($event_in_cart_1->event->start_date);
$date_2 = CRM_Utils_Date::unixTime($event_in_cart_2->event->start_date);
*
* @return int
*/
- function get_participant_index_from_id($participant_id) {
+ public function get_participant_index_from_id($participant_id) {
foreach ($this->events_in_carts as $event_in_cart) {
$index = 0;
foreach ($event_in_cart->participants as $participant) {
*
* @return array|null
*/
- static function get_participant_sessions($main_event_participant_id) {
+ public static function get_participant_sessions($main_event_participant_id) {
$sql = <<<EOS
SELECT sub_event.* FROM civicrm_participant main_participant
JOIN civicrm_event sub_event ON sub_event.parent_event_id = main_participant.event_id
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
* @param bool $useWhere
*/
- function delete($useWhere = false) {
+ public function delete($useWhere = false) {
$this->load_associations();
$contacts_to_delete = array();
foreach ($this->participants as $participant) {
*
* @return mixed
*/
- static function part_key($participant) {
+ public static function part_key($participant) {
return $participant->id;
}
*
* @return array
*/
- static function get_registration_link($event_id) {
+ public static function get_registration_link($event_id) {
$cart = CRM_Event_Cart_BAO_Cart::find_or_create_for_current_session();
$cart->load_associations();
$event_in_cart = $cart->get_event_in_cart_by_event_id($event_id);
/**
* @return bool
*/
- function is_parent_event() {
+ public function is_parent_event() {
return (NULL !== (CRM_Event_BAO_Event::get_sub_events($this->event_id)));
}
*
* @return bool
*/
- function is_child_event($parent_event_id = NULL) {
+ public function is_child_event($parent_event_id = NULL) {
if ($parent_event_id == NULL) {
return $this->event->parent_event_id;
}
/**
* @param null $participant
*/
- function __construct($participant = NULL) {
+ public function __construct($participant = NULL) {
parent::__construct();
$a = (array)$participant;
$this->copyValues($a);
* @return CRM_Event_Cart_BAO_MerParticipant
* @throws Exception
*/
- static function create(&$params) {
+ public static function create(&$params) {
$participantParams = array(
'id' => CRM_Utils_Array::value('id', $params),
'role_id' => self::get_attendee_role_id(),
/**
* @return mixed
*/
- static function get_attendee_role_id() {
+ public static function get_attendee_role_id() {
$roles = CRM_Event_PseudoConstant::participantRole(NULL, "v.label='Attendee'");
$role_names = array_keys($roles);
return end($role_names);
/**
* @return mixed
*/
- static function get_pending_in_cart_status_id() {
+ public static function get_pending_in_cart_status_id() {
$status_types = CRM_Event_PseudoConstant::participantStatus(NULL, "name='Pending in cart'");
$status_names = array_keys($status_types);
return end($status_names);
return array_pop($results);
}
- function load_associations() {
+ public function load_associations() {
$contact_details = CRM_Contact_BAO_Contact::getContactDetails($this->contact_id);
$this->email = $contact_details[1];
}
/**
* @return int
*/
- function get_participant_index() {
+ public function get_participant_index() {
if (!$this->cart) {
$this->cart = CRM_Event_Cart_BAO_Cart::find_by_id($this->cart_id);
$this->cart->load_associations();
*
* @return null
*/
- static function billing_address_from_contact($contact) {
+ public static function billing_address_from_contact($contact) {
foreach ($contact->address as $loc) {
if ($loc['is_billing']) {
return $loc;
/**
* @return CRM_Event_Cart_Form_MerParticipant
*/
- function get_form() {
+ public function get_form() {
return new CRM_Event_Cart_Form_MerParticipant($this);
}
}
* @param bool|int $action
* @param bool $modal
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
}
}
- function loadCart() {
+ public function loadCart() {
if ($this->event_cart_id == NULL) {
$this->cart = CRM_Event_Cart_BAO_Cart::find_or_create_for_current_session();
}
$this->stub_out_and_inherit();
}
- function stub_out_and_inherit() {
+ public function stub_out_and_inherit() {
$transaction = new CRM_Core_Transaction();
foreach ($this->cart->get_main_events_in_carts() as $event_in_cart) {
$transaction->commit();
}
- function checkWaitingList() {
+ public function checkWaitingList() {
foreach ($this->cart->events_in_carts as $event_in_cart) {
$empty_seats = $this->checkEventCapacity($event_in_cart->event_id);
if ($empty_seats === NULL) {
*
* @return bool|int|null|string
*/
- function checkEventCapacity($event_id) {
+ public function checkEventCapacity($event_id) {
$empty_seats = CRM_Event_BAO_Participant::eventFull($event_id, TRUE);
if (is_numeric($empty_seats)) {
return $empty_seats;
/**
* @return bool
*/
- static function is_administrator() {
+ public static function is_administrator() {
global $user;
return CRM_Core_Permission::check('administer CiviCRM');
}
/**
* @return mixed
*/
- function getContactID() {
+ public function getContactID() {
//XXX when do we query 'cid' ?
$tempID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
*
* @return mixed|null
*/
- static function find_contact($fields) {
+ public static function find_contact($fields) {
$dedupe_params = CRM_Dedupe_Finder::formatParams($fields, 'Individual');
$dedupe_params['check_permission'] = FALSE;
$ids = CRM_Dedupe_Finder::dupesByParams($dedupe_params, 'Individual');
*
* @return int|mixed|null
*/
- static function find_or_create_contact($registeringContactID = NULL, $fields = array()) {
+ public static function find_or_create_contact($registeringContactID = NULL, $fields = array()) {
$contact_id = self::find_contact($fields);
if ($contact_id) {
*
* @return mixed
*/
- function getValuesForPage($page_name) {
+ public function getValuesForPage($page_name) {
$container = $this->controller->container();
return $container['values'][$page_name];
}
public $main_participant = NULL;
public $contact_id = NULL;
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$matches = array();
preg_match("/.*_(\d+)_(\d+)/", $this->getAttribute('name'), $matches);
}
}
- function buildQuickForm() {
+ public function buildQuickForm() {
//drupal_add_css(drupal_get_path('module', 'jquery_ui') . '/jquery.ui/themes/base/jquery-ui.css');
//variable_set('jquery_update_compression_type', 'none');
//jquery_ui_add('ui.dialog');
$this->addButtons($buttons);
}
- function postProcess() {
+ public function postProcess() {
$params = $this->controller->exportValues($this->_name);
$main_event_in_cart = $this->cart->get_event_in_cart_by_event_id($this->conference_event->id);
public $price_fields_for_event;
public $_values = NULL;
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$this->cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
}
}
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->price_fields_for_event = array();
foreach ($this->cart->get_main_event_participants() as $participant) {
$form = new CRM_Event_Cart_Form_MerParticipant($participant);
*
* @return null
*/
- static function primary_email_from_contact($contact) {
+ public static function primary_email_from_contact($contact) {
foreach ($contact->email as $email) {
if ($email['is_primary']) {
return $email['email'];
*
* @return array
*/
- function build_price_options($event) {
+ public function build_price_options($event) {
$price_fields_for_event = array();
$base_field_name = "event_{$event->id}_amount";
$price_set_id = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $event->id);
/**
* @return bool
*/
- function validate() {
+ public function validate() {
parent::validate();
if ($this->_errors) {
return FALSE;
return $defaults;
}
- function postProcess() {
+ public function postProcess() {
if (!array_key_exists('event', $this->_submitValues)) {
return;
}
*
* @return mixed
*/
- function registerParticipant($params, &$participant, $event) {
+ public function registerParticipant($params, &$participant, $event) {
$transaction = new CRM_Core_Transaction();
// handle register date CRM-4320
return $participant;
}
- function buildPaymentFields() {
+ public function buildPaymentFields() {
$payment_processor_id = NULL;
$can_pay_later = TRUE;
$pay_later_text = "";
}
}
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->line_items = array();
$this->sub_total = 0;
* @param $event_in_cart
* @param null $class
*/
- function process_event_line_item(&$event_in_cart, $class = NULL) {
+ public function process_event_line_item(&$event_in_cart, $class = NULL) {
$cost = 0;
$price_set_id = CRM_Price_BAO_PriceSet::getFor("civicrm_event", $event_in_cart->event_id);
$amount_level = NULL;
* @param $event_in_cart
* @param null $class
*/
- function add_line_item($event_in_cart, $class = NULL) {
+ public function add_line_item($event_in_cart, $class = NULL) {
$amount = 0;
$cost = 0;
$not_waiting_participants = array();
/**
* @return mixed
*/
- function getDefaultFrom() {
+ public function getDefaultFrom() {
$values = CRM_Core_OptionGroup::values('from_email_address');
return $values[1];
}
* @param $events_in_cart
* @param array $params
*/
- function emailReceipt($events_in_cart, $params) {
+ public function emailReceipt($events_in_cart, $params) {
$contact_details = CRM_Contact_BAO_Contact::getContactDetails($this->payer_contact_id);
$state_province = new CRM_Core_DAO_StateProvince();
$state_province->id = $params["billing_state_province_id-{$this->_bltID}"];
*
* @return array|bool
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
if ($self->payment_required && empty($self->_submitValues['is_pay_later'])) {
/**
* @return bool
*/
- function validate() {
+ public function validate() {
if ($this->is_pay_later) {
$this->_fields['credit_card_number']['is_required'] = FALSE;
$this->_fields['cvv2']['is_required'] = FALSE;
return parent::validate();
}
- function preProcess() {
+ public function preProcess() {
$params = $this->_submitValues;
$this->is_pay_later = CRM_Utils_Array::value('is_pay_later', $params, FALSE) && !CRM_Utils_Array::value('payment_completed', $params);
parent::preProcess();
}
- function postProcess() {
+ public function postProcess() {
$transaction = new CRM_Core_Transaction();
$trxnDetails = NULL;
* @return array
* @throws Exception
*/
- function make_payment(&$params) {
+ public function make_payment(&$params) {
$config = CRM_Core_Config::singleton();
if (isset($params["billing_state_province_id-{$this->_bltID}"]) && $params["billing_state_province_id-{$this->_bltID}"]) {
$params["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($params["billing_state_province_id-{$this->_bltID}"]);
* @return object
* @throws Exception
*/
- function record_contribution(&$mer_participant, &$params, $event) {
+ public function record_contribution(&$mer_participant, &$params, $event) {
if (self::is_administrator() && !empty($params['payment_type'])) {
$params['payment_instrument_id'] = $params['payment_type'];
}
return $contribution;
}
- function saveDataToSession() {
+ public function saveDataToSession() {
$session_line_items = array();
foreach ($this->line_items as $line_item) {
$session_line_item = array();
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = parent::setDefaultValues();
public $line_items = NULL;
public $sub_total = 0;
- function buildLineItems() {
+ public function buildLineItems() {
foreach ($this->cart->events_in_carts as $event_in_cart) {
$event_in_cart->load_location();
}
$this->assign('line_items', $this->line_items);
}
- function buildQuickForm() {
+ public function buildQuickForm() {
$defaults = array();
$ids = array();
$template_params_to_copy = array(
//$this->assign( 'site_contact', "" );
}
- function preProcess() {
+ public function preProcess() {
$this->event_cart_id = $this->get('last_event_cart_id');
$this->loadCart();
//$this->loadParticipants( );
/**
* @param null|object $participant
*/
- function __construct($participant) {
+ public function __construct($participant) {
parent::__construct();
//XXX
$this->participant = $participant;
/**
* @param CRM_Core_Form $form
*/
- function appendQuickForm(&$form) {
+ public function appendQuickForm(&$form) {
$textarea_size = array('size' => 30, 'maxlength' => 60);
$form->add('text', $this->email_field_name(), ts('Email Address'), $textarea_size, TRUE);
*
* @return array
*/
- function get_profile_groups($event_id) {
+ public function get_profile_groups($event_id) {
$ufJoinParams = array(
'entity_table' => 'civicrm_event',
'module' => 'CiviEvent',
/**
* @return array
*/
- function get_participant_custom_data_fields() {
+ public function get_participant_custom_data_fields() {
list($custom_pre_id, $custom_post_id) = self::get_profile_groups($this->participant->event_id);
$pre_fields = $post_fields = array();
/**
* @return string
*/
- function email_field_name() {
+ public function email_field_name() {
return $this->html_field_name("email");
}
*
* @return string
*/
- static function full_field_name($event_id, $participant_id, $field_name) {
+ public static function full_field_name($event_id, $participant_id, $field_name) {
return "event[$event_id][participant][$participant_id][$field_name]";
}
*
* @return string
*/
- function html_field_name($field_name) {
+ public function html_field_name($field_name) {
return self::full_field_name($this->participant->event_id, $this->participant->id, $field_name);
}
/**
* @return string
*/
- function name() {
+ public function name() {
return "Participant {$this->participant->get_participant_index()}";
}
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array(
$this->html_field_name('email') => $this->participant->email,
);
* Class CRM_Event_Cart_Page_AddToCart
*/
class CRM_Event_Cart_Page_AddToCart extends CRM_Core_Page {
- function run() {
+ public function run() {
$transaction = new CRM_Core_Transaction();
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
* Class CRM_Event_Cart_Page_CheckoutAJAX
*/
class CRM_Event_Cart_Page_CheckoutAJAX {
- function add_participant_to_cart() {
+ public function add_participant_to_cart() {
$transaction = new CRM_Core_Transaction();
$cart_id = CRM_Utils_Request::retrieve('cart_id', 'Integer');
$event_id = CRM_Utils_Request::retrieve('event_id', 'Integer');
CRM_Utils_System::civiExit();
}
- function remove_participant_from_cart() {
+ public function remove_participant_from_cart() {
$id = CRM_Utils_Request::retrieve('id', 'Integer');
$participant = CRM_Event_Cart_BAO_MerParticipant::get_by_id($id);
$participant->delete();
* Class CRM_Event_Cart_Page_RemoveFromCart
*/
class CRM_Event_Cart_Page_RemoveFromCart extends CRM_Core_Page {
- function run() {
+ public function run() {
$transaction = new CRM_Core_Transaction();
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$cart = CRM_Event_Cart_BAO_Cart::find_or_create_for_current_session();
/**
* @return string
*/
- function run() {
+ public function run() {
$transaction = new CRM_Core_Transaction();
$cart = CRM_Event_Cart_BAO_Cart::find_or_create_for_current_session();
* @param object $controller
* @param const|int $action
*/
- function __construct($controller, $action = CRM_Core_Action::NONE) {
+ public function __construct($controller, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);
$cart = CRM_Event_Cart_BAO_Cart::find_or_create_for_current_session();
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
$this->_stateMachine = new CRM_Event_StateMachine_Registration($this, $action);
}
}
- function invalidKey() {
+ public function invalidKey() {
$this->invalidKeyRedirect();
}
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
* @return void
* @access public
*/
- static function preProcess(&$form) {
+ public static function preProcess(&$form) {
//as when call come from register.php
if (!$form->_eventId) {
$form->_eventId = CRM_Utils_Request::retrieve('eventId', 'Positive', $form);
*
* @return void
*/
- static function setDefaultValues(&$form) {
+ public static function setDefaultValues(&$form) {
$defaults = array();
if ($form->_eventId) {
*
* @return void
*/
- static function setDefaultPriceSet($participantID, $eventID = NULL, $includeQtyZero = TRUE) {
+ public static function setDefaultPriceSet($participantID, $eventID = NULL, $includeQtyZero = TRUE) {
$defaults = array();
if (!$eventID && $participantID) {
$eventID = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $participantID, 'event_id');
* @return void
* @access public
*/
- static function buildQuickForm(&$form) {
+ public static function buildQuickForm(&$form) {
if ($form->_eventId) {
$form->_isPaidEvent = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $form->_eventId, 'is_monetary');
if ($form->_isPaidEvent) {
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$config = CRM_Core_Config::singleton();
if (in_array('CiviEvent', $config->enableComponents)) {
$this->assign('CiviEvent', TRUE);
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if (isset($this->_id)) {
$params = array('id' => $this->_id);
$this->add('hidden', 'is_template', $this->_isTemplate);
}
- function endPostProcess() {
+ public function endPostProcess() {
// make submit buttons keep the current working tab opened.
if ($this->_action & CRM_Core_Action::UPDATE) {
$className = CRM_Utils_String::getClassName($this->_name);
/**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
if ($this->controller->getPrint() || $this->getVar('_id') <= 0 || $this->_action & CRM_Core_Action::DELETE) {
return parent::getTemplateFileName();
}
/**
* Pre-load libraries required by Online Registration Profile fields
*/
- static function addProfileEditScripts() {
+ public static function addProfileEditScripts() {
CRM_UF_Page_ProfileEditor::registerProfileScripts();
CRM_UF_Page_ProfileEditor::registerSchemas(array('IndividualModel', 'ParticipantModel'));
}
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$parentDefaults = parent::setDefaultValues();
$eventId = $this->_id;
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
//custom data related code
$this->_cdType = CRM_Utils_Array::value('type', $_GET);
$this->assign('cdType', FALSE);
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if ($this->_cdType) {
$tempId = (int) CRM_Utils_Request::retrieve('template_id', 'Integer', $this);
// set template custom data as a default for event, CRM-5596
* @static
* @access public
*/
- static function formRule($values) {
+ public static function formRule($values) {
$errors = array();
if (!$values['is_template']) {
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$parentDefaults = parent::setDefaultValues();
$eventId = $this->_id;
*
* @return void
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Event_Form_ManageEvent_Fee', 'formRule'));
}
* @static
* @access public
*/
- static function formRule($values) {
+ public static function formRule($values) {
$errors = array();
if (!empty($values['is_discount'])) {
$occurDiscount = array_count_values($values['discount_name']);
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$this->_values = $this->get('values');
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = $this->_values;
if (!empty($defaults['loc_block_id'])) {
*
* @return void
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Event_Form_ManageEvent_Location', 'formRule'));
}
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
// check for state/country mapping
$errors = CRM_Contact_Form_Edit_Address::formRule($fields, CRM_Core_DAO::$_nullArray, CRM_Core_DAO::$_nullObject);
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->_addProfileBottom = CRM_Utils_Array::value('addProfileBottom', $_GET, FALSE);
$this->_profileBottomNum = CRM_Utils_Array::value('addProfileNum', $_GET, 0);
$this->_addProfileBottomAdd = CRM_Utils_Array::value('addProfileBottomAdd', $_GET, FALSE);
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if ($this->_addProfileBottom || $this->_addProfileBottomAdd) {
return;
}
*
* @return void
*/
- function setShowHide($defaults) {
+ public function setShowHide($defaults) {
$this->_showHide = new CRM_Core_ShowHideBlocks(array('registration' => 1),
''
);
*
* @static
*/
- function buildRegistrationBlock(&$form) {
+ public function buildRegistrationBlock(&$form) {
$attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event');
$attributes['intro_text']['click_wysiwyg'] = true;
$form->addWysiwyg('intro_text', ts('Introductory Text'), $attributes['intro_text']);
* @param string $label Label
* @param array $configs Optional, for addProfileSelector(), defaults to using getProfileSelectorTypes()
**/
- function buildMultipleProfileBottom(&$form, $count, $prefix = '', $label = 'Include Profile', $configs = null) {
+ 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]";
$label .= '<br />'.ts('(bottom of page)');
*
* @return array( 'allowCoreTypes' => array(), 'allowSubTypes' => array(), 'profileEntities' => array() )
**/
- static function getProfileSelectorTypes() {
+ public static function getProfileSelectorTypes() {
$configs = array(
'allowCoreTypes' => array(),
'allowSubTypes' => array(),
*
* @static
*/
- function buildConfirmationBlock(&$form) {
+ public function buildConfirmationBlock(&$form) {
$attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event');
$attributes['confirm_text']['click_wysiwyg'] = true;
// CRM-11182 - Optional confirmation page for free events
*
* @static
*/
- function buildMailBlock(&$form) {
+ public function buildMailBlock(&$form) {
$form->registerRule('emailList', 'callback', 'emailList', 'CRM_Utils_Rule');
$attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event');
$form->addYesNo('is_email_confirm', ts('Send Confirmation Email?'), NULL, NULL, array('onclick' => "return showHideByValue('is_email_confirm','','confirmEmail','block','radio',false);"));
/**
* @param CRM_Core_Form $form
*/
- function buildThankYouBlock(&$form) {
+ public function buildThankYouBlock(&$form) {
$attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event');
$attributes['thankyou_text']['click_wysiwyg'] = true;
$form->add('text', 'thankyou_title', ts('Title'), $attributes['thankyou_title']);
*
* @return void
*/
- function addRules() {
+ public function addRules() {
if ($this->_addProfileBottom || $this->_addProfileBottomAdd) {
return;
}
* @static
* @access public
*/
- static function formRule($values, $files, $form) {
+ public static function formRule($values, $files, $form) {
if (!empty($values['is_online_registration'])) {
if (!$values['confirm_title']) {
* @param $profileIds
* @return boolean
*/
- static function getEmailFields($profileIds) {
+ public static function getEmailFields($profileIds) {
$emailFields = array();
foreach ($profileIds as $profileId) {
if ($profileId && is_numeric($profileId)) {
* @param $profileIds
* @return boolean
*/
- static function isProfileComplete($profileIds) {
+ public static function isProfileComplete($profileIds) {
$profileReqFields = array();
foreach ($profileIds as $profileId) {
if ($profileId && is_numeric($profileId)) {
* @return boolean
*/
- function canProfilesDedupe($profileIds, $rgId = 0) {
+ public function canProfilesDedupe($profileIds, $rgId = 0) {
// find the unsupervised rule
* Add additional profiles from the form to an array of profile ids.
*
*/
- static function addMultipleProfiles(&$profileIds, $values, $field) {
+ public static function addMultipleProfiles(&$profileIds, $values, $field) {
if ($multipleProfiles = CRM_Utils_Array::value($field, $values)) {
foreach ($multipleProfiles as $profileId) {
$profileIds[] = $profileId;
protected $_parentEventEndDate = NULL;\r
\r
\r
- function preProcess() {\r
+ public function preProcess() {\r
parent::preProcess();\r
CRM_Core_Form_RecurringEntity::preProcess('civicrm_event');\r
$this->assign('currentEventId', $this->_id);\r
*\r
* @return None\r
*/\r
- function setDefaultValues() {\r
+ public function setDefaultValues() {\r
$defaults = array();\r
\r
//Always pass current event's start date by default\r
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$setTab = CRM_Utils_Request::retrieve('setTab', 'Int', $this, FALSE, 0);
$this->setPageTitle(ts('Scheduled Reminder'));
}
- function getTemplateFileName() {
+ public function getTemplateFileName() {
return 'CRM/Admin/Page/ScheduleReminders.tpl';
}
}
\ No newline at end of file
*
* @return array
*/
- static function build(&$form) {
+ public static function build(&$form) {
$tabs = $form->get('tabHeader');
if (!$tabs || empty($_GET['reset'])) {
$tabs = self::process($form);
* @return array
* @throws Exception
*/
- static function process(&$form) {
+ public static function process(&$form) {
if ($form->getVar('_id') <= 0) {
return NULL;
}
/**
* @param $form
*/
- static function reset(&$form) {
+ public static function reset(&$form) {
$tabs = self::process($form);
$form->set('tabHeader', $tabs);
}
*
* @return int|string
*/
- static function getCurrentTab($tabs) {
+ public static function getCurrentTab($tabs) {
static $current = FALSE;
if ($current) {
*
* @return void
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Event_Form_Participant', 'formRule'), $this);
}
* @static
* @access public
*/
- static function formRule($values, $files, $self) {
+ public static function formRule($values, $files, $self) {
// If $values['_qf_Participant_next'] is Delete or
// $values['event_id'] is empty, then return
// instead of proceeding further.
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
return $errors;
}
*
* @return mixed
*/
- function emailReceipt(&$params) {
+ public function emailReceipt(&$params) {
$updatedLineItem = CRM_Price_BAO_LineItem::getLineItems($this->_participantId, 'participant', NULL, FALSE);
$lineItem = array();
if ($updatedLineItem) {
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->_eventId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
* @return void
* @access public
*/
- function assignToTemplate() {
+ public function assignToTemplate() {
//process only primary participant params
$this->_params = $this->get('params');
if (isset($this->_params[0])) {
* @return void
* @access public
*/
- function buildCustom($id, $name, $viewOnly = FALSE) {
+ public function buildCustom($id, $name, $viewOnly = FALSE) {
if ($id) {
$button = substr($this->controller->getButtonName(), -4);
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
*
* @throws Exception
*/
- static function initEventFee(&$form, $eventID) {
+ public static function initEventFee(&$form, $eventID) {
// get price info
// retrive all active price set fields.
* @return void
* @access public
*/
- function confirmPostProcess($contactID = NULL, $contribution = NULL, $payment = NULL) {
+ public function confirmPostProcess($contactID = NULL, $contribution = NULL, $payment = NULL) {
// add/update contact information
$fields = array();
unset($this->_params['note']);
*
* @return null|string
*/
- function checkTemplateFileExists($suffix = '') {
+ public function checkTemplateFileExists($suffix = '') {
if ($this->_eventId) {
$templateName = $this->_name;
if (substr($templateName, 0, 12) == 'Participant_') {
/**
* @return null|string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
$fileName = $this->checkTemplateFileExists();
return $fileName ? $fileName : parent::getTemplateFileName();
}
/**
* @return null|string
*/
- function overrideExtraTemplateFileName() {
+ public function overrideExtraTemplateFileName() {
$fileName = $this->checkTemplateFileExists('extra.');
return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
}
* @param unknown_type $params
* @return multitype:|Ambigous <multitype:, string, string>
*/
- static function validatePriceSet(&$form, $params) {
+ public static function validatePriceSet(&$form, $params) {
$errors = array();
$hasOptMaxValue = FALSE;
if (!is_array($params) || empty($params)) {
/**
* @param int $participantID
*/
- function processFirstParticipant($participantID) {
+ public function processFirstParticipant($participantID) {
$this->_participantId = $participantID;
$this->set('participantId', $this->_participantId);
*
* @param string $redirect
*/
- function checkValidEvent($redirect = NULL) {
+ public function checkValidEvent($redirect = NULL) {
// is the event active (enabled)?
if (!$this->_values['event']['is_active']) {
// form is inactive, die a fatal death
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$participantNo = substr($this->_name, 12);
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = $unsetSubmittedOptions = array();
$discountId = NULL;
//fix for CRM-3088, default value for discount set.
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
//get the button name.
$button = substr($self->controller->getButtonName(), -4);
*
* @return bool
*/
- function validatePaymentValues($self, $fields) {
+ public function validatePaymentValues($self, $fields) {
if (!empty($self->_params[0]['bypass_payment']) ||
$self->_allowWaitlist ||
* @return boolean ture on success.
* @access public
*/
- function isLastParticipant($isButtonJs = FALSE) {
+ public function isLastParticipant($isButtonJs = FALSE) {
$participant = $isButtonJs ? $this->_params[0]['additional_participants'] : $this->_params[0]['additional_participants'] + 1;
if (count($this->_params) == $participant) {
return TRUE;
* Reset values for all options those are full.
*
**/
- function resetElementValue($optionFullIds = array()) {
+ public function resetElementValue($optionFullIds = array()) {
if (!is_array($optionFullIds) ||
empty($optionFullIds) ||
!$this->isSubmitted()
* @param string $elementName
* @param array $optionIds
*/
- function resetSubmittedValue($elementName, $optionIds = array()) {
+ public function resetSubmittedValue($elementName, $optionIds = array()) {
if (empty($elementName) ||
!$this->elementExists($elementName) ||
!$this->getSubmitValue($elementName)
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
// lineItem isn't set until Register postProcess
* @return int
* @access public
*/
- function getAction() {
+ public function getAction() {
if ($this->_action & CRM_Core_Action::PREVIEW) {
return CRM_Core_Action::VIEW | CRM_Core_Action::PREVIEW;
}
$this->addFormRule(array('CRM_Event_Form_Registration_Confirm', 'formRule'), $this);
}
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
$eventFull = CRM_Event_BAO_Participant::eventFull($self->_eventId, FALSE, CRM_Utils_Array::value('has_waitlist', $self->_values['event']));
if ($eventFull && empty($self->_allowConfirmation)) {
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
//CRM-4320.
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if ($this->_paymentProcessorID && $this->_snippet && !($this->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_FORM)) {
// see function comment block for explanation of this. Note that CRM-15555 will require this to look at the billing form fields not the
// billing_mode which
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
//check that either an email or firstname+lastname is included in the form(CRM-9587)
self::checkProfileComplete($fields, $errors, $self->_eventId);
* Check if profiles are complete when event registration occurs(CRM-9587)
*
*/
- static function checkProfileComplete($fields, &$errors, $eventId) {
+ public static function checkProfileComplete($fields, &$errors, $eventId) {
$email = '';
foreach ($fields as $fieldname => $fieldvalue) {
if (substr($fieldname, 0, 6) == 'email-' && $fieldvalue) {
* @return void
* @access public
*/
- static function checkRegistration($fields, &$self, $isAdditional = FALSE, $returnContactId = FALSE, $useDedupeRules = FALSE) {
+ public static function checkRegistration($fields, &$self, $isAdditional = FALSE, $returnContactId = FALSE, $useDedupeRules = FALSE) {
// CRM-3907, skip check for preview registrations
// CRM-4320 participant need to walk wizard
if (!$returnContactId &&
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$this->_params = $this->get('params');
$this->_lineItem = $this->get('lineItem');
* @return int
* @access public
*/
- function getAction() {
+ public function getAction() {
if ($this->_action & CRM_Core_Action::PREVIEW) {
return CRM_Core_Action::VIEW | CRM_Core_Action::PREVIEW;
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->set('searchFormName', 'Search');
/**
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
parent::buildQuickForm();
$this->addElement('text', 'sort_name', ts('Participant Name or Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
* @return void
* @access public
*/
- function postProcess() {
+ public function postProcess() {
if ($this->_done) {
return;
}
* @access public
* @see valid_date
*/
- function addRules() {}
+ public function addRules() {}
/**
* Set the default form values
*
* @return array the default array reference
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$defaults = $this->_formValues;
return $defaults;
}
- function fixFormValues() {
+ public function fixFormValues() {
// if this search has been forced
// then see if there are any get values, and if so over-ride the post values
// note that this means that GET over-rides POST :)
/**
* @return null
*/
- function getFormValues() {
+ public function getFormValues() {
return NULL;
}
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$defaults['eventsByDates'] = 0;
));
}
- function postProcess() {
+ public function postProcess() {
$params = $this->controller->exportValues($this->_name);
$parent = $this->controller->getParent();
$parent->set('searchResult', 1);
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
self::preProcessCommon($this);
}
* @param CRM_Core_Form $form
* @param bool $useTable
*/
- static function preProcessCommon(&$form, $useTable = FALSE) {
+ public static function preProcessCommon(&$form, $useTable = FALSE) {
$form->_participantIds = array();
$values = $form->controller->exportValues($form->get('searchFormName'));
* @return void
* @access public
*/
- function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
+ public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
$this->addButtons(array(
array(
'type' => $nextType,
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
// initialize the task and row fields
parent::preProcess();
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
//create radio buttons to select existing group or add a new group
$options = array(ts('Add Contact To Existing Group'), ts('Create New Group'));
*
* @return array the default array reference
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if ($this->_context === 'amtg') {
*
* @return void
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Event_Form_Task_AddToGroup', 'formRule'));
}
* @static
* @access public
*/
- static function formRule($params) {
+ public static function formRule($params) {
$errors = array();
if (!empty($params['group_option']) && empty($params['title'])) {
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
if ($this->_context == 'view') {
$this->_single = TRUE;
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
CRM_Utils_System::setTitle(ts('Make Name Badges'));
//add select for label
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
/*
* initialize the task and row fields
*/
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$ufGroupId = $this->get('ufGroupId');
if (!$ufGroupId) {
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if (empty($this->_fields)) {
return;
}
*
* @return Ambigous|void
*/
- static function updatePendingOnlineContribution($participantId, $statusId) {
+ public static function updatePendingOnlineContribution($participantId, $statusId) {
if (!$participantId || !$statusId) {
return;
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
// initialize the task and row fields
parent::preProcess();
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
CRM_Utils_System::setTitle(ts('Cancel Registration for Event Participation'));
$session = CRM_Core_Session::singleton();
$this->addDefaultButtons(ts('Continue'), 'done');
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
//check for delete
if (!CRM_Core_Permission::checkActionPermission('CiviEvent', CRM_Core_Action::DELETE)) {
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$deleteParticipants = array(1 => ts('Delete this participant record along with associated participant record(s).'),
2 => ts('Delete only this participant record.'),
);
*
*/
class CRM_Event_Form_Task_ParticipantStatus extends CRM_Event_Form_Task_Batch {
- function buildQuickForm() {
+ 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;
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
// initialize the task and row fields
parent::preProcess();
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$types = array('Participant');
$profiles = CRM_Core_BAO_UFGroup::getProfiles($types, TRUE);
*
* @return void
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Event_Form_Task_PickProfile', 'formRule'));
}
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
return TRUE;
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preprocess();
// set print view, so that print templates are called
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
//
// just need to add a javacript to popup the window for printing
//
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$session = CRM_Core_Session::singleton();
//this is done to unset searchRows variable assign during AddToHousehold and AddToOrganization
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
CRM_Utils_System::setTitle(ts('Smart Group'));
// get the qill
$query = new CRM_Event_BAO_Query($this->get('formValues'));
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$this->_id = $this->get('ssID');
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$params = array();
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$rows = array();
// display name and participation details of participants
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
// lets get around the time limit issue if possible, CRM-2113
* @param string $headerPattern
* @param string $dataPattern
*/
- function __construct($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//') {
+ public function __construct($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//') {
$this->_name = $name;
$this->_title = $title;
$this->_type = $type;
$this->_value = NULL;
}
- function resetValue() {
+ public function resetValue() {
$this->_value = NULL;
}
* The value is in string format. convert the value to the type of this field
* and set the field value with the appropriate type
*/
- function setValue($value) {
+ public function setValue($value) {
$this->_value = $value;
}
/**
* @return bool
*/
- function validate() {
+ public function validate() {
if (CRM_Utils_System::isNull($this->_value)) {
return TRUE;
}
* @static
* @access public
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
$fieldMessage = NULL;
if (!array_key_exists('savedMapping', $fields)) {
* @return void
* @access public
*/
- function setActiveFields($fieldKeys) {
+ public function setActiveFields($fieldKeys) {
$this->_activeFieldCount = count($fieldKeys);
foreach ($fieldKeys as $key) {
if (empty($this->_fields[$key])) {
* @return array (reference ) associative array of name/value pairs
* @access public
*/
- function &getActiveFieldParams() {
+ public function &getActiveFieldParams() {
$params = array();
for ($i = 0; $i < $this->_activeFieldCount; $i++) {
if (isset($this->_activeFields[$i]->_value)
* @param string $headerPattern
* @param string $dataPattern
*/
- function addField($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//') {
+ public function addField($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//') {
if (empty($name)) {
$this->_fields['doNotImport'] = new CRM_Event_Import_Field($name, $title, $type, $headerPattern, $dataPattern);
}
* @return void
* @access public
*/
- function set($store, $mode = self::MODE_SUMMARY) {
+ public function set($store, $mode = self::MODE_SUMMARY) {
$store->set('fileSize', $this->_fileSize);
$store->set('lineCount', $this->_lineCount);
$store->set('seperator', $this->_seperator);
* @return void
* @access public
*/
- static function exportCSV($fileName, $header, $data) {
+ public static function exportCSV($fileName, $header, $data) {
$output = array();
$fd = fopen($fileName, 'w');
/**
* Class constructor
*/
- function __construct(&$mapperKeys, $mapperLocType = NULL, $mapperPhoneType = NULL) {
+ public function __construct(&$mapperKeys, $mapperLocType = NULL, $mapperPhoneType = NULL) {
parent::__construct();
$this->_mapperKeys = &$mapperKeys;
}
* @return void
* @access public
*/
- function init() {
+ public function init() {
$fields = CRM_Event_BAO_Participant::importableFields($this->_contactType, FALSE);
$fields['event_id']['title'] = 'Event ID';
$eventfields = &CRM_Event_BAO_Event::fields();
* @return boolean
* @access public
*/
- function mapField(&$values) {
+ public function mapField(&$values) {
return CRM_Import_Parser::VALID;
}
* @return boolean the result of this processing
* @access public
*/
- function preview(&$values) {
+ public function preview(&$values) {
return $this->summary($values);
}
* @return boolean the result of this processing
* @access public
*/
- function summary(&$values) {
+ public function summary(&$values) {
$erroneousField = NULL;
$response = $this->setActiveFieldValues($values, $erroneousField);
* @return boolean the result of this processing
* @access public
*/
- function import($onDuplicate, &$values) {
+ public function import($onDuplicate, &$values) {
// first make sure this is a valid line
$response = $this->summary($values);
* @return array
* @access public
*/
- function &getImportedParticipations() {
+ public function &getImportedParticipations() {
return $this->_newParticipants;
}
* @return void
* @access public
*/
- function fini() {}
+ public function fini() {}
}
* Building EventFee combo box
* FIXME: This ajax callback could be eliminated in favor of an entityRef field but the priceFieldValue api doesn't currently support filtering on entity_table
*/
- function eventFee() {
+ public function eventFee() {
$name = trim(CRM_Utils_Type::escape($_GET['term'], 'String'));
if (!$name) {
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
CRM_Utils_System::setTitle(ts('CiviEvent'));
$eventSummary = CRM_Event_BAO_Event::getEventSummary();
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
$controller = new CRM_Core_Controller_Simple('CRM_Event_Form_Search', ts('events'), NULL);
* @access public
*
*/
- function run() {
+ public function run() {
//get the event id.
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$config = CRM_Core_Config::singleton();
/**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
if ($this->_id) {
$templateFile = "CRM/Event/Page/{$this->_id}/EventInfo.tpl";
$template = CRM_Core_Page::getTemplate();
*
* @return void
*/
- function run() {
+ public function run() {
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, NULL, 'GET');
$type = CRM_Utils_Request::retrieve('type', 'Positive', $this, FALSE, 0);
$start = CRM_Utils_Request::retrieve('start', 'Positive', $this, FALSE, 0);
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_actionLinks)) {
// helper variable for nicer formatting
$copyExtra = ts('Are you sure you want to make a copy of this Event?');
*
* @return array (reference) of tab links
*/
- static function &tabs($enableCart) {
+ public static function &tabs($enableCart) {
$cacheKey = $enableCart ? 1 : 0;
if (!(self::$_tabLinks)) {
self::$_tabLinks = array();
* @access public
*
*/
- function run() {
+ public function run() {
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String',
// default to 'browse'
*
* @return void
*/
- function browse() {
+ public function browse() {
$this->assign('includeWysiwygEditor', TRUE);
$this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter',
'String',
* @return void
* @access public
*/
- function copy() {
+ public function copy() {
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE, 0, 'GET');
$urlString = 'civicrm/event/manage';
return CRM_Utils_System::redirect(CRM_Utils_System::url($urlString, $urlParams));
}
- function search() {
+ public function search() {
if (isset($this->_action) &
(CRM_Core_Action::ADD |
CRM_Core_Action::UPDATE |
*
* @return string
*/
- function whereClause(&$params, $sortBy = TRUE, $force) {
+ public function whereClause(&$params, $sortBy = TRUE, $force) {
$values = array();
$clauses = array();
$title = $this->get('title');
* @param $whereClause
* @param array $whereParams
*/
- function pager($whereClause, $whereParams) {
+ public function pager($whereClause, $whereParams) {
$params['status'] = ts('Event %%StatusMessage%%');
$params['csvString'] = NULL;
* @param $whereClause
* @param array $whereParams
*/
- function pagerAtoZ($whereClause, $whereParams) {
+ public function pagerAtoZ($whereClause, $whereParams) {
$query = "
SELECT DISTINCT UPPER(LEFT(title, 1)) as sort_name
protected $_eventTitle;
protected $_pager;
- function preProcess() {
+ public function preProcess() {
$this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this, TRUE);
// ensure that there is a particpant type for this
$this->assign('displayRecent', FALSE);
}
- function run() {
+ public function run() {
$this->preProcess();
// get the class name from the participantListingID
*
*/
class CRM_Event_Page_ParticipantListing_Name extends CRM_Event_Page_ParticipantListing_Simple {
- function preProcess() {
+ public function preProcess() {
$this->_participantListingType == 'Name';
parent::preProcess();
*
*/
class CRM_Event_Page_ParticipantListing_NameAndEmail extends CRM_Event_Page_ParticipantListing_Simple {
- function preProcess() {
+ public function preProcess() {
$this->_participantListingType = 'Name and Email';
parent::preProcess();
protected $_pager;
- function preProcess() {
+ public function preProcess() {
$this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this, TRUE);
// ensure that there is a particpant type for this
/**
* @return string
*/
- function run() {
+ public function run() {
$this->preProcess();
$fromClause = "
* @param $whereClause
* @param array $whereParams
*/
- function pager($fromClause, $whereClause, $whereParams) {
+ public function pager($fromClause, $whereClause, $whereParams) {
$params = array();
/**
* @return string
*/
- function orderBy() {
+ public function orderBy() {
static $headers = NULL;
if (!$headers) {
$headers = array();
protected $_pager;
- function preProcess() {
+ public function preProcess() {
$this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this, TRUE);
// retrieve Event Title and include it in page title
/**
* @return string
*/
- function run() {
+ public function run() {
$this->preProcess();
$fromClause = "
* @param $whereClause
* @param array $whereParams
*/
- function pager($fromClause, $whereClause, $whereParams) {
+ public function pager($fromClause, $whereClause, $whereParams) {
$params = array();
/**
* @return string
*/
- function orderBy() {
+ public function orderBy() {
static $headers = NULL;
if (!$headers) {
$headers = array();
* return null
* @access public
*/
- function browse() {
+ public function browse() {
$controller = new CRM_Core_Controller_Simple(
'CRM_Event_Form_Search',
ts('Events'),
* return null
* @access public
*/
- function view() {
+ public function view() {
// build associated contributions
$this->associatedContribution();
* return null
* @access public
*/
- function edit() {
+ public function edit() {
// set https for offline cc transaction
$mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
if ($mode == 'test' || $mode == 'live') {
return $controller->run();
}
- function preProcess() {
+ public function preProcess() {
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
// check if we can process credit card registration
return parent::run();
}
- function setContext() {
+ public function setContext() {
$context = CRM_Utils_Request::retrieve('context',
'String', $this, FALSE, 'search'
);
* return null
* @access public
*/
- function associatedContribution() {
+ public function associatedContribution() {
if (CRM_Core_Permission::access('CiviContribute')) {
$this->assign('accessContribution', TRUE);
$controller = new CRM_Core_Controller_Simple(
* return null
* @access public
*/
- function listParticipations() {
+ public function listParticipations() {
$controller = new CRM_Core_Controller_Simple(
'CRM_Event_Form_Search',
ts('Events'),
* return null
* @access public
*/
- function run() {
+ public function run() {
parent::preProcess();
$this->listParticipations();
}
*
* @return array of status classes, keyed by status type
*/
- static function &participantStatusClass() {
+ public static function &participantStatusClass() {
static $statusClasses = NULL;
if ($statusClasses === NULL) {
* @access public
*
*/
- function setLimit($limit) {
+ public function setLimit($limit) {
$this->_limit = $limit;
}
* @return array
* @access public
*/
- static function &links($qfKey = NULL, $context = NULL, $compContext = NULL) {
+ public static function &links($qfKey = NULL, $context = NULL, $compContext = NULL) {
$extraParams = NULL;
if ($compContext) {
$extraParams .= "&compContext={$compContext}";
*
* @access public
*/
- function getPagerParams($action, &$params) {
+ public function getPagerParams($action, &$params) {
$params['status'] = ts('Event') . ' %%StatusMessage%%';
$params['csvString'] = NULL;
if ($this->_limit) {
* @return int Total number of rows
* @access public
*/
- function getTotalCount($action) {
+ public function getTotalCount($action) {
return $this->_query->searchQuery(0, 0, NULL,
TRUE, FALSE,
FALSE, FALSE,
*
* @return array rows in the given offset and rowCount
*/
- function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
+ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
$result = $this->_query->searchQuery($offset, $rowCount, $sort,
FALSE, FALSE,
FALSE, FALSE,
/**
* @return mixed
*/
- function alphabetQuery() {
+ public function alphabetQuery() {
return $this->_query->searchQuery(NULL, NULL, NULL, FALSE, FALSE, TRUE);
}
/**
* @return string
*/
- function &getQuery() {
+ public function &getQuery() {
return $this->_query;
}
*
* @return string name of the file
*/
- function getExportFileName($output = 'csv') {
+ public function getExportFileName($output = 'csv') {
return ts('CiviCRM Event Search');
}
}
*
* @return \CRM_Event_StateMachine_Registration CRM_Event_StateMachine
*/
- function __construct($controller, $action = CRM_Core_Action::NONE) {
+ public function __construct($controller, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);
$id = CRM_Utils_Request::retrieve('id', 'Positive', $controller, TRUE);
$is_monetary = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $id, 'is_monetary');
/**
* 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 name of the form that will handle the task
* @access protected
*/
- function taskName($controller, $formName = 'Search') {
+ public function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
$value = CRM_Utils_Array::value('task', $_POST);
if (!isset($value)) {
* @return string
* @access public
*/
- function getTaskFormName() {
+ public function getTaskFormName() {
return CRM_Utils_String::getClassName($this->_task);
}
* we dont want to issue a reset of the state session when we are done processing a task
*
*/
- function shouldReset() {
+ public function shouldReset() {
return FALSE;
}
}
* @static
* @access public
*/
- static function &tasks() {
+ public static function &tasks() {
if (!(self::$_tasks)) {
self::$_tasks = array(1 => array(
'title' => ts('Delete Participants'),
* @static
* @access public
*/
- static function &taskTitles() {
+ public static function &taskTitles() {
self::tasks();
$titles = array();
foreach (self::$_tasks as $id => $value) {
* @static
* @access public
*/
- static function &optionalTaskTitle() {
+ public static function &optionalTaskTitle() {
$tasks = array(
14 => self::$_tasks[14]['title'],
);
* @return array set of tasks that are valid for the user
* @access public
*/
- static function &permissionedTaskTitles($permission) {
+ public static function &permissionedTaskTitles($permission) {
$tasks = array();
if (($permission == CRM_Core_Permission::EDIT)
|| CRM_Core_Permission::check('edit event participants')
* @static
* @access public
*/
- static function getTask($value) {
+ public static function getTask($value) {
self::tasks();
if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) {
// make the print task by default
*
* @return string name of the file
*/
- static function getExportFileName($output = 'csv', $mode = CRM_Export_Form_Select::CONTACT_EXPORT) {
+ public static function getExportFileName($output = 'csv', $mode = CRM_Export_Form_Select::CONTACT_EXPORT) {
switch ($mode) {
case CRM_Export_Form_Select::CONTACT_EXPORT:
return ts('CiviCRM Contact Search');
* Handle import error file creation.
*
*/
- static function invoke() {
+ public static function invoke() {
$type = CRM_Utils_Request::retrieve('type', 'Positive', CRM_Core_DAO::$_nullObject);
$parserName = CRM_Utils_Request::retrieve('parser', 'String', CRM_Core_DAO::$_nullObject);
if (empty($parserName) || empty($type)) {
* @param $formValues
* @param $order
*/
- static function exportCustom($customSearchClass, $formValues, $order) {
+ public static function exportCustom($customSearchClass, $formValues, $order) {
$ext = CRM_Extension_System::singleton()->getMapper();
if (!$ext->isExtensionClass($customSearchClass)) {
require_once (str_replace('_', DIRECTORY_SEPARATOR, $customSearchClass) . '.php');
* @param $sqlColumns
* @param $field
*/
- static function sqlColumnDefn(&$query, &$sqlColumns, $field) {
+ public static function sqlColumnDefn(&$query, &$sqlColumns, $field) {
if (substr($field, -4) == '_a_b' || substr($field, -4) == '_b_a') {
return;
}
* @param $details
* @param $sqlColumns
*/
- static function writeDetailsToTable($tableName, &$details, &$sqlColumns) {
+ public static function writeDetailsToTable($tableName, &$details, &$sqlColumns) {
if (empty($details)) {
return;
}
*
* @return string
*/
- static function createTempTable(&$sqlColumns) {
+ public static function createTempTable(&$sqlColumns) {
//creating a temporary table for the search result that need be exported
$exportTempTable = CRM_Core_DAO::createTempTableName('civicrm_export', TRUE);
* @param $sqlColumns
* @param array $exportParams
*/
- static function mergeSameAddress($tableName, &$headerRows, &$sqlColumns, $exportParams) {
+ public static function mergeSameAddress($tableName, &$headerRows, &$sqlColumns, $exportParams) {
// check if any records are present based on if they have used shared address feature,
// and not based on if city / state .. matches.
$sql = "
*
* @return array
*/
- static function _replaceMergeTokens($contactId, $exportParams) {
+ public static function _replaceMergeTokens($contactId, $exportParams) {
$greetings = array();
$contact = NULL;
*
* @return array
*/
- static function _buildMasterCopyArray($sql, $exportParams, $sharedAddress = FALSE) {
+ public static function _buildMasterCopyArray($sql, $exportParams, $sharedAddress = FALSE) {
static $contactGreetingTokens = array();
$addresseeOptions = CRM_Core_OptionGroup::values('addressee');
* @param array $sqlColumns array of names of the table columns of the temp table
* @param string $prefix name of the relationship type that is prefixed to the table columns
*/
- static function mergeSameHousehold($exportTempTable, &$headerRows, &$sqlColumns, $prefix) {
+ public static function mergeSameHousehold($exportTempTable, &$headerRows, &$sqlColumns, $prefix) {
$prefixColumn = $prefix . '_';
$allKeys = array_keys($sqlColumns);
$replaced = array();
* @param null $saveFile
* @param string $batchItems
*/
- static function writeCSVFromTable($exportTempTable, $headerRows, $sqlColumns, $exportMode, $saveFile = null, $batchItems = '') {
+ public static function writeCSVFromTable($exportTempTable, $headerRows, $sqlColumns, $exportMode, $saveFile = null, $batchItems = '') {
$writeHeader = TRUE;
$offset = 0;
$limit = self::EXPORT_ROW_COUNT;
* or have no street address
*
*/
- static function postalMailingFormat($exportTempTable, &$headerRows, &$sqlColumns, $exportParams) {
+ public static function postalMailingFormat($exportTempTable, &$headerRows, &$sqlColumns, $exportParams) {
$whereClause = array();
if (array_key_exists('is_deceased', $sqlColumns)) {
/**
* Build componentPayment fields.
*/
- static function componentPaymentFields() {
+ public static function componentPaymentFields() {
static $componentPaymentFields;
if (!isset( $componentPaymentFields)) {
$componentPaymentFields = array(
* @static
* @access public
*/
- static function formRule($fields, $values, $mappingTypeId) {
+ public static function formRule($fields, $values, $mappingTypeId) {
$errors = array();
if (!empty($fields['saveMapping']) && !empty($fields['_qf_Map_next'])) {
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
//special case for custom search, directly give option to download csv file
$customSearchID = $this->get('customSearchID');
if ($customSearchID) {
* Build mapping form element
*
*/
- function buildMapping() {
+ public function buildMapping() {
switch ($this->_exportMode) {
case CRM_Export_Form_Select::CONTACT_EXPORT:
$exportType = 'Export Contact';
/**
* @return array
*/
- static function getGreetingOptions() {
+ public static function getGreetingOptions() {
$options = array();
$greetings = array(
'postal_greeting' => 'postal_greeting_other',
*
* @return bool
*/
- function validateFiles($key, $extractedZipPath) {
+ public function validateFiles($key, $extractedZipPath) {
$filename = $extractedZipPath . DIRECTORY_SEPARATOR . CRM_Extension_Info::FILENAME;
if (!is_readable($filename)) {
CRM_Core_Session::setStatus(ts('Failed reading data from %1 during installation', array(1 => $filename)), ts('Installation Error'), 'error');
* @param null $label
* @param null $file
*/
- function __construct($key = NULL, $type = NULL, $name = NULL, $label = NULL, $file = NULL) {
+ public function __construct($key = NULL, $type = NULL, $name = NULL, $label = NULL, $file = NULL) {
$this->key = $key;
$this->type = $type;
$this->name = $name;
* @param CRM_Extension_Mapper $mapper
* @param $typeManagers
*/
- function __construct(CRM_Extension_Container_Interface $fullContainer, $defaultContainer, CRM_Extension_Mapper $mapper, $typeManagers) {
+ public function __construct(CRM_Extension_Container_Interface $fullContainer, $defaultContainer, CRM_Extension_Mapper $mapper, $typeManagers) {
$this->fullContainer = $fullContainer;
$this->defaultContainer = $defaultContainer;
$this->mapper = $mapper;
*
* @return bool
*/
- static function hasPending() {
+ public static function hasPending() {
$checks = CRM_Utils_Hook::upgrade('check');
if (is_array($checks)) {
foreach ($checks as $check) {
*
* @return CRM_Queue_Queue
*/
- static function createQueue() {
+ public static function createQueue() {
$queue = CRM_Queue_Service::singleton()->create(array(
'type' => 'Sql',
'name' => self::QUEUE_NAME,
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
if ( !isset( self::$_template ) ) {
self::$_template = CRM_Core_Smarty::singleton();
}
*
* @return mixed
*/
- function export($exportParams) {
+ public function export($exportParams) {
$this->_exportParams = $exportParams;
return $exportParams;
}
/**
* @param null $fileName
*/
- function output($fileName = NULL) {
+ public function output($fileName = NULL) {
switch ($this->getFileExtension()) {
case 'csv':
self::createActivityExport($this->_batchIds, $fileName);
/**
* @return string
*/
- function getMimeType() {
+ public function getMimeType() {
return 'text/plain';
}
/**
* @return string
*/
- function getFileExtension() {
+ public function getFileExtension() {
return 'txt';
}
/**
* @return null
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
return null;
}
/**
* @return object
*/
- static function &getTemplate() {
+ public static function &getTemplate() {
return self::$_template;
}
* @param $var
* @param null $value
*/
- function assign($var, $value = NULL) {
+ public function assign($var, $value = NULL) {
self::$_template->assign($var, $value);
}
*
* @return null
*/
- static function format($s, $type = 'string') {
+ public static function format($s, $type = 'string') {
if (!empty($s)) {
return $s;
}
}
}
- function initiateDownload() {
+ public function initiateDownload() {
$config = CRM_Core_Config::singleton();
//zip files if more than one.
if (count($this->_downloadFile)>1) {
*
* @throws CRM_Core_Exception
*/
- static function createActivityExport($batchIds, $fileName) {
+ public static function createActivityExport($batchIds, $fileName) {
$session = CRM_Core_Session::singleton();
$values = array();
$params = array('id' => $batchIds);
*
* @return bool
*/
- function createZip($files = array(), $destination = NULL, $overwrite = FALSE) {
+ public function createZip($files = array(), $destination = NULL, $overwrite = FALSE) {
//if the zip file already exists and overwrite is false, return false
if (file_exists($destination) && !$overwrite) {
return FALSE;
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
* @param array $exportParams
*/
- function export($exportParams) {
+ public function export($exportParams) {
$export = parent::export($exportParams);
// Save the file in the public directory
*
* @return Object
*/
- function generateExportQuery($batchId) {
+ public function generateExportQuery($batchId) {
$sql = "SELECT
ft.id as financial_trxn_id,
ft.trxn_date,
*
* @return string
*/
- function putFile($export) {
+ public function putFile($export) {
$config = CRM_Core_Config::singleton();
$fileName = $config->uploadDir.'Financial_Transactions_'.$this->_batchIds.'_'.date('YmdHis').'.'.$this->getFileExtension();
$this->_downloadFile[] = $config->customFileUploadDir.CRM_Utils_File::cleanFileName(basename($fileName));
* @param array $values
* @return array
*/
- function formatHeaders($values) {
+ public function formatHeaders($values) {
$arrayKeys = array_keys($values);
$headers = '';
if (!empty($arrayKeys)) {
* @param array $export
*
*/
- function makeCSV($export) {
+ public function makeCSV($export) {
foreach ($export as $batchId => $dao) {
$financialItems = array();
$this->_batchIds = $batchId;
/**
* @return string
*/
- function getFileExtension() {
+ public function getFileExtension() {
return 'csv';
}
- function exportACCNT() {
+ public function exportACCNT() {
}
- function exportCUST() {
+ public function exportCUST() {
}
- function exportTRANS() {
+ public function exportTRANS() {
}
}
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
self::$SEPARATOR = chr(9);
}
/**
* @param array $exportParams
*/
- function export( $exportParams ) {
+ public function export( $exportParams ) {
parent::export( $exportParams );
foreach( self::$complementaryTables as $rct ) {
*
* @return string
*/
- function putFile($out) {
+ public function putFile($out) {
$config = CRM_Core_Config::singleton();
$fileName = $config->uploadDir.'Financial_Transactions_'.$this->_batchIds.'_'.date('YmdHis').'.'.$this->getFileExtension();
$this->_downloadFile[] = $config->customFileUploadDir.CRM_Utils_File::cleanFileName(basename($fileName));
*
* @return Object
*/
- function generateExportQuery($batchId) {
+ public function generateExportQuery($batchId) {
$sql = "SELECT
ft.id as financial_trxn_id,
/**
* @param $export
*/
- function makeIIF($export) {
+ public function makeIIF($export) {
// Keep running list of accounts and contacts used in this batch, since we need to
// include those in the output. Only want to include ones used in the batch, not everything in the db,
// since would increase the chance of messing up user's existing Quickbooks entries.
parent::initiateDownload();
}
- function exportACCNT() {
+ public function exportACCNT() {
self::assign( 'accounts', $this->_exportParams['accounts'] );
}
- function exportCUST() {
+ public function exportCUST() {
self::assign( 'contacts', $this->_exportParams['contacts'] );
}
- function exportTRANS() {
+ public function exportTRANS() {
self::assign( 'journalEntries', $this->_exportParams['journalEntries'] );
}
/**
* @return string
*/
- function getMimeType() {
+ public function getMimeType() {
return 'application/octet-stream';
}
/**
* @return string
*/
- function getFileExtension() {
+ public function getFileExtension() {
return 'iif';
}
/**
* @return string
*/
- function getHookedTemplateFileName() {
+ public function getHookedTemplateFileName() {
return 'CRM/Financial/ExportFormat/IIF.tpl';
}
*
* @return bool|mixed|string
*/
- static function format($s, $type = 'string') {
+ public static function format($s, $type = 'string') {
// If I remember right there's a couple things:
// NOTEPAD field needs to be surrounded by quotes and then get rid of double quotes inside, also newlines should be literal \n, and ditch any ascii 0x0d's.
// Date handling has changed over the years. It used to only understand mm/dd/yy but I think now it might depend on your OS settings. Sometimes mm/dd/yyyy works but sometimes it wants yyyy/mm/dd, at least where I had used it.
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$financialAccount = new CRM_Financial_DAO_FinancialAccount();
$financialAccount->copyValues($params);
if ($financialAccount->find(TRUE)) {
* @return Object DAO object on sucess, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Financial_DAO_FinancialAccount', $id, 'is_active', $is_active);
}
* @static
* @return object
*/
- static function add(&$params, &$ids = array()) {
+ public static function add(&$params, &$ids = array()) {
if(empty($params['id'])) {
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['is_deductible'] = CRM_Utils_Array::value('is_deductible', $params, FALSE);
* @param int $financialAccountId
* @static
*/
- static function del($financialAccountId) {
+ public static function del($financialAccountId) {
//checking if financial type is present
$check = FALSE;
* @return accounting code
* @static
*/
- static function getAccountingCode($financialTypeId) {
+ public static function getAccountingCode($financialTypeId) {
$relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Income Account is' "));
$query = "SELECT cfa.accounting_code
FROM civicrm_financial_type cft
* @return integer count
* @static
*/
- static function getARAccounts($financialAccountId, $financialAccountTypeId = NULL, $accountTypeCode = 'ar') {
+ public static function getARAccounts($financialAccountId, $financialAccountTypeId = NULL, $accountTypeCode = 'ar') {
if (!$financialAccountTypeId) {
$financialAccountType = CRM_Core_PseudoConstant::accountOptionValues('financial_account_type');
$financialAccountTypeId = array_search('Asset', $financialAccountType);
/**
* Class constructor
*/
- function __construct( ) {
+ public function __construct( ) {
parent::__construct( );
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$financialItem = new CRM_Financial_DAO_FinancialItem();
$financialItem->copyValues($params);
if ($financialItem->find(TRUE)) {
* @static
* @return void
*/
- static function add($lineItem, $contribution, $taxTrxnID = FALSE) {
+ public static function add($lineItem, $contribution, $taxTrxnID = FALSE) {
$contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$financialItemStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id');
$itemStatus = NULL;
* @static
* @return object
*/
- static function create(&$params, $ids = NULL, $trxnIds = NULL) {
+ public static function create(&$params, $ids = NULL, $trxnIds = NULL) {
$financialItem = new CRM_Financial_DAO_FinancialItem();
if (!empty($ids['id'])) {
* @access public
* @static
*/
- static function createEntityTrxn($params) {
+ public static function createEntityTrxn($params) {
$entity_trxn = new CRM_Financial_DAO_EntityFinancialTrxn();
$entity_trxn->copyValues($params);
$entity_trxn->save();
* @access public
* @static
*/
- static function retrieveEntityFinancialTrxn($params, $maxId = FALSE) {
+ public static function retrieveEntityFinancialTrxn($params, $maxId = FALSE) {
$financialItem = new CRM_Financial_DAO_EntityFinancialTrxn();
$financialItem->copyValues($params);
//retrieve last entry from civicrm_entity_financial_trxn
* @access public
* @static
*/
- static function checkContactPresent($contactIds, &$error) {
+ public static function checkContactPresent($contactIds, &$error) {
if (empty($contactIds)) {
return FALSE;
}
/**
* Class constructor
*/
- function __construct( ) {
+ public function __construct( ) {
parent::__construct( );
}
* @access public
* @static
*/
- static function retrieve( &$params, &$defaults ) {
+ public static function retrieve( &$params, &$defaults ) {
$financialType = new CRM_Financial_DAO_FinancialType( );
$financialType->copyValues( $params );
if ($financialType->find(true)) {
* @return Object DAO object on sucess, null otherwise
* @static
*/
- static function setIsActive( $id, $is_active ) {
+ public static function setIsActive( $id, $is_active ) {
return CRM_Core_DAO::setFieldValue( 'CRM_Financial_DAO_FinancialType', $id, 'is_active', $is_active );
}
* @static
* @return object
*/
- static function add(&$params, &$ids = array()) {
+ public static function add(&$params, &$ids = array()) {
if(empty($params['id'])) {
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, false);
$params['is_deductible'] = CRM_Utils_Array::value('is_deductible', $params, false);
* @return array|bool
* @static
*/
- static function del($financialTypeId) {
+ public static function del($financialTypeId) {
$financialType = new CRM_Financial_DAO_FinancialType( );
$financialType->id = $financialTypeId;
$financialType->find(true);
* @return array all financial type with income account is relationship
* @static
*/
- static function getIncomeFinancialType() {
+ public static function getIncomeFinancialType() {
// Financial Type
$financialType = CRM_Contribute_PseudoConstant::financialType();
$revenueFinancialType = array();
/**
* Class constructor
*/
- function __construct( ) {
+ public function __construct( ) {
parent::__construct( );
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults, &$allValues = array()) {
+ public static function retrieve(&$params, &$defaults, &$allValues = array()) {
$financialTypeAccount = new CRM_Financial_DAO_EntityFinancialAccount();
$financialTypeAccount->copyValues($params);
$financialTypeAccount->find();
* @static
* @return object
*/
- static function add(&$params, &$ids = NULL) {
+ public static function add(&$params, &$ids = NULL) {
// action is taken depending upon the mode
$financialTypeAccount = new CRM_Financial_DAO_EntityFinancialAccount();
if ($params['entity_table'] != 'civicrm_financial_type') {
*
* @static
*/
- static function del($financialTypeAccountId, $accountId = null) {
+ public static function del($financialTypeAccountId, $accountId = null) {
//checking if financial type is present
$check = false;
$relationValues = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
* @return null|string
* @static
*/
- static function getFinancialAccount($entityId, $entityTable, $columnName = 'name') {
+ public static function getFinancialAccount($entityId, $entityTable, $columnName = 'name') {
$join = $columnName == 'name' ? 'LEFT JOIN civicrm_financial_account ON civicrm_entity_financial_account.financial_account_id = civicrm_financial_account.id' : NULL;
$query = "
SELECT {$columnName}
* @return array|null|string
* @static
*/
- static function getInstrumentFinancialAccount($paymentInstrumentValue = NULL) {
+ public static function getInstrumentFinancialAccount($paymentInstrumentValue = NULL) {
if (!self::$financialAccount) {
$query = "SELECT ceft.financial_account_id, cov.value
FROM civicrm_entity_financial_account ceft
* @return array
* @static
*/
- static function createDefaultFinancialAccounts($financialType) {
+ public static function createDefaultFinancialAccounts($financialType) {
$titles = array();
$financialAccountTypeID = CRM_Core_PseudoConstant::accountOptionValues('financial_account_type');
$accountRelationship = CRM_Core_PseudoConstant::accountOptionValues('account_relationship');
* @return CRM_Financial_DAO_PaymentProcessor
* @throws Exception
*/
- static function create($params) {
+ public static function create($params) {
// FIXME Reconcile with CRM_Admin_Form_PaymentProcessor::updatePaymentProcessor
$processor = new CRM_Financial_DAO_PaymentProcessor();
$processor->copyValues($params);
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$paymentProcessor = new CRM_Financial_DAO_PaymentProcessor();
$paymentProcessor->copyValues($params);
if ($paymentProcessor->find(TRUE)) {
* @access public
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Financial_DAO_PaymentProcessor', $id, 'is_active', $is_active);
}
* @static
* @access public
*/
- static function &getDefault() {
+ public static function &getDefault() {
if (self::$_defaultPaymentProcessor == NULL) {
$params = array('is_default' => 1);
$defaults = array();
* @access public
* @static
*/
- static function del($paymentProcessorID) {
+ public static function del($paymentProcessorID) {
if (!$paymentProcessorID) {
CRM_Core_Error::fatal(ts('Invalid value passed to delete function.'));
}
* @static
* @access public
*/
- static function getPayment($paymentProcessorID, $mode) {
+ public static function getPayment($paymentProcessorID, $mode) {
if (!$paymentProcessorID) {
CRM_Core_Error::fatal(ts('Invalid value passed to getPayment function'));
}
* @return array
* @throws Exception
*/
- static function getPayments($paymentProcessorIDs, $mode) {
+ public static function getPayments($paymentProcessorIDs, $mode) {
if (!$paymentProcessorIDs) {
CRM_Core_Error::fatal(ts('Invalid value passed to getPayment function'));
}
* @param array_type $processor2
* @return number
*/
- static function defaultComparison($processor1, $processor2){
+ public static function defaultComparison($processor1, $processor2){
$p1 = CRM_Utils_Array::value('is_default', $processor1);
$p2 = CRM_Utils_Array::value('is_default', $processor2);
if ($p1 == $p2) {
* @static
* @access public
*/
- static function buildPayment($dao, $mode) {
+ public static function buildPayment($dao, $mode) {
$fields = array(
'id', 'name', 'payment_processor_type_id', 'user_name', 'password',
'signature', 'url_site', 'url_api', 'url_recur', 'url_button',
* @throws CiviCRM_API3_Exception
* @return array
*/
- static function getAllPaymentProcessors($isExcludeTest, $reset = FALSE) {
+ public static function getAllPaymentProcessors($isExcludeTest, $reset = FALSE) {
/**
* $cacheKey = 'CRM_Financial_BAO_Payment_Processor_' . ($isExcludeTest ? 'test' : 'all');
if (!$reset) {
*
* @return array available processors
*/
- static function getPaymentProcessors($capabilities = array(), $isIncludeTest = FALSE, $ids = array()) {
+ public static function getPaymentProcessors($capabilities = array(), $isIncludeTest = FALSE, $ids = array()) {
$processors = self::getAllPaymentProcessors(!$isIncludeTest);
if ($capabilities) {
foreach ($processors as $index => $processor) {
*
* @return bool
*/
- static function hasPaymentProcessorSupporting($capabilities = array(), $isIncludeTest = FALSE) {
+ public static function hasPaymentProcessorSupporting($capabilities = array(), $isIncludeTest = FALSE) {
$result = self::getPaymentProcessors($capabilities, $isIncludeTest);
return (!empty($result)) ? TRUE : FALSE;
}
* @static
* @access public
*/
- static function getProcessorForEntity($entityID, $component = 'contribute', $type = 'id') {
+ public static function getProcessorForEntity($entityID, $component = 'contribute', $type = 'id') {
$result = NULL;
if (!in_array($component, array(
'membership', 'contribute', 'recur'))) {
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$paymentProcessorType = new CRM_Financial_DAO_PaymentProcessorType();
$paymentProcessorType->copyValues($params);
if ($paymentProcessorType->find(TRUE)) {
* @access public
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Financial_DAO_PaymentProcessorType', $id, 'is_active', $is_active);
}
* @static
* @access public
*/
- static function &getDefault() {
+ public static function &getDefault() {
if (self::$_defaultPaymentProcessorType == NULL) {
$params = array('is_default' => 1);
$defaults = array();
* @access public
* @static
*/
- static function create(&$params) {
+ public static function create(&$params) {
$paymentProcessorType = new CRM_Financial_DAO_PaymentProcessorType();
$paymentProcessorType->copyValues($params);
* @access public
* @static
*/
- static function del($paymentProcessorTypeId) {
+ public static function del($paymentProcessorTypeId) {
$query = "
SELECT pp.id processor_id
FROM civicrm_payment_processor pp, civicrm_payment_processor_type ppt
*/
protected $_batchStatusId;
- function preProcess() {
+ public function preProcess() {
self::$_entityID = CRM_Utils_Request::retrieve( 'bid' , 'Positive' ) ? CRM_Utils_Request::retrieve( 'bid' , 'Positive' ) : $_POST['batch_id'];
$this->assign('entityID', self::$_entityID);
if (isset(self::$_entityID)) {
$this->add('text', 'name', ts('Batch Name'));
}
- function setDefaultValues() {
+ public function setDefaultValues() {
// do not setdefault unless it is open batch
if ($this->_batchStatusId != 1 ) {
return;
/**
* @return array|null
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
'view' => array(
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
// this mean it's a batch action
* @access public
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
// this mean it's a batch action
if (!empty($this->_batchIds)) {
$batchNames = CRM_Batch_BAO_Batch::getBatchNames($this->_batchIds);
* @static
* @access public
*/
- static function formRule( $values, $files, $self ) {
+ public static function formRule( $values, $files, $self ) {
$errorMsg = array( );
$financialAccountTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('financial_account_type', NULL, " AND v.name LIKE 'Liability' "));
if (isset($values['is_tax'])) {
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = parent::setDefaultValues();
if ($this->_action & CRM_Core_Action::ADD) {
$defaults['contact_id'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Domain', CRM_Core_Config::domainID(), 'contact_id');
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = parent::setDefaultValues();
if ($this->_id) {
* @static
* @access public
*/
- static function formRule($values, $files, $self) {
+ public static function formRule($values, $files, $self) {
$errors = array();
if (!empty($values['contact_name']) && !is_numeric($values['created_id'])) {
$errors['contact_name'] = ts('Please select a valid contact.');
* @static
* @access public
*/
- function checkPermissions($action, $permissions, $createdID, $userContactID, $actionName) {
+ public function checkPermissions($action, $permissions, $createdID, $userContactID, $actionName) {
if ((CRM_Core_Permission::check($permissions[0]) || CRM_Core_Permission::check($permissions[1]))) {
if (CRM_Core_Permission::check($permissions[0]) && $userContactID != $createdID && !CRM_Core_Permission::check($permissions[1])) {
CRM_Core_Error::statusBounce(ts('You dont have permission to %1 this batch'), array(1 => $actionName));
* @static
* @access public
*/
- static function formRule($values, $files, $self) {
+ public static function formRule($values, $files, $self) {
$errorMsg = array();
$errorFlag = FALSE;
if ($self->_action == CRM_Core_Action::DELETE) {
public $_batchStatus;
- function preProcess() {
+ public function preProcess() {
$this->_batchStatus = CRM_Utils_Request::retrieve('batchStatus', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, NULL);
$this->assign('batchStatus', $this->_batchStatus);
}
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$status = CRM_Utils_Request::retrieve('status', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1);
$defaults['batch_update'] = $status;
parent::buildQuickForm();
}
- function postProcess() {
+ public function postProcess() {
$batchIds = array();
foreach ($_POST as $key => $value) {
if (substr($key,0,6) == "check_") {
/**
* @param $config
*/
- static function jqFinancial($config) {
+ public static function jqFinancial($config) {
if (!isset($_GET['_value']) ||
empty($_GET['_value'])) {
CRM_Utils_System::civiExit();
/**
* @param $config
*/
- static function jqFinancialRelation($config) {
+ public static function jqFinancialRelation($config) {
if (!isset($_GET['_value']) ||
empty($_GET['_value'])) {
CRM_Utils_System::civiExit();
/**
* @param $config
*/
- static function jqFinancialType($config) {
+ public static function jqFinancialType($config) {
if (! isset($_GET['_value']) ||
empty($_GET['_value'])) {
CRM_Utils_System::civiExit();
/**
* Callback to perform action on batch records.
*/
- static function assignRemove() {
+ public static function assignRemove() {
$op = CRM_Utils_Type::escape($_POST['op'], 'String');
$recordBAO = CRM_Utils_Type::escape($_POST['recordBAO'], 'String');
foreach ($_POST['records'] as $record) {
CRM_Utils_JSON::output($response);
}
- static function getFinancialTransactionsList() {
+ public static function getFinancialTransactionsList() {
$sortMapper =
array(
0 => '', 1 => '', 2 => 'sort_name',
CRM_Utils_System::civiExit();
}
- static function bulkAssignRemove() {
+ public static function bulkAssignRemove() {
$checkIDs = $_REQUEST['ID'];
$entityID = CRM_Utils_Type::escape($_REQUEST['entityID'], 'String');
$action = CRM_Utils_Type::escape($_REQUEST['action'], 'String');
CRM_Utils_JSON::output($status);
}
- static function getBatchSummary() {
+ public static function getBatchSummary() {
$batchID = CRM_Utils_Type::escape($_REQUEST['batchID'], 'String');
$params = array('id' => $batchID);
$batchInfo = CRM_Batch_BAO_Batch::retrieve($params, $value);
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Batch_BAO_Batch';
}
*
* @return array (reference) of action links
*/
- function &links() {}
+ public function &links() {}
/**
* Get name of edit form
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Financial_Form_FinancialBatch';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return ts('Accounting Batch Processing');
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return CRM_Utils_System::currentPath();
}
* @return void
* @access public
*/
- function browse() {
+ public function browse() {
$status = CRM_Utils_Request::retrieve('status', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1);
$this->assign('status', $status);
$this->search();
}
- function search() {
+ public function search() {
if ($this->_action &
(CRM_Core_Action::ADD |
CRM_Core_Action::UPDATE |
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Batch_BAO_Batch';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
'view' => array(
* @access public
*
*/
- function run() {
+ public function run() {
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse'); // default to 'browse'
* @access public
* @static
*/
- function browse() {
+ public function browse() {
}
/**
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Financial_Form_BatchTransaction';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Batch';
}
*
* @return string user context.
*/
- function userContext($mode = null) {
+ public function userContext($mode = null) {
return 'civicrm/batchtransaction';
}
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Financial_BAO_FinancialAccount';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
* @access public
*
*/
- function run() {
+ public function run() {
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse'); // default to 'browse'
* @access public
* @static
*/
- function browse() {
+ public function browse() {
// get all custom groups sorted by weight
$contributionType = array();
$dao = new CRM_Financial_DAO_FinancialAccount();
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Financial_Form_FinancialAccount';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Financial Types';
}
*
* @return string user context.
*/
- function userContext($mode = null) {
+ public function userContext($mode = null) {
return 'civicrm/admin/financial/financialAccount';
}
}
*
* @return string classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Batch_BAO_Batch';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array();
}
* @access public
*
*/
- function run() {
+ public function run() {
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->set("context", $context);
// assign vars to templates
*
* @return string classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Financial_Form_FinancialBatch';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Accounting Batch';
}
*
* @return string user context.
*/
- function userContext($mode = null) {
+ public function userContext($mode = null) {
$context = $this->get("context");
if ($mode == CRM_Core_Action::UPDATE || ($mode = CRM_Core_Action::ADD & isset($context))) {
return "civicrm/financial/financialbatches";
*
* @return string
*/
- function userContextParams($mode = NULL) {
+ public function userContextParams($mode = NULL) {
$context = $this->get("context");
if ($mode == CRM_Core_Action::UPDATE || ($mode = CRM_Core_Action::ADD & isset($context))) {
return "reset=1&batchStatus={$context}";
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Financial_BAO_FinancialType';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::BROWSE => array(
* @access public
*
*/
- function run() {
+ public function run() {
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse'); // default to 'browse'
* @access public
* @static
*/
- function browse() {
+ public function browse() {
// get all financial types sorted by weight
$financialType = array();
$dao = new CRM_Financial_DAO_FinancialType();
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Financial_Form_FinancialType';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Financial Types';
}
*
* @return string user context.
*/
- function userContext($mode = null) {
+ public function userContext($mode = null) {
return 'civicrm/admin/financial/financialType';
}
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Financial_BAO_FinancialTypeAccount';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
* @access public
*
*/
- function run() {
+ public function run() {
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse'); // default to 'browse'
* @access public
* @static
*/
- function browse() {
+ public function browse() {
// get all Financial Type Account data sorted by weight
$financialType = array();
$params = array();
* @return void
* @access public
*/
- function edit( $action ) {
+ public function edit( $action ) {
// create a simple controller for editing CiviCRM Profile data
$controller = new CRM_Core_Controller_Simple( 'CRM_Financial_Form_FinancialTypeAccount', ts('Financial Account Types'), $action );
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
$friend = CRM_Contact_BAO_Contact::createProfileContact($params, CRM_Core_DAO::$_nullArray);
return $friend;
}
* @access public
* @static
*/
- static function retrieve(&$params, &$values) {
+ public static function retrieve(&$params, &$values) {
$friend = new CRM_Friend_DAO_Friend();
$friend->copyValues($params);
* @access public
* @static
*/
- static function create(&$params) {
+ public static function create(&$params) {
$transaction = new CRM_Core_Transaction();
$mailParams = array();
* @return void
* @access public
*/
- static function buildFriendForm($form) {
+ public static function buildFriendForm($form) {
$form->addElement('checkbox', 'tf_is_active', ts('Tell a Friend enabled?'), NULL, array('onclick' => "friendBlock(this)"));
// name
$form->add('text', 'tf_title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'title'), TRUE);
*
* @return booelan whether anything was found
*/
- static function getValues(&$defaults) {
+ public static function getValues(&$defaults) {
if (empty($defaults)) {
return NULL;
}
* @return void
* @access public
*/
- static function sendMail($contactID, &$values) {
+ public static function sendMail($contactID, &$values) {
list($fromName, $email) = CRM_Contact_BAO_Contact::getContactDetails($contactID);
// if no $fromName (only email collected from originating contact) - list returns single space
if (trim($fromName) == '') {
* @access public
* @static
*/
- static function addTellAFriend(&$params) {
+ public static function addTellAFriend(&$params) {
$friendDAO = new CRM_Friend_DAO_Friend();
$friendDAO->copyValues($params);
* @access public
* @static
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$errors = array();
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
*
* @return array Array of event summary values
*/
- static function getGrantSummary($admin = FALSE) {
+ public static function getGrantSummary($admin = FALSE) {
$query = "
SELECT status_id, count(id) as status_total
FROM civicrm_grant GROUP BY status_id";
*
* @return array Array of event summary values
*/
- static function getGrantStatusOptGroup() {
+ public static function getGrantStatusOptGroup() {
$params = array();
$params['name'] = CRM_Grant_BAO_Grant::$statusGroupName;
*
* @return array Array of grant summary statistics
*/
- static function getGrantStatistics($admin = FALSE) {
+ public static function getGrantStatistics($admin = FALSE) {
$grantStatuses = array();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$grant = new CRM_Grant_DAO_Grant();
$grant->copyValues($params);
if ($grant->find(TRUE)) {
*
* @return object
*/
- static function add(&$params, &$ids) {
+ public static function add(&$params, &$ids) {
if (!empty($ids['grant_id'])) {
CRM_Utils_Hook::pre('edit', 'Grant', $ids['grant_id'], $params);
* @access public
* @static
*/
- static function deleteContact($id) {
+ public static function deleteContact($id) {
$grant = new CRM_Grant_DAO_Grant();
$grant->contact_id = $id;
$grant->delete();
* @static
*
*/
- static function del($id) {
+ public static function del($id) {
CRM_Utils_Hook::pre('delete', 'Grant', $id, CRM_Core_DAO::$_nullArray);
$grant = new CRM_Grant_DAO_Grant();
* @access public
* @static
*/
- static function &exportableFields() {
+ public static function &exportableFields() {
if (!self::$_exportableFields) {
if (!self::$_exportableFields) {
self::$_exportableFields = array();
* @access public
* @static
*/
- static function getContactGrantCount($contactID) {
+ public static function getContactGrantCount($contactID) {
$query = "SELECT count(*) FROM civicrm_grant WHERE civicrm_grant.contact_id = {$contactID} ";
return CRM_Core_DAO::singleValueQuery($query);
}
/**
* @return array
*/
- static function &getFields() {
+ public static function &getFields() {
$fields = array();
$fields = CRM_Grant_BAO_Grant::exportableFields();
return $fields;
* @return void
* @access public
*/
- static function select(&$query) {
+ public static function select(&$query) {
if (($query->_mode & CRM_Contact_BAO_Query::MODE_GRANT) || !empty($query->_returnProperties)) {
if (!empty($query->_returnProperties['grant_status_id'])) {
$query->_select['grant_status_id'] = 'grant_status.id as grant_status_id';
* @return void
* @access public
*/
- static function where(&$query) {
+ public static function where(&$query) {
foreach ($query->_params as $id => $values) {
if (!is_array($values) || count($values) != 5) {
continue;
* @param $values
* @param $query
*/
- static function whereClauseSingle(&$values, &$query) {
+ public static function whereClauseSingle(&$values, &$query) {
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
list($name, $op, $value, $grouping, $wildcard) = $values;
$val = $names = array();
*
* @return null|string
*/
- static function from($name, $mode, $side) {
+ public static function from($name, $mode, $side) {
$from = NULL;
switch ($name) {
case 'civicrm_grant':
* @return string
* @access public
*/
- function qill() {
+ public function qill() {
return (isset($this->_qill)) ? $this->_qill : "";
}
* @return void
* @static
*/
- static function buildSearchForm(&$form) {
+ public static function buildSearchForm(&$form) {
$grantType = CRM_Core_OptionGroup::values('grant_type');
$form->add('select', 'grant_type_id', ts('Grant Type'), $grantType, FALSE,
* @param $row
* @param int $id
*/
- static function searchAction(&$row, $id) {}
+ public static function searchAction(&$row, $id) {}
/**
* @param $tables
*/
- static function tableNames(&$tables) {}
+ public static function tableNames(&$tables) {}
}
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::setDefaultValues($this);
}
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
parent::buildQuickForm();
$this->addElement('text', 'sort_name', ts('Name or Email'), array('class' => 'twenty') + CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
* @return void
* @access public
*/
- function postProcess() {
+ public function postProcess() {
if ($this->_done) {
return;
}
*
* @return array the default array reference
*/
- function &setDefaultValues() {
+ public function &setDefaultValues() {
return $this->_formValues;
}
- function fixFormValues() {
+ public function fixFormValues() {
// if this search has been forced
// then see if there are any get values, and if so over-ride the post values
// note that this means that GET over-rides POST :)
/**
* @return null
*/
- function getFormValues() {
+ public function getFormValues() {
return NULL;
}
* @param CRM_Core_Form $form
* @param bool $useTable
*/
- static function preProcessCommon(&$form, $useTable = FALSE) {
+ public static function preProcessCommon(&$form, $useTable = FALSE) {
$form->_grantIds = array();
$values = $form->controller->exportValues('Search');
* @return void
* @access public
*/
- function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
+ public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
$this->addButtons(array(
array(
'type' => $nextType,
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->addDefaultButtons(ts('Delete Grants'), 'done');
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preprocess();
// set print view, so that print templates are called
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
//
// just need to add a javacript to popup the window for printing
//
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$session = CRM_Core_Session::singleton();
$this->set('searchRows', '');
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$rows = array();
// display name and grant details of all selectced contacts
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
//check permission for update.
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$grantStatus = CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'status_id');
$this->addElement('select', 'status_id', ts('Grant Status'), array('' => '') + $grantStatus);
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
$admin = CRM_Core_Permission::check('administer CiviCRM');
$grantSummary = CRM_Grant_BAO_Grant::getGrantSummary($admin);
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
$controller = new CRM_Core_Controller_Simple('CRM_Grant_Form_Search', ts('grants'), NULL);
* return null
* @access public
*/
- function view() {
+ public function view() {
$controller = new CRM_Core_Controller_Simple('CRM_Grant_Form_GrantView', 'View Grant', $this->_action);
$controller->setEmbedded(TRUE);
$controller->set('id', $this->_id);
* return null
* @access public
*/
- function edit() {
+ public function edit() {
$controller = new CRM_Core_Controller_Simple('CRM_Grant_Form_Grant', 'Create grant', $this->_action);
$controller->setEmbedded(TRUE);
$controller->set('id', $this->_id);
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
$this->setContext();
return parent::run();
}
- function setContext() {
+ public function setContext() {
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this);
$session = CRM_Core_Session::singleton();
* @return array
* @access public
*/
- static function &links($key = NULL) {
+ public static function &links($key = NULL) {
$cid = CRM_Utils_Request::retrieve('cid', 'Integer', $this);
$extraParams = ($key) ? "&key={$key}" : NULL;
*
* @access public
*/
- function getPagerParams($action, &$params) {
+ public function getPagerParams($action, &$params) {
$params['status'] = ts('Grant') . ' %%StatusMessage%%';
$params['csvString'] = NULL;
if ($this->_limit) {
* @return int Total number of rows
* @access public
*/
- function getTotalCount($action) {
+ public function getTotalCount($action) {
return $this->_query->searchQuery(0, 0, NULL,
TRUE, FALSE,
FALSE, FALSE,
*
* @return int the total number of rows for this action
*/
- function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
+ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
$result = $this->_query->searchQuery($offset, $rowCount, $sort,
FALSE, FALSE,
FALSE, FALSE,
/**
* @return string
*/
- function &getQuery() {
+ public function &getQuery() {
return $this->_query;
}
*
* @return string name of the file
*/
- function getExportFileName($output = 'csv') {
+ public function getExportFileName($output = 'csv') {
return ts('CiviCRM Grant Search');
}
}
* @return string the name of the form that will handle the task
* @access protected
*/
- function taskName($controller, $formName = 'Search') {
+ public function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
$value = CRM_Utils_Array::value('task', $_POST);
if (!isset($value)) {
* @return string
* @access public
*/
- function getTaskFormName() {
+ public function getTaskFormName() {
return CRM_Utils_String::getClassName($this->_task);
}
}
* @static
* @access public
*/
- static function &tasks() {
+ public static function &tasks() {
if (!(self::$_tasks)) {
self::$_tasks = array(1 => array(
'title' => ts('Delete Grants'),
* @static
* @access public
*/
- static function &taskTitles() {
+ public static function &taskTitles() {
self::tasks();
$titles = array();
foreach (self::$_tasks as $id => $value) {
* @return array set of tasks that are valid for the user
* @access public
*/
- static function &permissionedTaskTitles($permission) {
+ public static function &permissionedTaskTitles($permission) {
$tasks = array();
if (($permission == CRM_Core_Permission::EDIT)
|| CRM_Core_Permission::check('edit grants')
* @static
* @access public
*/
- static function getTask($value) {
+ public static function getTask($value) {
self::tasks();
if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) {
// make the print task by default
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
$this->_stateMachine = new CRM_Group_StateMachine($this, $action);
/**
* @return mixed
*/
- function run() {
+ public function run() {
return parent::run();
}
* @return void
* @acess protected
*/
- function preProcess() {
+ public function preProcess() {
$this->_id = $this->get('id');
if ($this->_id) {
$breadCrumb = array(array('title' => ts('Manage Groups'),
* @access public
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if (isset($this->_id)) {
* @static
* @access public
*/
- static function formRule($fields, $fileParams, $options) {
+ public static function formRule($fields, $fileParams, $options) {
$errors = array();
$doParentCheck = $options['doParentCheck'];
* @static
* @access public
*/
- static function buildParentGroups(&$form) {
+ public static function buildParentGroups(&$form) {
$groupNames = CRM_Core_PseudoConstant::group();
$parentGroups = $parentGroupElements = array();
if (isset($form->_id) && !empty($form->_groupValues['parents'])) {
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$defaults['group_status[1]'] = 1;
return $defaults;
$this->assign('suppressForm', TRUE);
}
- function postProcess() {
+ public function postProcess() {
$params = $this->controller->exportValues($this->_name);
$parent = $this->controller->getParent();
if (!empty($params)) {
* This class contains the functions that are called using AJAX (jQuery)
*/
class CRM_Group_Page_AJAX {
- static function getGroupList() {
+ public static function getGroupList() {
$params = $_REQUEST;
if (isset($params['parent_id'])) {
/**
* @return string
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Contact_BAO_Group';
}
* @return array self::$_links array of action links
* @access public
*/
- function &links() {}
+ public function &links() {}
/**
* Return class name of edit form
* @return string
* @access public
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Group_Form_Edit';
}
* @return string
* @access public
*/
- function editName() {
+ public function editName() {
return ts('Edit Group');
}
* @return string
* @access public
*/
- function deleteName() {
+ public function deleteName() {
return 'Delete Group';
}
* @return string
* @access public
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/group';
}
* @return string
* @access public
*/
- function userContextParams($mode = NULL) {
+ public function userContextParams($mode = NULL) {
return 'reset=1&action=browse';
}
* @return string the permission that the user has (or null)
* @access public
*/
- function checkPermission($id, $title) {
+ public function checkPermission($id, $title) {
return CRM_Contact_BAO_Group::checkPermission($id, $title);
}
* @return void
* @access public
*/
- function browse($action = NULL) {
+ public function browse($action = NULL) {
$groupPermission = CRM_Core_Permission::check('edit groups') ? CRM_Core_Permission::EDIT : CRM_Core_Permission::VIEW;
$this->assign('groupPermission', $groupPermission);
$this->search();
}
- function search() {
+ public function search() {
if ($this->_action &
(CRM_Core_Action::ADD |
CRM_Core_Action::UPDATE |
/**
* 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
* @access public
*/
- function getTaskFormName() {
+ public function getTaskFormName() {
return CRM_Utils_String::getClassName('CRM_Contact_Form_Task_AddToGroup');
}
}
* @access public
*
*/
- function getInfo() {
+ public function getInfo() {
return array('title' => ts('Comma-Separated Values (CSV)'));
}
*
* @access public
*/
- function preProcess(&$form) {}
+ public function preProcess(&$form) {}
/**
* This is function is called by the form object to get the DataSource's
* @return void (operates directly on form argument)
* @access public
*/
- function buildQuickForm(&$form) {
+ public function buildQuickForm(&$form) {
$form->add('hidden', 'hidden_dataSource', 'CRM_Import_DataSource_CSV');
$config = CRM_Core_Config::singleton();
*
* @access public
*/
- function postProcess(&$params, &$db, &$form) {
+ public function postProcess(&$params, &$db, &$form) {
$file = $params['uploadFile']['name'];
$result = self::_CsvToTable($db,
$file,
*
* @return array|bool
*/
- static function formRule($fields, $files, $form) {
+ public static function formRule($fields, $files, $form) {
$errors = array();
// poor man's query validation (case-insensitive regex matching on word boundaries)
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
$this->_maxLinesToProcess = 0;
$this->_maxErrorCount = self::MAX_ERRORS;
}
*
* @return int
*/
- function setActiveFieldValues($elements, &$erroneousField) {
+ public function setActiveFieldValues($elements, &$erroneousField) {
$maxCount = count($elements) < $this->_activeFieldCount ? count($elements) : $this->_activeFieldCount;
for ($i = 0; $i < $maxCount; $i++) {
$this->_activeFields[$i]->setValue($elements[$i]);
* @return array (reference) associative array of name/value pairs
* @access public
*/
- function &getActiveFieldParams() {
+ public function &getActiveFieldParams() {
$params = array();
for ($i = 0; $i < $this->_activeFieldCount; $i++) {
if (isset($this->_activeFields[$i]->_value)
/**
* @return array
*/
- function getSelectValues() {
+ public function getSelectValues() {
$values = array();
foreach ($this->_fields as $name => $field) {
$values[$name] = $field->_title;
/**
* @return array
*/
- function getSelectTypes() {
+ public function getSelectTypes() {
$values = array();
foreach ($this->_fields as $name => $field) {
if (isset($field->_hasLocationType)) {
/**
* @return array
*/
- function getHeaderPatterns() {
+ public function getHeaderPatterns() {
$values = array();
foreach ($this->_fields as $name => $field) {
if (isset($field->_headerPattern)) {
/**
* @return array
*/
- function getDataPatterns() {
+ public function getDataPatterns() {
$values = array();
foreach ($this->_fields as $name => $field) {
$values[$name] = $field->_dataPattern;
* @static
* @access public
*/
- static function encloseScrub(&$values, $enclosure = "'") {
+ public static function encloseScrub(&$values, $enclosure = "'") {
if (empty($values)) {
return;
}
* @return void
* @access public
*/
- function setMaxLinesToProcess($max) {
+ public function setMaxLinesToProcess($max) {
$this->_maxLinesToProcess = $max;
}
* @return string
* @static
*/
- static function errorFileName($type) {
+ public static function errorFileName($type) {
$fileName = NULL;
if (empty($type)) {
return $fileName;
* @return string
* @static
*/
- static function saveFileName($type) {
+ public static function saveFileName($type) {
$fileName = NULL;
if (empty($type)) {
return $fileName;
* @param \const|int $action
*
*/
- function __construct($controller, $action = CRM_Core_Action::NONE) {
+ public function __construct($controller, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);
$classType = str_replace('_Controller', '', get_class($controller));
* @param $log_date
* @param string $interval
*/
- function __construct($log_conn_id, $log_date, $interval = '10 SECOND') {
+ public function __construct($log_conn_id, $log_date, $interval = '10 SECOND') {
$dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
$this->db = $dsn['database'];
$this->log_conn_id = $log_conn_id;
*
* @return array
*/
- function diffsInTables($tables) {
+ public function diffsInTables($tables) {
$diffs = array();
foreach ($tables as $table) {
$diff = $this->diffsInTable($table);
*
* @return array
*/
- function diffsInTable($table, $contactID = null) {
+ public function diffsInTable($table, $contactID = null) {
$diffs = array();
$params = array(
*
* @return array
*/
- function titlesAndValuesForTable($table) {
+ public function titlesAndValuesForTable($table) {
// static caches for subsequent calls with the same $table
static $titles = array();
static $values = array();
/**
*
*/
- function __construct() {
+ public function __construct() {
// don’t display the ‘Add these Contacts to Group’ button
$this->_add2groupSupported = FALSE;
/**
* @param bool $applyLimit
*/
- function buildQuery($applyLimit = TRUE) {}
+ public function buildQuery($applyLimit = TRUE) {}
/**
* @param $sql
* @param $rows
*/
- function buildRows($sql, &$rows) {
+ public function buildRows($sql, &$rows) {
// safeguard for when there aren’t any log entries yet
if (!$this->log_conn_id or !$this->log_date) {
return;
return $rows;
}
- function buildQuickForm() {
+ public function buildQuickForm() {
parent::buildQuickForm();
$params = array(
/**
*
*/
- function __construct() {
+ public function __construct() {
// don’t display the ‘Add these Contacts to Group’ button
$this->_add2groupSupported = FALSE;
parent::__construct();
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = 'GROUP BY entity_log_civireport.log_conn_id, entity_log_civireport.log_user_id, EXTRACT(DAY_MICROSECOND FROM entity_log_civireport.log_date), entity_log_civireport.id';
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
$this->_select = 'SELECT ' . implode(', ', $select) . ' ';
}
- function where() {
+ public function where() {
// reset where clause as its called multiple times, every time insert sql is built.
$this->_whereClauses = array();
$this->_where .= " AND (entity_log_civireport.log_action != 'Initialization')";
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
$rows = array();
*
* @return string
*/
- function getLogType($entity) {
+ public function getLogType($entity) {
if (!empty($this->_logTables[$entity]['log_type'])) {
return $this->_logTables[$entity]['log_type'];
}
*
* @return mixed|null|string
*/
- function getEntityValue($id, $entity, $logDate) {
+ public function getEntityValue($id, $entity, $logDate) {
if (!empty($this->_logTables[$entity]['bracket_info'])) {
if (!empty($this->_logTables[$entity]['bracket_info']['entity_column'])) {
$logTable = !empty($this->_logTables[$entity]['table_name']) ? $this->_logTables[$entity]['table_name'] : $entity;
*
* @return null|string
*/
- function getEntityAction($id, $connId, $entity, $oldAction) {
+ public function getEntityAction($id, $connId, $entity, $oldAction) {
if (!empty($this->_logTables[$entity]['action_column'])) {
$sql = "select {$this->_logTables[$entity]['action_column']} from `{$this->loggingDB}`.{$entity} where id = %1 AND log_conn_id = %2";
$newAction = CRM_Core_DAO::singleValueQuery($sql, array(
* @param int $log_conn_id
* @param $log_date
*/
- function __construct($log_conn_id, $log_date) {
+ public function __construct($log_conn_id, $log_date) {
$dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
$this->db = $dsn['database'];
$this->log_conn_id = $log_conn_id;
/**
* @param $tables
*/
- function revert($tables) {
+ public function revert($tables) {
// FIXME: split off the table → DAO mapping to a GenCode-generated class
$daos = array(
'civicrm_address' => 'CRM_Core_DAO_Address',
/**
* Populate $this->tables and $this->logs with current db state.
*/
- function __construct() {
+ public function __construct() {
$dao = new CRM_Contact_DAO_Contact();
$civiDBName = $dao->_database;
/**
* Return logging custom data tables.
*/
- function customDataLogTables() {
+ public function customDataLogTables() {
return preg_grep('/^log_civicrm_value_/', $this->logs);
}
/**
* Return custom data tables for specified entity / extends.
*/
- function entityCustomDataLogTables($extends) {
+ public function entityCustomDataLogTables($extends) {
$customGroupTables = array();
$customGroupDAO = CRM_Core_BAO_CustomGroup::getAllCustomGroupsByBaseEntity($extends);
$customGroupDAO->find();
/**
* Disable logging by dropping the triggers (but keep the log tables intact).
*/
- function disableLogging() {
+ public function disableLogging() {
$config = CRM_Core_Config::singleton();
$config->logging = FALSE;
/**
* Drop triggers for all logged tables.
*/
- function dropTriggers($tableName = NULL) {
+ public function dropTriggers($tableName = NULL) {
$dao = new CRM_Core_DAO;
if ($tableName) {
*
* @return void
*/
- function enableLogging() {
+ public function enableLogging() {
$this->fixSchemaDifferences(TRUE);
$this->addReports();
}
*
* @return void
*/
- function fixSchemaDifferences($enableLogging = FALSE) {
+ public function fixSchemaDifferences($enableLogging = FALSE) {
$config = CRM_Core_Config::singleton();
if ($enableLogging) {
$config->logging = TRUE;
*
* @return void
*/
- function fixSchemaDifferencesFor($table, $cols = array(), $rebuildTrigger = FALSE) {
+ public function fixSchemaDifferencesFor($table, $cols = array(), $rebuildTrigger = FALSE) {
if (empty($table)) {
return FALSE;
}
/**
* @param bool $rebuildTrigger
*/
- function fixSchemaDifferencesForAll($rebuildTrigger = FALSE) {
+ public function fixSchemaDifferencesForAll($rebuildTrigger = FALSE) {
$diffs = array();
foreach ($this->tables as $table) {
if (empty($this->logs[$table])) {
*
* @return mixed
*/
- function fixTimeStampAndNotNullSQL($query) {
+ public function fixTimeStampAndNotNullSQL($query) {
$query = str_ireplace("TIMESTAMP NOT NULL", "TIMESTAMP NULL", $query);
$query = str_ireplace("DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", '', $query);
$query = str_ireplace("DEFAULT CURRENT_TIMESTAMP", '', $query);
*
* @return array
*/
- function columnsWithDiffSpecs($civiTable, $logTable) {
+ public function columnsWithDiffSpecs($civiTable, $logTable) {
$civiTableSpecs = $this->columnSpecsOf($civiTable);
$logTableSpecs = $this->columnSpecsOf($logTable);
* @param null $tableName
* @param bool $force
*/
- function triggerInfo(&$info, $tableName = NULL, $force = FALSE) {
+ public function triggerInfo(&$info, $tableName = NULL, $force = FALSE) {
// check if we have logging enabled
$config =& CRM_Core_Config::singleton();
if (!$config->logging) {
* @static
* @public
*/
- static function disableLoggingForThisConnection( ) {
+ public static function disableLoggingForThisConnection( ) {
// do this only if logging is enabled
$config = CRM_Core_Config::singleton( );
if ( $config->logging ) {
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$component = new CRM_Mailing_DAO_Component();
$component->copyValues($params);
if ($component->find(TRUE)) {
* @return Object DAO object on sucess, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Mailing_DAO_Component', $id, 'is_active', $is_active);
}
* @access public
* @static
*/
- static function add(&$params, $ids = array()) {
+ public static function add(&$params, $ids = array()) {
$id = CRM_Utils_Array::value('id', $params, CRM_Utils_Array::value('id', $ids));
$component = new CRM_Mailing_DAO_Component();
$component->id = $id;
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
*
* @return int
*/
- static function &getRecipientsCount($job_id, $mailing_id = NULL, $mode = NULL) {
+ public static function &getRecipientsCount($job_id, $mailing_id = NULL, $mode = NULL) {
// need this for backward compatibility, so we can get count for old mailings
// please do not use this function if possible
$eq = self::getRecipients($job_id, $mailing_id);
* the type will tell us which function to use for the data lookup
* if we need to do a lookup at all
*/
- function &getDataFunc($token) {
+ public function &getDataFunc($token) {
static $_categories = NULL;
static $_categoryString = NULL;
if (!$_categories) {
*
* @return void
*/
- static function addMessageIdHeader(&$headers, $prefix, $job_id, $event_queue_id, $hash) {
+ public static function addMessageIdHeader(&$headers, $prefix, $job_id, $event_queue_id, $hash) {
$config = CRM_Core_Config::singleton();
$localpart = CRM_Core_BAO_MailSettings::defaultLocalpart();
$emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
*
* @return array (reference) array array ref that hold array refs to the verp info and urls
*/
- static function getVerpAndUrls($job_id, $event_queue_id, $hash, $email) {
+ public static function getVerpAndUrls($job_id, $event_queue_id, $hash, $email) {
// create a skeleton object and set its properties that are required by getVerpAndUrlsAndHeaders()
$config = CRM_Core_Config::singleton();
$bao = new CRM_Mailing_BAO_Mailing();
*
* @return object
*/
- static function add(&$params, $ids = array()) {
+ public static function add(&$params, $ids = array()) {
$id = CRM_Utils_Array::value('mailing_id', $ids, CRM_Utils_Array::value('id', $params));
if ($id) {
*
* @throws Exception
*/
- static function checkPermission($id) {
+ public static function checkPermission($id) {
if (!$id) {
return;
}
*
* @return string
*/
- static function mailingACL($alias = NULL) {
+ public static function mailingACL($alias = NULL) {
$mailingACL = " ( 0 ) ";
$mailingIDs = self::mailingACLIDs();
* @return boolean | array - TRUE if the user has access to all mailings, else array of mailing IDs (possibly empty)
* @static
*/
- static function mailingACLIDs() {
+ public static function mailingACLIDs() {
// CRM-11633
// optimize common case where admin has access
// to all mailings
* @static
* @access public
*/
- static function showEmailDetails($id) {
+ public static function showEmailDetails($id) {
return CRM_Utils_System::url('civicrm/mailing/report', "mid=$id");
}
/**
* @return array
*/
- function getReturnProperties() {
+ public function getReturnProperties() {
$tokens = &$this->getTokens();
$properties = array();
*
* @return array $report array content/component.@access public
*/
- static function getMailingContent(&$report, &$form, $isSMS = FALSE) {
+ public static function getMailingContent(&$report, &$form, $isSMS = FALSE) {
$htmlHeader = $textHeader = NULL;
$htmlFooter = $textFooter = NULL;
*
* @return mixed
*/
- static function overrideVerp($jobID) {
+ public static function overrideVerp($jobID) {
static $_cache = array();
if (!isset($_cache[$jobID])) {
* @return bool
* @throws Exception
*/
- static function processQueue($mode = NULL) {
+ public static function processQueue($mode = NULL) {
$config = &CRM_Core_Config::singleton();
if ($mode == NULL && CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG") {
*
* @return mixed
*/
- static function getMailingsList($isSMS = FALSE) {
+ public static function getMailingsList($isSMS = FALSE) {
static $list = array();
$where = " WHERE ";
if (!$isSMS) {
*
* @return null|string
*/
- static function hiddenMailingGroup($mid) {
+ public static function hiddenMailingGroup($mid) {
$sql = "
SELECT g.id
FROM civicrm_mailing m
/**
* class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
*
* @return object
*/
- static function add(&$params, $ids = array()) {
+ public static function add(&$params, $ids = array()) {
$id = CRM_Utils_Array::value('mailingab_id', $ids, CRM_Utils_Array::value('id', $params));
if ($id) {
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
* @return array|null
*/
- static function &getFields() {
+ public static function &getFields() {
if (!self::$_mailingFields) {
self::$_mailingFields = array();
$_mailingFields['mailing_id'] = array(
* @return void
* @access public
*/
- static function select(&$query) {
+ public static function select(&$query) {
// if Mailing mode add mailing id
if ($query->_mode & CRM_Contact_BAO_Query::MODE_MAILING) {
$query->_select['mailing_id'] = "civicrm_mailing.id as mailing_id";
/**
* @param $query
*/
- static function where(&$query) {
+ public static function where(&$query) {
$grouping = NULL;
foreach (array_keys($query->_params) as $id) {
if (empty($query->_params[$id][0])) {
*
* @return null|string
*/
- static function from($name, $mode, $side) {
+ public static function from($name, $mode, $side) {
$from = NULL;
switch ($name) {
* @param $values
* @param $query
*/
- static function whereClauseSingle(&$values, &$query) {
+ public static function whereClauseSingle(&$values, &$query) {
list($name, $op, $value, $grouping, $wildcard) = $values;
$fields = array();
* @return void
* @static
*/
- static function buildSearchForm(&$form) {
+ public static function buildSearchForm(&$form) {
// mailing selectors
$mailings = CRM_Mailing_BAO_Mailing::getMailingsList();
* @param $row
* @param int $id
*/
- static function searchAction(&$row, $id) {}
+ public static function searchAction(&$row, $id) {}
/**
* @param $tables
*/
- static function tableNames(&$tables) {
+ public static function tableNames(&$tables) {
}
/**
*
* @return void
*/
- static function mailingEventQueryBuilder(&$query, &$values, $tableName, $fieldName, $fieldTitle, &$valueTitles) {
+ public static function mailingEventQueryBuilder(&$query, &$values, $tableName, $fieldName, $fieldTitle, &$valueTitles) {
list($name, $op, $value, $grouping, $wildcard) = $values;
if (empty($value) || $value == 'A') {
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
*
* @return null|string
*/
- static function mailingSize($mailingID) {
+ public static function mailingSize($mailingID) {
$sql = "
SELECT count(*) as count
FROM civicrm_mailing_recipients
* @param int $totalLimit
* Number of recipients to move
*/
- static function updateRandomRecipients($sourceMailingId, $newMailingID, $totalLimit = NULL) {
+ public static function updateRandomRecipients($sourceMailingId, $newMailingID, $totalLimit = NULL) {
$limitString = NULL;
if ($totalLimit) {
$limitString = "LIMIT 0, $totalLimit";
* @param int $sourceMailingId
* @param array $to (int $targetMailingId => int $count)
*/
- static function reassign($sourceMailingId, $to) {
+ public static function reassign($sourceMailingId, $to) {
foreach ($to as $targetMailingId => $count) {
if ($count > 0) {
CRM_Mailing_BAO_Recipients::updateRandomRecipients($sourceMailingId, $targetMailingId, $count);
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* failure.
* @access public
*/
- function send($recipient, $headers, $body, $job_id = null) {
+ public function send($recipient, $headers, $body, $job_id = null) {
$headerStr = array();
foreach ($headers as $name => $value) {
$headerStr[] = "$name: $value";
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal, NULL, FALSE, TRUE);
if (!defined('CIVICRM_CIVIMAIL_UI_LEGACY')) {
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
* Create a new bounce event, update the email address if necessary
*/
- static function &create(&$params) {
+ public static function &create(&$params) {
$q = &CRM_Mailing_Event_BAO_Queue::verify($params['job_id'],
$params['event_queue_id'],
$params['hash']
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @param $eventQueueIDs
* @param null $time
*/
- static function bulkCreate($eventQueueIDs, $time = NULL) {
+ public static function bulkCreate($eventQueueIDs, $time = NULL) {
if (!$time) {
$time = date('YmdHis');
}
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
* Create a new forward event, create a new contact if necessary
*/
- static function &forward($job_id, $queue_id, $hash, $forward_email, $fromEmail = NULL, $comment = NULL) {
+ public static function &forward($job_id, $queue_id, $hash, $forward_email, $fromEmail = NULL, $comment = NULL) {
$q = CRM_Mailing_Event_BAO_Queue::verify($job_id, $queue_id, $hash);
$successfulForward = FALSE;
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @param array $params
* @param null $now
*/
- static function bulkCreate($params, $now = NULL) {
+ public static function bulkCreate($params, $now = NULL) {
if (!$now) {
$now = time();
}
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if ($this->_mailingID) {
$defaults['approval_status_id'] = $this->_mailing->approval_status_id;
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
$this->_mailingId = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
*/
protected $_BAOName;
- function preProcess() {
+ public function preProcess() {
$this->_id = $this->get('id');
$this->_BAOName = $this->get('BAOName');
}
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$params = array();
* @access public
* @static
*/
- static function dataRule($params, $files, $options) {
+ public static function dataRule($params, $files, $options) {
if ($params['component_type'] == 'Header' || $params['component_type'] == 'Footer') {
$InvalidTokens = array();
}
*
*/
class CRM_Mailing_Form_ForwardMailing extends CRM_Core_Form {
- function preProcess() {
+ public function preProcess() {
$job_id = CRM_Utils_Request::retrieve('jid', 'Positive',
$this, NULL
);
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$continue = CRM_Utils_Request::retrieve('continue', 'String', $this, FALSE, NULL);
$defaults = array();
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$errors = array();
if (isset($fields['includeGroups']) &&
is_array($fields['includeGroups']) &&
*/
class CRM_Mailing_Form_Optout extends CRM_Core_Form {
- function preProcess() {
+ public function preProcess() {
$this->_type = 'optout';
$this->_email = $email;
}
- function buildQuickForm() {
+ public function buildQuickForm() {
CRM_Utils_System::addHTMLHead('<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">');
CRM_Utils_System::setTitle(ts('Please Confirm Your Opt Out'));
$this->addButtons($buttons);
}
- function postProcess() {
+ public function postProcess() {
$values = $this->exportValues();
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if ($this->_scheduleFormOnly) {
$count = CRM_Mailing_BAO_Recipients::mailingSize($this->_mailingID);
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = $statusVals = array();
$parent = $this->controller->getParent();
return $defaults;
}
- function postProcess() {
+ public function postProcess() {
$params = $this->controller->exportValues($this->_name);
CRM_Contact_BAO_Query::fixDateValues($params["mailing_relative"], $params['mailing_from'], $params['mailing_to']);
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
// CRM-14716 - Pick up mailingID from session since most of the time it's not in the URL
if (!$mailingID) {
class CRM_Mailing_Form_Subscribe extends CRM_Core_Form {
protected $_groupID = NULL;
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$this->_groupID = CRM_Utils_Request::retrieve('gid', 'Integer', $this,
FALSE, NULL, 'REQUEST'
*
* @return array|bool
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
foreach ($fields as $name => $dontCare) {
if (substr($name, 0, CRM_Core_Form::CB_PREFIX_LEN) == CRM_Core_Form::CB_PREFIX) {
return TRUE;
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
self::preProcessCommon($this);
}
* @param CRM_Core_Form $form
* @param bool $useTable
*/
- static function preProcessCommon(&$form, $useTable = FALSE) {
+ public static function preProcessCommon(&$form, $useTable = FALSE) {
$values = $form->controller->exportValues($form->get('searchFormName'));
$form->_task = CRM_Utils_Array::value('task', $values);
* @return void
* @access public
*/
- function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
+ public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
$this->addButtons(array(
array(
'type' => $nextType,
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preprocess();
// set print view, so that print templates are called
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
//
// just need to add a javacript to popup the window for printing
//
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$count = $this->get('count');
$this->assign('count', $count);
}
* @return boolean true on successful SMTP handoff
* @access public
*/
- static function testMail($testParams, $files, $self) {
+ public static function testMail($testParams, $files, $self) {
$error = NULL;
$urlString = 'civicrm/mailing/send';
*/
class CRM_Mailing_Form_Unsubscribe extends CRM_Core_Form {
- function preProcess() {
+ public function preProcess() {
$this->_type = 'unsubscribe';
}
- function buildQuickForm() {
+ public function buildQuickForm() {
CRM_Utils_System::addHTMLHead('<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">');
CRM_Utils_System::setTitle(ts('Please Confirm Your Unsubscribe from this Mailing/Group'));
$this->addButtons($buttons);
}
- function postProcess() {
+ public function postProcess() {
$values = $this->exportValues();
public $_mailingID;
- function preProcess() {
+ public function preProcess() {
$this->_mailingID = $this->get('mailing_id');
if (CRM_Core_Permission::check('administer CiviCRM')) {
$this->assign('isAdmin', 1);
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
//need to differentiate new/reuse mailing, CRM-2873
* @access public
* @static
*/
- static function formRule($params, $files, $self) {
+ public static function formRule($params, $files, $self) {
if (!empty($_POST['_qf_Import_refresh'])) {
return TRUE;
}
/**
* @return bool
*/
- static function workflowEnabled() {
+ public static function workflowEnabled() {
$config = CRM_Core_Config::singleton();
// early exit, since not true for most
*
* @return array array of ezcMail objects
*/
- function allMails() {
+ public function allMails() {
return $this->fetchNext(0);
}
/**
* Expunge the messages marked for deletion; stub function to be redefined by IMAP store
*/
- function expunge() {}
+ public function expunge() {}
/**
* Return the next X messages from the mail store
*
* @return array array of ezcMail objects
*/
- function fetchNext($count = 1) {
+ public function fetchNext($count = 1) {
if (isset($this->_transport->options->uidReferencing) and $this->_transport->options->uidReferencing) {
$offset = array_shift($this->_transport->listUniqueIdentifiers());
}
* @throws Exception
* @return string path to the Maildir's cur directory
*/
- function maildir($name) {
+ public function maildir($name) {
$config = CRM_Core_Config::singleton();
$dir = $config->customFileUploadDir . DIRECTORY_SEPARATOR . $name;
foreach (array(
*
* @return \CRM_Mailing_MailStore_Imap
*/
- function __construct($host, $username, $password, $ssl = TRUE, $folder = 'INBOX') {
+ public function __construct($host, $username, $password, $ssl = TRUE, $folder = 'INBOX') {
// default to INBOX if an empty string
if (!$folder) {
$folder = 'INBOX';
/**
* Expunge the messages marked for deletion, CRM-7356
*/
- function expunge() {
+ public function expunge() {
$this->_transport->expunge();
}
*
* @return void
*/
- function markIgnored($nr) {
+ public function markIgnored($nr) {
if ($this->_debug) {
print "setting $nr as seen and moving it to the ignored mailbox\n";
}
*
* @return void
*/
- function markProcessed($nr) {
+ public function markProcessed($nr) {
if ($this->_debug) {
print "setting $nr as seen and moving it to the processed mailbox\n";
}
*
* @return \CRM_Mailing_MailStore_Localdir
*/
- function __construct($dir) {
+ public function __construct($dir) {
$this->_dir = $dir;
$this->_ignored = $this->maildir(implode(DIRECTORY_SEPARATOR, array('CiviMail.ignored', date('Y'), date('m'), date('d'))));
*
* @return array array of ezcMail objects
*/
- function fetchNext($count = 0) {
+ public function fetchNext($count = 0) {
$mails = array();
$path = rtrim($this->_dir, DIRECTORY_SEPARATOR);
* @throws Exception
* @return void
*/
- function markIgnored($file) {
+ public function markIgnored($file) {
if ($this->_debug) {
print "moving $file to ignored folder\n";
}
* @throws Exception
* @return void
*/
- function markProcessed($file) {
+ public function markProcessed($file) {
if ($this->_debug) {
print "moving $file to processed folder\n";
}
*
* @return \CRM_Mailing_MailStore_Maildir
*/
- function __construct($dir) {
+ public function __construct($dir) {
$this->_dir = $dir;
$this->_ignored = $this->maildir(implode(DIRECTORY_SEPARATOR, array('CiviMail.ignored', date('Y'), date('m'), date('d'))));
*
* @return array array of ezcMail objects
*/
- function fetchNext($count = 0) {
+ public function fetchNext($count = 0) {
$mails = array();
$parser = new ezcMailParser;
//set property text attachment as file CRM-5408
* @throws Exception
* @return void
*/
- function markIgnored($file) {
+ public function markIgnored($file) {
if ($this->_debug) {
print "moving $file to ignored folder\n";
}
* @throws Exception
* @return void
*/
- function markProcessed($file) {
+ public function markProcessed($file) {
if ($this->_debug) {
print "moving $file to processed folder\n";
}
*
* @return \CRM_Mailing_MailStore_Mbox
*/
- function __construct($file) {
+ public function __construct($file) {
$this->_transport = new ezcMailMboxTransport($file);
flock($this->_transport->fh, LOCK_EX);
*
* @return void
*/
- function __destruct() {
+ public function __destruct() {
if ($this->_leftToProcess === 0) {
// FIXME: the ftruncate() call does not work for some reason
if ($this->_debug) {
*
* @return void
*/
- function markIgnored($nr) {
+ public function markIgnored($nr) {
if ($this->_debug) {
print "copying message $nr to ignored folder\n";
}
*
* @return void
*/
- function markProcessed($nr) {
+ public function markProcessed($nr) {
if ($this->_debug) {
print "copying message $nr to processed folder\n";
}
*
* @return \CRM_Mailing_MailStore_Pop3
*/
- function __construct($host, $username, $password, $ssl = TRUE) {
+ public function __construct($host, $username, $password, $ssl = TRUE) {
if ($this->_debug) {
print "connecting to $host and authenticating as $username\n";
}
*
* @return void
*/
- function markIgnored($nr) {
+ public function markIgnored($nr) {
if ($this->_debug) {
print "fetching message $nr and putting it in the ignored mailbox\n";
}
*
* @return void
*/
- function markProcessed($nr) {
+ public function markProcessed($nr) {
if ($this->_debug) {
print "fetching message $nr and putting it in the processed mailbox\n";
}
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
$this->_unscheduled = $this->_archived = $archiveLinks = FALSE;
$this->_mailingId = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
$this->_sms = CRM_Utils_Request::retrieve('sms', 'Positive', $this);
*
* @return void
*/
- function run() {
+ public function run() {
$this->preProcess();
$newArgs = func_get_args();
return parent::run();
}
- function search() {
+ public function search() {
if ($this->_action &
(CRM_Core_Action::ADD |
CRM_Core_Action::UPDATE
*
* @return string
*/
- function whereClause(&$params, $sortBy = TRUE) {
+ public function whereClause(&$params, $sortBy = TRUE) {
$values = array();
$clauses = array();
* @return string
* @throws Exception
*/
- function run() {
+ public function run() {
$job_id = CRM_Utils_Request::retrieve('jid', 'Integer', CRM_Core_DAO::$_nullObject);
$queue_id = CRM_Utils_Request::retrieve('qid', 'Integer', CRM_Core_DAO::$_nullObject);
$hash = CRM_Utils_Request::retrieve('h', 'String', CRM_Core_DAO::$_nullObject);
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Mailing_BAO_Component';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Mailing_Form_Component';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Mailing Components';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return CRM_Utils_System::currentPath();
}
* @param null $pageArgs
* @param null $sort
*/
- function run($args = NULL, $pageArgs = NULL, $sort = NULL) {
+ public function run($args = NULL, $pageArgs = NULL, $sort = NULL) {
return parent::run($args, $pageArgs, "component_type, is_default desc, name");
}
}
* @return string
* @throws Exception
*/
- function run() {
+ public function run() {
CRM_Utils_System::addHTMLHead('<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">');
$contact_id = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
*
* @return void
*/
- function run() {
+ public function run() {
$selector = &new CRM_Mailing_Selector_Event(
CRM_Utils_Request::retrieve('event', 'String', $this),
CRM_Utils_Request::retrieve('distinct', 'Boolean', $this),
*
*/
class CRM_Mailing_Page_Optout extends CRM_Mailing_Page_Common {
- function run() {
+ public function run() {
$this->_type = 'optout';
return parent::run();
}
*
* @return void
*/
- function run() {
+ public function run() {
$session = CRM_Core_Session::singleton();
*
* @return string Classname of BAO
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Mailing_BAO_Mailing';
}
/**
* @return null
*/
- function &links() {
+ public function &links() {
return CRM_Core_DAO::$_nullObject;
}
/**
* @return null
*/
- function editForm() {
+ public function editForm() {
return NULL;
}
/**
* @return string
*/
- function editName() {
+ public function editName() {
return 'CiviMail Report';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/mailing/report';
}
*
* @return string
*/
- function userContextParams($mode = NULL) {
+ public function userContextParams($mode = NULL) {
return 'reset=1&mid=' . $this->_mailing_id;
}
/**
* @return string
*/
- function run() {
+ public function run() {
$this->_mailing_id = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
// check that the user has permission to access mailing id
/**
* @return string
*/
- function run() {
+ public function run() {
$this->_type = 'resubscribe';
return parent::run();
}
* return null
* @access public
*/
- function browse() {
+ public function browse() {
}
/**
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
$this->browse();
*/
class CRM_Mailing_Page_Unsubscribe extends CRM_Mailing_Page_Common {
- function run() {
+ public function run() {
$this->_type = 'unsubscribe';
return parent::run();
}
* Second check for visibility
* Call a hook to see if hook wants to override visibility setting
*/
- function checkPermission() {
+ public function checkPermission() {
if (!$this->_mailing) {
return FALSE;
}
*
* @return void
*/
- function run($id = NULL, $contactID = NULL, $print = TRUE, $allowID = FALSE) {
+ public function run($id = NULL, $contactID = NULL, $print = TRUE, $allowID = FALSE) {
if (is_numeric($id)) {
$this->_mailingID = $id;
}
* @return \CRM_Mailing_Selector_Browse
@access public
*/
- function __construct() {
+ public function __construct() {
}
/**
* @access public
*
*/
- static function &links() {
+ public static function &links() {
return self::$_links;
}
*
* @access public
*/
- function getPagerParams($action, &$params) {
+ public function getPagerParams($action, &$params) {
$params['csvString'] = NULL;
$params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
$params['status'] = ts('Mailings %%StatusMessage%%');
* @return array the column headers that need to be displayed
* @access public
*/
- function &getColumnHeaders($action = NULL, $output = NULL) {
+ public function &getColumnHeaders($action = NULL, $output = NULL) {
$mailing = CRM_Mailing_BAO_Mailing::getTableName();
$job = CRM_Mailing_BAO_MailingJob::getTableName();
if (!isset(self::$_columnHeaders)) {
* @return int Total number of rows
* @access public
*/
- function getTotalCount($action) {
+ public function getTotalCount($action) {
$job = CRM_Mailing_BAO_MailingJob::getTableName();
$mailing = CRM_Mailing_BAO_Mailing::getTableName();
$mailingACL = CRM_Mailing_BAO_Mailing::mailingACL();
*
* @return int the total number of rows for this action
*/
- function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
+ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
static $actionLinks = NULL;
if (empty($actionLinks)) {
$cancelExtra = ts('Are you sure you want to cancel this mailing?');
*
* @return string name of the file
*/
- function getExportFileName($output = 'csv') {
+ public function getExportFileName($output = 'csv') {
return ts('CiviMail Mailings');
}
/**
* @param $parent
*/
- function setParent($parent) {
+ public function setParent($parent) {
$this->_parent = $parent;
}
*
* @return int|string
*/
- function whereClause(&$params, $sortBy = TRUE) {
+ public function whereClause(&$params, $sortBy = TRUE) {
$values = $clauses = array();
$isFormSubmitted = $this->_parent->get('hidden_find_mailings');
return implode(' AND ', $clauses);
}
- function pagerAtoZ() {
+ public function pagerAtoZ() {
$params = array();
$whereClause = $this->whereClause($params, FALSE);
* @return \CRM_Mailing_Selector_Event
@access public
*/
- function __construct($event, $distinct, $mailing, $job = NULL, $url = NULL) {
+ public function __construct($event, $distinct, $mailing, $job = NULL, $url = NULL) {
$this->_event_type = $event;
$this->_is_distinct = $distinct;
$this->_mailing_id = $mailing;
* @access public
* @static
*/
- static function &links() {
+ public static function &links() {
return self::$_links;
}
*
* @access public
*/
- function getPagerParams($action, &$params) {
+ public function getPagerParams($action, &$params) {
$params['csvString'] = NULL;
$params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
$params['status'] = ts('%1 %%StatusMessage%%', array(1 => $this->eventToTitle()));
* @return array the column headers that need to be displayed
* @access public
*/
- function &getColumnHeaders($action = NULL, $output = NULL) {
+ public function &getColumnHeaders($action = NULL, $output = NULL) {
$mailing = CRM_Mailing_BAO_Mailing::getTableName();
$contact = CRM_Contact_BAO_Contact::getTableName();
* @return int Total number of rows
* @access public
*/
- function getTotalCount($action) {
+ public function getTotalCount($action) {
switch ($this->_event_type) {
case 'queue':
$event = new CRM_Mailing_Event_BAO_Queue();
*
* @return int the total number of rows for this action
*/
- function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
+ 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,
*
* @return string name of the file
*/
- function getExportFileName($output = 'csv') {}
+ public function getExportFileName($output = 'csv') {}
- function eventToTitle() {
+ public function eventToTitle() {
static $events = NULL;
if (empty($events)) {
return $events[$this->_event_type];
}
- function getTitle() {
+ public function getTitle() {
return $this->eventToTitle();
}
}
* @access public
*
*/
- static function &links() {
+ public static function &links() {
if (!(self::$_links)) {
list($context, $key) = func_get_args();
$extraParams = ($key) ? "&key={$key}" : NULL;
*
* @access public
*/
- function getPagerParams($action, &$params) {
+ public function getPagerParams($action, &$params) {
$params['status'] = ts('Mailing Recipient') . ' %%StatusMessage%%';
$params['csvString'] = NULL;
if ($this->_limit) {
* @return int Total number of rows
* @access public
*/
- function getTotalCount($action) {
+ public function getTotalCount($action) {
return $this->_query->searchQuery(0, 0, NULL,
TRUE, FALSE,
FALSE, FALSE,
*
* @return int the total number of rows for this action
*/
- function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
+ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
$result = $this->_query->searchQuery($offset, $rowCount, $sort,
FALSE, FALSE,
FALSE, FALSE,
/**
* @return mixed
*/
- function alphabetQuery() {
+ public function alphabetQuery() {
return $this->_query->searchQuery(NULL, NULL, NULL, FALSE, FALSE, TRUE);
}
/**
* @return string
*/
- function &getQuery() {
+ public function &getQuery() {
return $this->_query;
}
*
* @return string name of the file
*/
- function getExportFileName($output = 'csv') {
+ public function getExportFileName($output = 'csv') {
return ts('CiviCRM Mailing Search');
}
}
*
* @return \CRM_Mailing_StateMachine_Send CRM_Mailing_StateMachine
*/
- function __construct($controller, $action = CRM_Core_Action::NONE) {
+ public function __construct($controller, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);
$this->_pages = array(
* @static
* @access public
*/
- static function &tasks() {
+ public static function &tasks() {
if (!(self::$_tasks)) {
self::$_tasks = array(
1 => array(
* @static
* @access public
*/
- static function &taskTitles() {
+ public static function &taskTitles() {
return array();
}
* @return array set of tasks that are valid for the user
* @access public
*/
- static function &permissionedTaskTitles($permission) {
+ public static function &permissionedTaskTitles($permission) {
$task = array();
return $task;
}
* @static
* @access public
*/
- static function getTask($value) {
+ public static function getTask($value) {
self::tasks();
if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) {
// make the print task by default
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function add(&$params, $ids = array()) {
+ public static function add(&$params, $ids = array()) {
$oldStatus = $oldType = NULL;
if (!empty($ids['membership'])) {
CRM_Utils_Hook::pre('edit', 'Membership', $ids['membership'], $params);
* @access public
* @static
*/
- static function &getValues(&$params, &$values, $active = FALSE) {
+ public static function &getValues(&$params, &$values, $active = FALSE) {
if (empty($params)) {
return NULL;
}
* @access public
* @static
*/
- static function create(&$params, &$ids, $skipRedirect = FALSE, $activityType = 'Membership Signup') {
+ public static function create(&$params, &$ids, $skipRedirect = FALSE, $activityType = 'Membership Signup') {
// always calculate status if is_override/skipStatusCal is not true.
// giving respect to is_override during import. CRM-4012
* @return Array array of contact_id of all related contacts.
* @static
*/
- static function checkMembershipRelationship($membershipId, $contactId, $action = CRM_Core_Action::ADD) {
+ public static function checkMembershipRelationship($membershipId, $contactId, $action = CRM_Core_Action::ADD) {
$contacts = array();
$membershipTypeID = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $membershipId, 'membership_type_id');
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$membership = new CRM_Member_DAO_Membership();
$membership->copyValues($params);
* @return array of key value pairs
* @access public
*/
- static function getStatusANDTypeValues($membershipId) {
+ public static function getStatusANDTypeValues($membershipId) {
$values = array();
if (!$membershipId) {
return $values;
* @return $results no of deleted Membership on success, false otherwise
* @access public
*/
- static function del($membershipId) {
+ public static function del($membershipId) {
//delete related first and then delete parent.
self::deleteRelatedMemberships($membershipId);
return self::deleteMembership($membershipId);
* @return $results no of deleted Membership on success, false otherwise
* @access public
*/
- static function deleteMembership($membershipId) {
+ public static function deleteMembership($membershipId) {
// CRM-12147, retrieve membership data before we delete it for hooks
$params = array('id' => $membershipId);
$memValues = array();
* @return null
* @static
*/
- static function deleteRelatedMemberships($ownerMembershipId, $contactId = NULL) {
+ public static function deleteRelatedMemberships($ownerMembershipId, $contactId = NULL) {
if (!$ownerMembershipId && !$contactId) {
return;
}
* @static
* @access public
*/
- static function activeMembers($memberships, $status = 'active') {
+ public static function activeMembers($memberships, $status = 'active') {
$actives = array();
if ($status == 'active') {
foreach ($memberships as $f => $v) {
*
* @static
*/
- static function getMembershipBlock($pageID) {
+ public static function getMembershipBlock($pageID) {
$membershipBlock = array();
$dao = new CRM_Member_DAO_MembershipBlock();
$dao->entity_table = 'civicrm_contribution_page';
* @return array|bool
* @static
*/
- static function getContactMembership($contactID, $memType, $isTest, $membershipId = NULL, $onlySameParentOrg = FALSE) {
+ public static function getContactMembership($contactID, $memType, $isTest, $membershipId = NULL, $onlySameParentOrg = FALSE) {
$dao = new CRM_Member_DAO_Membership();
if ($membershipId) {
$dao->id = $membershipId;
* @access public
* @static
*/
- static function &importableFields($contactType = 'Individual', $status = TRUE) {
+ public static function &importableFields($contactType = 'Individual', $status = TRUE) {
if (!self::$_importableFields) {
if (!self::$_importableFields) {
self::$_importableFields = array();
* @retun array return array of all exportable fields
* @static
*/
- static function &exportableFields() {
+ public static function &exportableFields() {
$expFieldMembership = CRM_Member_DAO_Membership::export();
$expFieldsMemType = CRM_Member_DAO_MembershipType::export();
*
* @return int
*/
- static function statusAvailabilty($contactId) {
+ public static function statusAvailabilty($contactId) {
$membership = new CRM_Member_DAO_MembershipStatus();
$membership->whereAdd('is_active=1');
return $membership->count();
* @return void
* @static
*/
- static function fixMembershipStatusBeforeRenew(&$currentMembership, $changeToday) {
+ public static function fixMembershipStatusBeforeRenew(&$currentMembership, $changeToday) {
$today = NULL;
if ($changeToday) {
$today = CRM_Utils_Date::processDate($changeToday, NULL, FALSE, 'Y-m-d');
* @access public
* @static
*/
- static function getContributionPageId($membershipID) {
+ public static function getContributionPageId($membershipID) {
$query = "
SELECT c.contribution_page_id as pageID
FROM civicrm_membership_payment mp, civicrm_contribution c
* @param array $params formatted array of key => value..
* @static
*/
- static function updateRelatedMemberships($ownerMembershipId, $params) {
+ public static function updateRelatedMemberships($ownerMembershipId, $params) {
$membership = new CRM_Member_DAO_Membership();
$membership->owner_membership_id = $ownerMembershipId;
$membership->find();
* @static
* @access public
*/
- static function getMembershipFields($mode = NULL) {
+ public static function getMembershipFields($mode = NULL) {
$fields = CRM_Member_DAO_Membership::export();
unset($fields['membership_contact_id']);
* @static
* @access public
*/
- static function sortName($id) {
+ public static function sortName($id) {
$id = CRM_Utils_Type::escape($id, 'Integer');
$query = "
* @static
* @access public
*/
- static function createRelatedMemberships(&$params, &$dao, $reset = FALSE) {
+ public static function createRelatedMemberships(&$params, &$dao, $reset = FALSE) {
static $relatedContactIds = array();
if ($reset) {
// not sure why a static var is in use here - we need a way to reset it from the test suite
* @return boolean true if deleted false otherwise
* @access public
*/
- static function deleteMembershipPayment($membershipId) {
+ public static function deleteMembershipPayment($membershipId) {
$membesrshipPayment = new CRM_Member_DAO_MembershipPayment();
$membesrshipPayment->membership_id = $membershipId;
*
* @return array
*/
- static function &buildMembershipTypeValues(&$form, $membershipTypeID = NULL) {
+ public static function &buildMembershipTypeValues(&$form, $membershipTypeID = NULL) {
$whereClause = " WHERE domain_id = ". CRM_Core_Config::domainID();
if (is_array($membershipTypeID)) {
* @access public
* @static
*/
- static function getContactMembershipCount($contactID, $activeOnly = FALSE) {
+ public static function getContactMembershipCount($contactID, $activeOnly = FALSE) {
$select = "SELECT count(*) FROM civicrm_membership ";
$where = "WHERE civicrm_membership.contact_id = {$contactID} AND civicrm_membership.is_test = 0 ";
* @access public
* @static
*/
- static function isCancelSubscriptionSupported($mid, $isNotCancelled = TRUE) {
+ public static function isCancelSubscriptionSupported($mid, $isNotCancelled = TRUE) {
$cacheKeyString = "$mid";
$cacheKeyString .= $isNotCancelled ? '_1' : '_0';
* @access public
* @static
*/
- static function isSubscriptionCancelled($mid) {
+ public static function isSubscriptionCancelled($mid) {
$sql = "
SELECT cr.contribution_status_id
FROM civicrm_contribution_recur cr
* whose join_date is between $startDate and $endDate and
* whose start_date is between $startDate and $endDate
*/
- static function getMembershipJoins($membershipTypeId, $startDate, $endDate, $isTest = 0) {
+ public static function getMembershipJoins($membershipTypeId, $startDate, $endDate, $isTest = 0) {
$testClause = 'membership.is_test = 1';
if (!$isTest) {
$testClause = '( membership.is_test IS NULL OR membership.is_test = 0 )';
* whose join_date is before $startDate and
* whose start_date is between $startDate and $endDate
*/
- static function getMembershipRenewals($membershipTypeId, $startDate, $endDate, $isTest = 0) {
+ public static function getMembershipRenewals($membershipTypeId, $startDate, $endDate, $isTest = 0) {
$testClause = 'membership.is_test = 1';
if (!$isTest) {
$testClause = '( membership.is_test IS NULL OR membership.is_test = 0 )';
*
* @return void
*/
- function processPriceSet($membershipId, $lineItem) {
+ public function processPriceSet($membershipId, $lineItem) {
//FIXME : need to move this too
if (!$membershipId || !is_array($lineItem)
|| CRM_Utils_System::isNull($lineItem)
* @return integer contribution id
* @access public
*/
- static function getMembershipContributionId($membershipId) {
+ public static function getMembershipContributionId($membershipId) {
$membershipPayment = new CRM_Member_DAO_MembershipPayment();
$membershipPayment->membership_id = $membershipId;
* @return array $result
* @access public
*/
- static function updateAllMembershipStatus() {
+ public static function updateAllMembershipStatus() {
//get all active statuses of membership, CRM-3984
$allStatus = CRM_Member_PseudoConstant::membershipStatus();
*
* @return array
*/
- static function getAllContactMembership($contactID, $isTest = FALSE, $onlyLifeTime = FALSE) {
+ public static function getAllContactMembership($contactID, $isTest = FALSE, $onlyLifeTime = FALSE) {
$contactMembershipType = array();
if (!$contactID) {
return $contactMembershipType;
* @return CRM_Contribute_BAO_Contribution
* @static
*/
- static function recordMembershipContribution( &$params, $ids = array()) {
+ public static function recordMembershipContribution( &$params, $ids = array()) {
$membershipId = $params['membership_id'];
$contributionParams = array();
$config = CRM_Core_Config::singleton();
* @access public
* @static
*/
- static function createLineItems(&$qf, $membershipType, &$priceSetId) {
+ public static function createLineItems(&$qf, $membershipType, &$priceSetId) {
$qf->_priceSetId = $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', 'default_membership_type_amount', 'id', 'name');
if ($priceSetId) {
$qf->_priceSet = $priceSets = current(CRM_Price_BAO_PriceSet::getSetDetail($priceSetId));
/**
* @todo document me - I seem a bit out of date....
*/
- static function _getActTypes() {
+ public static function _getActTypes() {
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name');
self::$_renewalActType = CRM_Utils_Array::key('Membership Renewal', $activityTypes);
self::$_signupActType = CRM_Utils_Array::key('Membership Signup', $activityTypes);
* @static
* @access public
*/
- static function getContactsCancelledMembership($contactID, $isTest = FALSE) {
+ public static function getContactsCancelledMembership($contactID, $isTest = FALSE) {
if (!$contactID) {
return array();
}
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
*
* @return object
*/
- static function create(&$params) {
+ public static function create(&$params) {
$hook = empty($params['id']) ? 'create' : 'edit';
CRM_Utils_Hook::pre($hook, 'MembershipBlock', CRM_Utils_Array::value('id', $params), $params);
$dao = new CRM_Member_DAO_MembershipBlock();
* @return bool
* @static
*/
- static function del($id) {
+ public static function del($id) {
$dao = new CRM_Member_DAO_MembershipBlock();
$dao->id = $id;
$result = FALSE;
*
* @return object
*/
- static function add(&$params, &$ids) {
+ public static function add(&$params, &$ids) {
$membershipLog = new CRM_Member_DAO_MembershipLog();
$membershipLog->copyValues($params);
* @static
*/
- static function del($membershipID) {
+ public static function del($membershipID) {
$membershipLog = new CRM_Member_DAO_MembershipLog();
$membershipLog->membership_id = $membershipID;
return $membershipLog->delete();
/**
* @param int $contactID
*/
- static function resetModifiedID($contactID) {
+ public static function resetModifiedID($contactID) {
$query = "
UPDATE civicrm_membership_log
SET modified_id = null
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
*
* @return object
*/
- static function create($params) {
+ public static function create($params) {
$hook = empty($params['id']) ? 'create' : 'edit';
CRM_Utils_Hook::pre($hook, 'MembershipPayment', CRM_Utils_Array::value('id', $params), $params);
$dao = new CRM_Member_DAO_MembershipPayment();
* @return bool
* @static
*/
- static function del($id) {
+ public static function del($id) {
$dao = new CRM_Member_DAO_MembershipPayment();
$dao->id = $id;
$result = FALSE;
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$membershipStatus = new CRM_Member_DAO_MembershipStatus();
$membershipStatus->copyValues($params);
if ($membershipStatus->find(TRUE)) {
* @return Object DAO object on sucess, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Member_DAO_MembershipStatus', $id, 'is_active', $is_active);
}
* @access public
* @static
*/
- static function create($params){
+ public static function create($params){
$ids = array();
if(!empty($params['id'])){
$ids['membershipStatus'] = $params['id'];
*
* @return object
*/
- static function add(&$params, $ids = array()) {
+ public static function add(&$params, $ids = array()) {
$id = CRM_Utils_Array::value('id', $params, CRM_Utils_Array::value('membershipStatus', $ids));
if (!$id) {
CRM_Core_DAO::setCreateDefaults($params, self::getDefaults());
* Get defaults for new entity
* @return array
*/
- static function getDefaults() {
+ public static function getDefaults() {
return array(
'is_active' => FALSE,
'is_current_member' => FALSE,
* @throws CRM_Core_Exception
* @static
*/
- static function del($membershipStatusId) {
+ public static function del($membershipStatusId) {
//check dependencies
//checking if membership status is present in some other table
$check = FALSE;
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$membershipType = new CRM_Member_DAO_MembershipType();
$membershipType->copyValues($params);
if ($membershipType->find(TRUE)) {
* @return Object DAO object on sucess, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Member_DAO_MembershipType', $id, 'is_active', $is_active);
}
*
* @return object
*/
- static function add(&$params, $ids = array()) {
+ public static function add(&$params, $ids = array()) {
$id = CRM_Utils_Array::value('id', $params, CRM_Utils_Array::value('membershipType', $ids));
if (!$id) {
if (!isset($params['is_active'])) {
* @return bool|mixed
* @static
*/
- static function del($membershipTypeId) {
+ public static function del($membershipTypeId) {
//check dependencies
$check = FALSE;
$status = array();
* @param array $membershipType an array of membershipType-details.
* @static
*/
- static function convertDayFormat(&$membershipType) {
+ public static function convertDayFormat(&$membershipType) {
$periodDays = array(
'fixed_period_start_day',
'fixed_period_rollover_day',
* @return array
* @static
*/
- static function getMembershipTypes($public = TRUE) {
+ public static function getMembershipTypes($public = TRUE) {
$membershipTypes = array();
$membershipType = new CRM_Member_DAO_MembershipType();
$membershipType->is_active = 1;
* @return array|null
* @static
*/
- static function getMembershipTypeDetails($membershipTypeId) {
+ public static function getMembershipTypeDetails($membershipTypeId) {
$membershipTypeDetails = array();
$membershipType = new CRM_Member_DAO_MembershipType();
* @return Array array of the details of membership types
* @static
*/
- static function getMembershipTypesByOrg($orgID) {
+ public static function getMembershipTypesByOrg($orgID) {
$membershipTypes = array();
$dao = new CRM_Member_DAO_MembershipType();
$dao->member_of_contact_id = $orgID;
* @return Array array of the details of membership types with Member of Contact id
* @static
*/
- static function getMemberOfContactByMemTypes($membershipTypes) {
+ public static function getMemberOfContactByMemTypes($membershipTypes) {
$memTypeOrgs = array();
if (empty($membershipTypes)) {
return $memTypeOrgs;
*
* @return array
*/
- static function getMembershipTypeOrganization($membershipTypeId = NULL) {
+ public static function getMembershipTypeOrganization($membershipTypeId = NULL) {
$allmembershipTypes = array();
$membershipType = new CRM_Member_DAO_MembershipType();
* @static
* @access public
*/
- static function getMembershipTypeInfo() {
+ public static function getMembershipTypeInfo() {
if (!self::$_membershipTypeInfo) {
$orgs = $types = array();
*
* @param integer financial type id
*/
- static function updateAllPriceFieldValue($membershipTypeId, $params) {
+ public static function updateAllPriceFieldValue($membershipTypeId, $params) {
if (!empty($params['minimum_fee'])){
$amount = $params['minimum_fee'];
}
/**
* @return array
*/
- static function &getFields() {
+ public static function &getFields() {
$fields = CRM_Member_BAO_Membership::exportableFields();
return $fields;
}
* @return void
* @access public
*/
- static function select(&$query) {
+ public static function select(&$query) {
// if membership mode add membership id
if ($query->_mode & CRM_Contact_BAO_Query::MODE_MEMBER ||
CRM_Contact_BAO_Query::componentPresent($query->_returnProperties, 'membership_')
/**
* @param $query
*/
- static function where(&$query) {
+ public static function where(&$query) {
$grouping = NULL;
foreach (array_keys($query->_params) as $id) {
if (empty($query->_params[$id][0])) {
* @param $values
* @param $query
*/
- static function whereClauseSingle(&$values, &$query) {
+ public static function whereClauseSingle(&$values, &$query) {
list($name, $op, $value, $grouping, $wildcard) = $values;
switch ($name) {
case 'member_join_date_low':
*
* @return null|string
*/
- static function from($name, $mode, $side) {
+ public static function from($name, $mode, $side) {
$from = NULL;
switch ($name) {
case 'civicrm_membership':
/**
* @param CRM_Core_Form $form
*/
- static function buildSearchForm(&$form) {
+ public static function buildSearchForm(&$form) {
foreach (CRM_Member_PseudoConstant::membershipType() as $id => $Name) {
$form->_membershipType = &$form->addElement('checkbox', "member_membership_type_id[$id]", NULL, $Name);
}
* @param $row
* @param int $id
*/
- static function searchAction(&$row, $id) {}
+ public static function searchAction(&$row, $id) {}
/**
* @param $tables
*/
- static function tableNames(&$tables) {
+ public static function tableNames(&$tables) {
//add membership table
if (!empty($tables['civicrm_membership_log']) || !empty($tables['civicrm_membership_status']) || CRM_Utils_Array::value('civicrm_membership_type', $tables)) {
$tables = array_merge(array('civicrm_membership' => 1), $tables);
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
*/
protected $_fromEmails = array();
- function preProcess() {
+ public function preProcess() {
$this->_action = CRM_Utils_Request::retrieve('action', 'String',$this, FALSE, 'add');
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'membership');
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
*
* @return array defaults
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if (isset($this->_id)) {
$params = array('id' => $this->_id);
* - contact_id
* - soft_credit_contact_id
*/
- function storeContactFields($formValues){
+ public function storeContactFields($formValues){
// in a 'standalone form' (contact id not in the url) the contact will be in the form values
if (!empty($formValues['contact_id'])) {
$this->_contactID = $formValues['contact_id'];
* @access public
* @static
*/
- static function formRule($params, $files, $self) {
+ public static function formRule($params, $files, $self) {
$errors = array();
$priceSetId = CRM_Utils_Array::value('price_set_id', $params);
* @return boolean true if mail was sent successfully
* @static
*/
- static function emailReceipt(&$form, &$formValues, &$membership) {
+ public static function emailReceipt(&$form, &$formValues, &$membership) {
// retrieve 'from email id' for acknowledgement
$receiptFrom = $formValues['from_email_address'];
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
//parent::setDefaultValues();
$defaults = array();
if (isset($this->_id)) {
* @access public
* @static
*/
- static function formRule($params, $files, $contributionPageId = NULL) {
+ public static function formRule($params, $files, $contributionPageId = NULL) {
$errors = array();
if (!empty($params['member_price_set_id'])) {
*/
protected $_BAOName;
- function preProcess() {
+ public function preProcess() {
$this->_id = $this->get('id');
$this->_BAOName = $this->get('BAOName');
}
*
* @return array defaults
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if (isset($this->_id)) {
* @access public
* @static
*/
- static function formRule($params) {
+ public static function formRule($params) {
$errors = array();
if ($params['membership_type_id'][0] == 0) {
$errors['membership_type_id'] = ts('Oops. It looks like you are trying to change the membership type while renewing the membership. Please click the "change membership type" link, and select a Membership Organization.');
*/
const MAX_CONTACTS = 50;
- function preProcess() {
+ public function preProcess() {
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0 );
$this->_BAOName = 'CRM_Member_BAO_MembershipType';
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
* @access public
* @static
*/
- static function formRule($params) {
+ public static function formRule($params) {
$errors = array();
if (!$params['name']) {
*
* @return text extra query parameters
*/
- function addContext() {
+ public function addContext() {
$extra = '';
foreach (array('context', 'selectedChild') as $arg) {
if ($value = CRM_Utils_Request::retrieve($arg, 'String', $this)) {
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::DELETE => array(
* @param array $owner primary membership info (membership_id, contact_id, membership_type ...)
*
*/
- function relAction($action, $owner) {
+ public function relAction($action, $owner) {
switch ($action) {
case 'delete':
$id = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->set('searchFormName', 'Search');
/**
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
parent::buildQuickForm();
$this->addElement('text', 'sort_name', ts('Member Name or Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
* @return void
* @access public
*/
- function postProcess() {
+ public function postProcess() {
if ($this->_done) {
return;
}
$controller->run();
}
- function setDefaultValues() {
+ public function setDefaultValues() {
return $this->_defaults;
}
- function fixFormValues() {
+ public function fixFormValues() {
// if this search has been forced
// then see if there are any get values, and if so over-ride the post values
// note that this means that GET over-rides POST :)
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
self::preProcessCommon($this);
}
* @param CRM_Core_Form $form
* @param bool $useTable
*/
- static function preProcessCommon(&$form, $useTable = FALSE) {
+ public static function preProcessCommon(&$form, $useTable = FALSE) {
$form->_memberIds = array();
$values = $form->controller->exportValues($form->get('searchFormName'));
* @return void
* @access public
*/
- function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
+ public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
$this->addButtons(array(
array(
'type' => $nextType,
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
/*
* initialize the task and row fields
*/
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$ufGroupId = $this->get('ufGroupId');
if (!$ufGroupId) {
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if (empty($this->_fields)) {
return;
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
//check for delete
if (!CRM_Core_Permission::checkActionPermission('CiviMember', CRM_Core_Action::DELETE)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->addDefaultButtons(ts('Delete Memberships'), 'done');
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this);
parent::preProcess();
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$this->setContactIDs();
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Member/Form/Task/Label.js');
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
CRM_Contact_Form_Task_Label::buildQuickForm($this);
$this->addElement('checkbox', 'per_membership', ts('Print one label per Membership (rather than per contact)'));
}
* @return array array of default values
* @access public
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$format = CRM_Core_BAO_LabelFormat::getDefaultValues();
$defaults['label_name'] = CRM_Utils_Array::value('name', $format);
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->skipOnHold = $this->skipDeceased = FALSE;
parent::preProcess();
$this->setContactIDs();
* (non-PHPdoc)
* @see CRM_Core_Form::setDefaultValues()
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
return CRM_Contact_Form_Task_PDFLetterCommon::setDefaultValues();
}
*
* @return void
*/
- static function postProcessMembers(&$form, $membershipIDs, $skipOnHold, $skipDeceased, $contactIDs) {
+ public static function postProcessMembers(&$form, $membershipIDs, $skipOnHold, $skipDeceased, $contactIDs) {
list($formValues, $categories, $html_message, $messageToken, $returnProperties) =
self::processMessageTemplate($form);
*
* @return unknown
*/
- static function generateHTML($membershipIDs, $returnProperties, $skipOnHold, $skipDeceased, $messageToken, $html_message, $categories) {
+ public static function generateHTML($membershipIDs, $returnProperties, $skipOnHold, $skipDeceased, $messageToken, $html_message, $categories) {
$memberships = CRM_Utils_Token::getMembershipTokenDetails($membershipIDs);
foreach ($membershipIDs as $membershipID) {
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
// initialize the task and row fields
parent::preProcess();
$session = CRM_Core_Session::singleton();
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$types = array('Membership');
$profiles = CRM_Core_BAO_UFGroup::getProfiles($types, TRUE);
*
* @return void
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Member_Form_Task_PickProfile', 'formRule'));
}
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
return TRUE;
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preprocess();
// set print view, so that print templates are called
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
//
// just need to add a javacript to popup the window for printing
//
* @return void
* @access public
*/
- function preProcess() {}
+ public function preProcess() {}
/**
* Build the form object
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$rows = array();
// display name and membership details of all selected contacts
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
// lets get around the time limit issue if possible, CRM-2113
* @param string $headerPattern
* @param string $dataPattern
*/
- function __construct($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//') {
+ public function __construct($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//') {
$this->_name = $name;
$this->_title = $title;
$this->_type = $type;
$this->_value = NULL;
}
- function resetValue() {
+ public function resetValue() {
$this->_value = NULL;
}
* The value is in string format. convert the value to the type of this field
* and set the field value with the appropriate type
*/
- function setValue($value) {
+ public function setValue($value) {
$this->_value = $value;
}
/**
* @return bool
*/
- function validate() {
+ public function validate() {
if (CRM_Utils_System::isNull($this->_value)) {
return TRUE;
* @static
* @access public
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
if (!array_key_exists('savedMapping', $fields)) {
* @return void
* @access public
*/
- function setActiveFields($fieldKeys) {
+ public function setActiveFields($fieldKeys) {
$this->_activeFieldCount = count($fieldKeys);
foreach ($fieldKeys as $key) {
if (empty($this->_fields[$key])) {
* @return array (reference ) associative array of name/value pairs
* @access public
*/
- function &getActiveFieldParams() {
+ public function &getActiveFieldParams() {
$params = array();
for ($i = 0; $i < $this->_activeFieldCount; $i++) {
if (isset($this->_activeFields[$i]->_value)
* @param string $headerPattern
* @param string $dataPattern
*/
- function addField($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//') {
+ public function addField($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//') {
if (empty($name)) {
$this->_fields['doNotImport'] = new CRM_Member_Import_Field($name, $title, $type, $headerPattern, $dataPattern);
}
* @return void
* @access public
*/
- function set($store, $mode = self::MODE_SUMMARY) {
+ public function set($store, $mode = self::MODE_SUMMARY) {
$store->set('fileSize', $this->_fileSize);
$store->set('lineCount', $this->_lineCount);
$store->set('seperator', $this->_seperator);
* @return void
* @access public
*/
- static function exportCSV($fileName, $header, $data) {
+ public static function exportCSV($fileName, $header, $data) {
$output = array();
$fd = fopen($fileName, 'w');
/**
* Class constructor
*/
- function __construct(&$mapperKeys, $mapperLocType = NULL, $mapperPhoneType = NULL) {
+ public function __construct(&$mapperKeys, $mapperLocType = NULL, $mapperPhoneType = NULL) {
parent::__construct();
$this->_mapperKeys = &$mapperKeys;
}
* @return void
* @access public
*/
- function init() {
+ public function init() {
$fields = CRM_Member_BAO_Membership::importableFields($this->_contactType, FALSE);
foreach ($fields as $name => $field) {
* @return boolean
* @access public
*/
- function mapField(&$values) {
+ public function mapField(&$values) {
return CRM_Import_Parser::VALID;
}
* @return boolean the result of this processing
* @access public
*/
- function preview(&$values) {
+ public function preview(&$values) {
return $this->summary($values);
}
* @return boolean the result of this processing
* @access public
*/
- function summary(&$values) {
+ public function summary(&$values) {
$erroneousField = NULL;
$response = $this->setActiveFieldValues($values, $erroneousField);
* @return boolean the result of this processing
* @access public
*/
- function import($onDuplicate, &$values) {
+ public function import($onDuplicate, &$values) {
try{
// first make sure this is a valid line
$response = $this->summary($values);
* @return array
* @access public
*/
- function &getImportedMemberships() {
+ public function &getImportedMemberships() {
return $this->_newMemberships;
}
* @return void
* @access public
*/
- function fini() {}
+ public function fini() {}
/**
* to calculate join, start and end dates
*
* @access public
*/
- function formattedDates($calcDates, &$formatted) {
+ public function formattedDates($calcDates, &$formatted) {
$dates = array(
'join_date',
'start_date',
* @return array|error
* @access public
*/
- function membership_format_params($params, &$values, $create = FALSE) {
+ public function membership_format_params($params, &$values, $create = FALSE) {
require_once 'api/v3/utils.php';
$fields = CRM_Member_DAO_Membership::fields();
_civicrm_api3_store_values($fields, $params, $values);
/**
* SetDefaults according to membership type
*/
- static function getMemberTypeDefaults() {
+ public static function getMemberTypeDefaults() {
if (!$_POST['mtype']) {
$details['name'] = '';
$details['auto_renew'] = '';
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
//CRM-13901 don't show dashboard to contacts with limited view writes & it does not relect
//what they have access to
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
$controller = new CRM_Core_Controller_Simple('CRM_Member_Form_Search', ts('Member'), NULL);
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Member_BAO_MembershipStatus';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
* @access public
*
*/
- function run() {
+ public function run() {
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String',
// default to 'browse'
* @access public
* @static
*/
- function browse() {
+ public function browse() {
// get all custom groups sorted by weight
$membershipStatus = array();
$dao = new CRM_Member_DAO_MembershipStatus();
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Member_Form_MembershipStatus';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'Membership Status';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/member/membershipStatus';
}
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
* @access public
*
*/
- function run() {
+ public function run() {
$this->browse();
// parent run
* @access public
* @static
*/
- function browse() {
+ public function browse() {
// get all membership types sorted by weight
$membershipType = array();
$dao = new CRM_Member_DAO_MembershipType();
* return null
* @access public
*/
- function browse() {
+ public function browse() {
$links = self::links('all', $this->_isPaymentProcessor, $this->_accessContribution);
$membership = array();
* return null
* @access public
*/
- function view() {
+ public function view() {
$controller = new CRM_Core_Controller_Simple(
'CRM_Member_Form_MembershipView',
ts('View Membership'),
* return null
* @access public
*/
- function edit() {
+ public function edit() {
// set https for offline cc transaction
$mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
if ($mode == 'test' || $mode == 'live') {
return $controller->run();
}
- function preProcess() {
+ public function preProcess() {
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
// check if we can process credit card membership
* @return array self::$_membershipTypesLinks array of action links
* @access public
*/
- static function &membershipTypesLinks() {
+ public static function &membershipTypesLinks() {
if (!self::$_membershipTypesLinks) {
self::$_membershipTypesLinks = array(
CRM_Core_Action::VIEW => array(
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Member_BAO_Membership';
}
}
* return null
* @access public
*/
- function listMemberships() {
+ public function listMemberships() {
$membership = array();
$dao = new CRM_Member_DAO_Membership();
$dao->contact_id = $this->_contactId;
* return null
* @access public
*/
- function run() {
+ public function run() {
parent::preProcess();
$this->listMemberships();
}
* @param array $params
* @access public
*/
- function getPagerParams($action, &$params) {
+ public function getPagerParams($action, &$params) {
$params['status'] = ts('Member') . ' %%StatusMessage%%';
$params['csvString'] = NULL;
if ($this->_limit) {
* @return int Total number of rows
* @access public
*/
- function getTotalCount($action) {
+ public function getTotalCount($action) {
return $this->_query->searchQuery(0, 0, NULL,
TRUE, FALSE,
FALSE, FALSE,
*
* @return int the total number of rows for this action
*/
- function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
+ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
// check if we can process credit card registration
$processors = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE,
"billing_mode IN ( 1, 3 )"
/**
* @return mixed
*/
- function alphabetQuery() {
+ public function alphabetQuery() {
return $this->_query->searchQuery(NULL, NULL, NULL, FALSE, FALSE, TRUE);
}
/**
* @return string
*/
- function &getQuery() {
+ public function &getQuery() {
return $this->_query;
}
*
* @return string name of the file
*/
- function getExportFileName($output = 'csv') {
+ public function getExportFileName($output = 'csv') {
return ts('CiviCRM Member Search');
}
}
* @return string the name of the form that will handle the task
* @access protected
*/
- function taskName($controller, $formName = 'Search') {
+ public function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
$value = CRM_Utils_Array::value('task', $_POST);
if (!isset($value)) {
* @return string
* @access public
*/
- function getTaskFormName() {
+ public function getTaskFormName() {
return CRM_Utils_String::getClassName($this->_task);
}
* we dont want to issue a reset of the state session when we are done processing a task
*
*/
- function shouldReset() {
+ public function shouldReset() {
return FALSE;
}
}
* @static
* @access public
*/
- static function &tasks() {
+ public static function &tasks() {
if (!(self::$_tasks)) {
self::$_tasks = array(
1 => array(
* @static
* @access public
*/
- static function &taskTitles() {
+ public static function &taskTitles() {
self::tasks();
$titles = array();
foreach (self::$_tasks as $id => $value) {
* @return array set of tasks that are valid for the user
* @access public
*/
- static function &permissionedTaskTitles($permission) {
+ public static function &permissionedTaskTitles($permission) {
$tasks = array();
if (($permission == CRM_Core_Permission::EDIT)
|| CRM_Core_Permission::check('edit memberships')
* @static
* @access public
*/
- static function getTask($value) {
+ public static function getTask($value) {
self::tasks();
if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) {
// make the print task by default
*/
protected $_parentId;
- function preProcess() {
+ public function preProcess() {
$this->_entityTable = $this->get('entityTable');
$this->_entityId = $this->get('entityId');
$this->_id = $this->get('id');
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if ($this->_action & CRM_Core_Action::UPDATE) {
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
*
* @return object
*/
- static function add(&$params, $pcpBlock = TRUE) {
+ public static function add(&$params, $pcpBlock = TRUE) {
if ($pcpBlock) {
// action is taken depending upon the mode
$dao = new CRM_PCP_DAO_PCPBlock();
* @static
* @access public
*/
- static function displayName($id) {
+ public static function displayName($id) {
$id = CRM_Utils_Type::escape($id, 'Integer');
$query = "
* @access public
* @static
*/
- static function getPcpDashboardInfo($contactId) {
+ public static function getPcpDashboardInfo($contactId) {
$links = self::pcpLinks();
$query = "
*
* @return total amount
*/
- static function thermoMeter($pcpId) {
+ public static function thermoMeter($pcpId) {
$query = "
SELECT SUM(cc.total_amount) as total
FROM civicrm_pcp pcp
*
* @return array $honor
*/
- static function honorRoll($pcpId) {
+ public static function honorRoll($pcpId) {
$query = "
SELECT cc.id, cs.pcp_roll_nickname, cs.pcp_personal_note,
cc.total_amount, cc.currency
* @return array (reference) of action links
* @static
*/
- static function &pcpLinks() {
+ public static function &pcpLinks() {
if (!(self::$_pcpLinks)) {
$deleteExtra = ts('Are you sure you want to delete this Personal Campaign Page?') . '\n' . ts('This action cannot be undone.');
* @param CRM_Core_Page $page
* @param null $elements
*/
- function buildPcp($pcpId, &$page, &$elements = NULL) {
+ public function buildPcp($pcpId, &$page, &$elements = NULL) {
$prms = array('id' => $pcpId);
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCP', $prms, $pcpInfo);
* @access public
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
switch ($is_active) {
case 0:
$is_active = 3;
* @access public
* @static
*/
- static function sendStatusUpdate($pcpId, $newStatus, $isInitial = FALSE, $component = 'contribute') {
+ public static function sendStatusUpdate($pcpId, $newStatus, $isInitial = FALSE, $component = 'contribute') {
$pcpStatusName = CRM_Core_OptionGroup::values("pcp_status", FALSE, FALSE, FALSE, NULL, 'name');
$pcpStatus = CRM_Core_OptionGroup::values("pcp_status");
$config = CRM_Core_Config::singleton();
* @access public
* @static
*/
- static function setDisable($id, $is_active) {
+ public static function setDisable($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_PCP_DAO_PCP', $id, 'is_active', $is_active);
}
* @access public
* @static
*/
- static function getStatus($pcpId, $component) {
+ public static function getStatus($pcpId, $component) {
$query = "
SELECT pb.is_active
FROM civicrm_pcp pcp
* @access public
* @static
*/
- static function getPcpBlockStatus($pageId, $component) {
+ public static function getPcpBlockStatus($pageId, $component) {
$query = "
SELECT pb.link_text as linkText
FROM civicrm_pcp_block pb
* @static
*
*/
- static function getPcpBlockInUse($id) {
+ public static function getPcpBlockInUse($id) {
$query = "
SELECT count(*)
FROM civicrm_pcp pcp
* @access public
* @static
*/
- static function checkEmailProfile($profileId) {
+ public static function checkEmailProfile($profileId) {
$query = "
SELECT field_name
FROM civicrm_uf_field
* @access public
* @static
*/
- static function getPcpPageTitle($pcpId, $component) {
+ public static function getPcpPageTitle($pcpId, $component) {
if ($component == 'contribute') {
$query = "
SELECT cp.title
* @access public
* @static
*/
- static function getPcpBlockEntityId($pcpId, $component) {
+ public static function getPcpBlockEntityId($pcpId, $component) {
$entity_table = self::getPcpEntityTable($component);
$query = "
* @access public
* @static
*/
- static function getPcpEntityTable($component) {
+ public static function getPcpEntityTable($component) {
$entity_table_map = array(
'event' => 'civicrm_event',
'civicrm_event' => 'civicrm_event',
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
parent::preProcess();
}
- function setDefaultValues() {
+ public function setDefaultValues() {
$dafaults = array();
$dao = new CRM_PCP_DAO_PCP();
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
if ($fields['goal_amount'] <= 0) {
$errors['goal_amount'] = ts('Goal Amount should be a numeric value greater than zero.');
* @return array array of default values
* @access public
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$pageType = CRM_Utils_Request::retrieve('page_type', 'String', $this);
* @static
* @access public
*/
- static function formRule($fields, $files, $form) {}
+ public static function formRule($fields, $files, $form) {}
/**
* Process the form
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$this->_defaults = array();
if ($this->_contactID) {
foreach ($this->_fields as $name => $dontcare) {
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
foreach ($fields as $key => $value) {
if (strpos($key, 'email-') !== FALSE && !empty($value)) {
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_PCP_BAO_PCP';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
// helper variable for nicer formatting
$deleteExtra = ts('Are you sure you want to delete this Campaign Page ?');
* @return void
* @access public
*/
- function run() {
+ public function run() {
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String',
$this, FALSE,
* @access public
* @static
*/
- function browse($action = NULL) {
+ public function browse($action = NULL) {
$this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter',
'String',
$this
}
}
- function search() {
+ public function search() {
if ($this->_action & CRM_Core_Action::DELETE) {
return;
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_PCP_Form_PCP';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return ts('Personal Campaign Page');
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/pcp';
}
* @param $whereClause
* @param array $whereParams
*/
- function pagerAtoZ($whereClause, $whereParams) {
+ public function pagerAtoZ($whereClause, $whereParams) {
$where = '';
if ($whereClause) {
if (strpos($whereClause, ' AND') == 0) {
* @access public
*
*/
- function run() {
+ public function run() {
$session = CRM_Core_Session::singleton();
$config = CRM_Core_Config::singleton();
$permissionCheck = FALSE;
/**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
if ($this->_id) {
$templateFile = "CRM/PCP/Page/{$this->_id}/PCPInfo.tpl";
$template = &CRM_Core_Page::getTemplate();
* @internal param \CRM_Contact_Import_Controller $object
* @return \CRM_PCP_StateMachine_PCP CRM_Contact_Import_StateMachine
*/
- function __construct($controller, $action = CRM_Core_Action::NONE) {
+ public function __construct($controller, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);
$session = CRM_Core_Session::singleton();
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$pledge = new CRM_Pledge_DAO_Pledge();
$pledge->copyValues($params);
if ($pledge->find(TRUE)) {
*
* @return object
*/
- static function add(&$params) {
+ public static function add(&$params) {
if (!empty($params['id'])) {
CRM_Utils_Hook::pre('edit', 'Pledge', $params['id'], $params);
}
* @access public
* @static
*/
- static function &getValues(&$params, &$values, $returnProperties = NULL) {
+ public static function &getValues(&$params, &$values, $returnProperties = NULL) {
if (empty($params)) {
return NULL;
}
* @access public
* @static
*/
- static function &create(&$params) {
+ public static function &create(&$params) {
//FIXME: a cludgy hack to fix the dates to MySQL format
$dateFields = array('start_date', 'create_date', 'acknowledge_date', 'modified_date', 'cancel_date', 'end_date');
foreach ($dateFields as $df) {
* @static
*
*/
- static function deletePledge($id) {
+ public static function deletePledge($id) {
CRM_Utils_Hook::pre('delete', 'Pledge', $id, CRM_Core_DAO::$_nullArray);
$transaction = new CRM_Core_Transaction();
*
* @return array|null
*/
- static function getTotalAmountAndCount($status = NULL, $startDate = NULL, $endDate = NULL) {
+ public static function getTotalAmountAndCount($status = NULL, $startDate = NULL, $endDate = NULL) {
$where = array();
$select = $from = $queryDate = NULL;
//get all status
* @access public
* @static
*/
- static function getHonorContacts($honorId) {
+ public static function getHonorContacts($honorId) {
$params = array();
$honorDAO = new CRM_Contribute_DAO_ContributionSoft();
$honorDAO->contact_id = $honorId;
*
* @return void.
*/
- static function sendAcknowledgment(&$form, $params) {
+ public static function sendAcknowledgment(&$form, $params) {
//handle Acknowledgment.
$allPayments = $payments = array();
* @access public
* @static
*/
- static function &exportableFields() {
+ public static function &exportableFields() {
if (!self::$_exportableFields) {
if (!self::$_exportableFields) {
self::$_exportableFields = array();
* @return array associated array of pledge id(s)
* @static
*/
- static function getContactPledges($contactID) {
+ public static function getContactPledges($contactID) {
$pledgeDetails = array();
$pledgeStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
* @access public
* @static
*/
- static function getContactPledgeCount($contactID) {
+ public static function getContactPledgeCount($contactID) {
$query = "SELECT count(*) FROM civicrm_pledge WHERE civicrm_pledge.contact_id = {$contactID} AND civicrm_pledge.is_test = 0";
return CRM_Core_DAO::singleValueQuery($query);
}
* @param integer $pledgeStatusID
* @return bool do financial transactions exist for this pledge?
*/
- static function pledgeHasFinancialTransactions($pledgeID, $pledgeStatusID) {
+ public static function pledgeHasFinancialTransactions($pledgeID, $pledgeStatusID) {
if (empty($pledgeStatusID)) {
//why would this happen? If we can see where it does then we can see if we should look it up
//but assuming from form code it CAN be empty
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$pledgeBlock = new CRM_Pledge_DAO_PledgeBlock();
$pledgeBlock->copyValues($params);
if ($pledgeBlock->find(TRUE)) {
* @access public
* @static
*/
- static function &create(&$params) {
+ public static function &create(&$params) {
$transaction = new CRM_Core_Transaction();
$pledgeBlock = self::add($params);
*
* @return object
*/
- static function add(&$params) {
+ public static function add(&$params) {
if (!empty($params['id'])) {
CRM_Utils_Hook::pre('edit', 'PledgeBlock', $params['id'], $params);
* @access public
* @static
*/
- static function deletePledgeBlock($id) {
+ public static function deletePledgeBlock($id) {
CRM_Utils_Hook::pre('delete', 'PledgeBlock', $id, CRM_Core_DAO::$_nullArray);
$transaction = new CRM_Core_Transaction();
* @return array
* @static
*/
- static function getPledgeBlock($pageID) {
+ public static function getPledgeBlock($pageID) {
$pledgeBlock = array();
$dao = new CRM_Pledge_DAO_PledgeBlock();
* @param CRM_Core_Form $form
* @static
*/
- static function buildPledgeBlock($form) {
+ public static function buildPledgeBlock($form) {
//build pledge payment fields.
if (!empty($form->_values['pledge_id'])) {
//get all payments required details.
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @return array associated array of pledge payment details
* @static
*/
- static function getPledgePayments($pledgeId) {
+ public static function getPledgePayments($pledgeId) {
$query = "
SELECT civicrm_pledge_payment.id id,
scheduled_amount,
*
* @return pledge
*/
- static function create($params) {
+ public static function create($params) {
$transaction = new CRM_Core_Transaction();
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
* @return pledge payment id
* @static
*/
- static function add($params) {
+ public static function add($params) {
if (!empty($params['id'])) {
CRM_Utils_Hook::pre('edit', 'PledgePayment', $params['id'], $params);
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$payment = new CRM_Pledge_BAO_PledgePayment;
$payment->copyValues($params);
if ($payment->find(TRUE)) {
* @return int pledge payment id
* @static
*/
- static function del($id) {
+ public static function del($id) {
$payment = new CRM_Pledge_DAO_PledgePayment();
$payment->id = $id;
if ($payment->find()) {
* @static
*
*/
- static function deletePayments($id) {
+ public static function deletePayments($id) {
if (!CRM_Utils_Rule::positiveInteger($id)) {
return FALSE;
}
* @access public
* @static
*/
- static function resetPledgePayment($contributionID) {
+ public static function resetPledgePayment($contributionID) {
//get all status
$allStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
* @return array $newdate Next scheduled date as an array
* @static
*/
- static function calculateBaseScheduleDate(&$params) {
+ public static function calculateBaseScheduleDate(&$params) {
$date = array();
$scheduled_date = CRM_Utils_Date::processDate($params['scheduled_date']);
$date['year'] = (int) substr($scheduled_date, 0, 4);
* @return formatted date
*
*/
- static function calculateNextScheduledDate(&$params, $paymentNo, $basePaymentDate = NULL) {
+ public static function calculateNextScheduledDate(&$params, $paymentNo, $basePaymentDate = NULL) {
if (!$basePaymentDate) {
$basePaymentDate = self::calculateBaseScheduleDate($params);
}
* @return int $statusId calculated status id of pledge
* @static
*/
- static function calculatePledgeStatus($pledgeId) {
+ public static function calculatePledgeStatus($pledgeId) {
$paymentStatusTypes = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
//retrieve all pledge payments for this particular pledge
*
* @static
*/
- static function updateReminderDetails($paymentId) {
+ public static function updateReminderDetails($paymentId) {
$query = "
UPDATE civicrm_pledge_payment
SET civicrm_pledge_payment.reminder_date = CURRENT_TIMESTAMP,
* @return array associated array of pledge details
* @static
*/
- static function getOldestPledgePayment($pledgeID, $limit = 1) {
+ public static function getOldestPledgePayment($pledgeID, $limit = 1) {
//get pending / overdue statuses
$pledgeStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
* @param int $pPaymentId
* @param int $paymentStatusID
*/
- static function adjustPledgePayment($pledgeID, $actualAmount, $pledgeScheduledAmount, $paymentContributionId = NULL, $pPaymentId = NULL, $paymentStatusID = NULL) {
+ public static function adjustPledgePayment($pledgeID, $actualAmount, $pledgeScheduledAmount, $paymentContributionId = NULL, $pPaymentId = NULL, $paymentStatusID = NULL) {
$allStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
if ($paymentStatusID == array_search('Cancelled', $allStatus) || $paymentStatusID == array_search('Refunded', $allStatus)) {
$query = "
/**
* @return array
*/
- static function &getFields() {
+ public static function &getFields() {
$fields = CRM_Pledge_BAO_Pledge::exportableFields();
return $fields;
}
* @return void
* @access public
*/
- static function select(&$query) {
+ public static function select(&$query) {
if (($query->_mode & CRM_Contact_BAO_Query::MODE_PLEDGE) || !empty($query->_returnProperties['pledge_id'])) {
$query->_select['pledge_id'] = 'civicrm_pledge.id as pledge_id';
$query->_element['pledge_id'] = 1;
/**
* @param $query
*/
- static function where(&$query) {
+ public static function where(&$query) {
$grouping = NULL;
foreach (array_keys($query->_params) as $id) {
if (empty($query->_params[$id][0])) {
* @param $values
* @param $query
*/
- static function whereClauseSingle(&$values, &$query) {
+ public static function whereClauseSingle(&$values, &$query) {
list($name, $op, $value, $grouping, $wildcard) = $values;
switch ($name) {
*
* @return null|string
*/
- static function from($name, $mode, $side) {
+ public static function from($name, $mode, $side) {
$from = NULL;
switch ($name) {
* @return string
* @access public
*/
- function qill() {
+ public function qill() {
return (isset($this->_qill)) ? $this->_qill : "";
}
/**
* This includes any extra fields that might need for export etc
*/
- static function extraReturnProperties($mode) {
+ public static function extraReturnProperties($mode) {
$properties = NULL;
if ($mode & CRM_Contact_BAO_Query::MODE_PLEDGE) {
/**
* @param CRM_Core_Form $form
*/
- static function buildSearchForm(&$form) {
+ public static function buildSearchForm(&$form) {
// pledge related dates
CRM_Core_Form_Date::buildDateRange($form, 'pledge_start_date', 1, '_low', '_high', ts('From'), FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'pledge_end_date', 1, '_low', '_high', ts('From'), FALSE);
* @param $row
* @param int $id
*/
- static function searchAction(&$row, $id) {}
+ public static function searchAction(&$row, $id) {}
/**
* @param $tables
*/
- static function tableNames(&$tables) {
+ public static function tableNames(&$tables) {
//add status table
if (!empty($tables['pledge_status']) || !empty($tables['civicrm_pledge_payment'])) {
$tables = array_merge(array('civicrm_pledge' => 1), $tables);
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if ($this->_id) {
$params['id'] = $this->_id;
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = $this->_values;
$fields = array();
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
if ($fields['amount'] <= 0) {
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
/**
* set the button names
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
parent::buildQuickForm();
$this->addElement('text', 'sort_name', ts('Pledger Name or Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
* @return void
* @access public
*/
- function postProcess() {
+ public function postProcess() {
if ($this->_done) {
return;
}
* @access public
* @see valid_date
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Pledge_Form_Search', 'formRule'));
}
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$errors = array();
if (!empty($errors)) {
*
* @return array the default array reference
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$defaults = $this->_formValues;
return $defaults;
}
- function fixFormValues() {
+ public function fixFormValues() {
if (!$this->_force) {
return;
}
/**
* @return null
*/
- function getFormValues() {
+ public function getFormValues() {
return NULL;
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
self::preProcessCommon($this);
}
* @param CRM_Core_Form $form
* @param bool $useTable
*/
- static function preProcessCommon(&$form, $useTable = FALSE) {
+ public static function preProcessCommon(&$form, $useTable = FALSE) {
$form->_pledgeIds = array();
$values = $form->controller->exportValues('Search');
* @return void
* @access public
*/
- function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
+ public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
$this->addButtons(array(
array(
'type' => $nextType,
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->addDefaultButtons(ts('Delete Pledges'), 'done');
}
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preprocess();
// set print view, so that print templates are called
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
//
// just need to add a javacript to popup the window for printing
//
* @return void
* @access public
*/
- function preProcess() {}
+ public function preProcess() {}
/**
* Build the form object
* @return void
* @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$rows = array();
// display name and pledge details of all selected contacts
/**
* Building Pledge Name combo box
*/
- static function pledgeName() {
+ public static function pledgeName() {
$getRecords = FALSE;
if (isset($_GET['name']) && $_GET['name']) {
* Function to setDefaults according to Pledge Id
* for batch entry pledges
*/
- function getPledgeDefaults() {
+ public function getPledgeDefaults() {
$details = array();
if (!empty($_POST['pid'])) {
$pledgeID = CRM_Utils_Type::escape($_POST['pid'], 'Integer');
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
CRM_Utils_System::setTitle(ts('CiviPledge'));
$startToDate = array();
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
$controller = new CRM_Core_Controller_Simple('CRM_Pledge_Form_Search',
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
* return null
* @access public
*/
- function edit() {
+ public function edit() {
$controller = new CRM_Core_Controller_Simple('CRM_Pledge_Form_Payment',
'Update Pledge Payment',
$this->_action
* return null
* @access public
*/
- function browse() {
+ public function browse() {
$controller = new CRM_Core_Controller_Simple('CRM_Pledge_Form_Search', ts('Pledges'), $this->_action);
$controller->setEmbedded(TRUE);
$controller->reset();
* return null
* @access public
*/
- function view() {
+ public function view() {
$controller = new CRM_Core_Controller_Simple('CRM_Pledge_Form_PledgeView',
'View Pledge',
$this->_action
* return null
* @access public
*/
- function edit() {
+ public function edit() {
$controller = new CRM_Core_Controller_Simple('CRM_Pledge_Form_Pledge',
'Create Pledge',
$this->_action
return $controller->run();
}
- function preProcess() {
+ public function preProcess() {
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
* return null
* @access public
*/
- function run() {
+ public function run() {
$this->preProcess();
// check if we can process credit card registration
* return null
* @access public
*/
- function listPledges() {
+ public function listPledges() {
$controller = new CRM_Core_Controller_Simple(
'CRM_Pledge_Form_Search',
ts('Pledges'),
* return null
* @access public
*/
- function run() {
+ public function run() {
parent::preProcess();
$this->listPledges();
}
* @access public
*
*/
- static function &links() {
+ public static function &links() {
$args = func_get_args();
$hideOption = CRM_Utils_Array::value(0, $args);
$key = CRM_Utils_Array::value(1, $args);
*
* @access public
*/
- function getPagerParams($action, &$params) {
+ public function getPagerParams($action, &$params) {
$params['status'] = ts('Pledge') . ' %%StatusMessage%%';
$params['csvString'] = NULL;
if ($this->_limit) {
* @return int Total number of rows
* @access public
*/
- function getTotalCount($action) {
+ public function getTotalCount($action) {
return $this->_query->searchQuery(0, 0, NULL,
TRUE, FALSE,
FALSE, FALSE,
*
* @return int the total number of rows for this action
*/
- function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
+ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
$result = $this->_query->searchQuery($offset, $rowCount, $sort,
FALSE, FALSE,
FALSE, FALSE,
/**
* @return string
*/
- function &getQuery() {
+ public function &getQuery() {
return $this->_query;
}
*
* @return string name of the file
*/
- function getExportFileName($output = 'csv') {
+ public function getExportFileName($output = 'csv') {
return ts('Pledge Search');
}
}
* @return string the name of the form that will handle the task
* @access protected
*/
- function taskName($controller, $formName = 'Search') {
+ public function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
$value = CRM_Utils_Array::value('task', $_POST);
if (!isset($value)) {
* @return string
* @access public
*/
- function getTaskFormName() {
+ public function getTaskFormName() {
return CRM_Utils_String::getClassName($this->_task);
}
* we dont want to issue a reset of the state session when we are done processing a task
*
*/
- function shouldReset() {
+ public function shouldReset() {
return FALSE;
}
}
* @static
* @access public
*/
- static function &tasks() {
+ public static function &tasks() {
if (!self::$_tasks) {
self::$_tasks = array(1 => array(
'title' => ts('Delete Pledges'),
* @static
* @access public
*/
- static function &taskTitles() {
+ public static function &taskTitles() {
self::tasks();
$titles = array();
foreach (self::$_tasks as $id => $value) {
* @static
* @access public
*/
- static function &optionalTaskTitle() {
+ public static function &optionalTaskTitle() {
$tasks = array();
return $tasks;
}
* @return array set of tasks that are valid for the user
* @access public
*/
- static function &permissionedTaskTitles($permission) {
+ public static function &permissionedTaskTitles($permission) {
$tasks = array();
if (($permission == CRM_Core_Permission::EDIT)
|| CRM_Core_Permission::check('edit pledges')
* @static
* @access public
*/
- static function getTask($value) {
+ public static function getTask($value) {
self::tasks();
if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) {
// make the print task by default
* @access public
* @static
*/
- static function create(&$params) {
+ public static function create(&$params) {
$id = CRM_Utils_Array::value('id', $params);
if ($id) {
CRM_Utils_Hook::pre('edit', 'LineItem', $id, $params);
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$lineItem = new CRM_Price_BAO_LineItem();
$lineItem->copyValues($params);
if ($lineItem->find(TRUE)) {
*
* @return null|string
*/
- static function getLineTotal($entityId, $entityTable) {
+ public static function getLineTotal($entityId, $entityTable) {
$sqlLineItemTotal = "SELECT SUM(li.line_total + COALESCE(li.tax_amount,0))
FROM civicrm_line_item li
WHERE li.entity_table = '{$entityTable}'
*
* @return array
*/
- static function getLineItemsByContributionID($contributionID) {
+ public static function getLineItemsByContributionID($contributionID) {
return self::getLineItems($contributionID,'contribution', NULL, TRUE, TRUE, " WHERE contribution_id = " . (int) $contributionID);
}
*
* @return array of line items
*/
- static function getLineItems($entityId, $entity = 'participant', $isQuick = NULL , $isQtyZero = TRUE, $relatedEntity = FALSE, $overrideWhereClause = '') {
+ public static function getLineItems($entityId, $entity = 'participant', $isQuick = NULL , $isQtyZero = TRUE, $relatedEntity = FALSE, $overrideWhereClause = '') {
$whereClause = $fromClause = NULL;
$selectClause = "
SELECT li.id,
* @return void
* @access static
*/
- static function format($fid, &$params, &$fields, &$values) {
+ public static function format($fid, &$params, &$fields, &$values) {
if (empty($params["price_{$fid}"])) {
return;
}
* @return void
* @static
*/
- static function processPriceSet($entityId, $lineItem, $contributionDetails = NULL, $entityTable = 'civicrm_contribution', $update = FALSE) {
+ public static function processPriceSet($entityId, $lineItem, $contributionDetails = NULL, $entityTable = 'civicrm_contribution', $update = FALSE) {
if (!$entityId || !is_array($lineItem)
|| CRM_Utils_system::isNull($lineItem)
) {
* @return void
* @static
*/
- static function getLineItemArray(&$params, $entityId = NULL, $entityTable = 'contribution', $isRelatedID = FALSE) {
+ public static function getLineItemArray(&$params, $entityId = NULL, $entityTable = 'contribution', $isRelatedID = FALSE) {
if (!$entityId) {
$priceSetDetails = CRM_Price_BAO_PriceSet::getDefaultPriceSet($entityTable);
* @access public
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
$priceFieldBAO = new CRM_Price_BAO_PriceField();
$priceFieldBAO->copyValues($params);
* @access public
* @static
*/
- static function create(&$params) {
+ public static function create(&$params) {
if(empty($params['id']) && empty($params['name'])) {
$params['name'] = strtolower(CRM_Utils_String::munge($params['label'], '_', 242));
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
return CRM_Core_DAO::commonRetrieve('CRM_Price_DAO_PriceField', $params, $defaults);
}
* @access public
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceField', $id, 'is_active', $is_active);
}
- static function freezeIfEnabled(&$element, $fieldOptions) {
+ public static function freezeIfEnabled(&$element, $fieldOptions) {
if (!empty($fieldOptions['is_full'])) {
$element->freeze();
}
/**
* @return array
*/
- static function &htmlTypes() {
+ public static function &htmlTypes() {
static $htmlTypes = NULL;
if (!$htmlTypes) {
$htmlTypes = array(
* @access public
* @static
*/
- static function add(&$params, $ids = array()) {
+ public static function add(&$params, $ids = array()) {
$fieldValueBAO = new CRM_Price_BAO_PriceFieldValue();
$fieldValueBAO->copyValues($params);
* @access public
* @static
*/
- static function create(&$params, $ids = array()) {
+ public static function create(&$params, $ids = array()) {
$id = CRM_Utils_Array::value('id', $params, CRM_Utils_Array::value('id', $ids));
if (!is_array($params) || empty($params)) {
return;
* Get defaults for new entity
* @return array
*/
- static function getDefaults() {
+ public static function getDefaults() {
return array(
'is_active' => 1,
'weight' => 1,
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
return CRM_Core_DAO::commonRetrieve('CRM_Price_DAO_PriceFieldValue', $params, $defaults);
}
* @access public
* @static
*/
- static function getValues($fieldId, &$values, $orderBy = 'weight', $isActive = FALSE) {
+ public static function getValues($fieldId, &$values, $orderBy = 'weight', $isActive = FALSE) {
$fieldValueDAO = new CRM_Price_DAO_PriceFieldValue();
$fieldValueDAO->price_field_id = $fieldId;
$fieldValueDAO->orderBy($orderBy, 'label');
* @access public
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceFieldValue', $id, 'is_active', $is_active);
}
* @access public
* @static
*/
- static function deleteValues($fieldId) {
+ public static function deleteValues($fieldId) {
if (!$fieldId) {
return;
}
* @access public
* @static
*/
- static function del($id) {
+ public static function del($id) {
if (!$id) {
return FALSE;
}
* @access public
* @static
*/
- static function updateFinancialType($entityId, $entityTable, $financialTypeID) {
+ public static function updateFinancialType($entityId, $entityTable, $financialTypeID) {
if (!$entityId || !$entityTable || !$financialTypeID) {
return;
}
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function create(&$params) {
+ public static function create(&$params) {
if(empty($params['id']) && empty($params['name'])) {
$params['name'] = CRM_Utils_String::munge($params['title'], '_', 242);
}
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
return CRM_Core_DAO::commonRetrieve('CRM_Price_DAO_PriceSet', $params, $defaults);
}
* @static
* @access public
*/
- static function setIsActive($id, $isActive) {
+ public static function setIsActive($id, $isActive) {
return CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceSet', $id, 'is_active', $isActive);
}
* @throws CRM_Core_Exception
* @return int
*/
- static function getOnlyPriceFieldID(array $priceSet) {
+ public static function getOnlyPriceFieldID(array $priceSet) {
if(count($priceSet['fields']) > 1) {
throw new CRM_Core_Exception(ts('expected only one price field to be in priceset but multiple are present'));
}
* @throws CRM_Core_Exception
* @return int
*/
- static function getOnlyPriceFieldValueID(array $priceSet) {
+ public static function getOnlyPriceFieldValueID(array $priceSet) {
$priceFieldID = self::getOnlyPriceFieldID($priceSet);
if(count($priceSet['fields'][$priceFieldID]['options']) > 1) {
throw new CRM_Core_Exception(ts('expected only one price field to be in priceset but multiple are present'));
*
* @return bool|false|int|null
*/
- static function initSet(&$form, $id, $entityTable = 'civicrm_event', $validOnly = FALSE, $priceSetId = NULL) {
+ public static function initSet(&$form, $id, $entityTable = 'civicrm_event', $validOnly = FALSE, $priceSetId = NULL) {
if (!$priceSetId) {
$priceSetId = self::getFor($entityTable, $id);
}
* @param $lineItem
* @param string $component
*/
- static function processAmount(&$fields, &$params, &$lineItem, $component = '') {
+ public static function processAmount(&$fields, &$params, &$lineItem, $component = '') {
// using price set
$totalPrice = $totalTax = 0;
$radioLevel = $checkboxLevel = $selectLevel = $textLevel = array();
* @return void
* @access public
*/
- static function buildPriceSet(&$form) {
+ public static function buildPriceSet(&$form) {
$priceSetId = $form->get('priceSetId');
if (!$priceSetId) {
return;
* 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 $defaults
* @access public
*/
- static function setDefaultPriceSet(&$form, &$defaults) {
+ public static function setDefaultPriceSet(&$form, &$defaults) {
if (!isset($form->_priceSet) || empty($form->_priceSet['fields'])) {
return $defaults;
}
* @param CRM_Core_DAO $entity object for given entity
* @param string $entityName name of entity - e.g event
*/
- static function setPriceSets(&$params, $entity, $entityName) {
+ public static function setPriceSets(&$params, $entity, $entityName) {
if(empty($params['price_set_id']) || !is_array($params['price_set_id'])) {
return;
}
* @access public
* @static
*/
- 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
*/
- static function checkPermission($sid) {
+ public static function checkPermission($sid) {
if ($sid && self::eventPriceSetDomainID()) {
$domain_id = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $sid, 'domain_id', 'id');
if (CRM_Core_Config::domainID() != $domain_id) {
/**
* @return object
*/
- static function eventPriceSetDomainID() {
+ public static function eventPriceSetDomainID() {
return CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME,
'event_price_set_domain_id',
NULL, FALSE
* @static
* @access public
*/
- static function setIsQuickConfig($id, $isQuickConfig) {
+ public static function setIsQuickConfig($id, $isQuickConfig) {
return CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceSet', $id, 'is_quick_config', $isQuickConfig);
}
* @param int $id old event/contribution page id
* @param int $newId newly created event/contribution page id
*/
- static function copyPriceSet($baoName, $id, $newId) {
+ public static function copyPriceSet($baoName, $id, $newId) {
$priceSetId = CRM_Price_BAO_PriceSet::getFor($baoName, $id);
if ($priceSetId) {
$isQuickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config');
*
*
*/
- static function setLineItem($field, $lineItem, $optionValueId) {
+ public static function setLineItem($field, $lineItem, $optionValueId) {
if ($field['html_type'] == 'Text') {
$taxAmount = $field['options'][$optionValueId]['tax_amount'] * $lineItem[$optionValueId]['qty'];
}
* @return array array of default values
* @access public
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
// is it an edit operation ?
if (isset($this->_fid)) {
* @static
* @access public
*/
- static function formRule($fields, $files, $form) {
+ public static function formRule($fields, $files, $form) {
// all option fields are of type "money"
$errors = array();
* @return array array of default values
* @access public
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
if ($this->_action == CRM_Core_Action::DELETE) {
return;
}
* @static
* @access public
*/
- static function formRule($fields, $files, $form) {
+ public static function formRule($fields, $files, $form) {
$errors = array();
if (!empty($fields['count']) && !empty($fields['max_value']) &&
$fields['count'] > $fields['max_value']
* @return array the default array reference
* @access protected
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$groupId = $this->get('groupId');
$fieldId = $this->get('fieldId');
* @access public
* @static
*/
- static function formRule($fields, $files, $options) {
+ public static function formRule($fields, $files, $options) {
$errors = array();
$count = count(CRM_Utils_Array::value('extends', $fields));
//price sets configured for membership
* @return array array of default values
* @access public
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array('is_active' => TRUE);
if ($this->_sid) {
$params = array('id' => $this->_sid);
* @return void
* @access public
*/
- function browse() {
+ public function browse() {
$resourceManager = CRM_Core_Resources::singleton();
if (!empty($_GET['new']) && $resourceManager->ajaxPopupsEnabled) {
$resourceManager->addScriptFile('civicrm', 'js/crm.addNew.js', 999, 'html-header');
* @return void
* @access public
*/
- function edit($action) {
+ public function edit($action) {
// create a simple controller for editing price data
$controller = new CRM_Core_Controller_Simple('CRM_Price_Form_Field', ts('Price Field'), $action);
* @return void
* @access public
*/
- function run() {
+ public function run() {
// get the group id
$this->_sid = CRM_Utils_Request::retrieve('sid', 'Positive',
* @return void
* @access public
*/
- function preview($fid) {
+ public function preview($fid) {
$controller = new CRM_Core_Controller_Simple('CRM_Price_Form_Preview', ts('Preview Form Field'), CRM_Core_Action::PREVIEW);
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/admin/price/field', 'reset=1&action=browse&sid=' . $this->_sid));
* @return void
* @access public
*/
- function browse() {
+ public function browse() {
$customOption = array();
CRM_Price_BAO_PriceFieldValue::getValues($this->_fid, $customOption);
$config = CRM_Core_Config::singleton();
* @return void
* @access public
*/
- function edit($action) {
+ public function edit($action) {
$oid = CRM_Utils_Request::retrieve('oid', 'Positive',
$this, FALSE, 0
);
* @return void
* @access public
*/
- function run() {
+ public function run() {
// get the field id
$this->_fid = CRM_Utils_Request::retrieve('fid', 'Positive',
* @access public
*
*/
- function run() {
+ public function run() {
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String',
// default to 'browse'
* @return void
* @access public
*/
- function edit($sid, $action) {
+ public function edit($sid, $action) {
// create a simple controller for editing price sets
$controller = new CRM_Core_Controller_Simple('CRM_Price_Form_Set', ts('Price Set'), $action);
* @return void
* @access public
*/
- function preview($sid) {
+ public function preview($sid) {
$controller = new CRM_Core_Controller_Simple('CRM_Price_Form_Preview', ts('Preview Price Set'), NULL);
$session = CRM_Core_Session::singleton();
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
* @return void
* @access public
*/
- function browse($action = NULL) {
+ public function browse($action = NULL) {
// get all price sets
$priceSet = array();
$comps = array('CiviEvent' => ts('Event'),
* @return void
* @access public
*/
- function copy() {
+ public function copy() {
$id = CRM_Utils_Request::retrieve('sid', 'Positive',
$this, TRUE, 0, 'GET'
);
*
* @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->_id = $this->get('id');
$this->_profileIds = $this->get('profileIds');
$this->_grid = CRM_Utils_Request::retrieve('grid', 'Integer', $this);
*
* @return void
*/
- function setDefaultsValues() {
+ public function setDefaultsValues() {
$this->_defaults = array();
if ($this->_multiRecordProfile && ($this->_multiRecord == CRM_Core_Action::DELETE)) {
return;
*
* @return array
*/
- static function validateContactActivityProfile($activityId, $contactId, $gid) {
+ public static function validateContactActivityProfile($activityId, $contactId, $gid) {
$errors = array();
if (!$activityId) {
$errors[] = 'Profile is using one or more activity fields, and is missing the activity Id (aid) in the URL.';
* @access public
* @static
*/
- static function formRule($fields, $files, $form) {
+ public static function formRule($fields, $files, $form) {
CRM_Utils_Hook::validateProfile($form->_ufGroup['name']);
$errors = array();
*
* @return null|string
*/
- function checkTemplateFileExists($suffix = NULL) {
+ public function checkTemplateFileExists($suffix = NULL) {
if ($this->_gid) {
$templateFile = "CRM/Profile/Form/{$this->_gid}/{$this->_name}.{$suffix}tpl";
$template = CRM_Core_Form::getTemplate();
/**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
$fileName = $this->checkTemplateFileExists();
return $fileName ? $fileName : parent::getTemplateFileName();
}
/**
* @return string
*/
- function overrideExtraTemplateFileName() {
+ public function overrideExtraTemplateFileName() {
$fileName = $this->checkTemplateFileExists('extra.');
return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
}
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
if ($this->get('register')) {
$this->_mode = CRM_Profile_Form::MODE_REGISTER;
}
* @access public
* @static
*/
- static function formRule($fields, $files, $form) {
+ public static function formRule($fields, $files, $form) {
$errors = array();
// if no values, return
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
$this->_mode = CRM_Profile_Form::MODE_CREATE;
$this->_onPopupClose = CRM_Utils_Request::retrieve('onPopupClose', 'String', $this);
*
* @return boolean true if no error found
*/
- function validate() {
+ public function validate() {
$errors = parent::validate();
if (!$errors && !empty($_POST['errorURL'])) {
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
$this->_mode = CRM_Profile_Form::MODE_SEARCH;
parent::preProcess();
}
*
* @return array the default array reference
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
// note we intentionally overwrite value since we use it as defaults
// and its all pass by value
* @return \CRM_Profile_Page_Dynamic
* @access public
*/
- function __construct($id, $gid, $restrict, $skipPermission = FALSE, $profileIds = NULL) {
+ public function __construct($id, $gid, $restrict, $skipPermission = FALSE, $profileIds = NULL) {
parent::__construct();
$this->_id = $id;
* @return array $_actionLinks
*
*/
- function &actionLinks() {
+ public function &actionLinks() {
return NULL;
}
* @access public
*
*/
- function run() {
+ public function run() {
$template = CRM_Core_Smarty::singleton();
if ($this->_id && $this->_gid) {
*
* @return null|string
*/
- function checkTemplateFileExists($suffix = '') {
+ public function checkTemplateFileExists($suffix = '') {
if ($this->_gid) {
$templateFile = "CRM/Profile/Page/{$this->_gid}/Dynamic.{$suffix}tpl";
$template = CRM_Core_Page::getTemplate();
/**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
$fileName = $this->checkTemplateFileExists();
return $fileName ? $fileName : parent::getTemplateFileName();
}
/**
* @return string
*/
- function overrideExtraTemplateFileName() {
+ public function overrideExtraTemplateFileName() {
$fileName = $this->checkTemplateFileExists('extra.');
return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
}
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
$this->_search = TRUE;
*
* @return void
*/
- function run() {
+ public function run() {
$this->preProcess();
$this->assign('recentlyViewed', FALSE);
* @return array
* @access public
*/
- function getProfileContact($gid) {
+ public function getProfileContact($gid) {
$session = CRM_Core_Session::singleton();
$params = $session->get('profileParams');
*
* @return null|string
*/
- function checkTemplateFileExists($suffix = '') {
+ public function checkTemplateFileExists($suffix = '') {
if ($this->_gid) {
$templateFile = "CRM/Profile/Page/{$this->_gid}/Listings.{$suffix}tpl";
$template = CRM_Core_Page::getTemplate();
/**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
$fileName = $this->checkTemplateFileExists();
return $fileName ? $fileName : parent::getTemplateFileName();
}
/**
* @return string
*/
- function overrideExtraTemplateFileName() {
+ public function overrideExtraTemplateFileName() {
$fileName = $this->checkTemplateFileExists('extra.');
return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
}
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return '';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links[$this->_pageViewType])) {
// helper variable for nicer formatting
$links = array();
* @access public
*
*/
- function run() {
+ public function run() {
// get the requested action, default to 'browse'
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, FALSE);
* @return void
* @access public
*/
- function browse() {
+ public function browse() {
$dateFields = NULL;
$cgcount = 0;
$dateFieldsVals = NULL;
*
* @return string classname of edit form
*/
- function editForm() {
+ public function editForm() {
return '';
}
*
* @return string name of this page
*/
- function editName() {
+ public function editName() {
return '';
}
*
* @return string user context
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return '';
}
}
* @static
* @access public
*/
- function run($args = NULL) {
+ public function run($args = NULL) {
if ($args[1] !== 'profile') {
return;
}
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive',
$this, FALSE
);
* @access public
*
*/
- function run() {
+ public function run() {
$this->preProcess();
return parent::run();
}
*
* @return null|string
*/
- function checkTemplateFileExists($suffix = '') {
+ public function checkTemplateFileExists($suffix = '') {
if ($this->_gid) {
$templateFile = "CRM/Profile/Page/{$this->_gid}/View.{$suffix}tpl";
$template = CRM_Core_Page::getTemplate();
/**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
$fileName = $this->checkTemplateFileExists();
return $fileName ? $fileName : parent::getTemplateFileName();
}
/**
* @return string
*/
- function overrideExtraTemplateFileName() {
+ public function overrideExtraTemplateFileName() {
$fileName = $this->checkTemplateFileExists('extra.');
return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
}
* @return array
* @access public
*/
- static function &links($map = FALSE, $editLink = FALSE, $ufLink = FALSE, $gids = NULL) {
+ public static function &links($map = FALSE, $editLink = FALSE, $ufLink = FALSE, $gids = NULL) {
if (!self::$_links) {
self::$_links = array();
*
* @access public
*/
- function getPagerParams($action, &$params) {
+ public function getPagerParams($action, &$params) {
$status =
CRM_Utils_System::isNull($this->_multiRecordTableName) ? ts('Contact %%StatusMessage%%') : ts('Contact Multi Records %%StatusMessage%%');
$params['status'] = $status;
* @return array the column headers that need to be displayed
* @access public
*/
- function &getColumnHeaders($action = NULL, $output = NULL) {
+ public function &getColumnHeaders($action = NULL, $output = NULL) {
static $skipFields = array('group', 'tag');
$multipleFields = array('url');
$direction = CRM_Utils_Sort::ASCENDING;
* @return int Total number of rows
* @access public
*/
- function getTotalCount($action) {
+ public function getTotalCount($action) {
$additionalWhereClause = 'contact_a.is_deleted = 0';
$additionalFromClause = NULL;
$returnQuery = NULL;
* @return string
* @access public
*/
- function getQill() {
+ public function getQill() {
return $this->_query->qill();
}
*
* @return int the total number of rows for this action
*/
- function &getRows($action, $offset, $rowCount, $sort, $output = NULL, $extraWhereClause = NULL) {
+ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL, $extraWhereClause = NULL) {
$multipleFields = array('url');
//$sort object processing for location fields
*
* @return string name of the file
*/
- function getExportFileName($output = 'csv') {
+ public function getExportFileName($output = 'csv') {
return ts('CiviCRM Profile Listings');
}
* set the _multiRecordTableName to display the result set
* according to multi record custom field values
*/
- function setMultiRecordTableName($fields) {
+ public function setMultiRecordTableName($fields) {
$customGroupId = $multiRecordTableName = NULL;
$selectorSet = FALSE;
* @access public
* @static
*/
- static function add(&$params) {
+ public static function add(&$params) {
$instance = new CRM_Report_DAO_ReportInstance();
if (empty($params)) {
return NULL;
* @access public
* @static
*/
- static function &create(&$params) {
+ public static function &create(&$params) {
if (isset($params['report_header'])) {
$params['header'] = CRM_Utils_Array::value('report_header',$params);
}
*
* @return mixed $results no of deleted Instance on success, false otherwise@access public
*/
- static function del($id = NULL) {
+ public static function del($id = NULL) {
$dao = new CRM_Report_DAO_ReportInstance();
$dao->id = $id;
return $dao->delete();
*
* @return CRM_Report_DAO_ReportInstance|null
*/
- static function retrieve($params, &$defaults) {
+ public static function retrieve($params, &$defaults) {
$instance = new CRM_Report_DAO_ReportInstance();
$instance->copyValues($params);
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
// build tag filter
$this->assign('currencyColumn', $this->_currencyColumn);
}
- function preProcessCommon() {
+ public function preProcessCommon() {
$this->_force =
CRM_Utils_Request::retrieve(
'force',
$this->_chartButtonName = $this->getButtonName('submit', 'chart');
}
- function addBreadCrumb() {
+ public function addBreadCrumb() {
$breadCrumbs =
array(
array(
CRM_Utils_System::appendBreadCrumb($breadCrumbs);
}
- function preProcess() {
+ public function preProcess() {
$this->preProcessCommon();
if (!$this->_id) {
*
* @return array
*/
- function setDefaultValues($freeze = TRUE) {
+ public function setDefaultValues($freeze = TRUE) {
$freezeGroup = array();
// FIXME: generalizing form field naming conventions would reduce
*
* @return bool
*/
- function getElementFromGroup($group, $grpFieldName) {
+ public function getElementFromGroup($group, $grpFieldName) {
$eleObj = $this->getElement($group);
foreach ($eleObj->_elements as $index => $obj) {
if ($grpFieldName == $obj->_attributes['name']) {
*
* @param array $params
*/
- function setParams($params) {
+ public function setParams($params) {
$this->_params = $params;
}
*
* @param int $instanceid
*/
- function setID($instanceid) {
+ public function setID($instanceid) {
$this->_id = $instanceid;
}
*
* @param $isForce
*/
- function setForce($isForce) {
+ public function setForce($isForce) {
$this->_force = $isForce;
}
*
* @param number $_limitValue
*/
- function setLimitValue($_limitValue) {
+ public function setLimitValue($_limitValue) {
$this->_limitValue = $_limitValue;
}
*
* @param number $_offsetValue
*/
- function setOffsetValue($_offsetValue) {
+ public function setOffsetValue($_offsetValue) {
$this->_offsetValue = $_offsetValue;
}
* Getter for $_defaultValues
* @return array $_defaultValues
*/
- function getDefaultValues() {
+ public function getDefaultValues() {
return $this->_defaults;
}
- function addColumns() {
+ public function addColumns() {
$options = array();
$colGroups = NULL;
foreach ($this->_columns as $tableName => $table) {
$this->assign('colGroups', $colGroups);
}
- function addFilters() {
+ public function addFilters() {
$filters = array();
$count = 1;
foreach ($this->_filters as $table => $attributes) {
$this->assign('filters', $filters);
}
- function addOptions() {
+ public function addOptions() {
if (!empty($this->_options)) {
// FIXME: For now lets build all elements as checkboxes.
// Once we clear with the format we can build elements based on type
$this->assign('otherOptions', $this->_options);
}
- function addChartOptions() {
+ public function addChartOptions() {
if (!empty($this->_charts)) {
$this->addElement('select', "charts", ts('Chart'), $this->_charts, array('onchange' => 'disablePrintPDFButtons(this.value);'));
$this->assign('charts', $this->_charts);
}
}
- function addGroupBys() {
+ public function addGroupBys() {
$options = $freqElements = array();
foreach ($this->_columns as $tableName => $table) {
}
}
- function addOrderBys() {
+ public function addOrderBys() {
$options = array();
foreach ($this->_columns as $tableName => $table) {
}
}
- function buildInstanceAndButtons() {
+ public function buildInstanceAndButtons() {
CRM_Report_Form_Instance::buildForm($this);
$label = $this->_id ? ts('Update Report') : ts('Create Report');
);
}
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->addColumns();
$this->addFilters();
*
* @return array
*/
- function customDataFormRule($fields, $ignoreFields = array()) {
+ public function customDataFormRule($fields, $ignoreFields = array()) {
$errors = array();
if (!empty($this->_customGroupExtends) && $this->_customGroupGroupBy &&
!empty($fields['group_bys'])
*
* @return array
*/
- function getOperationPair($type = "string", $fieldName = NULL) {
+ public function getOperationPair($type = "string", $fieldName = NULL) {
// FIXME: At some point we should move these key-val pairs
// to option_group and option_value table.
switch ($type) {
}
}
- function buildTagFilter() {
+ public function buildTagFilter() {
$contactTags = CRM_Core_BAO_Tag::getTags();
if (!empty($contactTags)) {
$this->_columns['civicrm_tag'] = array(
/*
* Adds group filters to _columns (called from _Constuct
*/
- function buildGroupFilter() {
+ public function buildGroupFilter() {
$this->_columns['civicrm_group']['filters'] = array(
'gid' => array(
'name' => 'group_id',
*
* @return string
*/
- function getSQLOperator($operator = "like") {
+ public function getSQLOperator($operator = "like") {
switch ($operator) {
case 'eq':
return '=';
*
* @return string|NULL
*/
- function dateDisplay($relative, $from, $to) {
+ public function dateDisplay($relative, $from, $to) {
list($from, $to) = $this->getFromTo($relative, $from, $to);
if ($from) {
*
* @return array
*/
- function getFromTo($relative, $from, $to, $fromtime = NULL, $totime = NULL) {
+ public function getFromTo($relative, $from, $to, $fromtime = NULL, $totime = NULL) {
if (empty($totime)) {
$totime = '235959';
}
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
}
/**
* @param $rows
*/
- function alterCustomDataDisplay(&$rows) {
+ public function alterCustomDataDisplay(&$rows) {
// custom code to alter rows having custom values
if (empty($this->_customGroupExtends)) {
return;
*
* @return float|string
*/
- function formatCustomValues($value, $customField, $fieldValueMap) {
+ public function formatCustomValues($value, $customField, $fieldValueMap) {
if (CRM_Utils_System::isNull($value)) {
return;
}
/**
* @param $rows
*/
- function removeDuplicates(&$rows) {
+ public function removeDuplicates(&$rows) {
if (empty($this->_noRepeats)) {
return;
}
* @param $fields
* @param bool $subtotal
*/
- function fixSubTotalDisplay(&$row, $fields, $subtotal = TRUE) {
+ public function fixSubTotalDisplay(&$row, $fields, $subtotal = TRUE) {
foreach ($row as $colName => $colVal) {
if (in_array($colName, $fields)) {
$row[$colName] = $row[$colName];
*
* @return bool
*/
- function grandTotal(&$rows) {
+ public function grandTotal(&$rows) {
if (!$this->_rollup || ($this->_rollup == '') ||
($this->_limit && count($rows) >= self::ROW_COUNT_LIMIT)
) {
* @param $rows
* @param bool $pager
*/
- function formatDisplay(&$rows, $pager = TRUE) {
+ public function formatDisplay(&$rows, $pager = TRUE) {
// set pager based on if any limit was applied in the query.
if ($pager) {
$this->setPager();
/**
* @param $rows
*/
- function buildChart(&$rows) {
+ public function buildChart(&$rows) {
// override this method for building charts.
}
// 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.
- function select() {
+ public function select() {
$select = $this->_selectAliases = array();
foreach ($this->_columns as $tableName => $table) {
*
* @return bool
*/
- function selectClause(&$tableName, $tableKey, &$fieldName, &$field) {
+ public function selectClause(&$tableName, $tableKey, &$fieldName, &$field) {
return FALSE;
}
- function where() {
+ public function where() {
$this->storeWhereHavingClauseArray();
if (empty($this->_whereClauses)) {
* temp table that may not be part of the final where clause or added
* in other functions
*/
- function storeWhereHavingClauseArray() {
+ public function storeWhereHavingClauseArray() {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('filters', $table)) {
foreach ($table['filters'] as $fieldName => $field) {
}
- function processReportMode() {
+ public function processReportMode() {
$buttonName = $this->controller->getButtonName();
$output = CRM_Utils_Request::retrieve(
/**
* Post Processing function for Form (postProcessCommon should be used to set other variables from input as the api accesses that function)
*/
- function beginPostProcess() {
+ public function beginPostProcess() {
$this->setParams($this->controller->exportValues($this->_name));
if (empty($this->_params) &&
/**
* BeginPostProcess function run in both report mode and non-report mode (api)
*/
- function beginPostProcessCommon() {
+ public function beginPostProcessCommon() {
}
*
* @return string
*/
- function buildQuery($applyLimit = TRUE) {
+ public function buildQuery($applyLimit = TRUE) {
$this->select();
$this->from();
$this->customDataFrom();
return $sql;
}
- function groupBy() {
+ public function groupBy() {
$groupBys = array();
if (!empty($this->_params['group_bys']) &&
is_array($this->_params['group_bys']) &&
}
}
- function orderBy() {
+ public function orderBy() {
$this->_orderBy = "";
$this->_sections = array();
$this->storeOrderByArray();
* Separating this into a separate function allows it to be called separately from constructing
* the order by clause
*/
- function storeOrderByArray() {
+ public function storeOrderByArray() {
$orderBys = array();
if (!empty($this->_params['order_bys']) &&
/**
* @return array
*/
- function unselectedSectionColumns() {
+ public function unselectedSectionColumns() {
$selectColumns = array();
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
* @param $sql
* @param $rows
*/
- function buildRows($sql, &$rows) {
+ public function buildRows($sql, &$rows) {
$dao = CRM_Core_DAO::executeQuery($sql);
if (!is_array($rows)) {
$rows = array();
* an array of total counts for each section. This data is used by the Smarty
* plugin {sectionTotal}
*/
- function sectionTotals() {
+ public function sectionTotals() {
// Reports using order_bys with sections must populate $this->_selectAliases in select() method.
if (empty($this->_selectAliases)) {
}
}
- function modifyColumnHeaders() {
+ public function modifyColumnHeaders() {
// use this method to modify $this->_columnHeaders
}
/**
* @param $rows
*/
- function doTemplateAssignment(&$rows) {
+ public function doTemplateAssignment(&$rows) {
$this->assign_by_ref('columnHeaders', $this->_columnHeaders);
$this->assign_by_ref('rows', $rows);
$this->assign('statistics', $this->statistics($rows));
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = array();
$count = count($rows);
* @param $statistics
* @param $count
*/
- function countStat(&$statistics, $count) {
+ public function countStat(&$statistics, $count) {
$statistics['counts']['rowCount'] = array(
'title' => ts('Row(s) Listed'),
'value' => $count,
/**
* @param $statistics
*/
- function groupByStat(&$statistics) {
+ public function groupByStat(&$statistics) {
if (!empty($this->_params['group_bys']) &&
is_array($this->_params['group_bys']) &&
!empty($this->_params['group_bys'])
/**
* @param $statistics
*/
- function filterStat(&$statistics) {
+ public function filterStat(&$statistics) {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('filters', $table)) {
foreach ($table['filters'] as $fieldName => $field) {
/**
* @param null $rows
*/
- function endPostProcess(&$rows = NULL) {
+ public function endPostProcess(&$rows = NULL) {
if ($this->_storeResultSet) {
$this->_resultSet = $rows;
}
}
}
- function storeResultSet() {
+ public function storeResultSet() {
$this->_storeResultSet = TRUE;
}
/**
* @return bool
*/
- function getResultSet() {
+ public function getResultSet() {
return $this->_resultSet;
}
/**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
$defaultTpl = parent::getTemplateFileName();
$template = CRM_Core_Smarty::singleton();
if (!$template->template_exists($defaultTpl)) {
/**
* @return string
*/
- function compileContent() {
+ public function compileContent() {
$templateFile = $this->getHookedTemplateFileName();
return $this->_formValues['report_header'] .
CRM_Core_Form::$_template->fetch($templateFile) .
}
- function postProcess() {
+ public function postProcess() {
// get ready with post process params
$this->beginPostProcess();
/**
* @param int $rowCount
*/
- function limit($rowCount = self::ROW_COUNT_LIMIT) {
+ public function limit($rowCount = self::ROW_COUNT_LIMIT) {
// lets do the pager if in html mode
$this->_limit = NULL;
/**
* @param int $rowCount
*/
- function setPager($rowCount = self::ROW_COUNT_LIMIT) {
+ public function setPager($rowCount = self::ROW_COUNT_LIMIT) {
// CRM-14115, over-ride row count if rowCount is specified in URL
if ($this->_dashBoardRowCount) {
*
* @return string
*/
- function whereGroupClause($field, $value, $op) {
+ public function whereGroupClause($field, $value, $op) {
$smartGroupQuery = "";
*
* @return string
*/
- function whereTagClause($field, $value, $op) {
+ public function whereTagClause($field, $value, $op) {
// not using left join in query because if any contact
// belongs to more than one tag, results duplicate
// entries.
WHERE entity_table = 'civicrm_contact' AND {$clause} ) ";
}
- function whereMembershipOrgClause($field, $value, $op) {
+ public function whereMembershipOrgClause($field, $value, $op) {
$sqlOp = $this->getSQLOperator($op);
if (!is_array($value)) {
$value = array($value);
AND mem_status.is_active = '1' ) ";
}
- function whereMembershipTypeClause($field, $value, $op) {
+ public function whereMembershipTypeClause($field, $value, $op) {
$sqlOp = $this->getSQLOperator($op);
if (!is_array($value)) {
$value = array($value);
/**
* @param string $tableAlias
*/
- function buildACLClause($tableAlias = 'contact_a') {
+ public function buildACLClause($tableAlias = 'contact_a') {
list($this->_aclFrom, $this->_aclWhere) = CRM_Contact_BAO_Contact_Permission::cacheClause($tableAlias);
}
* @param bool $addFields
* @param array $permCustomGroupIds
*/
- function addCustomDataToColumns($addFields = TRUE, $permCustomGroupIds = array()) {
+ public function addCustomDataToColumns($addFields = TRUE, $permCustomGroupIds = array()) {
if (empty($this->_customGroupExtends)) {
return;
}
}
}
- function customDataFrom() {
+ public function customDataFrom() {
if (empty($this->_customGroupExtends)) {
return;
}
*
* @return bool
*/
- function isFieldSelected($prop) {
+ public function isFieldSelected($prop) {
if (empty($prop)) {
return FALSE;
}
* Check for empty order_by configurations and remove them; also set
* template to hide them.
*/
- function preProcessOrderBy(&$formValues) {
+ public function preProcessOrderBy(&$formValues) {
// Object to show/hide form elements
$_showHide = new CRM_Core_ShowHideBlocks('', '');
*
* @return bool
*/
- function isTableSelected($tableName) {
+ public function isTableSelected($tableName) {
return in_array($tableName, $this->selectedTables());
}
*
* @return Array $this->_selectedTables
*/
- function selectedTables() {
+ public function selectedTables() {
if (!$this->_selectedTables) {
$orderByColumns = array();
if (array_key_exists('order_bys', $this->_params) &&
*
* @return array address fields for construct clause
*/
- function addAddressFields($groupBy = TRUE, $orderBy = FALSE, $filters = TRUE, $defaults = array('country_id' => TRUE)) {
+ public function addAddressFields($groupBy = TRUE, $orderBy = FALSE, $filters = TRUE, $defaults = array('country_id' => TRUE)) {
$addressFields = array(
'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
*
* @return bool
*/
- function alterDisplayAddressFields(&$row, &$rows, &$rowNum, $baseUrl, $urltxt) {
+ public function alterDisplayAddressFields(&$row, &$rows, &$rowNum, $baseUrl, $urltxt) {
$criteriaQueryParams = CRM_Report_Utils_Report::getPreviewCriteriaQueryParams($this->_defaults, $this->_params);
$entryFound = FALSE;
// handle country
*
* @return string
*/
- function fiscalYearOffset($fieldName) {
+ public function fiscalYearOffset($fieldName) {
$config = CRM_Core_Config::singleton();
$fy = $config->fiscalYearStart;
if (CRM_Utils_Array::value('yid_op', $this->_params) == 'calendar' ||
/*
* Add Address into From Table if required
*/
- function addAddressFromClause() {
+ public function addAddressFromClause() {
// include address field if address column is to be included
if ((isset($this->_addressField) &&
$this->_addressField
/**
* Add Phone into From Table if required
*/
- function addPhoneFromClause() {
+ public function addPhoneFromClause() {
// include address field if address column is to be included
if ($this->isTableSelected('civicrm_phone')
) {
*
* @return array phone columns definition
*/
- function getPhoneColumns($options = array()) {
+ public function getPhoneColumns($options = array()) {
$defaultOptions = array(
'prefix' => '',
'prefix_label' => '',
*
* @return array address columns definition
*/
- function getAddressColumns($options = array()) {
+ public function getAddressColumns($options = array()) {
$options += array(
'prefix' => '',
'prefix_label' => '',
/**
* @param int $groupID
*/
- function add2group($groupID) {
+ public function add2group($groupID) {
if (is_numeric($groupID) && isset($this->_aliases['civicrm_contact'])) {
$select = "SELECT DISTINCT {$this->_aliases['civicrm_contact']}.id AS addtogroup_contact_id, ";
$select = str_ireplace('SELECT SQL_CALC_FOUND_ROWS ', $select, $this->_select);
}
/* function used for showing charts on print screen */
- static function uploadChartImage() {
+ public static function uploadChartImage() {
// upload strictly for '.png' images
$name = trim(basename(CRM_Utils_Request::retrieve('name', 'String', CRM_Core_DAO::$_nullObject, FALSE, NULL, 'GET')));
if (preg_match('/\.png$/', $name)) {
/**
*
*/
- function __construct() {
+ public function __construct() {
// There could be multiple contacts. We not clear on which contact id to display.
// Lets hide it for now.
$this->_exposeContactID = FALSE;
/** adding address fields with dbAlias for order clause
* @return array address fields
*/
- function addressFields($orderBy = FALSE) {
+ public function addressFields($orderBy = FALSE) {
$address = parent::addAddressFields(FALSE, TRUE);
if ($orderBy) {
foreach ($address['civicrm_address']['order_bys'] as $fieldName => $field) {
/**
* @param null $recordType
*/
- function select($recordType = NULL) {
+ public function select($recordType = NULL) {
if (!array_key_exists("contact_{$recordType}", $this->_params['fields']) &&
$recordType != 'final'
) {
/**
* @param $recordType
*/
- function from($recordType) {
+ public function from($recordType) {
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$activityTypeId = CRM_Core_DAO::getFieldValue("CRM_Core_DAO_OptionGroup", 'activity_type', 'id', 'name');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
/**
* @param null $recordType
*/
- function where($recordType = NULL) {
+ public function where($recordType = NULL) {
$this->_where = " WHERE {$this->_aliases['civicrm_activity']}.is_test = 0 AND
{$this->_aliases['civicrm_activity']}.is_deleted = 0 AND
{$this->_aliases['civicrm_activity']}.is_current_revision = 1";
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = "GROUP BY {$this->_aliases['civicrm_activity']}.id";
}
/**
* @param string $tableAlias
*/
- function buildACLClause($tableAlias = 'contact_a') {
+ public function buildACLClause($tableAlias = 'contact_a') {
//override for ACL( Since Contact may be source
//contact/assignee or target also it may be null )
*
* @throws Exception
*/
- function add2group($groupID) {
+ public function add2group($groupID) {
if (CRM_Utils_Array::value("contact_target_op", $this->_params) == 'nll') {
CRM_Core_Error::fatal(ts('Current filter criteria didn\'t have any target contact to add to group'));
}
}
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
//Assign those recordtype to array which have filter operator as 'Is not empty' or 'Is empty'
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
}
}
- function sectionTotals() {
+ public function sectionTotals() {
// Reports using order_bys with sections must populate $this->_selectAliases in select() method.
if (empty($this->_selectAliases)) {
return;
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
parent::__construct();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
- function from() {
+ public function from() {
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
}
}
- function where() {
+ public function where() {
$this->_where = " WHERE civicrm_option_group.name = 'activity_type' AND
{$this->_aliases['civicrm_activity']}.is_test = 0 AND
{$this->_aliases['civicrm_activity']}.is_deleted = 0 AND
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = array();
if (is_array($this->_params['group_bys']) &&
!empty($this->_params['group_bys'])
*
* @return array
*/
- function formRule($fields, $files, $self) {
+ public function formRule($fields, $files, $self) {
$errors = array();
$contactFields = array('sort_name', 'email', 'phone');
if (!empty($fields['group_bys'])) {
return $errors;
}
- function postProcess() {
+ public function postProcess() {
// get the acl clauses built before we assemble the query
$this->buildACLClause($this->_aliases['civicrm_contact']);
parent::postProcess();
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
/**
*
*/
- function __construct() {
+ public function __construct() {
//filter options for survey activity status.
$responseStatus = array('' => '- Any -');
self::$_surveyRespondentStatus = array();
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
//add the survey response fields.
$this->_select = "SELECT " . implode(",\n", $select) . " ";
}
- function from() {
+ public function from() {
$this->_from = " FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom} ";
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
}
}
- function where() {
+ public function where() {
$clauses = array();
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('filters', $table)) {
}
}
- function postProcess() {
+ public function postProcess() {
// get the acl clauses built before we assemble the query
$this->buildACLClause($this->_aliases['civicrm_contact']);
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
//format the survey result data.
$this->_formatSurveyResult($rows);
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = $grouping = array();
return $errors;
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_contact {$this->_aliases['civicrm_contact']}
LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']}
}
}
- function where() {
+ public function where() {
$clauses = array();
$this->_having = '';
foreach ($this->_columns as $tableName => $table) {
$this->_where = "WHERE " . implode(' AND ', $clauses);
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = "GROUP BY {$this->_aliases['civicrm_contact']}.id, {$this->_aliases['civicrm_case']}.id";
}
- function orderBy() {
+ public function orderBy() {
$this->_orderBy = "ORDER BY {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_contact']}.id, {$this->_aliases['civicrm_case']}.id";
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
foreach ($rows as $rowNum => $row) {
*
* @return null|string
*/
- function getCustomFieldLabel($fname, $val) {
+ public function getCustomFieldLabel($fname, $val) {
$query = "
SELECT v.label
FROM civicrm_custom_group cg INNER JOIN civicrm_custom_field cf ON cg.id = cf.custom_group_id
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->case_statuses = CRM_Core_OptionGroup::values('case_status');
$this->case_types = CRM_Case_PseudoConstant::caseType();
$rels = CRM_Core_PseudoConstant::relationshipType();
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function buildQuickForm() {
+ public function buildQuickForm() {
parent::buildQuickForm();
$this->caseDetailSpecialColumnsAdd();
}
- function caseDetailSpecialColumnsAdd() {
+ public function caseDetailSpecialColumnsAdd() {
$elements = array();
$elements[] = &$this->createElement('select', 'case_activity_all_dates', NULL,
array(
$this->assign('caseDetailExtra', $this->_caseDetailExtra);
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
$this->_select = 'SELECT ' . implode(', ', $select) . ' ';
}
- function from() {
+ public function from() {
$case = $this->_aliases['civicrm_case'];
$conact = $this->_aliases['civicrm_contact'];
}
}
- function where() {
+ public function where() {
$clauses = array();
$this->_having = '';
foreach ($this->_columns as $tableName => $table) {
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_case']}.id";
}
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
$select = "select COUNT( DISTINCT( {$this->_aliases['civicrm_address']}.country_id))";
return $statistics;
}
- function orderBy() {
+ public function orderBy() {
$this->_orderBy = " ORDER BY {$this->_aliases['civicrm_case']}.start_date DESC ";
}
- function caseDetailSpecialColumnProcess() {
+ public function caseDetailSpecialColumnProcess() {
if (!$this->_includeCaseDetailExtra) {
return;
}
$this->_from .= ' ' . implode(' ', $from) . ' ';
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
$this->endPostProcess($rows);
}
- function checkEnabledFields() {
+ public function checkEnabledFields() {
if (isset($this->_params['worldregion_id_value']) &&
!empty($this->_params['worldregion_id_value'])
) {
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
$entryFound = FALSE;
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->case_types = CRM_Case_PseudoConstant::caseType();
$this->case_statuses = CRM_Core_OptionGroup::values('case_status');
$rels = CRM_Core_PseudoConstant::relationshipType();
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = $grouping = array();
if (empty($fields['relationship_type_id_value']) &&
(array_key_exists('sort_name', $fields['fields']) ||
return $errors;
}
- function from() {
+ public function from() {
$cc = $this->_aliases['civicrm_case'];
$c = $this->_aliases['civicrm_contact'];
}
}
- function where() {
+ public function where() {
$clauses = array();
$this->_having = '';
foreach ($this->_columns as $tableName => $table) {
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = "";
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
$entryFound = FALSE;
foreach ($rows as $rowNum => $row) {
if (array_key_exists('civicrm_case_status_id', $row)) {
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
asort($this->activityTypes);
parent::__construct();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_activity {$this->_aliases['civicrm_activity']}
";
}
- function where() {
+ public function where() {
$this->_where = " WHERE {$this->_aliases['civicrm_activity']}.is_current_revision = 1 AND
{$this->_aliases['civicrm_activity']}.is_deleted = 0 AND
{$this->_aliases['civicrm_activity']}.is_test = 0";
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = '';
if ($this->has_grouping) {
$this->_groupBy = "
}
}
- function orderBy() {
+ public function orderBy() {
$this->_orderBy = "ORDER BY {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_contact']}.id";
}
- function postProcess() {
+ public function postProcess() {
parent::postProcess();
}
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
if (!empty($fields['group_bys']) &&
(!array_key_exists('id', $fields['fields']) ||
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_employer' => array(
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$select = $this->_columnHeaders = array();
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_contact {$this->_aliases['civicrm_contact']}
AND {$this->_aliases['civicrm_email']}.is_primary = 1) ";
}
- function where() {
+ public function where() {
$clauses = array();
foreach ($this->_columns as $tableName => $table) {
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = "GROUP BY {$this->_aliases['civicrm_employer']}.id,{$this->_aliases['civicrm_contact']}.id";
}
- function orderBy() {
+ public function orderBy() {
$this->_orderBy = "ORDER BY {$this->_aliases['civicrm_employer']}.organization_name, {$this->_aliases['civicrm_contact']}.display_name";
}
- function postProcess() {
+ public function postProcess() {
// get the acl clauses built before we assemble the query
$this->buildACLClause(array(
$this->_aliases['civicrm_contact'],
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$checkList = array();
$entryFound = FALSE;
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_autoIncludeIndexedFieldsAsOrderBys = 1;
$this->_columns = array(
'civicrm_contact' => array(
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
$this->_csvSupported = FALSE;
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
$this->_component = array(
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
return $errors;
}
- function from() {
+ public function from() {
$group = " ";
$this->_from = "
FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom}";
}
}
- function where() {
+ public function where() {
$clauses = array();
foreach ($this->_columns as $tableName => $table) {
/**
* @return array
*/
- function clauseComponent() {
+ public function clauseComponent() {
$selectedContacts = implode(',', $this->_contactSelected);
$contribution = $membership = $participant = NULL;
$eligibleResult = $rows = $tempArray = array();
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = array();
$count = count($rows);
/**
* @param int $rowCount
*/
- function limit($rowCount = self::ROW_COUNT_LIMIT) {
+ public function limit($rowCount = self::ROW_COUNT_LIMIT) {
parent::limit($rowCount);
}
/**
* @param int $rowCount
*/
- function setPager($rowCount = self::ROW_COUNT_LIMIT) {
+ public function setPager($rowCount = self::ROW_COUNT_LIMIT) {
parent::setPager($rowCount);
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
/**
* @param $componentRows
*/
- function alterComponentDisplay(&$componentRows) {
+ public function alterComponentDisplay(&$componentRows) {
// custom code to alter rows
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
$activityStatus = CRM_Core_PseudoConstant::activityStatus();
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
asort($this->activityTypes);
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = $grouping = array();
return $errors;
}
- function from() {
+ public function from() {
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$this->_from = "
";
}
- function where() {
+ public function where() {
$clauses = array();
$this->_having = '';
foreach ($this->_columns as $tableName => $table) {
$this->_where = "WHERE " . implode(' AND ', $clauses);
}
- function orderBy() {
+ public function orderBy() {
$this->_orderBy = "
ORDER BY {$this->_aliases['civicrm_log']}.modified_date DESC, {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_contact_touched']}.sort_name
";
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
foreach ($rows as $rowNum => $row) {
/**
*
*/
- function __construct() {
+ public function __construct() {
$logging = new CRM_Logging_Schema;
$this->tables[] = 'civicrm_contact';
$this->tables = array_merge($this->tables, array_keys($logging->customDataLogTables()));
parent::__construct();
}
- function buildQuickForm() {
+ public function buildQuickForm() {
$layout = CRM_Utils_Request::retrieve('layout', 'String', $this);
$this->assign('layout', $layout);
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
$logTypes = array();
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// cache for id → is_deleted mapping
$isDeleted = array();
$newRows = array();
/**
* @param null $logTable
*/
- function from( $logTable = null ) {
+ public function from( $logTable = null ) {
static $entity = null;
if ( $logTable ) {
$entity = $logTable;
);
public $_drilldownReport = array('contact/detail' => 'Link to Detail Report');
- function __construct() {
+ public function __construct() {
$contact_type = CRM_Contact_BAO_ContactType::getSelectElements(FALSE, TRUE, '_');
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$select = $this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_relationship {$this->_aliases['civicrm_relationship']}
}
}
- function where() {
+ public function where() {
$whereClauses = $havingClauses = array();
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('filters', $table)) {
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
$isStatusFilter = FALSE;
return $statistics;
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = " ";
$groupBy = array();
if ($this->relationType == 'a_b') {
}
}
- function orderBy() {
+ public function orderBy() {
$this->_orderBy = " ORDER BY {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_contact_b']}.sort_name ";
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
$this->relationType = NULL;
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_autoIncludeIndexedFieldsAsOrderBys = 1;
$this->_columns = array(
'civicrm_contact' => array(
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = $grouping = array();
return $errors;
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom}
LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']}
}
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
$entryFound = TRUE;
}
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
$this->_select = 'SELECT ' . implode(', ', $select) . ' ';
}
- function from() {
+ public function from() {
$this->_from = NULL;
$this->_from = "FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom}
ON fitem.entity_id = {$this->_aliases['civicrm_line_item']}.id AND fitem.entity_table = 'civicrm_line_item' ";
}
- function orderBy() {
+ public function orderBy() {
parent::orderBy();
// please note this will just add the order-by columns to select query, and not display in column-headers.
}
}
- function where() {
+ public function where() {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('filters', $table)) {
foreach ($table['filters'] as $fieldName => $field) {
}
}
- function postProcess() {
+ public function postProcess() {
// get the acl clauses built before we assemble the query
$this->buildACLClause($this->_aliases['civicrm_contact']);
parent::postProcess();
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
$select = " SELECT COUNT({$this->_aliases['civicrm_financial_trxn']}.id ) as count,
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
$contributionTypes = CRM_Contribute_PseudoConstant::financialType();
$paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
/**
*
*/
- function __construct() {
+ public function __construct() {
// Check if CiviCampaign is a) enabled and b) has active campaigns
$config = CRM_Core_Config::singleton();
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$this->_columnHeaders = array();
parent::select();
$this->_select = str_replace("sum({$this->_aliases['civicrm_contribution']}.total_amount)", "{$this->_aliases['civicrm_contribution']}.total_amount", $this->_select);
}
- function orderBy() {
+ public function orderBy() {
parent::orderBy();
// please note this will just add the order-by columns to select query, and not display in column-headers.
/**
* @param bool $softcredit
*/
- function from($softcredit = FALSE) {
+ public function from($softcredit = FALSE) {
$this->_from = "
FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom}
INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_contact']}.id, {$this->_aliases['civicrm_contribution']}.id ";
}
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
$totalAmount = $average = array();
return $statistics;
}
- function postProcess() {
+ public function postProcess() {
// get the acl clauses built before we assemble the query
$this->buildACLClause($this->_aliases['civicrm_contact']);
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$checkList = array();
$entryFound = FALSE;
}
}
- function sectionTotals() {
+ public function sectionTotals() {
// Reports using order_bys with sections must populate $this->_selectAliases in select() method.
if (empty($this->_selectAliases)) {
/**
*
*/
- function __construct() {
+ public function __construct() {
$yearsInPast = 4;
$date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, 0);
$count = $date['maxYear'];
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_contact {$this->_aliases['civicrm_contact']}
INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
}
}
- function where() {
+ public function where() {
$whereClauses = $havingClauses = $relationshipWhere = array();
$this->_relationshipWhere = '';
$this->_statusClause = '';
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = "GROUP BY {$this->_aliases['civicrm_contribution']}.contact_id, YEAR({$this->_aliases['civicrm_contribution']}.receive_date)";
}
/**
* @param int $rowCount
*/
- function limit($rowCount = self::ROW_COUNT_LIMIT) {
+ public function limit($rowCount = self::ROW_COUNT_LIMIT) {
parent::limit($rowCount);
}
/**
* @param int $rowCount
*/
- function setPager($rowCount = self::ROW_COUNT_LIMIT) {
+ public function setPager($rowCount = self::ROW_COUNT_LIMIT) {
parent::setPager($rowCount);
}
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
$count = 0;
foreach ($rows as $rownum => $row) {
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
if (!empty($fields['this_year_value']) &&
!empty($fields['other_year_value']) &&
return $errors;
}
- function postProcess() {
+ public function postProcess() {
// get ready with post process params
$this->beginPostProcess();
$this->fixReportParams();
$this->endPostProcess($rows);
}
- function fixReportParams() {
+ public function fixReportParams() {
if (!empty($this->_params['this_year_value'])) {
$this->_referenceYear['this_year'] = $this->_params['this_year_value'];
}
/**
* @param $rows
*/
- function buildRows($sql, &$rows) {
+ public function buildRows($sql, &$rows) {
$contactIds = array();
$addWhere = '';
*
* @return array
*/
- function buildContributionRows($contactIds) {
+ public function buildContributionRows($contactIds) {
$rows = array();
if (empty($contactIds)) {
return $rows;
*
* @return array
*/
- function buildRelationshipRows($contactIds) {
+ public function buildRelationshipRows($contactIds) {
$relationshipRows = $relatedContactIds = array();
if (empty($contactIds)) {
return array($relationshipRows, $relatedContactIds);
*
* @return array
*/
- function getOperationPair($type = "string", $fieldName = NULL) {
+ public function getOperationPair($type = "string", $fieldName = NULL) {
if ($fieldName == 'this_year' || $fieldName == 'other_year') {
return array(
'calendar' => ts('Is Calendar Year'),
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
if (empty($rows)) {
return;
}
/**
*
*/
- function __construct() {
+ public function __construct() {
self::validRelationships();
$config = CRM_Core_Config::singleton();
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$this->_columnHeaders = $select = array();
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
- function from() {
+ public function from() {
$this->_from = NULL;
$this->_from = "
}
}
- function where() {
+ public function where() {
$clauses = array();
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('filters', $table)) {
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_relationship']}.$this->householdContact, {$this->_aliases['civicrm_relationship']}.$this->otherContact , {$this->_aliases['civicrm_contribution']}.id, {$this->_aliases['civicrm_relationship']}.relationship_type_id ";
}
- function orderBy() {
+ public function orderBy() {
$this->_orderBy = " ORDER BY {$this->_aliases['civicrm_contact_household']}.household_name, {$this->_aliases['civicrm_relationship']}.$this->householdContact, {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_relationship']}.$this->otherContact";
}
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
//hack filter display for relationship type
return $statistics;
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
$this->buildACLClause(array(
/**
* Set variables to be accessed by API and form layer in processing
*/
- function beginPostProcessCommon() {
+ public function beginPostProcessCommon() {
$getRelationship = $this->_params['relationship_type_id_value'];
$type = substr($getRelationship, -3);
$this->relationshipId = intval((substr($getRelationship, 0, strpos($getRelationship, '_'))));
}
}
- function validRelationships() {
+ public function validRelationships() {
$this->relationTypes = $relationTypes = array();
$params = array('contact_type_b' => 'Household', 'version' => 3);
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$type = substr($this->_params['relationship_type_id_value'], -3);
/**
*
*/
- function __construct() {
+ public function __construct() {
$logging = new CRM_Logging_Schema;
$this->tables[] = 'civicrm_contribution';
$this->tables = array_merge($this->tables, array_keys($logging->customDataLogTables()));
parent::__construct();
}
- function buildQuickForm() {
+ public function buildQuickForm() {
parent::buildQuickForm();
// link back to summary report
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_contact_altered_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// cache for id → is_deleted mapping
$isDeleted = array();
}
}
- function from() {
+ public function from() {
$this->_from = "
FROM `{$this->loggingDB}`.log_civicrm_contribution {$this->_aliases['log_civicrm_contribution']}
LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact_altered_by']}
/**
*
*/
- function __construct() {
+ public function __construct() {
$yearsInPast = 10;
$yearsInFuture = 1;
$date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture);
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$this->_columnHeaders = $select = array();
$current_year = $this->_params['yid_value'];
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_contribution {$this->_aliases['civicrm_contribution']}
$this->addAddressFromClause();
}
- function where() {
+ public function where() {
$this->_statusClause = "";
$clauses = array($this->_aliases['civicrm_contribution'] . '.is_test = 0');
$current_year = $this->_params['yid_value'];
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy =
"GROUP BY {$this->_aliases['civicrm_contribution']}.contact_id, " .
self::fiscalYearOffset($this->_aliases['civicrm_contribution'] .
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
if (!empty($rows)) {
$select = "
return $statistics;
}
- function postProcess() {
+ public function postProcess() {
// get ready with post process params
$this->beginPostProcess();
/**
* @param $rows
*/
- function buildChart(&$rows) {
+ public function buildChart(&$rows) {
$graphRows = array();
$count = 0;
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
*
* @return array
*/
- function getOperationPair($type = "string", $fieldName = NULL) {
+ public function getOperationPair($type = "string", $fieldName = NULL) {
if ($fieldName == 'yid') {
return array(
'calendar' => ts('Is Calendar Year'),
/**
*
*/
- function __construct() {
+ public function __construct() {
self::validRelationships();
$config = CRM_Core_Config::singleton();
$campaignEnabled = in_array('CiviCampaign', $config->enableComponents);
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$this->_columnHeaders = $select = array();
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
- function from() {
+ public function from() {
$this->_from = NULL;
$this->_from = "
}
}
- function where() {
+ public function where() {
$clauses = array();
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('filters', $table)) {
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_relationship']}.$this->orgContact, {$this->_aliases['civicrm_relationship']}.$this->otherContact , {$this->_aliases['civicrm_contribution']}.id, {$this->_aliases['civicrm_relationship']}.relationship_type_id ";
}
- function orderBy() {
+ public function orderBy() {
$this->_orderBy = " ORDER BY {$this->_aliases['civicrm_contact_organization']}.organization_name, {$this->_aliases['civicrm_relationship']}.$this->orgContact, {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_relationship']}.$this->otherContact";
}
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
//hack filter display for relationship type
return $statistics;
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
$this->buildACLClause(array($this->_aliases['civicrm_contact'], $this->_aliases['civicrm_contact_organization']));
$sql = $this->buildQuery(TRUE);
/**
* Set variables to be accessed by API and form layer in processing
*/
- function beginPostProcessCommon() {
+ public function beginPostProcessCommon() {
$getRelationship = $this->_params['relationship_type_id_value'];
$type = substr($getRelationship, -3);
$this->relationshipId = intval((substr($getRelationship, 0, strpos($getRelationship, '_'))));
}
}
- function validRelationships() {
+ public function validRelationships() {
$this->relationTypes = $relationTypes = array();
$params = array('contact_type_b' => 'Organization', 'version' => 3);
/**
* @param array $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$type = substr($this->_params['relationship_type_id_value'], -3);
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
parent::__construct();
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_pcp {$this->_aliases['civicrm_pcp']}
{$this->_aliases['civicrm_contribution_page']}.id";
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = "GROUP BY {$this->_aliases['civicrm_pcp']}.id";
}
- function orderBy() {
+ public function orderBy() {
$this->_orderBy = " ORDER BY {$this->_aliases['civicrm_contact']}.sort_name ";
}
- function where() {
+ public function where() {
$whereClauses = $havingClauses = array();
foreach ($this->_columns as $tableName => $table) {
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
$select =
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
$checkList = array();
*/
class CRM_Report_Form_Contribute_Recur extends CRM_Report_Form {
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
$this->_currencyColumn = 'civicrm_contribution_recur_currency';
parent::__construct();
}
- function getTemplateName() {
+ public function getTemplateName() {
return 'CRM/Report/Form.tpl' ;
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_contact {$this->_aliases['civicrm_contact']}
INNER JOIN civicrm_contribution_recur {$this->_aliases['civicrm_contribution_recur']}
{$this->_aliases['civicrm_phone']}.is_primary = 1)";
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = "GROUP BY " . $this->_aliases['civicrm_contribution_recur'] . ".id";
}
- function where() {
+ public function where() {
parent::where();
// Handle calculated end date. This can come from one of two sources:
// Either there is a specified end date for the end_date field
}
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
foreach ($rows as $rowNum => $row) {
// convert display name to links
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
*
* @return array
*/
- function setDefaultValues($freeze = TRUE) {
+ public function setDefaultValues($freeze = TRUE) {
return parent::setDefaultValues($freeze);
}
- function select() {
+ public function select() {
$select = array();
$append = NULL;
// since contact fields not related to financial type
/**
* @param bool $tableCol
*/
- function groupBy($tableCol = FALSE) {
+ public function groupBy($tableCol = FALSE) {
$this->_groupBy = "";
if (!empty($this->_params['group_bys']) &&
is_array($this->_params['group_bys'])
}
}
- function from() {
+ public function from() {
list($fromTable, $fromAlias, $fromCol) = $this->groupBy(TRUE);
$from = "$fromTable $fromAlias";
*
* @return mixed|string
*/
- function whereContribution($replaceAliasWith = 'contribution1') {
+ public function whereContribution($replaceAliasWith = 'contribution1') {
$clauses = array("is_test" => "{$this->_aliases['civicrm_contribution']}.is_test = 0");
foreach ($this->_columns['civicrm_contribution']['filters'] as $fieldName => $field) {
return $whereClause;
}
- function where() {
+ 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)";
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = $checkDate = $errorCount = array();
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
//fetch contributions for both date ranges from pre-existing temp tables
return $statistics;
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
$create = $subSelect1 = $subSelect2 = NULL;
list($fromTable, $fromAlias, $fromCol) = $this->groupBy(TRUE);
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
list($from1, $to1) = $this->getFromTo(CRM_Utils_Array::value("receive_date1_relative", $this->_params),
CRM_Utils_Array::value("receive_date1_from", $this->_params),
/**
*
*/
- function __construct() {
+ public function __construct() {
// Check if CiviCampaign is a) enabled and b) has active campaigns
$config = CRM_Core_Config::singleton();
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = $grouping = array();
return $errors;
}
- function from() {
+ public function from() {
$alias_constituent = 'constituentname';
$alias_creditor = 'contact_civireport';
$this->_from = "
}
}
- function groupBy() {
+ public function groupBy() {
$this->_rollup = 'WITH ROLLUP';
$this->_groupBy = "
GROUP BY {$this->_aliases['civicrm_contribution_soft']}.contact_id, constituentname.id {$this->_rollup}";
}
- function where() {
+ public function where() {
parent::where();
$this->_where .= " AND {$this->_aliases['civicrm_contribution']}.is_test = 0 ";
}
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
$select = "
return $statistics;
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
$this->buildACLClause(array('constituentname', 'contact_civireport'));
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
/**
*
*/
- function __construct() {
+ public function __construct() {
// Check if CiviCampaign is a) enabled and b) has active campaigns
$config = CRM_Core_Config::singleton();
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
*
* @return array
*/
- function setDefaultValues($freeze = TRUE) {
+ public function setDefaultValues($freeze = TRUE) {
return parent::setDefaultValues($freeze);
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = $grouping = array();
//check for searching combination of dispaly columns and
//grouping criteria
return $errors;
}
- function from() {
+ public function from() {
$softCreditJoin = "LEFT";
if (!empty($this->_params['fields']['soft_amount']) &&
empty($this->_params['fields']['total_amount'])
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = "";
$append = FALSE;
if (is_array($this->_params['group_bys']) &&
}
}
- function storeWhereHavingClauseArray() {
+ public function storeWhereHavingClauseArray() {
parent::storeWhereHavingClauseArray();
if (empty($this->_params['fields']['soft_amount']) &&
!empty($this->_havingClauses)
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
$softCredit = CRM_Utils_Array::value('soft_amount', $this->_params['fields']);
return $statistics;
}
- function postProcess() {
+ public function postProcess() {
$this->buildACLClause($this->_aliases['civicrm_contact']);
parent::postProcess();
}
/**
* @param $rows
*/
- function buildChart(&$rows) {
+ public function buildChart(&$rows) {
$graphRows = array();
if (!empty($this->_params['charts'])) {
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
/**
*
*/
- function __construct() {
+ public function __construct() {
$yearsInPast = 10;
$yearsInFuture = 1;
$date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture);
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
$current_year = $this->_params['yid_value'];
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_contribution {$this->_aliases['civicrm_contribution']}
$this->addAddressFromClause();
}
- function where() {
+ public function where() {
$this->_statusClause = "";
$clauses = array($this->_aliases['civicrm_contribution'] . '.is_test = 0');
foreach ($this->_columns as $tableName => $table) {
}
}
- function groupBy() {
+ public function groupBy() {
$this->assign('chartSupported', TRUE);
$this->_groupBy =
"Group BY {$this->_aliases['civicrm_contribution']}.contact_id, " .
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
if (!empty($rows)) {
return $statistics;
}
- function postProcess() {
+ public function postProcess() {
// get ready with post process params
$this->beginPostProcess();
/**
* @param $rows
*/
- function buildChart(&$rows) {
+ public function buildChart(&$rows) {
$graphRows = array();
$count = 0;
$current_year = $this->_params['yid_value'];
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
*
* @return array
*/
- function getOperationPair($type = "string", $fieldName = NULL) {
+ public function getOperationPair($type = "string", $fieldName = NULL) {
if ($fieldName == 'yid') {
return array(
'calendar' => ts('Is Calendar Year'),
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
//Headers for Rank column
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
$op = CRM_Utils_Array::value('total_range_op', $fields);
return $errors;
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom}
INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
$this->addAddressFromClause();
}
- function where() {
+ public function where() {
$clauses = array();
$this->_tempClause = $this->_outerCluase = $this->_groupLimit = '';
foreach ($this->_columns as $tableName => $table) {
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = "GROUP BY {$this->_aliases['civicrm_contact']}.id, {$this->_aliases['civicrm_contribution']}.currency";
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
/**
* @param int $groupID
*/
- function add2group($groupID) {
+ public function add2group($groupID) {
if (is_numeric($groupID)) {
$sql = "
/**
* @param int $rowCount
*/
- function limit($rowCount = CRM_Report_Form::ROW_COUNT_LIMIT) {
+ public function limit($rowCount = CRM_Report_Form::ROW_COUNT_LIMIT) {
// lets do the pager if in html mode
$this->_limit = NULL;
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_event' => array(
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
$this->_csvSupported = FALSE;
parent::preProcess();
}
/**
* @param $eventIDs
*/
- function buildEventReport($eventIDs) {
+ public function buildEventReport($eventIDs) {
$this->assign('events', $eventIDs);
*
* @return array
*/
- function statistics(&$eventIDs) {
+ public function statistics(&$eventIDs) {
$statistics = array();
$count = count($eventIDs);
$this->countStat($statistics, $count);
/**
* @param int $rowCount
*/
- function limit($rowCount = self::ROW_COUNT_LIMIT) {
+ public function limit($rowCount = self::ROW_COUNT_LIMIT) {
parent::limit($rowCount);
//modify limit
/**
* @param int $rowCount
*/
- function setPager($rowCount = self::ROW_COUNT_LIMIT) {
+ public function setPager($rowCount = self::ROW_COUNT_LIMIT) {
$params = array(
'total' => $this->_rowsFound,
'rowCount' => self::ROW_COUNT_LIMIT,
$this->assign_by_ref('pager', $pager);
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
$this->_setVariable = TRUE;
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_event' => array(
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
$this->_select = "SELECT " . implode(', ', $select);
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_event {$this->_aliases['civicrm_event']}
LEFT JOIN civicrm_participant {$this->_aliases['civicrm_participant']}
{$this->_aliases['civicrm_line_item']}.entity_table = 'civicrm_participant' ";
}
- function where() {
+ public function where() {
$clauses = array();
$this->_participantWhere = "";
foreach ($this->_columns as $tableName => $table) {
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
$select = "
SELECT SUM( {$this->_aliases['civicrm_line_item']}.participant_count ) as count,
return $statistics;
}
- function groupBy() {
+ public function groupBy() {
$this->assign('chartSupported', TRUE);
$this->_rollup = " WITH ROLLUP";
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_event']}.id {$this->_rollup}";
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
/**
* @param $rows
*/
- function buildChart(&$rows) {
+ public function buildChart(&$rows) {
$this->_interval = 'events';
$countEvent = NULL;
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
if (is_array($rows)) {
$eventType = CRM_Core_OptionGroup::values('event_type');
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
$avg = NULL;
return $statistics;
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = $grouping = array();
return $errors;
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_participant {$this->_aliases['civicrm_participant']}
LEFT JOIN civicrm_event {$this->_aliases['civicrm_event']}
ON {$this->_aliases['civicrm_line_item']}.entity_table = 'civicrm_participant' AND {$this->_aliases['civicrm_participant']}.id ={$this->_aliases['civicrm_line_item']}.entity_id";
}
- function storeWhereHavingClauseArray() {
+ public function storeWhereHavingClauseArray() {
parent::storeWhereHavingClauseArray();
$this->_whereClauses[] = "{$this->_aliases['civicrm_participant']}.is_test = 0";
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = "";
if (!empty($this->_params['group_bys']) &&
is_array($this->_params['group_bys']) &&
$this->_groupBy;
}
- function postProcess() {
+ public function postProcess() {
// get ready with post process params
$this->beginPostProcess();
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
$entryFound = FALSE;
$eventType = CRM_Core_OptionGroup::values('event_type');
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_autoIncludeIndexedFieldsAsOrderBys = 1;
// Check if CiviCampaign is a) enabled and b) has active campaigns
/**
* @return array
*/
- function getPriceLevels() {
+ public function getPriceLevels() {
$query = "
SELECT CONCAT(cv.label, ' (', ps.title, ')') label, cv.id
FROM civicrm_price_field_value cv
} //searches database for priceset values
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = $grouping = array();
return $errors;
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_participant {$this->_aliases['civicrm_participant']}
LEFT JOIN civicrm_event {$this->_aliases['civicrm_event']}
}
}
- function where() {
+ public function where() {
$clauses = array();
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('filters', $table)) {
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = "GROUP BY {$this->_aliases['civicrm_participant']}.id";
}
- function postProcess() {
+ public function postProcess() {
// get ready with post process params
$this->beginPostProcess();
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_event' => array(
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
$this->_select = 'SELECT ' . implode(', ', $select);
}
- function from() {
+ public function from() {
$this->_from = " FROM civicrm_event {$this->_aliases['civicrm_event']} ";
}
- function where() {
+ public function where() {
$clauses = array();
$this->_participantWhere = "";
foreach ($this->_columns as $tableName => $table) {
$this->_where = 'WHERE ' . implode(' AND ', $clauses);
}
- function groupBy() {
+ public function groupBy() {
$this->assign('chartSupported', TRUE);
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_event']}.id";
}
/**
* @return array
*/
- function participantInfo() {
+ public function participantInfo() {
$statusType1 = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1');
$statusType2 = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 0');
}
//build header for table
- function buildColumnHeaders() {
+ public function buildColumnHeaders() {
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
);
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
/**
* @param $rows
*/
- function buildChart(&$rows) {
+ public function buildChart(&$rows) {
$this->_interval = 'events';
$countEvent = NULL;
if (!empty($this->_params['charts'])) {
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
if (is_array($rows)) {
$eventType = CRM_Core_OptionGroup::values('event_type');
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
parent::select();
}
/*
* From clause build where baseTable & fromClauses are defined
*/
- function from() {
+ public function from() {
if (!empty($this->_baseTable)) {
$this->buildACLClause($this->_aliases['civicrm_contact']);
$this->_from = "FROM {$this->_baseTable} {$this->_aliases[$this->_baseTable]}";
/**
* @return array
*/
- function fromClauses() {
+ public function fromClauses() {
return array();
}
- function groupBy() {
+ public function groupBy() {
parent::groupBy();
//@todo - need to re-visit this - bad behaviour from pa
if ($this->_groupBy == 'GROUP BY') {
}
}
- function orderBy() {
+ public function orderBy() {
parent::orderBy();
}
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
return parent::statistics($rows);
}
- function postProcess() {
+ public function postProcess() {
if (!empty($this->_aclTable) && !empty($this->_aliases[$this->_aclTable])) {
$this->buildACLClause($this->_aliases[$this->_aclTable]);
}
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
parent::alterDisplay($rows);
//THis is all generic functionality which can hopefully go into the parent class
/**
* @return array
*/
- function getLineItemColumns() {
+ public function getLineItemColumns() {
return array(
'civicrm_line_item' => array(
'dao' => 'CRM_Price_BAO_LineItem',
/**
* @return array
*/
- function getPriceFieldValueColumns() {
+ public function getPriceFieldValueColumns() {
return array(
'civicrm_price_field_value' => array(
'dao' => 'CRM_Price_BAO_PriceFieldValue',
/**
* @return array
*/
- function getPriceFieldColumns() {
+ public function getPriceFieldColumns() {
return array(
'civicrm_price_field' => array(
'dao' => 'CRM_Price_BAO_PriceField',
/**
* @return array
*/
- function getParticipantColumns() {
+ public function getParticipantColumns() {
static $_events = array();
if (!isset($_events['all'])) {
CRM_Core_PseudoConstant::populate($_events['all'], 'CRM_Event_DAO_Event', FALSE, 'title', 'is_active', "is_template IS NULL OR is_template = 0", 'end_date DESC');
/**
* @return array
*/
- function getMembershipColumns() {
+ public function getMembershipColumns() {
return array(
'civicrm_membership' => array(
'dao' => 'CRM_Member_DAO_Membership',
/**
* @return array
*/
- function getMembershipTypeColumns() {
+ public function getMembershipTypeColumns() {
return array(
'civicrm_membership_type' => array(
'dao' => 'CRM_Member_DAO_MembershipType',
/**
* @return array
*/
- function getEventColumns() {
+ public function getEventColumns() {
return array(
'civicrm_event' => array(
'dao' => 'CRM_Event_DAO_Event',
/**
* @return array
*/
- function getContributionColumns() {
+ public function getContributionColumns() {
return array(
'civicrm_contribution' => array(
'dao' => 'CRM_Contribute_DAO_Contribution',
/**
* @return array
*/
- function getContactColumns() {
+ public function getContactColumns() {
return array(
'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
/**
* @return array
*/
- function getCaseColumns() {
+ public function getCaseColumns() {
return array(
'civicrm_case' => array(
'dao' => 'CRM_Case_DAO_Case',
*
* @return array
*/
- function getAddressColumns($options = array()) {
+ public function getAddressColumns($options = array()) {
$defaultOptions = array(
'prefix' => '',
'prefix_label' => '',
/**
* @return array
*/
- function getAvailableJoins() {
+ public function getAvailableJoins() {
return array(
'priceFieldValue_from_lineItem' => array(
'leftTable' => 'civicrm_line_item',
/**
* @param string $prefix
*/
- function joinAddressFromContact($prefix = '') {
+ public function joinAddressFromContact($prefix = '') {
$this->_from .= " LEFT JOIN civicrm_address {$this->_aliases[$prefix .
'civicrm_address']}
ON {$this->_aliases[$prefix .
'civicrm_contact']}.id";
}
- function joinPriceFieldValueFromLineItem() {
+ public function joinPriceFieldValueFromLineItem() {
$this->_from .= " LEFT JOIN civicrm_price_field_value {$this->_aliases['civicrm_price_field_value']}
ON {$this->_aliases['civicrm_line_item']}.price_field_value_id = {$this->_aliases['civicrm_price_field_value']}.id";
}
- function joinPriceFieldFromLineItem() {
+ public function joinPriceFieldFromLineItem() {
$this->_from .= "
LEFT JOIN civicrm_price_field {$this->_aliases['civicrm_price_field']}
ON {$this->_aliases['civicrm_line_item']}.price_field_id = {$this->_aliases['civicrm_price_field']}.id
/*
* Define join from line item table to participant table
*/
- function joinParticipantFromLineItem() {
+ public function joinParticipantFromLineItem() {
$this->_from .= " LEFT JOIN civicrm_participant {$this->_aliases['civicrm_participant']}
ON ( {$this->_aliases['civicrm_line_item']}.entity_id = {$this->_aliases['civicrm_participant']}.id
AND {$this->_aliases['civicrm_line_item']}.entity_table = 'civicrm_participant')
* Define join from line item table to Membership table. Seems to be still via contribution
* as the entity. Have made 'inner' to restrict does that make sense?
*/
- function joinMembershipFromLineItem() {
+ public function joinMembershipFromLineItem() {
$this->_from .= " INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
ON ( {$this->_aliases['civicrm_line_item']}.entity_id = {$this->_aliases['civicrm_contribution']}.id
AND {$this->_aliases['civicrm_line_item']}.entity_table = 'civicrm_contribution')
/*
* Define join from Participant to Contribution table
*/
- function joinContributionFromParticipant() {
+ public function joinContributionFromParticipant() {
$this->_from .= " LEFT JOIN civicrm_participant_payment pp
ON {$this->_aliases['civicrm_participant']}.id = pp.participant_id
LEFT JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
/*
* Define join from Membership to Contribution table
*/
- function joinContributionFromMembership() {
+ public function joinContributionFromMembership() {
$this->_from .= " LEFT JOIN civicrm_membership_payment pp
ON {$this->_aliases['civicrm_membership']}.id = pp.membership_id
LEFT JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
";
}
- function joinParticipantFromContribution() {
+ public function joinParticipantFromContribution() {
$this->_from .= " LEFT JOIN civicrm_participant_payment pp
ON {$this->_aliases['civicrm_contribution']}.id = pp.contribution_id
LEFT JOIN civicrm_participant {$this->_aliases['civicrm_participant']}
ON pp.participant_id = {$this->_aliases['civicrm_participant']}.id";
}
- function joinMembershipFromContribution() {
+ public function joinMembershipFromContribution() {
$this->_from .= "
LEFT JOIN civicrm_membership_payment pp
ON {$this->_aliases['civicrm_contribution']}.id = pp.contribution_id
ON pp.membership_id = {$this->_aliases['civicrm_membership']}.id";
}
- function joinMembershipTypeFromMembership() {
+ public function joinMembershipTypeFromMembership() {
$this->_from .= "
LEFT JOIN civicrm_membership_type {$this->_aliases['civicrm_membership_type']}
ON {$this->_aliases['civicrm_membership']}.membership_type_id = {$this->_aliases['civicrm_membership_type']}.id
";
}
- function joinContributionFromLineItem() {
+ public function joinContributionFromLineItem() {
// this can be stored as a temp table & indexed for more speed. Not done at this state.
// another option is to cache it but I haven't tried to put that code in yet (have used it before for one hour caching
";
}
- function joinLineItemFromContribution() {
+ public function joinLineItemFromContribution() {
// this can be stored as a temp table & indexed for more speed. Not done at this stage.
// another option is to cache it but I haven't tried to put that code in yet (have used it before for one hour caching
";
}
- function joinLineItemFromMembership() {
+ public function joinLineItemFromMembership() {
// this can be stored as a temp table & indexed for more speed. Not done at this stage.
// another option is to cache it but I haven't tried to put that code in yet (have used it before for one hour caching
";
}
- function joinContactFromParticipant() {
+ public function joinContactFromParticipant() {
$this->_from .= " LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
ON {$this->_aliases['civicrm_participant']}.contact_id = {$this->_aliases['civicrm_contact']}.id";
}
- function joinContactFromMembership() {
+ public function joinContactFromMembership() {
$this->_from .= " LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
ON {$this->_aliases['civicrm_membership']}.contact_id = {$this->_aliases['civicrm_contact']}.id";
}
- function joinContactFromContribution() {
+ public function joinContactFromContribution() {
$this->_from .= " LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
ON {$this->_aliases['civicrm_contribution']}.contact_id = {$this->_aliases['civicrm_contact']}.id";
}
- function joinEventFromParticipant() {
+ public function joinEventFromParticipant() {
$this->_from .= " LEFT JOIN civicrm_event {$this->_aliases['civicrm_event']}
ON ({$this->_aliases['civicrm_event']}.id = {$this->_aliases['civicrm_participant']}.event_id ) AND
({$this->_aliases['civicrm_event']}.is_template IS NULL OR
*
* @return string
*/
- function alterNickName($value, &$row) {
+ public function alterNickName($value, &$row) {
if (empty($row['civicrm_contact_id'])) {
return;
}
*
* @return array|string
*/
- function alterContributionType($value, &$row) {
+ public function alterContributionType($value, &$row) {
return is_string(CRM_Contribute_PseudoConstant::financialType($value, FALSE)) ? CRM_Contribute_PseudoConstant::financialType($value, FALSE) : '';
}
*
* @return array
*/
- function alterContributionStatus($value, &$row) {
+ public function alterContributionStatus($value, &$row) {
return CRM_Contribute_PseudoConstant::contributionStatus($value);
}
*
* @return array
*/
- function alterEventType($value, &$row) {
+ public function alterEventType($value, &$row) {
return CRM_Event_PseudoConstant::eventType($value);
}
*
* @return array|string
*/
- function alterEventID($value, &$row) {
+ public function alterEventID($value, &$row) {
return is_string(CRM_Event_PseudoConstant::event($value, FALSE)) ? CRM_Event_PseudoConstant::event($value, FALSE) : '';
}
*
* @return array|string
*/
- function alterMembershipTypeID($value, &$row) {
+ public function alterMembershipTypeID($value, &$row) {
return is_string(CRM_Member_PseudoConstant::membershipType($value, FALSE)) ? CRM_Member_PseudoConstant::membershipType($value, FALSE) : '';
}
*
* @return array|string
*/
- function alterMembershipStatusID($value, &$row) {
+ public function alterMembershipStatusID($value, &$row) {
return is_string(CRM_Member_PseudoConstant::membershipStatus($value, FALSE)) ? CRM_Member_PseudoConstant::membershipStatus($value, FALSE) : '';
}
*
* @return array
*/
- function alterCountryID($value, &$row, $selectedfield, $criteriaFieldName) {
+ public function alterCountryID($value, &$row, $selectedfield, $criteriaFieldName) {
$url = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "reset=1&force=1&{$criteriaFieldName}_op=in&{$criteriaFieldName}_value={$value}", $this->_absoluteUrl);
$row[$selectedfield . '_link'] = $url;
$row[$selectedfield .
*
* @return array
*/
- function alterCountyID($value, &$row, $selectedfield, $criteriaFieldName) {
+ public function alterCountyID($value, &$row, $selectedfield, $criteriaFieldName) {
$url = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "reset=1&force=1&{$criteriaFieldName}_op=in&{$criteriaFieldName}_value={$value}", $this->_absoluteUrl);
$row[$selectedfield . '_link'] = $url;
$row[$selectedfield .
*
* @return array
*/
- function alterStateProvinceID($value, &$row, $selectedfield, $criteriaFieldName) {
+ public function alterStateProvinceID($value, &$row, $selectedfield, $criteriaFieldName) {
$url = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "reset=1&force=1&{$criteriaFieldName}_op=in&{$criteriaFieldName}_value={$value}", $this->_absoluteUrl);
$row[$selectedfield . '_link'] = $url;
$row[$selectedfield .
*
* @return mixed
*/
- function alterContactID($value, &$row, $fieldname) {
+ public function alterContactID($value, &$row, $fieldname) {
$row[$fieldname . '_link'] = CRM_Utils_System::url("civicrm/contact/view",
'reset=1&cid=' . $value, $this->_absoluteUrl);
return $value;
*
* @return array
*/
- function alterParticipantStatus($value) {
+ public function alterParticipantStatus($value) {
if (empty($value)) {
return;
}
*
* @return string
*/
- function alterParticipantRole($value) {
+ public function alterParticipantRole($value) {
if (empty($value)) {
return;
}
*
* @return mixed
*/
- function alterPaymentType($value) {
+ public function alterPaymentType($value) {
$paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
return $paymentInstruments[$value];
}
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
parent::__construct();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_grant {$this->_aliases['civicrm_grant']}
LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
}
}
- function where() {
+ public function where() {
$clauses = array();
$this->_where = '';
foreach ($this->_columns as $tableName => $table) {
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = "";
if (!empty($this->_params['group_bys']) &&
is_array($this->_params['group_bys']) &&
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
foreach ($rows as $rowNum => $row) {
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_grant' => array(
'dao' => 'CRM_Grant_DAO_Grant',
parent::__construct();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_grant {$this->_aliases['civicrm_grant']}
LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
}
}
- function where() {
+ public function where() {
$whereClause = "
WHERE {$this->_aliases['civicrm_grant']}.amount_total IS NOT NULL
AND {$this->_aliases['civicrm_grant']}.amount_total > 0";
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = '';
if (!empty($this->_params['fields']) &&
}
}
- function postProcess() {
+ public function postProcess() {
// get ready with post process params
$this->beginPostProcess();
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
$totalStatistics = $grantStatistics = array();
$totalStatistics = parent::statistics($rows);
$awardedGrantsAmount = $grantsReceived = $totalAmount = $awardedGrants = $grantReportsReceived = 0;
/**
* @param CRM_Core_Form $form
*/
- static function buildForm(&$form) {
+ public static function buildForm(&$form) {
// we should not build form elements in dashlet mode
if ($form->_section) {
return;
*
* @return array|bool
*/
- static function formRule($fields, $errors, $self) {
+ public static function formRule($fields, $errors, $self) {
// Validate both the "next" and "save" buttons for creating/updating a report
$nextButton = $self->controller->getButtonName();
$saveButton = str_replace('_next', '_save', $nextButton);
* @param CRM_Core_Form $form
* @param $defaults
*/
- static function setDefaultValues(&$form, &$defaults) {
+ public static function setDefaultValues(&$form, &$defaults) {
// we should not build form elements in dashlet mode
if ($form->_section) {
return;
* @param CRM_Core_Form $form
* @param bool $redirect
*/
- static function postProcess(&$form, $redirect = TRUE) {
+ public static function postProcess(&$form, $redirect = TRUE) {
$params = $form->getVar('_params');
$instanceID = $form->getVar('_id');
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array();
$this->_columns['civicrm_contact'] = array(
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
$this->assign('chartSupported', TRUE);
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = $grouping = array();
return $errors;
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom}";
// LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']}
}
}
- function where() {
+ public function where() {
parent::where();
$this->_where .= " AND {$this->_aliases['civicrm_mailing']}.sms_provider_id IS NULL";
}
- function groupBy() {
+ public function groupBy() {
if (!empty($this->_params['charts'])) {
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_mailing']}.id";
}
}
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
// get the acl clauses built before we assemble the query
/**
* @param $rows
*/
- function buildChart(&$rows) {
+ public function buildChart(&$rows) {
if (empty($rows)) {
return;
}
/**
* @return array
*/
- function bounce_type() {
+ public function bounce_type() {
$data = array('' => '--Please Select--');
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
foreach ($rows as $rowNum => $row) {
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array();
$this->_columns['civicrm_contact'] = array(
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
$this->assign('chartSupported', TRUE);
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = $grouping = array();
return $errors;
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom}";
}
}
- function where() {
+ public function where() {
parent::where();
$this->_where .= " AND {$this->_aliases['civicrm_mailing']}.sms_provider_id IS NULL";
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = '';
if (!empty($this->_params['charts'])) {
}
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
/**
* @param $rows
*/
- function buildChart(&$rows) {
+ public function buildChart(&$rows) {
if (empty($rows)) {
return;
}
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
foreach ($rows as $rowNum => $row) {
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array();
$this->_columns['civicrm_contact'] = array(
parent::__construct();
}
- function select() {
+ public function select() {
$select = $columns = array();
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
ksort($this->_columnHeaders);
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_contact {$this->_aliases['civicrm_contact']}";
}
}
- function where() {
+ public function where() {
parent::where();
$this->_where .= " AND {$this->_aliases['civicrm_mailing']}.sms_provider_id IS NULL";
}
/**
* @return array
*/
- function mailingList() {
+ public function mailingList() {
$data = array();
$mailing = new CRM_Mailing_BAO_Mailing();
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
foreach ($rows as $rowNum => $row) {
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array();
$this->_columns['civicrm_contact'] = array(
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
$this->assign('chartSupported', TRUE);
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = $grouping = array();
return $errors;
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom}";
}
}
- function where() {
+ public function where() {
parent::where();
$this->_where .= " AND {$this->_aliases['civicrm_mailing']}.sms_provider_id IS NULL";
}
- function groupBy() {
+ public function groupBy() {
if (!empty($this->_params['charts'])) {
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_mailing']}.id";
}
}
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
/**
* @param $rows
*/
- function buildChart(&$rows) {
+ public function buildChart(&$rows) {
if (empty($rows)) {
return;
}
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
foreach ($rows as $rowNum => $row) {
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array();
$this->_columns['civicrm_mailing'] = array(
/**
* @return array
*/
- function mailing_select() {
+ public function mailing_select() {
$data = array();
return $data;
}
- function preProcess() {
+ public function preProcess() {
$this->assign('chartSupported', TRUE);
parent::preProcess();
}
// manipulate the select function to query count functions
- function select() {
+ public function select() {
$count_tables = array(
'civicrm_mailing_event_queue',
//print_r($this->_select);
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_mailing {$this->_aliases['civicrm_mailing']}
//print_r($this->_from);
}
- function where() {
+ public function where() {
$clauses = array();
//to avoid the sms listings
$clauses[] = "{$this->_aliases['civicrm_mailing']}.sms_provider_id IS NULL";
// }
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = "GROUP BY {$this->_aliases['civicrm_mailing']}.id";
}
- function orderBy() {
+ public function orderBy() {
$this->_orderBy = " ORDER BY {$this->_aliases['civicrm_mailing_job']}.end_date DESC ";
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
/**
* @return array
*/
- static function getChartCriteria() {
+ public static function getChartCriteria() {
return array('count' => array('civicrm_mailing_event_delivered_delivered_count' => ts('Delivered'),
'civicrm_mailing_event_bounce_bounce_count' => ts('Bounce'),
'civicrm_mailing_event_opened_open_count' => ts('Opened'),
*
* @return array
*/
- function formRule($fields, $files, $self) {
+ public function formRule($fields, $files, $self) {
$errors = array();
if (empty($fields['charts'])) {
/**
* @param $rows
*/
- function buildChart(&$rows) {
+ public function buildChart(&$rows) {
if (empty($rows)) {
return;
}
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
foreach ($rows as $rowNum => $row) {
/**
*
*/
- function __construct() {
+ public function __construct() {
$config = CRM_Core_Config::singleton();
$campaignEnabled = in_array('CiviCampaign', $config->enableComponents);
if ($campaignEnabled) {
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
$this->_select = 'SELECT ' . implode(', ', $select) . ' ';
}
- function from() {
+ public function from() {
$this->_from = "
FROM civireport_membership_contribution_detail
INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
/**
* @param bool $applyLimit
*/
- function tempTable($applyLimit = TRUE) {
+ public function tempTable($applyLimit = TRUE) {
// create temp table with contact ids,contribtuion id,membership id
$dropTempTable = 'DROP TABLE IF EXISTS civireport_membership_contribution_detail';
CRM_Core_DAO::executeQuery($dropTempTable);
*
* @return string
*/
- function buildQuery($applyLimit = TRUE) {
+ public function buildQuery($applyLimit = TRUE) {
$this->select();
//create temp table to be used as base table
$this->tempTable();
return $sql;
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_contact']}.id, {$this->_aliases['civicrm_contribution']}.id ";
}
- function orderBy() {
+ public function orderBy() {
$this->_orderBy = " ORDER BY {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_contact']}.id ";
if (!empty($this->_params['fields']['first_donation_date']) ||
!empty($this->_params['fields']['first_donation_amount'])
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
$select = " SELECT COUNT({$this->_aliases['civicrm_contribution']}.total_amount ) as count, SUM( {$this->_aliases['civicrm_contribution']}.total_amount ) as amount, ROUND(AVG({$this->_aliases['civicrm_contribution']}.total_amount), 2) as avg, {$this->_aliases['civicrm_contribution']}.currency as currency ";
return $statistics;
}
- function postProcess() {
+ public function postProcess() {
// get the acl clauses built before we assemble the query
$this->buildACLClause($this->_aliases['civicrm_contact']);
parent::postProcess();
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$checkList = array();
/**
*
*/
- function __construct() {
+ public function __construct() {
// Check if CiviCampaign is a) enabled and b) has active campaigns
$config = CRM_Core_Config::singleton();
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
$this->assign('reportTitle', ts('Membership Detail Report'));
parent::preProcess();
}
- function select() {
+ public function select() {
$select = $this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom}
INNER JOIN civicrm_membership {$this->_aliases['civicrm_membership']}
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_contact']}.id, {$this->_aliases['civicrm_membership']}.membership_type_id";
}
- function orderBy() {
+ public function orderBy() {
$this->_orderBy = " ORDER BY {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_contact']}.id, {$this->_aliases['civicrm_membership']}.membership_type_id";
if ($this->_contribField) {
}
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
$checkList = array();
/**
*
*/
- function __construct() {
+ public function __construct() {
// Check if CiviCampaign is a) enabled and b) has active campaigns
$config = CRM_Core_Config::singleton();
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = $grouping = array();
//check for searching combination of dispaly columns and
//grouping criteria
return $errors;
}
- function from() {
+ public function from() {
$this->_from = NULL;
$this->_from = "
}
}
- function where() {
+ public function where() {
$clauses = array();
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('filters', $table)) {
}
}
- function orderBy() {
+ public function orderBy() {
$this->_orderBy = " ORDER BY {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_contact']}.id, {$this->_aliases['civicrm_membership']}.membership_type_id";
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
// get the acl clauses built before we assemble the query
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
$checkList = array();
/**
*
*/
- function __construct() {
+ public function __construct() {
// UI for selecting columns to appear in the report list
// Array containing the columns, group_bys and filters build and provided to Form
parent::__construct();
}
- function select() {
+ public function select() {
$select = array();
$groupBys = FALSE;
$this->_columnHeaders = array();
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_membership {$this->_aliases['civicrm_membership']}
// end of from
- function where() {
+ public function where() {
$this->_whereClauses[] = "{$this->_aliases['civicrm_membership']}.is_test = 0 AND
{$this->_aliases['civicrm_contact']}.is_deleted = 0";
parent::where();
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = "";
if (is_array($this->_params['group_bys']) &&
!empty($this->_params['group_bys'])
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
$select = "
SELECT COUNT({$this->_aliases['civicrm_contribution']}.total_amount ) as count,
return $statistics;
}
- function postProcess() {
+ public function postProcess() {
parent::postProcess();
}
/**
* @param $rows
*/
- function buildChart(&$rows) {
+ public function buildChart(&$rows) {
$graphRows = array();
$count = 0;
$membershipTypeValues = CRM_Member_PseudoConstant::membershipType();
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
foreach ($rows as $rowNum => $row) {
/**
*
*/
- function __construct() {
+ 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
$this->_columns = array(
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
$this->assign('reportTitle', ts('Membership Summary Report'));
parent::preProcess();
}
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
return parent::setDefaultValues();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = $grouping = array();
//check for searching combination of dispaly columns and
//grouping criteria
return $errors;
}
- function from() {
+ public function from() {
$this->_from = NULL;
$this->_from = "
}
}
- function where() {
+ public function where() {
$clauses = array();
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('filters', $table)) {
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = array();
$statistics[] = array(
'title' => ts('Row(s) Listed'),
return $statistics;
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = "";
if (is_array($this->_params['group_bys']) &&
!empty($this->_params['group_bys'])
}
}
- function postProcess() {
+ public function postProcess() {
$this->_params = $this->controller->exportValues($this->_name);
if (empty($this->_params) &&
$this->_force
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
$checkList = array();
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_pledgeStatuses = CRM_Contribute_PseudoConstant::contributionStatus();
// Check if CiviCampaign is a) enabled and b) has active campaigns
$config = CRM_Core_Config::singleton();
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
parent::select();
}
/*
*
* @return bool|string
*/
- function selectClause(&$tableName, $tableKey, &$fieldName, &$field) {
+ public function selectClause(&$tableName, $tableKey, &$fieldName, &$field) {
if ($fieldName == 'total_paid') {
$this->_totalPaid = TRUE; // add pledge_payment join
$this->_columnHeaders["{$tableName}_{$fieldName}"] = array(
return FALSE;
}
- function groupBy() {
+ public function groupBy() {
parent::groupBy();
if (empty($this->_groupBy) && $this->_totalPaid) {
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_pledge']}.id, {$this->_aliases['civicrm_pledge']}.currency";
}
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_pledge {$this->_aliases['civicrm_pledge']}
LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
//regenerate the from field without extra left join on pledge payments
$this->_totalPaid = FALSE;
return $statistics;
}
- function orderBy() {
+ public function orderBy() {
$this->_orderBy = "ORDER BY {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_contact']}.id";
}
- function where() {
+ public function where() {
$clauses = array();
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('filters', $table)) {
}
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
$checkList = array();
/**
*
*/
- function __construct() {
+ public function __construct() {
// Check if CiviCampaign is a) enabled and b) has active campaigns
$config = CRM_Core_Config::singleton();
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
$this->assign('reportTitle', ts('Pledged but not Paid Report'));
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
$this->_select = "SELECT " . implode(', ', $select) . " ";
}
- function from() {
+ public function from() {
$this->_from = NULL;
$allStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = "
GROUP BY {$this->_aliases['civicrm_pledge']}.contact_id,
{$this->_aliases['civicrm_pledge']}.id,
{$this->_aliases['civicrm_pledge']}.currency";
}
- function orderBy() {
+ public function orderBy() {
$this->_orderBy = "ORDER BY {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_pledge']}.contact_id, {$this->_aliases['civicrm_pledge']}.id";
}
- function postProcess() {
+ public function postProcess() {
// get the acl clauses built before we assemble the query
$this->buildACLClause($this->_aliases['civicrm_contact']);
parent::PostProcess();
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
$checkList = array();
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
parent::select();
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_pledge {$this->_aliases['civicrm_pledge']}
LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = "";
$append = FALSE;
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
if (!$this->_having) {
return $statistics;
}
- function where() {
+ public function where() {
$clauses = array();
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('filters', $table)) {
}
}
- function postProcess() {
+ public function postProcess() {
parent::postProcess();
}
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
$checkList = array();
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
if ($this->_action & CRM_Core_Action::DELETE) {
return $defaults;
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
$dupeClass = FALSE;
$reportUrl = new CRM_Core_DAO_OptionValue();
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
$this->_select = "SELECT " . implode(",\n", $select) . " ";
}
- function from() {
+ public function from() {
$this->_from = NULL;
$this->_from = "
}
}
- function where() {
+ public function where() {
$clauses = array();
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('filters', $table)) {
}
}
- function orderBy() {
+ public function orderBy() {
$this->_orderBy = "";
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('order_bys', $table)) {
$this->_orderBy = "ORDER BY " . implode(', ', $this->_orderBy) . " ";
}
- function postProcess() {
+ public function postProcess() {
// get the acl clauses built before we assemble the query
$this->buildACLClause($this->_aliases['civicrm_contact']);
parent::postProcess();
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
foreach ($rows as $rowNum => $row) {
/**
* The constructor gets the submitted form values
*/
- function __construct(&$formValues);
+ public function __construct(&$formValues);
/**
* Builds the quickform for this search
*/
- function buildForm(&$form);
+ public function buildForm(&$form);
/**
* Builds the search query for various cases. We break it down into finer cases
* Count of records that match the current input parameters
* Used by pager
*/
- function count();
+ public function count();
/**
* Summary information for the query that can be displayed in the template
* This is useful to pass total / sub total information if needed
*/
- function summary();
+ public function summary();
/**
* List of contact ids that match the current input parameters
* Used by different tasks. Will be also used to optimize the
* 'all' query below to avoid excessive LEFT JOIN blowup
*/
- function contactIDs($offset = 0, $rowcount = 0, $sort = NULL);
+ public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL);
/**
* Retrieve all the values that match the current input parameters
/**
* The from clause for the query
*/
- function from();
+ public function from();
/**
* The where clause for the query
*/
- function where($includeContactIDs = FALSE);
+ public function where($includeContactIDs = FALSE);
/**
* The template FileName to use to display the results
*/
- function templateFile();
+ public function templateFile();
/**
* Returns an array of column headers and field names and sort options
*/
- function &columns();
+ public function &columns();
}
*
* @return void
*/
- function run() {
+ public function run() {
$instanceId = CRM_Report_Utils_Report::getInstanceID();
if (!$instanceId) {
$instanceId = CRM_Report_Utils_Report::getInstanceIDForPath();
*
* @return void
*/
- function run() {
+ public function run() {
//Filters by source report template or by component
$this->ovID = CRM_Utils_Request::retrieve('ovid', 'Positive', $this);
$this->compID = CRM_Utils_Request::retrieve('compid', 'Positive', $this);
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
$this->_id = CRM_Utils_Request::retrieve('id', 'String', $this, FALSE);
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_Core_BAO_OptionValue';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
*
* @return void
*/
- function run() {
+ public function run() {
$this->preProcess();
return parent::run();
}
* @access public
* @static
*/
- function browse() {
+ public function browse() {
$groupParams = array('name' => self::$_gName);
$optionValue = CRM_Core_OptionValue::getRows($groupParams, $this->links(), 'weight');
$gName = self::$_gName;
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_Report_Form_Register';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return self::$_GName;
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/report/options/' . self::$_gName;
}
* @return string
* @access public
*/
- function userContextParams($mode = NULL) {
+ public function userContextParams($mode = NULL) {
return 'reset=1&action=browse';
}
}
*
* @return void
*/
- function run() {
+ public function run() {
if (!CRM_Core_Permission::check('administer Reports')) {
return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/report/list', 'reset=1'));
}
*
* @return void
*/
- function run() {
+ public function run() {
$compID = CRM_Utils_Request::retrieve('compid', 'Positive', $this);
$grouping = CRM_Utils_Request::retrieve('grp', 'String', $this);
$rows = self::info($compID, $grouping);
*
* @return mixed|null
*/
- static function getTypedValue($name, $type) {
+ public static function getTypedValue($name, $type) {
$value = CRM_Utils_Array::value($name, $_GET);
if ($value === NULL) {
return NULL;
* @param $field
* @param $defaults
*/
- static function dateParam($fieldName, &$field, &$defaults) {
+ public static function dateParam($fieldName, &$field, &$defaults) {
// type = 12 (datetime) is not recognized by Utils_Type::escape() method,
// and therefore the below hack
$type = 4;
* @param $field
* @param $defaults
*/
- static function stringParam($fieldName, &$field, &$defaults) {
+ public static function stringParam($fieldName, &$field, &$defaults) {
$fieldOP = CRM_Utils_Array::value("{$fieldName}_op", $_GET, 'like');
switch ($fieldOP) {
* @param $field
* @param $defaults
*/
- static function intParam($fieldName, &$field, &$defaults) {
+ public static function intParam($fieldName, &$field, &$defaults) {
$fieldOP = CRM_Utils_Array::value("{$fieldName}_op", $_GET, 'eq');
switch ($fieldOP) {
/**
* @param $defaults
*/
- static function processChart(&$defaults) {
+ public static function processChart(&$defaults) {
$chartType = CRM_Utils_Array::value("charts", $_GET);
if (in_array($chartType, array(
'barChart', 'pieChart'))) {
* @param $fieldGrp
* @param $defaults
*/
- static function processFilter(&$fieldGrp, &$defaults) {
+ public static function processFilter(&$fieldGrp, &$defaults) {
// process only filters for now
foreach ($fieldGrp as $tableName => $fields) {
foreach ($fields as $fieldName => $field) {
/**
* @param $defaults
*/
- static function unsetFilters(&$defaults) {
+ public static function unsetFilters(&$defaults) {
static $unsetFlag = TRUE;
if ($unsetFlag) {
foreach ($defaults as $field_name => $field_value) {
* @param $fieldGrp
* @param $defaults
*/
- static function processGroupBy(&$fieldGrp, &$defaults) {
+ public static function processGroupBy(&$fieldGrp, &$defaults) {
// process only group_bys for now
$flag = FALSE;
* @param $reportFields
* @param $defaults
*/
- static function processFields(&$reportFields, &$defaults) {
+ public static function processFields(&$reportFields, &$defaults) {
//add filters from url
if (is_array($reportFields)) {
if ($urlFields = CRM_Utils_Array::value("fld", $_GET)) {
*
* @return null|string
*/
- static function getValueFromUrl($instanceID = NULL) {
+ public static function getValueFromUrl($instanceID = NULL) {
if ($instanceID) {
$optionVal = CRM_Core_DAO::getFieldValue('CRM_Report_DAO_ReportInstance',
$instanceID,
*
* @return array|bool
*/
- static function getValueIDFromUrl($instanceID = NULL) {
+ public static function getValueIDFromUrl($instanceID = NULL) {
$optionVal = self::getValueFromUrl($instanceID);
if ($optionVal) {
*
* @return mixed
*/
- static function getInstanceIDForValue($optionVal) {
+ public static function getInstanceIDForValue($optionVal) {
static $valId = array();
if (!array_key_exists($optionVal, $valId)) {
*
* @return mixed
*/
- static function getInstanceIDForPath($path = NULL) {
+ public static function getInstanceIDForPath($path = NULL) {
static $valId = array();
// if $path is null, try to get it from url
*
* @return bool|string
*/
- static function getNextUrl($urlValue, $query = 'reset=1', $absolute = FALSE, $instanceID = NULL, $drilldownReport = array()) {
+ public static function getNextUrl($urlValue, $query = 'reset=1', $absolute = FALSE, $instanceID = NULL, $drilldownReport = array()) {
if ($instanceID) {
$drilldownInstanceID = false;
if (array_key_exists($urlValue, $drilldownReport))
*
* @return int|null|string
*/
- static function getInstanceCount($optionVal) {
+ public static function getInstanceCount($optionVal) {
if (empty($optionVal)) return 0;
$sql = "
*
* @return bool
*/
- static function mailReport($fileContent, $instanceID = NULL, $outputMode = 'html', $attachments = array()) {
+ public static function mailReport($fileContent, $instanceID = NULL, $outputMode = 'html', $attachments = array()) {
if (!$instanceID) {
return FALSE;
}
* @param CRM_Core_Form $form
* @param $rows
*/
- static function export2csv(&$form, &$rows) {
+ public static function export2csv(&$form, &$rows) {
//Mark as a CSV file.
header('Content-Type: text/csv');
* Utility function for export2csv and CRM_Report_Form::endPostProcess
* - make CSV file content and return as string.
*/
- static function makeCsv(&$form, &$rows) {
+ public static function makeCsv(&$form, &$rows) {
$config = CRM_Core_Config::singleton();
$csv = '';
/**
* @return mixed
*/
- static function getInstanceID() {
+ public static function getInstanceID() {
$config = CRM_Core_Config::singleton();
$arg = explode('/', $_GET[$config->userFrameworkURLVar]);
/**
* @return string
*/
- static function getInstancePath() {
+ public static function getInstancePath() {
$config = CRM_Core_Config::singleton();
$arg = explode('/', $_GET[$config->userFrameworkURLVar]);
*
* @return bool
*/
- static function isInstancePermissioned($instanceId) {
+ public static function isInstancePermissioned($instanceId) {
if (!$instanceId) {
return TRUE;
}
* @static
* @access public
*/
- static function isInstanceGroupRoleAllowed($instanceId) {
+ public static function isInstanceGroupRoleAllowed($instanceId) {
if (!$instanceId) {
return TRUE;
}
*
* @return array
*/
- static function processReport($params) {
+ public static function processReport($params) {
$instanceId = CRM_Utils_Array::value('instanceId', $params);
// hack for now, CRM-8358
*
* @return string URL query string
*/
- static function getPreviewCriteriaQueryParams($defaults = array(), $params = array()) {
+ public static function getPreviewCriteriaQueryParams($defaults = array(), $params = array()) {
static $query_string;
if (!isset($query_string)) {
if (!empty($params)) {
*
* @return mixed
*/
- static function getInstanceList($reportUrl) {
+ public static function getInstanceList($reportUrl) {
static $instanceDetails = array();
if (!array_key_exists($reportUrl, $instanceDetails )) {
/**
*
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
* @return null|string
*/
- static function activeProviderCount() {
+ public static function activeProviderCount() {
$activeProviders = CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_sms_provider WHERE is_active = 1');
return $activeProviders;
}
*
* @return array
*/
- static function getProviders($selectArr = NULL, $filter = NULL, $getActive = TRUE, $orderBy = 'id') {
+ public static function getProviders($selectArr = NULL, $filter = NULL, $getActive = TRUE, $orderBy = 'id') {
$providers = array();
$temp = array();
/**
* @param $values
*/
- static function saveRecord($values) {
+ public static function saveRecord($values) {
$dao = new CRM_SMS_DAO_Provider();
$dao->copyValues($values);
$dao->save();
* @param $values
* @param int $providerId
*/
- static function updateRecord($values, $providerId) {
+ public static function updateRecord($values, $providerId) {
$dao = new CRM_SMS_DAO_Provider();
$dao->id = $providerId;
if ($dao->find(TRUE)) {
*
* @return bool
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_SMS_DAO_Provider', $id, 'is_active', $is_active);
}
* @return null
* @throws Exception
*/
- static function del($providerID) {
+ public static function del($providerID) {
if (!$providerID) {
CRM_Core_Error::fatal(ts('Invalid value passed to delete function.'));
}
/**
* Class constructor
*/
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
+ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal, NULL, FALSE, TRUE);
$mailingID = CRM_Utils_Request::retrieve('mid', 'String', $this, FALSE, NULL);
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
$continue = CRM_Utils_Request::retrieve('continue', 'String', $this, FALSE, NULL);
* @static
* @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$errors = array();
if (isset($fields['includeGroups']) &&
is_array($fields['includeGroups']) &&
class CRM_SMS_Form_Provider extends CRM_Core_Form {
protected $_id = NULL;
- function preProcess() {
+ public function preProcess() {
$this->_id = $this->get('id');
/**
* @return array
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$name = CRM_Utils_Request::retrieve('key', 'String', $this, FALSE, NULL);
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$count = $this->get('count');
class CRM_SMS_Form_Upload extends CRM_Core_Form {
public $_mailingID;
- function preProcess() {
+ public function preProcess() {
$this->_mailingID = $this->get('mailing_id');
if (CRM_Core_Permission::check('administer CiviCRM')) {
$this->assign('isAdmin', 1);
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
//need to differentiate new/reuse mailing, CRM-2873
* @access public
* @static
*/
- static function formRule($params, $files, $self) {
+ public static function formRule($params, $files, $self) {
if (!empty($_POST['_qf_Import_refresh'])) {
return TRUE;
}
class CRM_SMS_Page_Callback
{
- function run(){
+ public function run(){
$provider = CRM_SMS_Provider::singleton($_REQUEST);
if (array_key_exists('status',$_REQUEST)){
*
* @return string Classname of BAO.
*/
- function getBAOName() {
+ public function getBAOName() {
return 'CRM_SMS_BAO_Provider';
}
*
* @return array (reference) of action links
*/
- function &links() {
+ public function &links() {
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
* @access public
*
*/
- function run() {
+ public function run() {
// set title and breadcrumb
CRM_Utils_System::setTitle(ts('Settings - SMS Provider'));
$breadCrumb = array(array('title' => ts('SMS Provider'),
* @access public
* @static
*/
- function browse($action = NULL) {
+ public function browse($action = NULL) {
$providers = CRM_SMS_BAO_Provider::getProviders();
$rows = array();
foreach ($providers as $provider) {
*
* @return string Classname of edit form.
*/
- function editForm() {
+ public function editForm() {
return 'CRM_SMS_Form_Provider';
}
*
* @return string name of this page.
*/
- function editName() {
+ public function editName() {
return 'SMS Provider';
}
*
* @return string user context.
*/
- function userContext($mode = NULL) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/sms/provider';
}
}
* @return object
* @static
*/
- static function &singleton($providerParams = array(), $force = FALSE) {
+ public static function &singleton($providerParams = array(), $force = FALSE) {
$mailingID = CRM_Utils_Array::value('mailing_id', $providerParams);
$providerID = CRM_Utils_Array::value('provider_id', $providerParams);
$providerName = CRM_Utils_Array::value('provider', $providerParams);
*
* @access public
*/
- function getMessage($message, $contactID, $contactDetails) {
+ public function getMessage($message, $contactID, $contactDetails) {
$html = $message->getHTMLBody();
$text = $message->getTXTBody();
*
* @return mixed
*/
- function getRecipientDetails($fields, $additionalDetails) {
+ public function getRecipientDetails($fields, $additionalDetails) {
// we could do more altering here
$fields['To'] = $fields['phone'];
return $fields;
* @return $this|null|object
* @throws CRM_Core_Exception
*/
- function createActivity($apiMsgID, $message, $headers = array(), $jobID = NULL, $userID = NULL) {
+ public function createActivity($apiMsgID, $message, $headers = array(), $jobID = NULL, $userID = NULL) {
if ($jobID) {
$sql = "
SELECT scheduled_id FROM civicrm_mailing m
*
* @return mixed
*/
- function retrieve($name, $type, $abort = TRUE, $default = NULL, $location = 'REQUEST') {
+ public function retrieve($name, $type, $abort = TRUE, $default = NULL, $location = 'REQUEST') {
static $store = NULL;
$value = CRM_Utils_Request::retrieve($name, $type, $store,
FALSE, $default, $location
* @return $this|null|object
* @throws CRM_Core_Exception
*/
- function processInbound($from, $body, $to = NULL, $trackID = NULL) {
+ public function processInbound($from, $body, $to = NULL, $trackID = NULL) {
$formatFrom = $this->formatPhone($this->stripPhone($from), $like, "like");
$escapedFrom = CRM_Utils_Type::escape($formatFrom, 'String');
$fromContactID = CRM_Core_DAO::singleValueQuery('SELECT contact_id FROM civicrm_phone JOIN civicrm_contact ON civicrm_contact.id = civicrm_phone.contact_id WHERE !civicrm_contact.is_deleted AND phone LIKE "%' . $escapedFrom . '"');
*
* @return mixed|string
*/
- function stripPhone($phone) {
+ public function stripPhone($phone) {
$newphone = preg_replace('/[^0-9x]/', '', $phone);
while (substr($newphone, 0, 1) == "1") {
$newphone = substr($newphone, 1);
*
* @return mixed|string
*/
- function formatPhone($phone, &$kind, $format = "dash") {
+ public function formatPhone($phone, &$kind, $format = "dash") {
$phoneA = explode("x", $phone);
switch (strlen($phoneA[0])) {
case 0:
*
* @return string
*/
- function urlEncode($values) {
+ public function urlEncode($values) {
$uri = '';
foreach ($values as $key => $value) {
$value = urlencode($value);
* @internal param \CRM_SMS_Controller $object
* @return \CRM_SMS_StateMachine_Send CRM_SMS_StateMachine
*/
- function __construct($controller, $action = CRM_Core_Action::NONE) {
+ public function __construct($controller, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);
$this->_pages = array(
protected $_entityID;
protected $_entityTable;
- function preProcess() {
+ public function preProcess() {
if ($this->get('entityID')) {
$this->_entityID = $this->get('entityID');
}
*
* @return array the default array reference
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
foreach ($this->_fields as $name => $field) {
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($field['name'])) {
* @static
* @access public
*/
- static function formRuleSubType($fieldType, $groupType, $errors) {
+ public static function formRuleSubType($fieldType, $groupType, $errors) {
if (in_array($fieldType, array(
'Participant', 'Contribution', 'Membership', 'Activity'))) {
$individualSubTypes = CRM_Contact_BAO_ContactType::subTypes('Individual');
* @static
* @access public
*/
- static function formRuleCustomDataExtentColumnValue($customField, $gid, $fieldType, &$errors) {
+ public static function formRuleCustomDataExtentColumnValue($customField, $gid, $fieldType, &$errors) {
// fix me : check object $customField
if (in_array($fieldType, array(
'Participant', 'Contribution', 'Membership', 'Activity', 'Case'))) {
* @static
* @access public
*/
- static function formRulePrimaryCheck($fields, $profileFieldName, $groupFields, &$errors) {
+ public static function formRulePrimaryCheck($fields, $profileFieldName, $groupFields, &$errors) {
//FIXME: This may need to also apply to website fields if they are refactored to allow more than one per profile
$checkPrimary = array('phone' => 'civicrm_phone.phone', 'phone_and_ext' => 'civicrm_phone.phone');
$whereCheck = NULL;
* @static
* @access public
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$is_required = CRM_Utils_Array::value('is_required', $fields, FALSE);
$is_registration = CRM_Utils_Array::value('is_registration', $fields, FALSE);
$is_view = CRM_Utils_Array::value('is_view', $fields, FALSE);
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$showHide = new CRM_Core_ShowHideBlocks();
* @access public
* @static
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
//validate profile title as well as name.
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
// CRM_Core_Controller validates qfKey for POST requests, but not necessarily
// for GET requests. Allowing GET would therefore be CSRF vulnerability.
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
// Inline forms don't get menu-level permission checks
if (!CRM_Core_Permission::check('access CiviCRM')) {
CRM_Core_Error::fatal(ts('Permission Denied'));
* @access public
*
*/
- function preProcess() {
+ public function preProcess() {
$flag = FALSE;
$gid = $this->get('id');
$this->set('gid', $gid);
* Function the check whether the field belongs
* to multi-record custom set
*/
- function checkIsMultiRecord() {
+ public function checkIsMultiRecord() {
$customId = $_GET['customId'];
$isMultiple = CRM_Core_BAO_CustomField::isMultiRecordField($customId);
* @access public
* @static
*/
- function browse() {
+ public function browse() {
$resourceManager = CRM_Core_Resources::singleton();
if (!empty($_GET['new']) && $resourceManager->ajaxPopupsEnabled) {
$resourceManager->addScriptFile('civicrm', 'js/crm.addNew.js', 999, 'html-header');
* @return void
* @access public
*/
- function edit($action) {
+ public function edit($action) {
// create a simple controller for editing CiviCRM Profile data
$controller = new CRM_Core_Controller_Simple('CRM_UF_Form_Field', ts('CiviCRM Profile Field'), $action);
* @access public
*
*/
- function run() {
+ public function run() {
// get the group id
$this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive',
$this, FALSE, 0
* @return void
* @access public
*/
- function preview($fieldId, $groupId) {
+ public function preview($fieldId, $groupId) {
$controller = new CRM_Core_Controller_Simple('CRM_UF_Form_Preview', ts('Preview Custom Data'), CRM_Core_Action::PREVIEW);
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/admin/uf/group/field',
* @return array $_actionLinks
*
*/
- function &actionLinks() {
+ public function &actionLinks() {
// check if variable _actionsLinks is populated
if (!self::$_actionLinks) {
// helper variable for nicer formatting
* @return void
* @access public
*/
- function run() {
+ public function run() {
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String',
$this, FALSE,
* @return void
* @access public
*/
- function copy() {
+ public function copy() {
$gid = CRM_Utils_Request::retrieve('gid', 'Positive',
$this, TRUE, 0, 'GET'
);
* @return void
* @access public
*/
- function profile() {
+ public function profile() {
$config = CRM_Core_Config::singleton();
// reassign resource base to be the full url, CRM-4660
* @return void
* @access public
*/
- function edit($id, $action) {
+ public function edit($id, $action) {
// create a simple controller for editing uf data
$controller = new CRM_Core_Controller_Simple('CRM_UF_Form_Group', ts('CiviCRM Profile Group'), $action);
$this->setContext($id, $action);
* @access public
* @static
*/
- function browse($action = NULL) {
+ public function browse($action = NULL) {
$ufGroup = array();
$allUFGroups = array();
$allUFGroups = CRM_Core_BAO_UFGroup::getModuleUFGroup();
* @return void
* @access public
*/
- function preview($id, $action) {
+ public function preview($id, $action) {
$controller = new CRM_Core_Controller_Simple('CRM_UF_Form_Preview', ts('CiviCRM Profile Group Preview'), NULL);
$controller->set('id', $id);
$controller->setEmbedded(TRUE);
* @param int $id
* @param $action
*/
- function setContext($id, $action) {
+ public function setContext($id, $action) {
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
//we need to differentiate context for update and preview profile.
*
* @return array
*/
- static function extractGroupTypes($groupType) {
+ public static function extractGroupTypes($groupType) {
$returnGroupTypes = array();
if (!$groupType) {
return $returnGroupTypes;
* widgets
*/
class CRM_UF_Page_ProfileEditor extends CRM_Core_Page {
- function run() {
+ public function run() {
CRM_Core_Error::fatal('This is not a real page!');
}
- static function registerProfileScripts() {
+ public static function registerProfileScripts() {
static $loaded = FALSE;
if ($loaded || CRM_Core_Resources::isAjaxMode()) {
return;
*
* @param array $entityTypes strings, e.g. "IndividualModel", "ActivityModel"
*/
- static function registerSchemas($entityTypes) {
+ public static function registerSchemas($entityTypes) {
// TODO in cases where registerSchemas is called multiple times for same entity, be more efficient
CRM_Core_Resources::singleton()->addSettingsFactory(function () use ($entityTypes) {
return array(
/**
* AJAX callback
*/
- static function getSchemaJSON() {
+ public static function getSchemaJSON() {
$entityTypes = explode(',', $_REQUEST['entityTypes']);
CRM_Utils_JSON::output(self::getSchema($entityTypes));
}
* @see js/model/crm.core.js
* @see js/model/crm.mappedcore.js
*/
- static function getSchema($entityTypes) {
+ public static function getSchema($entityTypes) {
// FIXME: Depending on context (eg civicrm/profile/create vs search-columns), it may be appropriate to
// pick importable or exportable fields
* @see js/model/crm.core.js
* @see js/model/crm.mappedcore.js
*/
- static function convertCiviModelToBackboneModel($extends, $title, $availableFields) {
+ public static function convertCiviModelToBackboneModel($extends, $title, $availableFields) {
$locationFields = CRM_Core_BAO_UFGroup::getLocationFields();
$result = array(
*
* @return mixed
*/
- static function &incrementalPhpObject($version) {
+ public static function &incrementalPhpObject($version) {
static $incrementalPhpObject = array();
$versionParts = explode('.', $version);
*
* @return bool
*/
- function checkVersionRelease($version, $release) {
+ public function checkVersionRelease($version, $release) {
$versionParts = explode('.', $version);
if ($versionParts[2] == $release) {
return TRUE;
*
* @return array
*/
- function checkSQLConstraints(&$constraints) {
+ public function checkSQLConstraints(&$constraints) {
$pass = $fail = 0;
foreach ($constraints as $constraint) {
if ($this->checkSQLConstraint($constraint)) {
*
* @return bool
*/
- function checkSQLConstraint($constraint) {
+ public function checkSQLConstraint($constraint) {
// check constraint here
return TRUE;
}
* @param string $fileName
* @param bool $isQueryString
*/
- function source($fileName, $isQueryString = FALSE) {
+ public function source($fileName, $isQueryString = FALSE) {
CRM_Utils_File::sourceSQLFile($this->_config->dsn,
$fileName, NULL, $isQueryString
);
}
- function preProcess() {
+ public function preProcess() {
CRM_Utils_System::setTitle($this->getTitle());
if (!$this->verifyPreDBState($errorMessage)) {
if (!isset($errorMessage)) {
$this->assign('recentlyViewed', FALSE);
}
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->addDefaultButtons($this->getButtonTitle(),
'next',
NULL,
/**
* @return string
*/
- function getTitle() {
+ public function getTitle() {
return ts('Title not Set');
}
/**
* @return string
*/
- function getFieldsetTitle() {
+ public function getFieldsetTitle() {
return ts('');
}
/**
* @return string
*/
- function getButtonTitle() {
+ public function getButtonTitle() {
return ts('Continue');
}
/**
* @return string
*/
- function getTemplateFileName() {
+ public function getTemplateFileName() {
$this->assign('title',
$this->getFieldsetTitle()
);
return 'CRM/Upgrade/Base.tpl';
}
- function postProcess() {
+ public function postProcess() {
$this->upgrade();
if (!$this->verifyPostDBState($errorMessage)) {
*
* @return Object
*/
- function runQuery($query) {
+ public function runQuery($query) {
return CRM_Core_DAO::executeQuery($query,
CRM_Core_DAO::$_nullArray
);
*
* @return Object
*/
- function setVersion($version) {
+ public function setVersion($version) {
$this->logVersion($version);
$query = "
*
* @return bool
*/
- function logVersion($newVersion) {
+ public function logVersion($newVersion) {
if ($newVersion) {
$oldVersion = CRM_Core_BAO_Domain::version();
*
* @return bool
*/
- function checkVersion($version) {
+ public function checkVersion($version) {
$domainID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Domain',
$version, 'id',
'version'
* @return array
* @throws Exception
*/
- function getRevisionSequence() {
+ public function getRevisionSequence() {
$revList = array();
$sqlDir = implode(DIRECTORY_SEPARATOR,
array(dirname(__FILE__), 'Incremental', 'sql')
*
* @return null
*/
- static function getRevisionPart($rev, $index = 1) {
+ public static function getRevisionPart($rev, $index = 1) {
$revPattern = '/^((\d{1,2})\.\d{1,2})\.(\d{1,2}|\w{4,7})?$/i';
preg_match($revPattern, $rev, $matches);
*
* @return bool
*/
- function processLocales($tplFile, $rev) {
+ public function processLocales($tplFile, $rev) {
$smarty = CRM_Core_Smarty::singleton();
$smarty->assign('domainID', CRM_Core_Config::domainID());
/**
* @param $rev
*/
- function setSchemaStructureTables($rev) {
+ public function setSchemaStructureTables($rev) {
if ($this->multilingual) {
CRM_Core_I18n_Schema::schemaStructureTables($rev, TRUE);
}
*
* @throws Exception
*/
- function processSQL($rev) {
+ public function processSQL($rev) {
$sqlFile = implode(DIRECTORY_SEPARATOR,
array(
dirname(__FILE__), 'Incremental',
*
* @return array(0=>$currentVer, 1=>$latestVer)
*/
- function getUpgradeVersions() {
+ public function getUpgradeVersions() {
$latestVer = CRM_Utils_System::version();
$currentVer = CRM_Core_BAO_Domain::version(true);
if (!$currentVer) {
*
* @return mixed, a string error message or boolean 'false' if OK
*/
- function checkUpgradeableVersion($currentVer, $latestVer) {
+ public function checkUpgradeableVersion($currentVer, $latestVer) {
$error = FALSE;
// since version is suppose to be in valid format at this point, especially after conversion ($convertVer),
// lets do a pattern check -
*
* @return mixed, a string error message or boolean 'false' if OK
*/
- function checkCurrentVersion($currentVer, $latestVer) {
+ public function checkCurrentVersion($currentVer, $latestVer) {
$error = FALSE;
// since version is suppose to be in valid format at this point, especially after conversion ($convertVer),
*
* @return CRM_Queue
*/
- static function buildQueue($currentVer, $latestVer, $postUpgradeMessageFile) {
+ public static function buildQueue($currentVer, $latestVer, $postUpgradeMessageFile) {
$upgrade = new CRM_Upgrade_Form();
// hack to make 4.0.x (D7,J1.6) codebase go through 3.4.x (d6, J1.5) upgrade files,
*
* @return bool
*/
- static function doIncrementalUpgradeStart(CRM_Queue_TaskContext $ctx, $rev) {
+ public static function doIncrementalUpgradeStart(CRM_Queue_TaskContext $ctx, $rev) {
$upgrade = new CRM_Upgrade_Form();
// as soon as we start doing anything we append ".upgrade" to version.
*
* @return bool
*/
- static function doIncrementalUpgradeStep(CRM_Queue_TaskContext$ctx, $rev, $originalVer, $latestVer, $postUpgradeMessageFile) {
+ public static function doIncrementalUpgradeStep(CRM_Queue_TaskContext$ctx, $rev, $originalVer, $latestVer, $postUpgradeMessageFile) {
$upgrade = new CRM_Upgrade_Form();
$phpFunctionName = 'upgrade_' . str_replace('.', '_', $rev);
*
* @return bool
*/
- static function doIncrementalUpgradeFinish(CRM_Queue_TaskContext $ctx, $rev, $currentVer, $latestVer, $postUpgradeMessageFile) {
+ public static function doIncrementalUpgradeFinish(CRM_Queue_TaskContext $ctx, $rev, $currentVer, $latestVer, $postUpgradeMessageFile) {
$upgrade = new CRM_Upgrade_Form();
$upgrade->setVersion($rev);
CRM_Utils_System::flushCache();
return TRUE;
}
- static function doFinish() {
+ public static function doFinish() {
$upgrade = new CRM_Upgrade_Form();
list($ignore, $latestVer) = $upgrade->getUpgradeVersions();
// Seems extraneous in context, but we'll preserve old behavior
* @param $currentVer
* @param $latestVer
*/
- function setPreUpgradeMessage(&$preUpgradeMessage, $currentVer, $latestVer) {
+ public function setPreUpgradeMessage(&$preUpgradeMessage, $currentVer, $latestVer) {
CRM_Upgrade_Incremental_Legacy::setPreUpgradeMessage($preUpgradeMessage, $currentVer, $latestVer);
// Scan through all php files and see if any file is interested in setting pre-upgrade-message
* @return array, with keys:
* - message: string, HTML-ish blob
*/
- function run($enablePrint = TRUE) {
+ public function run($enablePrint = TRUE) {
// lets get around the time limit issue if possible for upgrades
if (!ini_get('safe_mode')) {
set_time_limit(0);
* @param $currentVer
* @param $latestVer
*/
- static function setPreUpgradeMessage(&$preUpgradeMessage, $currentVer, $latestVer) {
+ public static function setPreUpgradeMessage(&$preUpgradeMessage, $currentVer, $latestVer) {
$upgrade = new CRM_Upgrade_Form();
$template = CRM_Core_Smarty::singleton();
* @param $latestVer
* @param $currentVer
*/
- static function checkMessageTemplate(&$template, &$message, $latestVer, $currentVer) {
+ public static function checkMessageTemplate(&$template, &$message, $latestVer, $currentVer) {
if (version_compare($currentVer, '3.1.alpha1') < 0) {
return;
}
* @param $rev string, an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs
* @return void
*/
- static function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
+ public static function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
if ($rev == '3.2.alpha1') {
$postUpgradeMessage .= '<br />' . ts("We have reset the COUNTED flag to false for the event participant status 'Pending from incomplete transaction'. This change ensures that people who have a problem during registration can try again.");
}
*
* @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
*/
- static function upgrade_2_2_alpha1($rev) {
+ public static function upgrade_2_2_alpha1($rev) {
for ($stepID = 1; $stepID <= 4; $stepID++) {
$formName = "CRM_Upgrade_TwoTwo_Form_Step{$stepID}";
$form = new $formName();
*
* @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
*/
- static function upgrade_2_1_2($rev) {
+ public static function upgrade_2_1_2($rev) {
$formName = "CRM_Upgrade_TwoOne_Form_TwoOneTwo";
$form = new $formName($rev);
* Name of this function will change according to the latest release
*
*/
- static function upgrade_2_2_alpha3($rev) {
+ public static function upgrade_2_2_alpha3($rev) {
// skip processing sql file, if fresh install -
if (!CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'mail_protocol', 'id', 'name')) {
$upgrade = new CRM_Upgrade_Form();
*
* @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
*/
- static function upgrade_2_2_beta1($rev) {
+ public static function upgrade_2_2_beta1($rev) {
if (!CRM_Core_DAO::checkFieldExists('civicrm_pcp_block', 'notify_email')) {
$template = CRM_Core_Smarty::singleton();
$template->assign('notifyAbsent', TRUE);
*
* @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
*/
- static function upgrade_2_2_beta2($rev) {
+ public static function upgrade_2_2_beta2($rev) {
$template = CRM_Core_Smarty::singleton();
if (!CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue',
'CRM_Contact_Form_Search_Custom_ZipCodeRange', 'id', 'name'
*
* @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
*/
- static function upgrade_2_2_beta3($rev) {
+ public static function upgrade_2_2_beta3($rev) {
$template = CRM_Core_Smarty::singleton();
if (!CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'custom_data_type', 'id', 'name')) {
$template->assign('customDataType', TRUE);
*
* @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
*/
- static function upgrade_3_0_alpha1($rev) {
+ public static function upgrade_3_0_alpha1($rev) {
$threeZero = new CRM_Upgrade_ThreeZero_ThreeZero();
*
* @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
*/
- static function upgrade_3_1_alpha1($rev) {
+ public static function upgrade_3_1_alpha1($rev) {
$threeOne = new CRM_Upgrade_ThreeOne_ThreeOne();
*
* @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
*/
- static function upgrade_2_2_7($rev) {
+ public static function upgrade_2_2_7($rev) {
$upgrade = new CRM_Upgrade_Form();
$upgrade->processSQL($rev);
$sql = "UPDATE civicrm_report_instance
*
* @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
*/
- static function upgrade_3_0_2($rev) {
+ public static function upgrade_3_0_2($rev) {
$template = CRM_Core_Smarty::singleton();
//check whether upgraded from 2.1.x or 2.2.x
*
* @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
*/
- static function upgrade_3_0_4($rev) {
+ public static function upgrade_3_0_4($rev) {
//make sure 'Deceased' membership status present in db,CRM-5636
$template = CRM_Core_Smarty::singleton();
*
* @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
*/
- static function upgrade_3_1_0($rev) {
+ public static function upgrade_3_1_0($rev) {
// upgrade all roles who have 'access CiviEvent' permission, to also have
// newly added permission 'edit_all_events', CRM-5472
$config = CRM_Core_Config::singleton();
*
* @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
*/
- static function upgrade_3_1_3($rev) {
+ public static function upgrade_3_1_3($rev) {
$threeOne = new CRM_Upgrade_ThreeOne_ThreeOne();
$threeOne->upgrade_3_1_3();
*
* @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
*/
- static function upgrade_3_1_4($rev) {
+ public static function upgrade_3_1_4($rev) {
$threeOne = new CRM_Upgrade_ThreeOne_ThreeOne();
$threeOne->upgrade_3_1_4();
*
* @return bool
*/
- function verifyPreDBstate(&$errors) {
+ public function verifyPreDBstate(&$errors) {
return TRUE;
}
*
* @return void
*/
- function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
+ public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
}
/**
* @param $rev string, an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs
* @return void
*/
- function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
+ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
if ($rev == '4.5.alpha1') {
$postUpgradeMessage .= '<br /><br />' . ts('Default versions of the following System Workflow Message Templates have been modified to handle new functionality: <ul><li>Contributions - Receipt (off-line)</li><li>Contributions - Receipt (on-line)</li><li>Contributions - Recurring Start and End Notification</li><li>Contributions - Recurring Updates</li><li>Memberships - Receipt (on-line)</li><li>Memberships - Signup and Renewal Receipts (off-line)</li><li>Pledges - Acknowledgement</li></ul> If you have modified these templates, please review the new default versions and implement updates as needed to your copies (Administer > Communications > Message Templates > System Workflow Messages). (<a href="%1">learn more...</a>)', array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Updating+System+Workflow+Message+Templates+after+Upgrades+-+method+1+-+kdiff'));
$postUpgradeMessage .= '<br /><br />' . ts('This release allows you to view and edit multiple-record custom field sets in a table format which will be more usable in some cases. You can try out the format by navigating to Administer > Custom Data & Screens > Custom Fields. Click Settings for a custom field set and change Display Style to "Tab with Tables".');
*
* @return bool
*/
- function upgrade_4_5_alpha1($rev) {
+ public function upgrade_4_5_alpha1($rev) {
// task to process sql
$this->addTask(ts('Migrate honoree information to module_data'), 'migrateHonoreeInfo');
$this->addTask(ts('Upgrade DB to 4.5.alpha1: SQL'), 'task_4_5_x_runSql', $rev);
*
* @return bool
*/
- function upgrade_4_5_beta9($rev) {
+ public function upgrade_4_5_beta9($rev) {
$this->addTask(ts('Upgrade DB to 4.5.beta9: SQL'), 'task_4_5_x_runSql', $rev);
$entityTable = array(
*
* @return bool
*/
- static function task_4_5_0_fixLineItem(CRM_Queue_TaskContext $ctx, $startId, $endId, $entityTable) {
+ public static function task_4_5_0_fixLineItem(CRM_Queue_TaskContext $ctx, $startId, $endId, $entityTable) {
$sqlParams = array(
1 => array($startId, 'Integer'),
*
* @return bool TRUE for success
*/
- static function addNameFieldOptions(CRM_Queue_TaskContext $ctx) {
+ public static function addNameFieldOptions(CRM_Queue_TaskContext $ctx) {
$query = "SELECT `value` FROM `civicrm_setting` WHERE `group_name` = 'CiviCRM Preferences' AND `name` = 'contact_edit_options'";
$dao = CRM_Core_DAO::executeQuery($query);
$dao->fetch();
*
* @return bool TRUE for success
*/
- static function migrateHonoreeInfo(CRM_Queue_TaskContext $ctx) {
+ public static function migrateHonoreeInfo(CRM_Queue_TaskContext $ctx) {
$query = "ALTER TABLE `civicrm_uf_join`
ADD COLUMN `module_data` longtext COMMENT 'Json serialized array of data used by the ufjoin.module'";
CRM_Core_DAO::executeQuery($query);
/**
* (Queue Task Callback)
*/
- static function task_4_5_x_runSql(CRM_Queue_TaskContext $ctx, $rev) {
+ public static function task_4_5_x_runSql(CRM_Queue_TaskContext $ctx, $rev) {
$upgrade = new CRM_Upgrade_Form();
$upgrade->processSQL($rev);
*
* @return bool
*/
- function verifyPreDBstate(&$errors) {
+ public function verifyPreDBstate(&$errors) {
return TRUE;
}
*
* @return void
*/
- function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
+ public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
if ($rev == '4.4.beta1') {
$apiCalls = self::getConfigArraysAsAPIParams(FALSE);
$oversizedEntries = 0;
* @param $rev string, an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs
* @return void
*/
- function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
+ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
if ($rev == '4.4.1') {
$config = CRM_Core_Config::singleton();
if (!empty($config->useIDS)) {
*
* @return bool
*/
- function upgrade_4_4_alpha1($rev) {
+ public function upgrade_4_4_alpha1($rev) {
// task to process sql
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.4.alpha1')), 'task_4_4_x_runSql', $rev);
/**
* @param $rev
*/
- function upgrade_4_4_beta1($rev) {
+ public function upgrade_4_4_beta1($rev) {
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.4.beta1')), 'task_4_4_x_runSql', $rev);
// add new 'data' column in civicrm_batch
/**
* @param $rev
*/
- function upgrade_4_4_1($rev) {
+ public function upgrade_4_4_1($rev) {
$config = CRM_Core_Config::singleton();
// CRM-13327 upgrade handling for the newly added name badges
$ogID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'name_badge', 'id', 'name');
*
* @return bool
*/
- function upgrade_4_4_4($rev) {
+ public function upgrade_4_4_4($rev) {
$fkConstraint = array();
if (!CRM_Core_DAO::checkFKConstraintInFormat('civicrm_activity_contact', 'activity_id')) {
$fkConstraint[] = "ADD CONSTRAINT `FK_civicrm_activity_contact_activity_id` FOREIGN KEY (`activity_id`) REFERENCES `civicrm_activity` (`id`) ON DELETE CASCADE";
/**
* @param $rev
*/
- function upgrade_4_4_6($rev){
+ public function upgrade_4_4_6($rev){
$sql = "SELECT count(*) AS count FROM INFORMATION_SCHEMA.STATISTICS where ".
"TABLE_SCHEMA = database() AND INDEX_NAME = 'index_image_url' AND TABLE_NAME = 'civicrm_contact';";
$dao = CRM_Core_DAO::executeQuery($sql);
*
* @return bool
*/
- function upgrade_4_4_7($rev, $originalVer, $latestVer) {
+ public function upgrade_4_4_7($rev, $originalVer, $latestVer) {
// For WordPress/Joomla(?), cleanup broken image_URL from 4.4.6 upgrades - https://issues.civicrm.org/jira/browse/CRM-14971
$exBackendUrl = CRM_Utils_System::url('civicrm/contact/imagefile', 'photo=XXX', TRUE); // URL formula from 4.4.6 upgrade
$exFrontendUrl = CRM_Utils_System::url('civicrm/contact/imagefile', 'photo=XXX', TRUE, NULL, TRUE, TRUE);
$this->addTask(ts('Update saved search information'), 'changeSavedSearch');
}
- static function upgradeImageUrls(CRM_Queue_TaskContext $ctx, $startId, $endId){
+ public static function upgradeImageUrls(CRM_Queue_TaskContext $ctx, $startId, $endId){
$dao = self::findContactImageUrls($startId, $endId);
$failures = array();
while ($dao->fetch()){
return TRUE;
}
- static function changeSavedSearch(CRM_Queue_TaskContext $ctx) {
+ public static function changeSavedSearch(CRM_Queue_TaskContext $ctx) {
$membershipStatuses = array_flip(CRM_Member_PseudoConstant::membershipStatus());
$dao = new CRM_Contact_DAO_SavedSearch();
* @param int $endId
* @return bool
*/
- static function cleanupBackendImageUrls(CRM_Queue_TaskContext $ctx, $startId, $endId) {
+ public static function cleanupBackendImageUrls(CRM_Queue_TaskContext $ctx, $startId, $endId) {
$dao = self::findContactImageUrls($startId, $endId);
while ($dao->fetch()) {
$imageUrl = str_replace('&', '&', $dao->image_url);
*
* @return bool TRUE for success
*/
- static function activityContacts(CRM_Queue_TaskContext $ctx) {
+ public static function activityContacts(CRM_Queue_TaskContext $ctx) {
$upgrade = new CRM_Upgrade_Form();
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
* @return bool TRUE for success
* @see http://issues.civicrm.org/jira/browse/CRM-13187
*/
- static function wordReplacements(CRM_Queue_TaskContext $ctx) {
+ public static function wordReplacements(CRM_Queue_TaskContext $ctx) {
$query = "
CREATE TABLE IF NOT EXISTS `civicrm_word_replacement` (
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Word replacement ID',
* @return bool TRUE for success
* @see http://issues.civicrm.org/jira/browse/CRM-13655
*/
- static function wordReplacements_patch(CRM_Queue_TaskContext $ctx, $rev) {
+ public static function wordReplacements_patch(CRM_Queue_TaskContext $ctx, $rev) {
if (CRM_Core_DAO::checkConstraintExists('civicrm_word_replacement', 'UI_find')) {
CRM_Core_DAO::executeQuery("ALTER TABLE civicrm_word_replacement DROP FOREIGN KEY FK_civicrm_word_replacement_domain_id;");
CRM_Core_DAO::executeQuery("ALTER TABLE civicrm_word_replacement DROP KEY FK_civicrm_word_replacement_domain_id;");
/**
* (Queue Task Callback)
*/
- static function task_4_4_x_runSql(CRM_Queue_TaskContext $ctx, $rev) {
+ public static function task_4_4_x_runSql(CRM_Queue_TaskContext $ctx, $rev) {
$upgrade = new CRM_Upgrade_Form();
$upgrade->processSQL($rev);
* @return array Each item is $params for WordReplacement.create
* @see CRM_Core_BAO_WordReplacement::convertConfigArraysToAPIParams
*/
- static function getConfigArraysAsAPIParams($rebuildEach) {
+ public static function getConfigArraysAsAPIParams($rebuildEach) {
$wordReplacementCreateParams = array();
// get all domains
$result = civicrm_api3('domain', 'get', array(
* @param array $params
* @return bool TRUE if $params is valid
*/
- static function isValidWordReplacement($params) {
+ public static function isValidWordReplacement($params) {
$result = strlen($params['find_word']) <= self::MAX_WORD_REPLACEMENT_SIZE && strlen($params['replace_word']) <= self::MAX_WORD_REPLACEMENT_SIZE;
if (!$result) {
CRM_Core_Error::debug_var('invalidWordReplacement', $params);
*
* @return bool
*/
- function verifyPreDBstate(&$errors) {
+ public function verifyPreDBstate(&$errors) {
$config = CRM_Core_Config::singleton();
if (in_array('CiviCase', $config->enableComponents)) {
if (!CRM_Core_DAO::checkTriggerViewPermission(TRUE, FALSE)) {
*
* @return void
*/
- function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
+ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
if ($rev == '4.1.alpha1') {
$postUpgradeMessage .= '<br />' .
ts('WARNING! CiviCRM 4.1 introduces an improved way of handling cron jobs. However the new method is NOT backwards compatible. <strong>Please notify your system administrator that all CiviCRM related cron jobs will cease to work, and will need to be re-configured (this includes sending CiviMail mailings, updating membership statuses, etc.).</strong> Refer to the <a href="%1">online documentation</a> for detailed instructions.', array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC41/Managing+Scheduled+Jobs'));
/**
* @param $rev
*/
- function upgrade_4_1_alpha1($rev) {
+ public function upgrade_4_1_alpha1($rev) {
$config = CRM_Core_Config::singleton();
if (in_array('CiviCase', $config->enableComponents)) {
if (!CRM_Case_BAO_Case::createCaseViews()) {
CRM_Core_BAO_Navigation::resetNavigation();
}
- function transferPreferencesToSettings() {
+ public function transferPreferencesToSettings() {
// first transfer system preferences
$domainColumnNames = array(
CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME => array(
CRM_Core_DAO::executeQuery($sql);
}
- function createNewSettings() {
+ public function createNewSettings() {
$domainColumns = array(
CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME => array(
array('contact_ajax_check_similar', 1),
/**
* @param array $params
*/
- static function retrieveDirectoryAndURLPaths(&$params) {
+ public static function retrieveDirectoryAndURLPaths(&$params) {
$sql = "
SELECT v.name as valueName, v.value, g.name as optionName
/**
* @param $rev
*/
- function upgrade_4_1_alpha2($rev) {
+ public function upgrade_4_1_alpha2($rev) {
$dao = new CRM_Core_DAO_Setting();
$dao->group_name = 'Directory Preferences';
$dao->name = 'customTemplateDir';
/**
* @param $rev
*/
- function upgrade_4_1_beta1($rev) {
+ public function upgrade_4_1_beta1($rev) {
//CRM-9311
$groupNames = array('directory_preferences', 'url_preferences');
foreach ($groupNames as $groupName) {
/**
* @param $rev
*/
- function upgrade_4_1_1($rev) {
+ public function upgrade_4_1_1($rev) {
$upgrade = new CRM_Upgrade_Form();
$upgrade->assign('addDedupeEmail', !(CRM_Core_DAO::checkFieldExists('civicrm_mailing', 'dedupe_email')));
/**
* @return string
*/
- function getTemplateMessage() {
+ public function getTemplateMessage() {
return "Blah";
}
}
*
* @return bool
*/
- function verifyPreDBstate(&$errors) {
+ public function verifyPreDBstate(&$errors) {
return TRUE;
}
*
* @return void
*/
- function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
+ public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
}
/**
* @param $rev string, an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs
* @return void
*/
- function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
+ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
if ($rev == '4.6.alpha1') {
$postUpgradeMessage .= '<br /><br />' . ts('Default versions of the following System Workflow Message Templates have been modified to handle new functionality: <ul><li>Events - Registration Confirmation and Receipt (on-line)</li><li>Events - Registration Confirmation and Receipt (off-line)</li><li>Contributions - Receipt (on-line)</li><li>Contributions - Receipt (off-line)</li><li>Memberships - Receipt (on-line)</li><li>Memberships - Signup and Renewal Receipts (off-line)</li></ul> If you have modified these templates, please review the new default versions and implement updates as needed to your copies (Administer > Communications > Message Templates > System Workflow Messages).');
}
/**
* (Queue Task Callback)
*/
- static function task_4_6_x_runSql(CRM_Queue_TaskContext $ctx, $rev) {
+ public static function task_4_6_x_runSql(CRM_Queue_TaskContext $ctx, $rev) {
$upgrade = new CRM_Upgrade_Form();
$upgrade->processSQL($rev);
*
* @return bool
*/
- function verifyPreDBstate(&$errors) {
+ public function verifyPreDBstate(&$errors) {
return TRUE;
}
*
* @return void|bool
*/
- function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
+ public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
if ($rev == '4.3.beta3') {
//CRM-12084
//sql for checking orphaned contribution records
* @param $rev string, an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs
* @return void
*/
- function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
+ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
if ($rev == '4.3.alpha1') {
// check if CiviMember component is enabled
$config = CRM_Core_Config::singleton();
*
* @return bool
*/
- function upgrade_4_3_alpha1($rev) {
+ public function upgrade_4_3_alpha1($rev) {
self::task_4_3_alpha1_checkDBConstraints();
// add indexes for civicrm_entity_financial_trxn
/**
* @param $rev
*/
- function upgrade_4_3_alpha2($rev) {
+ public function upgrade_4_3_alpha2($rev) {
//CRM-11847
$isColumnPresent = CRM_Core_DAO::checkFieldExists('civicrm_dedupe_rule_group', 'is_default');
if ($isColumnPresent) {
/**
* @param $rev
*/
- function upgrade_4_3_alpha3($rev) {
+ public function upgrade_4_3_alpha3($rev) {
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.alpha3')), 'task_4_3_x_runSql', $rev);
}
/**
* @param $rev
*/
- function upgrade_4_3_beta2($rev) {
+ public function upgrade_4_3_beta2($rev) {
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.beta2')), 'task_4_3_x_runSql', $rev);
// CRM-12002
/**
* @param $rev
*/
- function upgrade_4_3_beta3($rev) {
+ public function upgrade_4_3_beta3($rev) {
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.beta3')), 'task_4_3_x_runSql', $rev);
// CRM-12065
$query = "SELECT id, form_values FROM civicrm_report_instance WHERE form_values LIKE '%contribution_type%'";
/**
* @param $rev
*/
- function upgrade_4_3_beta4($rev) {
+ public function upgrade_4_3_beta4($rev) {
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.beta4')), 'task_4_3_x_runSql', $rev);
// add indexes for civicrm_entity_financial_trxn
// CRM-12141
/**
* @param $rev
*/
- function upgrade_4_3_beta5($rev) {
+ public function upgrade_4_3_beta5($rev) {
// CRM-12205
if (
CRM_Core_DAO::checkTableExists('log_civicrm_financial_trxn') &&
/**
* @param $rev
*/
- function upgrade_4_3_4($rev) {
+ public function upgrade_4_3_4($rev) {
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.4')), 'task_4_3_x_runSql', $rev);
}
/**
* @param $rev
*/
- function upgrade_4_3_5($rev) {
+ public function upgrade_4_3_5($rev) {
// CRM-12156
$config = CRM_Core_Config::singleton();
$dbname = DB::parseDSN($config->dsn);
/**
* @param $rev
*/
- function upgrade_4_3_6($rev) {
+ public function upgrade_4_3_6($rev) {
//CRM-13094
$this->addTask(ts('Add missing constraints'), 'addMissingConstraints', $rev);
//CRM-13088
/**
* @return bool
*/
- function assignFinancialTypeToPriceRecords() {
+ public function assignFinancialTypeToPriceRecords() {
$upgrade = new CRM_Upgrade_Form();
//here we update price set entries
$sqlFinancialIds = "
/**
* @return bool
*/
- static function _checkAndMigrateDefaultFinancialTypes() {
+ public static function _checkAndMigrateDefaultFinancialTypes() {
$modifiedDefaults = FALSE;
//insert types if not exists
$sqlFetchTypes = "
/**
* @return bool
*/
- function createFinancialRecords() {
+ public function createFinancialRecords() {
$upgrade = new CRM_Upgrade_Form();
// update civicrm_entity_financial_trxn.amount = civicrm_financial_trxn.total_amount
/**
* @return array
*/
- function createDomainContacts() {
+ public function createDomainContacts() {
$domainParams = $context = array();
$query = "
ALTER TABLE civicrm_domain ADD contact_id INT( 10 ) UNSIGNED NULL DEFAULT NULL COMMENT 'FK to Contact ID. This is specifically not an FK to avoid circular constraints',
return $context;
}
- function task_4_3_alpha1_checkDBConstraints() {
+ public function task_4_3_alpha1_checkDBConstraints() {
//checking whether the foreign key exists before dropping it CRM-11260
$config = CRM_Core_Config::singleton();
$dbUf = DB::parseDSN($config->dsn);
* Read creation and modification times from civicrm_log; add
* them to civicrm_contact.
*/
- function convertTimestamps(CRM_Queue_TaskContext $ctx, $startId, $endId) {
+ public function convertTimestamps(CRM_Queue_TaskContext $ctx, $startId, $endId) {
$sql = "
SELECT entity_id, min(modified_date) AS created, max(modified_date) AS modified
FROM civicrm_log
/**
* Change index and add missing constraints for civicrm_contribution_recur
*/
- function addMissingConstraints(CRM_Queue_TaskContext $ctx) {
+ public function addMissingConstraints(CRM_Queue_TaskContext $ctx) {
$query = "SHOW KEYS FROM `civicrm_contribution_recur` WHERE key_name = 'UI_contrib_payment_instrument_id'";
$dao = CRM_Core_DAO::executeQuery($query);
if ($dao->N) {
* CRM-12844
*
*/
- function updateFinancialTrxnData(CRM_Queue_TaskContext $ctx) {
+ public function updateFinancialTrxnData(CRM_Queue_TaskContext $ctx) {
$upgrade = new CRM_Upgrade_Form();
$sql = "SELECT cc.id contribution_id, cc.contribution_recur_id, cft.payment_processor_id,
cft.id financial_trxn_id, cfi.entity_table, cft.from_financial_account_id, cft.to_financial_account_id
* CRM-12844
*
*/
- function updateLineItemData(CRM_Queue_TaskContext $ctx) {
+ public function updateLineItemData(CRM_Queue_TaskContext $ctx) {
$sql = "SELECT cc.id contribution_id, cc.contribution_recur_id,
cc.financial_type_id contribution_financial_type,
cli.financial_type_id line_financial_type_id,
* Replace contribution_type to financial_type in table
* civicrm_saved_search and Structure civicrm_report_instance
*/
- function replaceContributionTypeId(CRM_Queue_TaskContext $ctx, $query, $table) {
+ public function replaceContributionTypeId(CRM_Queue_TaskContext $ctx, $query, $table) {
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$formValues = unserialize($dao->form_values);
*
* @return bool TRUE for success
*/
- function task_4_3_x_checkConstraints(CRM_Queue_TaskContext $ctx) {
+ public function task_4_3_x_checkConstraints(CRM_Queue_TaskContext $ctx) {
CRM_Core_DAO::executeQuery('ALTER TABLE `civicrm_financial_account` CHANGE `contact_id` `contact_id` INT( 10 ) UNSIGNED NULL DEFAULT NULL');
$config = CRM_Core_Config::singleton();
$dbname = DB::parseDSN($config->dsn);
*
* @return bool TRUE for success
*/
- function task_4_3_x_checkIndexes(CRM_Queue_TaskContext $ctx) {
+ public function task_4_3_x_checkIndexes(CRM_Queue_TaskContext $ctx) {
$query = "
SHOW KEYS
FROM civicrm_entity_financial_trxn
*
* @return bool TRUE for success
*/
- static function phoneNumeric(CRM_Queue_TaskContext $ctx) {
+ public static function phoneNumeric(CRM_Queue_TaskContext $ctx) {
CRM_Core_DAO::executeQuery(CRM_Contact_BAO_Contact::DROP_STRIP_FUNCTION_43);
CRM_Core_DAO::executeQuery(CRM_Contact_BAO_Contact::CREATE_STRIP_FUNCTION_43);
CRM_Core_DAO::executeQuery("UPDATE civicrm_phone SET phone_numeric = civicrm_strip_non_numeric(phone)");
/**
* (Queue Task Callback)
*/
- static function task_4_3_x_runSql(CRM_Queue_TaskContext $ctx, $rev) {
+ public static function task_4_3_x_runSql(CRM_Queue_TaskContext $ctx, $rev) {
$upgrade = new CRM_Upgrade_Form();
$upgrade->processSQL($rev);
*
* @return bool
*/
- function verifyPreDBstate(&$errors) {
+ public function verifyPreDBstate(&$errors) {
return TRUE;
}
*
* @return void
*/
- function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
+ public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
if ($rev == '4.2.alpha1') {
$tables = array('civicrm_contribution_page','civicrm_event','civicrm_group','civicrm_contact');
if (!CRM_Core_DAO::schemaRequiresRebuilding($tables)){
* @param $rev string, an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs
* @return void
*/
- function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
+ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
if ($rev == '4.2.beta5') {
$config = CRM_Core_Config::singleton();
if (!empty($config->extensionsDir)) {
/**
* @param $rev
*/
- function upgrade_4_2_alpha1($rev) {
+ public function upgrade_4_2_alpha1($rev) {
//checking whether the foreign key exists before dropping it
//drop foreign key queries of CRM-9850
$params = array();
/**
* @param $rev
*/
- function upgrade_4_2_beta2($rev) {
+ public function upgrade_4_2_beta2($rev) {
// note: error conditions are also checked in setPreUpgradeMessage()
if (defined('CIVICRM_SETTINGS_PATH')) {
if (!preg_match(self::SETTINGS_SNIPPET_PATTERN, file_get_contents(CIVICRM_SETTINGS_PATH))) {
/**
* @param $rev
*/
- function upgrade_4_2_beta3($rev) {
+ public function upgrade_4_2_beta3($rev) {
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.2.beta3')), 'task_4_2_x_runSql', $rev);
$minParticipantId = CRM_Core_DAO::singleValueQuery('SELECT coalesce(min(id),0) FROM civicrm_participant');
$maxParticipantId = CRM_Core_DAO::singleValueQuery('SELECT coalesce(max(id),0) FROM civicrm_participant');
/**
* @param $rev
*/
- function upgrade_4_2_beta5($rev) {
+ public function upgrade_4_2_beta5($rev) {
// CRM-10629 Create a setting for extension URLs
// For some reason, this isn't working when placed in the .sql file
CRM_Core_DAO::executeQuery("
/**
* @param $rev
*/
- function upgrade_4_2_0($rev) {
+ public function upgrade_4_2_0($rev) {
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.2.0')), 'task_4_2_x_runSql', $rev);
}
/**
* @param $rev
*/
- function upgrade_4_2_2($rev) {
+ public function upgrade_4_2_2($rev) {
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.2.2')), 'task_4_2_x_runSql', $rev);
//create line items for memberships and participants for api/import
self::convertContribution();
/**
* @param $rev
*/
- function upgrade_4_2_3($rev) {
+ public function upgrade_4_2_3($rev) {
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.2.3')), 'task_4_2_x_runSql', $rev);
// CRM-10953 Remove duplicate activity type for 'Reminder Sent' which is mistakenly inserted by 4.2.alpha1 upgrade script
$queryMin = "
/**
* @param $rev
*/
- function upgrade_4_2_5($rev) {
+ public function upgrade_4_2_5($rev) {
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.2.5')), 'task_4_2_x_runSql', $rev);
//CRM-11077
$sql = " SELECT cpse.entity_id, cpse.price_set_id
}
}
- function convertContribution(){
+ public function convertContribution(){
$minContributionId = CRM_Core_DAO::singleValueQuery('SELECT coalesce(min(id),0) FROM civicrm_contribution');
$maxContributionId = CRM_Core_DAO::singleValueQuery('SELECT coalesce(max(id),0) FROM civicrm_contribution');
for ($startId = $minContributionId; $startId <= $maxContributionId; $startId += self::BATCH_SIZE) {
*
* Upgrade code to create priceset for contribution pages and events
*/
- static function task_4_2_alpha1_createPriceSets(CRM_Queue_TaskContext $ctx, $rev) {
+ public static function task_4_2_alpha1_createPriceSets(CRM_Queue_TaskContext $ctx, $rev) {
$upgrade = new CRM_Upgrade_Form();
$daoName = array(
'civicrm_contribution_page' => array(
/**
* (Queue Task Callback)
*/
- static function task_4_2_x_runSql(CRM_Queue_TaskContext $ctx, $rev) {
+ public static function task_4_2_x_runSql(CRM_Queue_TaskContext $ctx, $rev) {
$upgrade = new CRM_Upgrade_Form();
$upgrade->processSQL($rev);
*
* create price sets
*/
- static function createPriceSet($daoName, $addTo, $options = array()) {
+ public static function createPriceSet($daoName, $addTo, $options = array()) {
$query = "SELECT title FROM {$addTo[0]} where id =%1";
$setParams['title'] = CRM_Core_DAO::singleValueQuery($query,
array(1 => array($addTo[2], 'Integer'))
*
* @return bool
*/
- static function task_4_2_alpha1_convertContributions(CRM_Queue_TaskContext $ctx, $startId, $endId) {
+ public static function task_4_2_alpha1_convertContributions(CRM_Queue_TaskContext $ctx, $startId, $endId) {
$upgrade = new CRM_Upgrade_Form();
$query = "
INSERT INTO civicrm_line_item(`entity_table` ,`entity_id` ,`price_field_id` ,`label` , `qty` ,`unit_price` ,`line_total` ,`participant_count` ,`price_field_value_id`)
*
* @return bool
*/
- static function task_4_2_alpha1_convertParticipants(CRM_Queue_TaskContext $ctx, $startId, $endId) {
+ public static function task_4_2_alpha1_convertParticipants(CRM_Queue_TaskContext $ctx, $startId, $endId) {
$upgrade = new CRM_Upgrade_Form();
//create lineitems for participant in edge cases using default price set for contribution.
$query = "
*
* Create an event registration profile with a single email field CRM-9587
*/
- static function task_4_2_alpha1_eventProfile(CRM_Queue_TaskContext $ctx) {
+ public static function task_4_2_alpha1_eventProfile(CRM_Queue_TaskContext $ctx) {
$upgrade = new CRM_Upgrade_Form();
$profileTitle = ts('Your Registration Info');
*
* @return bool
*/
- function verifyPreDBstate(&$errors) {
+ public function verifyPreDBstate(&$errors) {
return TRUE;
}
/**
* @param $rev
*/
- function upgrade_4_0_alpha1($rev) {
+ public function upgrade_4_0_alpha1($rev) {
// do nothing, db is already upgraded to 3.4.alpha1.
}
}
*
* @return bool
*/
- function verifyPreDBstate(&$errors) {
+ public function verifyPreDBstate(&$errors) {
return TRUE;
}
/**
* @param $rev
*/
- function upgrade_3_4_alpha3($rev) {
+ public function upgrade_3_4_alpha3($rev) {
// CRM-7681, update report instance criteria.
$modifiedReportIds = array('contact/summary', 'contact/detail', 'event/participantListing', 'member/summary', 'pledge/summary', 'pledge/pbnp', 'member/detail', 'member/lapse', 'grant/detail', 'contribute/bookkeeping', 'contribute/lybunt', 'contribute/summary', 'contribute/repeat', 'contribute/detail', 'contribute/organizationSummary', 'contribute/sybunt', 'contribute/householdSummary', 'contact/relationship', 'contact/currentEmployer', 'case/demographics', 'walklist', 'case/detail', 'contact/log', 'activitySummary', 'case/timespent', 'case/summary');
/**
* @param $rev
*/
- function upgrade_3_4_beta2($rev) {
+ public function upgrade_3_4_beta2($rev) {
$addPetitionOptionGroup = !(boolean) CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'msg_tpl_workflow_petition', 'id', 'name');
$upgrade = new CRM_Upgrade_Form();
$upgrade->assign('addPetitionOptionGroup', $addPetitionOptionGroup);
/**
* @param $rev
*/
- function upgrade_3_4_beta3($rev) {
+ public function upgrade_3_4_beta3($rev) {
// do the regular upgrade
$upgrade = new CRM_Upgrade_Form;
$upgrade->processSQL($rev);
/**
* @param $rev
*/
- function upgrade_3_4_3($rev) {
+ public function upgrade_3_4_3($rev) {
// CRM-8147, update group_type for uf groups, check and add component field types
$ufGroups = new CRM_Core_DAO_UFGroup();
$ufGroups->find();
/**
* @param $rev
*/
- function upgrade_3_4_4($rev) {
+ public function upgrade_3_4_4($rev) {
// CRM-8315, update report instance criteria.
$modifiedReportIds = array('member/summary', 'member/detail');
/**
* @param $rev
*/
- function upgrade_3_4_5($rev) {
+ public function upgrade_3_4_5($rev) {
// handle db changes done for CRM-8218
$alterContactDashboard = FALSE;
$dao = new CRM_Contact_DAO_DashboardContact();
/**
* @param $rev
*/
- function upgrade_3_4_6($rev) {
+ public function upgrade_3_4_6($rev) {
$modifiedReportIds = array('event/summary', 'activity', 'Mailing/bounce', 'Mailing/clicks', 'Mailing/opened');
$instances = CRM_Core_DAO::executeQuery("SELECT id, form_values, report_id FROM civicrm_report_instance WHERE report_id IN ('" . implode("','", $modifiedReportIds) . "')");
*
* @throws Exception
*/
- function upgrade_3_4_7($rev) {
+ public function upgrade_3_4_7($rev) {
$onBehalfProfileId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', 'on_behalf_organization', 'id', 'name');
if (!$onBehalfProfileId) {
CRM_Core_Error::fatal();
*
* @return bool
*/
- function verifyPreDBstate(&$errors) {
+ public function verifyPreDBstate(&$errors) {
return TRUE;
}
/**
* @param $rev
*/
- function upgrade_3_3_alpha1($rev) {
+ public function upgrade_3_3_alpha1($rev) {
$config = CRM_Core_Config::singleton();
if ($config->userSystem->is_drupal) {
// CRM-6426 - make civicrm profiles permissioned on drupal my account
/**
* @param $rev
*/
- function upgrade_3_3_beta1($rev) {
+ public function upgrade_3_3_beta1($rev) {
$upgrade = new CRM_Upgrade_Form();
$upgrade->processSQL($rev);
/**
* @param $rev
*/
- function upgrade_3_3_beta3($rev) {
+ public function upgrade_3_3_beta3($rev) {
// get the duplicate Ids of line item entries
$dupeLineItemIds = array();
$fields = array('entity_table', 'entity_id', 'price_field_id', 'price_field_value_id');
/**
* @param $rev
*/
- function upgrade_3_3_0($rev) {
+ public function upgrade_3_3_0($rev) {
$upgrade = new CRM_Upgrade_Form();
$upgrade->processSQL($rev);
/**
* @param $rev
*/
- function upgrade_3_3_2($rev) {
+ public function upgrade_3_3_2($rev) {
$dropMailingIndex = FALSE;
$indexes = CRM_Core_DAO::executeQuery('SHOW INDEXES FROM civicrm_mailing_job');
while ($indexes->fetch()) {
/**
* @param $rev
*/
- function upgrade_3_3_7($rev) {
+ public function upgrade_3_3_7($rev) {
$dao = new CRM_Contact_DAO_Contact();
$dbName = $dao->_database;
*
* @return bool
*/
- function verifyPreDBstate(&$errors) {
+ public function verifyPreDBstate(&$errors) {
return TRUE;
}
/**
* @param $rev
*/
- function upgrade_3_2_alpha1($rev) {
+ public function upgrade_3_2_alpha1($rev) {
//CRM-5666 -if user already have 'access CiviCase'
//give all new permissions and drop access CiviCase.
$config = CRM_Core_Config::singleton();
/**
* @param $rev
*/
- function upgrade_3_2_beta4($rev) {
+ public function upgrade_3_2_beta4($rev) {
$upgrade = new CRM_Upgrade_Form;
$config = CRM_Core_Config::singleton();
/**
* @param $rev
*/
- function upgrade_3_2_1($rev) {
+ public function upgrade_3_2_1($rev) {
//CRM-6565 check if Activity Index is already exists or not.
$addActivityTypeIndex = TRUE;
$indexes = CRM_Core_DAO::executeQuery('SHOW INDEXES FROM civicrm_activity');
*
*/
class CRM_Upgrade_Page_Upgrade extends CRM_Core_Page {
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function run() {
+ public function run() {
// lets get around the time limit issue if possible for upgrades
if (!ini_get('safe_mode')) {
set_time_limit(0);
/**
* Display an introductory screen with any pre-upgrade messages
*/
- function runIntro() {
+ public function runIntro() {
$upgrade = new CRM_Upgrade_Form();
$template = CRM_Core_Smarty::singleton();
list($currentVer, $latestVer) = $upgrade->getUpgradeVersions();
/**
* Begin the upgrade by building a queue of tasks and redirecting to the queue-runner
*/
- function runBegin() {
+ public function runBegin() {
$upgrade = new CRM_Upgrade_Form();
list($currentVer, $latestVer) = $upgrade->getUpgradeVersions();
/**
* Display any final messages, clear caches, etc
*/
- function runFinish() {
+ public function runFinish() {
$upgrade = new CRM_Upgrade_Form();
$template = CRM_Core_Smarty::singleton();
* @access public
* @static
*/
- static function &add(&$params) {
+ public static function &add(&$params) {
$priceFieldBAO = new CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field();
$priceFieldBAO->copyValues($params);
* @access public
* @static
*/
- static function create(&$params) {
+ public static function create(&$params) {
$transaction = new CRM_Core_Transaction();
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
return CRM_Core_DAO::commonRetrieve('CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field', $params, $defaults);
}
* @access public
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field', $id, 'is_active', $is_active);
}
/**
* @return array
*/
- static function &htmlTypes() {
+ public static function &htmlTypes() {
static $htmlTypes = NULL;
if (!$htmlTypes) {
$htmlTypes = array(
* @access public
* @static
*/
- static function &add(&$params, $ids) {
+ public static function &add(&$params, $ids) {
$fieldValueBAO = new CRM_Upgrade_Snapshot_V4p2_Price_BAO_FieldValue();
$fieldValueBAO->copyValues($params);
* @access public
* @static
*/
- static function create(&$params, $ids) {
+ public static function create(&$params, $ids) {
if (!is_array($params) || empty($params)) {
return;
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
return CRM_Core_DAO::commonRetrieve('CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue', $params, $defaults);
}
* @access public
* @static
*/
- static function getValues($fieldId, &$values, $orderBy = 'weight', $isActive = FALSE) {
+ public static function getValues($fieldId, &$values, $orderBy = 'weight', $isActive = FALSE) {
$fieldValueDAO = new CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue();
$fieldValueDAO->price_field_id = $fieldId;
$fieldValueDAO->orderBy($orderBy, 'label');
* @access public
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue', $id, 'is_active', $is_active);
}
* @access public
* @static
*/
- static function deleteValues($fieldId) {
+ public static function deleteValues($fieldId) {
if (!$fieldId) {
return FALSE;
}
* @access public
* @static
*/
- static function del($id) {
+ public static function del($id) {
if (!$id) {
return FALSE;
}
* @access public
* @static
*/
- static function create(&$params) {
+ public static function create(&$params) {
//create mode only as we don't support editing line items
CRM_Utils_Hook::pre('create', 'LineItem', $params['entity_id'], $params);
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$lineItem = new CRM_Upgrade_Snapshot_V4p2_Price_BAO_LineItem();
$lineItem->copyValues($params);
if ($lineItem->find(TRUE)) {
*
* @return array of line items
*/
- static function getLineItems($entityId, $entity = 'participant', $isQuick = NULL) {
+ public static function getLineItems($entityId, $entity = 'participant', $isQuick = NULL) {
$selectClause = $whereClause = $fromClause = NULL;
$selectClause = "
* @return void
* @access static
*/
- static function format($fid, &$params, &$fields, &$values) {
+ public static function format($fid, &$params, &$fields, &$values) {
if (empty($params["price_{$fid}"])) {
return;
}
/**
* Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
* @access public
* @static
*/
- static function create(&$params) {
+ public static function create(&$params) {
$priceSetBAO = new CRM_Upgrade_Snapshot_V4p2_Price_BAO_Set();
$priceSetBAO->copyValues($params);
if (self::eventPriceSetDomainID()) {
* @access public
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
return CRM_Core_DAO::commonRetrieve('CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set', $params, $defaults);
}
* @static
* @access public
*/
- static function setIsActive($id, $isActive) {
+ public static function setIsActive($id, $isActive) {
return CRM_Core_DAO::setFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set', $id, 'is_active', $isActive);
}
*
* @return bool|false|int|null
*/
- static function initSet(&$form, $id, $entityTable = 'civicrm_event', $validOnly = FALSE, $priceSetId = NULL) {
+ public static function initSet(&$form, $id, $entityTable = 'civicrm_event', $validOnly = FALSE, $priceSetId = NULL) {
if (!$priceSetId) {
$priceSetId = self::getFor($entityTable, $id);
}
* @param array $params
* @param $lineItem
*/
- static function processAmount(&$fields, &$params, &$lineItem) {
+ public static function processAmount(&$fields, &$params, &$lineItem) {
// using price set
$totalPrice = 0;
$radioLevel = $checkboxLevel = $selectLevel = $textLevel = array();
/**
* @return object
*/
- static function eventPriceSetDomainID() {
+ public static function eventPriceSetDomainID() {
return CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME,
'event_price_set_domain_id',
NULL, FALSE
* @static
* @access public
*/
- static function setIsQuickConfig($id, $isQuickConfig) {
+ public static function setIsQuickConfig($id, $isQuickConfig) {
return CRM_Core_DAO::setFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set', $id, 'is_quick_config', $isQuickConfig);
}
}
* @access public
* @return \CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field
*/
- function __construct()
+ public function __construct()
{
$this->__table = 'civicrm_price_field';
parent::__construct();
* @access public
* @return array
*/
- function links()
+ public function links()
{
if (!(self::$_links)) {
self::$_links = array(
* @static
* @return string
*/
- static function getTableName()
+ public static function getTableName()
{
return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
}
* @access public
* @return boolean
*/
- function getLog()
+ public function getLog()
{
return self::$_log;
}
*
* @return string the display value of the enum
*/
- static function tsEnum($field, $value)
+ public static function tsEnum($field, $value)
{
static $translations = null;
if (!$translations) {
* @param array $values (reference) the array up for enhancing
* @return void
*/
- static function addDisplayEnums(&$values)
+ public static function addDisplayEnums(&$values)
{
$enumFields = & Snapshot_v4p2_Price_DAO_Field::getEnums();
foreach($enumFields as $enum) {
* @access public
* @return \CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue
*/
- function __construct()
+ public function __construct()
{
$this->__table = 'civicrm_price_field_value';
parent::__construct();
* @access public
* @return array
*/
- function links()
+ public function links()
{
if (!(self::$_links)) {
self::$_links = array(
* @static
* @return string
*/
- static function getTableName()
+ public static function getTableName()
{
return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
}
* @access public
* @return boolean
*/
- function getLog()
+ public function getLog()
{
return self::$_log;
}
* @access public
* @return \CRM_Upgrade_Snapshot_V4p2_Price_DAO_LineItem
*/
- function __construct()
+ public function __construct()
{
$this->__table = 'civicrm_line_item';
parent::__construct();
* @access public
* @return array
*/
- function links()
+ public function links()
{
if (!(self::$_links)) {
self::$_links = array(
* @static
* @return string
*/
- static function getTableName()
+ public static function getTableName()
{
return self::$_tableName;
}
* @access public
* @return boolean
*/
- function getLog()
+ public function getLog()
{
return self::$_log;
}
* @access public
* @return \CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set
*/
- function __construct()
+ public function __construct()
{
$this->__table = 'civicrm_price_set';
parent::__construct();
* @access public
* @return array
*/
- function links()
+ public function links()
{
if (!(self::$_links)) {
self::$_links = array(
* @static
* @return string
*/
- static function getTableName()
+ public static function getTableName()
{
return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
}
* @access public
* @return boolean
*/
- function getLog()
+ public function getLog()
{
return self::$_log;
}
* @access public
* @return \CRM_Upgrade_Snapshot_V4p2_Price_DAO_SetEntity
*/
- function __construct()
+ public function __construct()
{
$this->__table = 'civicrm_price_set_entity';
parent::__construct();
* @access public
* @return array
*/
- function links()
+ public function links()
{
if (!(self::$_links)) {
self::$_links = array(
* @static
* @return string
*/
- static function getTableName()
+ public static function getTableName()
{
return self::$_tableName;
}
* @access public
* @return boolean
*/
- function getLog()
+ public function getLog()
{
return self::$_log;
}
* @internal param \CRM_Upgrade_Controller_base $object
* @return \CRM_Upgrade_StateMachine CRM_Upgrade_StateMachine_Base
*/
- function __construct(&$controller, &$pages, $action = CRM_Core_Action::NONE) {
+ public function __construct(&$controller, &$pages, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);
$this->_pages = &$pages;
*
* @return array APIv3 $params
*/
- function createGetParams($origParams, $keys) {
+ public function createGetParams($origParams, $keys) {
$params = array('version' => 3);
foreach ($keys as $key) {
$params[$key] = CRM_Utils_Array::value($key, $origParams, '');
*
* @return array
*/
- static function sequence($format) {
+ public static function sequence($format) {
// also compute and store the address sequence
$addressSequence = array(
'address_name',
* @return array
* @throws Exception
*/
- function processContacts(&$config, $processGeocode, $parseStreetAddress) {
+ public function processContacts(&$config, $processGeocode, $parseStreetAddress) {
// build where clause.
$clause = array('( c.id = a.contact_id )');
$params = array();
/**
* @return array
*/
- function returnResult() {
+ public function returnResult() {
$result = array();
$result['is_error'] = $this->returnError;
$result['messages'] = implode("", $this->returnMessages);
*
* @return bool
*/
- static function checkAddress(&$values) {
+ public static function checkAddress(&$values) {
if (!isset($values['street_address']) ||
(!isset($values['city']) &&
!isset($values['state_province']) &&
* @return string
* @throws CRM_Core_Exception
*/
- static function getEntityName($classNameOrObject) {
+ public static function getEntityName($classNameOrObject) {
require_once 'api/api.php';
$className = is_string($classNameOrObject) ? $classNameOrObject : get_class($classNameOrObject);
* @return mixed
* Can return any type, since $list might contain anything.
*/
- static function value($key, $list, $default = NULL) {
+ public static function value($key, $list, $default = NULL) {
if (is_array($list)) {
return array_key_exists($key, $list) ? $list[$key] : $default;
}
* The value of the key, or null if the key is not found.
* @access public
*/
- static function retrieveValueRecursive(&$params, $key) {
+ public static function retrieveValueRecursive(&$params, $key) {
if (!is_array($params)) {
return NULL;
}
* @return int|string|null
* Returns the key, which could be an int or a string, or NULL on failure.
*/
- static function key($value, &$list) {
+ public static function key($value, &$list) {
if (is_array($list)) {
$key = array_search($value, $list);
* @return string
* XML fragment representing $list.
*/
- static function &xml(&$list, $depth = 1, $seperator = "\n") {
+ public static function &xml(&$list, $depth = 1, $seperator = "\n") {
$xml = '';
foreach ($list as $name => $value) {
$xml .= str_repeat(' ', $depth * 4);
* @return string
* Sanitized version of $value.
*/
- static function escapeXML($value) {
+ public static function escapeXML($value) {
static $src = NULL;
static $dst = NULL;
*
* @access public
*/
- static function flatten(&$list, &$flat, $prefix = '', $seperator = ".") {
+ public static function flatten(&$list, &$flat, $prefix = '', $seperator = ".") {
foreach ($list as $name => $value) {
$newPrefix = ($prefix) ? $prefix . $seperator . $name : $name;
if (is_array($value)) {
*
* @access public
*/
- function unflatten($delim, &$arr) {
+ public function unflatten($delim, &$arr) {
$result = array();
foreach ($arr as $key => $value) {
$path = explode($delim, $key);
* The merged array.
* @access public
*/
- static function crmArrayMerge($a1, $a2) {
+ public static function crmArrayMerge($a1, $a2) {
if (empty($a1)) {
return $a2;
}
* True if $list contains at least one sub-array, false otherwise.
* @access public
*/
- static function isHierarchical(&$list) {
+ public static function isHierarchical(&$list) {
foreach ($list as $n => $v) {
if (is_array($v)) {
return TRUE;
* @param $superset
* @return bool TRUE if $subset is a subset of $superset
*/
- static function isSubset($subset, $superset) {
+ public static function isSubset($subset, $superset) {
foreach ($subset as $expected) {
if (!in_array($expected, $superset)) {
return FALSE;
*
* @access public
*/
- static function crmInArray($value, $params, $caseInsensitive = TRUE) {
+ public static function crmInArray($value, $params, $caseInsensitive = TRUE) {
foreach ($params as $item) {
if (is_array($item)) {
$ret = crmInArray($value, $item, $caseInsensitive);
* the api needs the name => value conversion, also the view layer typically
* requires value => name conversion
*/
- static function lookupValue(&$defaults, $property, $lookup, $reverse) {
+ public static function lookupValue(&$defaults, $property, $lookup, $reverse) {
$id = $property . '_id';
$src = $reverse ? $property : $id;
* True if the array is empty.
* @access public
*/
- static function crmIsEmptyArray($array = array()) {
+ public static function crmIsEmptyArray($array = array()) {
if (!is_array($array)) {
return TRUE;
}
* @return array
* Sorted array
*/
- static function crmArraySortByField($array, $field) {
+ public static function crmArraySortByField($array, $field) {
$code = "return strnatcmp(\$a['$field'], \$b['$field']);";
uasort($array, create_function('$a,$b', $code));
return $array;
* @return array
* The input array with duplicate values removed.
*/
- static function crmArrayUnique($array) {
+ public static function crmArrayUnique($array) {
$result = array_map("unserialize", array_unique(array_map("serialize", $array)));
foreach ($result as $key => $value) {
if (is_array($value)) {
* @return array
* Sorted array.
*/
- static function asort($array = array()) {
+ public static function asort($array = array()) {
$lcMessages = CRM_Utils_System::getUFLocale();
if ($lcMessages && $lcMessages != 'en_US' && class_exists('Collator')) {
* When passed an array of strings, unsets $items[$k] for each string $k
* in the array.
*/
- static function remove(&$items) {
+ public static function remove(&$items) {
foreach (func_get_args() as $n => $key) {
// Skip argument 0 ($items) by testing $n for truth.
if ($n && is_array($key)) {
* @return array
* Multi-dimensional array, with one layer for each key.
*/
- static function index($keys, $records) {
+ public static function index($keys, $records) {
$final_key = array_pop($keys);
$result = array();
* @return array
* Keys are the original keys of $records; values are the $prop values.
*/
- static function collect($prop, $records) {
+ public static function collect($prop, $records) {
$result = array();
if (is_array($records)) {
foreach ($records as $key => $record) {
* An array of strings produced by explode(), or the unmodified input
* array, or NULL.
*/
- static function explodePadded($values, $delim = CRM_Core_DAO::VALUE_SEPARATOR) {
+ public static function explodePadded($values, $delim = CRM_Core_DAO::VALUE_SEPARATOR) {
if ($values === NULL) {
return NULL;
}
* @return string|NULL
* The generated string, or NULL if NULL was passed as $values parameter.
*/
- static function implodePadded($values, $delim = CRM_Core_DAO::VALUE_SEPARATOR) {
+ public static function implodePadded($values, $delim = CRM_Core_DAO::VALUE_SEPARATOR) {
if ($values === NULL) {
return NULL;
}
* @return array
* The manipulated array.
*/
- static function crmReplaceKey(&$elementArray, $oldKey, $newKey) {
+ public static function crmReplaceKey(&$elementArray, $oldKey, $newKey) {
$keys = array_keys($elementArray);
if (FALSE === $index = array_search($oldKey, $keys)) {
throw new Exception(sprintf('key "%s" does not exit', $oldKey));
*
* @return null
*/
- static function valueByRegexKey($regexKey, $list, $default = NULL) {
+ public static function valueByRegexKey($regexKey, $list, $default = NULL) {
if (is_array($list) && $regexKey) {
$matches = preg_grep($regexKey, array_keys($list));
$key = reset($matches);
* {fg => blue, bg => black}
* }
*/
- static function product($dimensions, $template = array()) {
+ public static function product($dimensions, $template = array()) {
if (empty($dimensions)) {
return array($template);
}
* @param array $array
* @return mixed|NULL
*/
- static function first($array) {
+ public static function first($array) {
foreach ($array as $value) {
return $value;
}
* @param array $keys list of keys to copy
* @return array
*/
- static function subset($array, $keys) {
+ public static function subset($array, $keys) {
$result = array();
foreach ($keys as $key) {
if (isset($array[$key])) {
* @param string $valueName
* @return array
*/
- static function makeNonAssociative($associative, $keyName = 'key', $valueName = 'value') {
+ public static function makeNonAssociative($associative, $keyName = 'key', $valueName = 'value') {
$output = array();
foreach ($associative as $key => $val) {
$output[] = array($keyName => $key, $valueName => $val);
*
* @return \CRM_Utils_Cache
*/
- function __construct(&$config) {
+ public function __construct(&$config) {
CRM_Core_Error::fatal(ts('this is just an interface and should not be called directly'));
}
* @static
*
*/
- static function &singleton() {
+ public static function &singleton() {
if (self::$_singleton === NULL) {
$className = 'ArrayCache'; // default to ArrayCache for now
* associative array of settings for the cache
* @static
*/
- static function getCacheSettings($cachePlugin) {
+ public static function getCacheSettings($cachePlugin) {
switch ($cachePlugin) {
case 'ArrayCache':
case 'NoCache':
*
* @return \CRM_Utils_Cache_APCcache
*/
- function __construct(&$config) {
+ public function __construct(&$config) {
if (isset($config['timeout'])) {
$this->_timeout = intval($config['timeout']);
}
*
* @return bool
*/
- function set($key, &$value) {
+ public function set($key, &$value) {
if (!apc_store($this->_prefix . $key, $value, $this->_timeout)) {
return FALSE;
}
*
* @return mixed
*/
- function &get($key) {
+ public function &get($key) {
return apc_fetch($this->_prefix . $key);
}
*
* @return bool|string[]
*/
- function delete($key) {
+ public function delete($key) {
return apc_delete($this->_prefix . $key);
}
- function flush() {
+ public function flush() {
$allinfo = apc_cache_info('user');
$keys = $allinfo['cache_list'];
$prefix = $this->_prefix . "CRM_"; // Our keys follows this pattern: ([A-Za-z0-9_]+)?CRM_[A-Za-z0-9_]+
*
* @return \CRM_Utils_Cache_Arraycache
*/
- function __construct($config) {
+ public function __construct($config) {
$this->_cache = array();
}
* @param string $key
* @param mixed $value
*/
- function set($key, &$value) {
+ public function set($key, &$value) {
$this->_cache[$key] = $value;
}
*
* @return mixed
*/
- function get($key) {
+ public function get($key) {
return CRM_Utils_Array::value($key, $this->_cache);
}
/**
* @param string $key
*/
- function delete($key) {
+ public function delete($key) {
unset($this->_cache[$key]);
}
- function flush() {
+ public function flush() {
unset($this->_cache);
$this->_cache = array();
}
* @param mixed $value
* @return void
*/
- function set($key, &$value);
+ public function set($key, &$value);
/**
* Get a value from the cache
* @param string $key
* @return mixed NULL if $key has not been previously set
*/
- function get($key);
+ public function get($key);
/**
* Delete a value from the cache
* @param string $key
* @return void
*/
- function delete($key);
+ public function delete($key);
/**
* Delete all values from the cache
*
* @return void
*/
- function flush();
+ public function flush();
}
*
* @return \CRM_Utils_Cache_Memcache
*/
- function __construct($config) {
+ public function __construct($config) {
if (isset($config['host'])) {
$this->_host = $config['host'];
}
*
* @return bool
*/
- function set($key, &$value) {
+ public function set($key, &$value) {
if (!$this->_cache->set($this->_prefix . $key, $value, FALSE, $this->_timeout)) {
return FALSE;
}
*
* @return mixed
*/
- function &get($key) {
+ public function &get($key) {
$result = $this->_cache->get($this->_prefix . $key);
return $result;
}
*
* @return mixed
*/
- function delete($key) {
+ public function delete($key) {
return $this->_cache->delete($this->_prefix . $key);
}
/**
* @return mixed
*/
- function flush() {
+ public function flush() {
return $this->_cache->flush();
}
}
*
* @return \CRM_Utils_Cache_Memcached
*/
- function __construct($config) {
+ public function __construct($config) {
if (isset($config['host'])) {
$this->_host = $config['host'];
}
* @return bool
* @throws Exception
*/
- function set($key, &$value) {
+ public function set($key, &$value) {
$key = $this->cleanKey($key);
if (!$this->_cache->set($key, $value, $this->_timeout)) {
CRM_Core_Error::debug( 'Result Code: ', $this->_cache->getResultMessage());
*
* @return mixed
*/
- function &get($key) {
+ public function &get($key) {
$key = $this->cleanKey($key);
$result = $this->_cache->get($key);
return $result;
*
* @return mixed
*/
- function delete($key) {
+ public function delete($key) {
$key = $this->cleanKey($key);
return $this->_cache->delete($key);
}
*
* @return mixed|string
*/
- function cleanKey($key) {
+ public function cleanKey($key) {
$key = preg_replace('/\s+|\W+/', '_', $this->_prefix . $key);
if ( strlen($key) > self::MAX_KEY_LEN ) {
$md5Key = md5($key); // this should be 32 characters in length
/**
* @return mixed
*/
- function flush() {
+ public function flush() {
return $this->_cache->flush();
}
}
*
* @return \CRM_Utils_Cache_NoCache
*/
- function __construct($config) {
+ public function __construct($config) {
}
/**
*
* @return bool
*/
- function set($key, &$value) {
+ public function set($key, &$value) {
return FALSE;
}
*
* @return null
*/
- function get($key) {
+ public function get($key) {
return NULL;
}
*
* @return bool
*/
- function delete($key) {
+ public function delete($key) {
return FALSE;
}
/**
* @return bool
*/
- function flush() {
+ public function flush() {
return FALSE;
}
}
*
* @return \CRM_Utils_Cache_SerializeCache
*/
- function __construct($config) {
+ public function __construct($config) {
$this->_cache = array();
}
*
* @return string
*/
- function fileName ($key) {
+ public function fileName ($key) {
if (strlen($key) > 50)
return CIVICRM_TEMPLATE_COMPILEDIR ."CRM_".md5($key).".php";
return CIVICRM_TEMPLATE_COMPILEDIR .$key.".php";
*
* @return mixed
*/
- function get ($key) {
+ public function get ($key) {
if (array_key_exists($key,$this->_cache))
return $this->_cache[$key];
* @param string $key
* @param mixed $value
*/
- function set($key, &$value) {
+ public function set($key, &$value) {
if (file_exists($this->fileName ($key))) {
return;
}
/**
* @param string $key
*/
- function delete($key) {
+ public function delete($key) {
if (file_exists($this->fileName ($key))) {
unlink ($this->fileName ($key));
}
/**
* @param null $key
*/
- function flush($key =null) {
+ public function flush($key =null) {
$prefix = "CRM_";
if (!$handle = opendir(CIVICRM_TEMPLATE_COMPILEDIR)) {
return; // die? Error?
* @throws RuntimeException
* @return \CRM_Utils_Cache_SqlGroup
*/
- function __construct($config) {
+ public function __construct($config) {
if (isset($config['group'])) {
$this->group = $config['group'];
} else {
* @param string $key
* @param mixed $value
*/
- function set($key, &$value) {
+ public function set($key, &$value) {
CRM_Core_BAO_Cache::setItem($value, $this->group, $key, $this->componentID);
$this->frontCache[$key] = $value;
}
*
* @return mixed
*/
- function get($key) {
+ public function get($key) {
if (! array_key_exists($key, $this->frontCache)) {
$this->frontCache[$key] = CRM_Core_BAO_Cache::getItem($this->group, $key, $this->componentID);
}
*
* @return mixed
*/
- function getFromFrontCache($key, $default = NULL) {
+ public function getFromFrontCache($key, $default = NULL) {
return CRM_Utils_Array::value($key, $this->frontCache, $default);
}
/**
* @param string $key
*/
- function delete($key) {
+ public function delete($key) {
CRM_Core_BAO_Cache::deleteGroup($this->group, $key);
unset($this->frontCache[$key]);
}
- function flush() {
+ public function flush() {
CRM_Core_BAO_Cache::deleteGroup($this->group);
$this->frontCache = array();
}
- function prefetch() {
+ public function prefetch() {
$this->frontCache = CRM_Core_BAO_Cache::getItems($this->group, $this->componentID);
}
}
*
* @return CRM_Utils_Check
*/
- static function &singleton() {
+ public static function &singleton() {
if (!isset(self::$_singleton)) {
self::$_singleton = new CRM_Utils_Check();
}
* @param CRM_Case_XMLRepository $xmlRepo
* @param array<string> $caseTypeNames
*/
- function __construct($xmlRepo, $caseTypeNames) {
+ public function __construct($xmlRepo, $caseTypeNames) {
$this->caseTypeNames = $caseTypeNames;
$this->xmlRepo = $xmlRepo;
}
* @param $message
* @param $title
*/
- function __construct($name, $message, $title) {
+ public function __construct($name, $message, $title) {
$this->name = $name;
$this->message = $message;
$this->title = $title;
/**
* @return string
*/
- function getName() {
+ public function getName() {
return $this->name;
}
/**
* @return string
*/
- function getMessage() {
+ public function getMessage() {
return $this->message;
}
/**
* @return array
*/
- function toArray() {
+ public function toArray() {
return array(
'name' => $this->name,
'message' => $this->message,
* Base64-encoded ciphertext, or base64-encoded plaintext if encryption is
* disabled or unavailable.
*/
- static function encrypt($string) {
+ public static function encrypt($string) {
if (empty($string)) {
return $string;
}
* Plaintext, or base64-decoded ciphertext if encryption is disabled or
* unavailable.
*/
- static function decrypt($string) {
+ public static function decrypt($string) {
if (empty($string)) {
return $string;
}
*
* @static
*/
- static function format($date, $separator = '', $invalidDate = 0) {
+ public static function format($date, $separator = '', $invalidDate = 0) {
if (is_numeric($date) &&
((strlen($date) == 8) || (strlen($date) == 14))
) {
*
* @static
*/
- static function &getAbbrWeekdayNames() {
+ public static function &getAbbrWeekdayNames() {
static $abbrWeekdayNames;
if (!isset($abbrWeekdayNames)) {
*
* @static
*/
- static function &getFullWeekdayNames() {
+ public static function &getFullWeekdayNames() {
static $fullWeekdayNames;
if (!isset($fullWeekdayNames)) {
*
* @static
*/
- static function &getAbbrMonthNames($month = FALSE) {
+ public static function &getAbbrMonthNames($month = FALSE) {
static $abbrMonthNames;
if (!isset($abbrMonthNames)) {
*
* @static
*/
- static function &getFullMonthNames() {
+ public static function &getFullMonthNames() {
static $fullMonthNames;
if (!isset($fullMonthNames)) {
*
* @return int
*/
- static function unixTime($string) {
+ public static function unixTime($string) {
if (empty($string)) {
return 0;
}
* @return string the $format-formatted $date
* @static
*/
- static function customFormat($dateString, $format = NULL, $dateParts = NULL) {
+ public static function customFormat($dateString, $format = NULL, $dateParts = NULL) {
// 1-based (January) month names arrays
$abbrMonths = self::getAbbrMonthNames();
$fullMonths = self::getFullMonthNames();
* @return string date/datetime in ISO format
* @static
*/
- static function mysqlToIso($mysql) {
+ public static function mysqlToIso($mysql) {
$year = substr($mysql, 0, 4);
$month = substr($mysql, 4, 2);
$day = substr($mysql, 6, 2);
* @return string date/datetime in MySQL format
* @static
*/
- static function isoToMysql($iso) {
+ public static function isoToMysql($iso) {
$dropArray = array('-' => '', ':' => '', ' ' => '');
return strtr($iso, $dropArray);
}
* @return bool
* @static
*/
- static function convertToDefaultDate(&$params, $dateType, $dateParam) {
+ public static function convertToDefaultDate(&$params, $dateType, $dateParam) {
$now = getDate();
$cen = substr($now['year'], 0, 2);
$prevCen = $cen - 1;
*
* @return bool
*/
- static function isDate(&$date) {
+ public static function isDate(&$date) {
if (CRM_Utils_System::isNull($date)) {
return FALSE;
}
*
* @return bool|string
*/
- static function currentDBDate($timeStamp = NULL) {
+ public static function currentDBDate($timeStamp = NULL) {
return $timeStamp ? date('YmdHis', $timeStamp) : date('YmdHis');
}
*
* @return bool
*/
- static function overdue($date, $now = NULL) {
+ public static function overdue($date, $now = NULL) {
$mysqlDate = self::isoToMysql($date);
if (!$now) {
$now = self::currentDBDate();
* @return string Return the customized todays date (Y-m-d)
* @static
*/
- static function getToday($dayParams = NULL, $format = "Y-m-d") {
+ public static function getToday($dayParams = NULL, $format = "Y-m-d") {
if (is_null($dayParams) || empty($dayParams)) {
$today = date($format);
}
* @return true todays date is in the given date range
* @static
*/
- static function getRange($startDate, $endDate) {
+ public static function getRange($startDate, $endDate) {
$today = date("Y-m-d");
$mysqlStartDate = self::isoToMysql($startDate);
$mysqlEndDate = self::isoToMysql($endDate);
* @return array start date, end date
* @static
*/
- static function getFromTo($relative, $from, $to) {
+ public static function getFromTo($relative, $from, $to) {
if ($relative) {
list($term, $unit) = explode('.', $relative);
$dateRange = self::relativeToAbsolute($term, $unit);
* @return array $result contains new date with added interval
* @access public
*/
- static function intervalAdd($unit, $interval, $date, $dontCareTime = FALSE) {
+ public static function intervalAdd($unit, $interval, $date, $dontCareTime = FALSE) {
if (is_array($date)) {
$hour = CRM_Utils_Array::value('H', $date);
$minute = CRM_Utils_Array::value('i', $date);
*
* @return array|null|string
*/
- static function &checkBirthDateFormat($format = NULL) {
+ public static function &checkBirthDateFormat($format = NULL) {
$birthDateFormat = NULL;
if (!$format) {
$birthDateFormat = self::getDateFormat('birth');
* @return array $dateRange start date and end date for the relative time frame
* @static
*/
- static function relativeToAbsolute($relativeTerm, $unit) {
+ public static function relativeToAbsolute($relativeTerm, $unit) {
$now = getDate();
$from = $to = $dateRange = array();
$from['H'] = $from['i'] = $from['s'] = 0;
* @access public
* @static
*/
- static function calculateFiscalYear($fyDate, $fyMonth) {
+ public static function calculateFiscalYear($fyDate, $fyMonth) {
$date = date("Y-m-d");
$currentYear = date("Y");
*
* @return string $mysqlDate date format that is excepted by mysql
*/
- static function processDate($date, $time = NULL, $returnNullString = FALSE, $format = 'YmdHis') {
+ public static function processDate($date, $time = NULL, $returnNullString = FALSE, $format = 'YmdHis') {
$mysqlDate = NULL;
if ($returnNullString) {
*
* @return array $date and time
*/
- static function setDateDefaults($mysqlDate = NULL, $formatType = NULL, $format = NULL, $timeFormat = NULL) {
+ public static function setDateDefaults($mysqlDate = NULL, $formatType = NULL, $format = NULL, $timeFormat = NULL) {
// if date is not passed assume it as today
if (!$mysqlDate) {
$mysqlDate = date('Y-m-d G:i:s');
*
* @return string $format
*/
- static function getDateFormat($formatType = NULL) {
+ public static function getDateFormat($formatType = NULL) {
$format = NULL;
if ($formatType) {
$format = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_PreferencesDate',
* @static
* @public
*/
- static function getUTCTime($offset = 0) {
+ public static function getUTCTime($offset = 0) {
$originalTimezone = date_default_timezone_get();
date_default_timezone_set('UTC');
$time = time() + $offset;
*
* @return null|string
*/
- static function formatDate($date, $dateType) {
+ public static function formatDate($date, $dateType) {
$formattedDate = NULL;
if (empty($date)) {
return $formattedDate;
/**
* @param $array
*/
- function __construct($array) {
+ public function __construct($array) {
$this->array = $array;
}
*
* @throws Exception
*/
- function __call($name, $arguments) {
+ public function __call($name, $arguments) {
if (isset($this->array[$name]) && is_callable($this->array[$name])) {
return call_user_func_array($this->array[$name], $arguments);
} else {
* @return boolean true if file is ascii
* @access public
*/
- static function isAscii($name) {
+ public static function isAscii($name) {
$fd = fopen($name, "r");
if (!$fd) {
return FALSE;
* @return boolean true if file is html
* @access public
*/
- static function isHtml($name) {
+ public static function isHtml($name) {
$fd = fopen($name, "r");
if (!$fd) {
return FALSE;
* @access public
* @static
*/
- static function createDir($path, $abort = TRUE) {
+ public static function createDir($path, $abort = TRUE) {
if (is_dir($path) || empty($path)) {
return;
}
* @access public
* @static
*/
- static function cleanDir($target, $rmdir = TRUE, $verbose = TRUE) {
+ public static function cleanDir($target, $rmdir = TRUE, $verbose = TRUE) {
static $exceptions = array('.', '..');
if ($target == '' || $target == '/') {
throw new Exception("Overly broad deletion");
* @param $source
* @param $destination
*/
- static function copyDir($source, $destination) {
+ public static function copyDir($source, $destination) {
$dir = opendir($source);
@mkdir($destination);
while (FALSE !== ($file = readdir($dir))) {
* @return boolean whether the file was recoded properly
* @access public
*/
- static function toUtf8($name) {
+ public static function toUtf8($name) {
static $config = NULL;
static $legacyEncoding = NULL;
if ($config == NULL) {
* @access public
* @static
*/
- static function addTrailingSlash($path, $slash = NULL) {
+ public static function addTrailingSlash($path, $slash = NULL) {
if (!$slash) {
// FIXME: Defaulting to backslash on windows systems can produce unexpected results, esp for URL strings which should always use forward-slashes.
// I think this fn should default to forward-slash instead.
* @param bool $isQueryString
* @param bool $dieOnErrors
*/
- static function sourceSQLFile($dsn, $fileName, $prefix = NULL, $isQueryString = FALSE, $dieOnErrors = TRUE) {
+ public static function sourceSQLFile($dsn, $fileName, $prefix = NULL, $isQueryString = FALSE, $dieOnErrors = TRUE) {
require_once 'DB.php';
$db = DB::connect($dsn);
*
* @return bool
*/
- static function isExtensionSafe($ext) {
+ public static function isExtensionSafe($ext) {
static $extensions = NULL;
if (!$extensions) {
$extensions = CRM_Core_OptionGroup::values('safe_file_extension', TRUE);
*
* @return boolean whether the file can be include()d or require()d
*/
- static function isIncludable($name) {
+ public static function isIncludable($name) {
$x = @fopen($name, 'r', TRUE);
if ($x) {
fclose($x);
* Remove the 32 bit md5 we add to the fileName
* also remove the unknown tag if we added it
*/
- static function cleanFileName($name) {
+ public static function cleanFileName($name) {
// replace the last 33 character before the '.' with null
$name = preg_replace('/(_[\w]{32})\./', '.', $name);
return $name;
*
* @return string
*/
- static function makeFileName($name) {
+ public static function makeFileName($name) {
$uniqID = md5(uniqid(rand(), TRUE));
$info = pathinfo($name);
$basename = substr($info['basename'],
*
* @return array
*/
- static function getFilesByExtension($path, $ext) {
+ public static function getFilesByExtension($path, $ext) {
$path = self::addTrailingSlash($path);
$dh = opendir($path);
$files = array();
* @param string $dir the directory to be secured
* @param bool $overwrite
*/
- static function restrictAccess($dir, $overwrite = FALSE) {
+ public static function restrictAccess($dir, $overwrite = FALSE) {
// note: empty value for $dir can play havoc, since that might result in putting '.htaccess' to root dir
// of site, causing site to stop functioning.
// FIXME: we should do more checks here -
*
* @param $publicDir
*/
- static function restrictBrowsing($publicDir) {
+ public static function restrictBrowsing($publicDir) {
if (!is_dir($publicDir) || !is_writable($publicDir)) {
return;
}
* Create the base file path from which all our internal directories are
* offset. This is derived from the template compile directory set
*/
- static function baseFilePath($templateCompileDir = NULL) {
+ public static function baseFilePath($templateCompileDir = NULL) {
static $_path = NULL;
if (!$_path) {
if ($templateCompileDir == NULL) {
*
* @return string
*/
- static function relativeDirectory($directory) {
+ public static function relativeDirectory($directory) {
// Do nothing on windows
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
return $directory;
*
* @return string
*/
- static function absoluteDirectory($directory) {
+ public static function absoluteDirectory($directory) {
// check if directory is already absolute, if so return immediately
// Note: Windows PHP accepts any mix of "/" or "\", so "C:\htdocs" or "C:/htdocs" would be a valid absolute path
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' && preg_match(';^[a-zA-Z]:[/\\\\];', $directory)) {
*
* @return string
*/
- static function relativize($directory, $basePath) {
+ public static function relativize($directory, $basePath) {
if (substr($directory, 0, strlen($basePath)) == $basePath) {
return substr($directory, strlen($basePath));
} else {
* @return string, path to an openable/writable file
* @see tempnam
*/
- static function tempnam($prefix = 'tmp-') {
+ public static function tempnam($prefix = 'tmp-') {
//$config = CRM_Core_Config::singleton();
//$nonce = md5(uniqid() . $config->dsn . $config->userFrameworkResourceURL);
//$fileName = "{$config->configAndLogDir}" . $prefix . $nonce . $suffix;
* @return string, path to an openable/writable directory; ends with '/'
* @see tempnam
*/
- static function tempdir($prefix = 'tmp-') {
+ public static function tempdir($prefix = 'tmp-') {
$fileName = self::tempnam($prefix);
unlink($fileName);
mkdir($fileName, 0700);
* @param $pattern string, glob pattern, eg "*.txt"
* @return array(string)
*/
- static function findFiles($dir, $pattern) {
+ public static function findFiles($dir, $pattern) {
$todos = array($dir);
$result = array();
while (!empty($todos)) {
*
* @return bool
*/
- static function isChildPath($parent, $child, $checkRealPath = TRUE) {
+ public static function isChildPath($parent, $child, $checkRealPath = TRUE) {
if ($checkRealPath) {
$parent = realpath($parent);
$child = realpath($child);
*
* @return bool TRUE on success
*/
- static function replaceDir($fromDir, $toDir, $verbose = FALSE) {
+ public static function replaceDir($fromDir, $toDir, $verbose = FALSE) {
if (is_dir($toDir)) {
if (!self::cleanDir($toDir, TRUE, $verbose)) {
return FALSE;
* @return boolean true if we modified the address, false otherwise
* @static
*/
- static function format(&$values, $stateName = FALSE) {
+ public static function format(&$values, $stateName = FALSE) {
// we need a valid country, else we ignore
if (empty($values['country'])) {
return FALSE;
* @return boolean true if we modified the address, false otherwise
* @static
*/
- static function format(&$values, $stateName = FALSE) {
+ public static function format(&$values, $stateName = FALSE) {
CRM_Utils_System::checkPHPVersion(5, TRUE);
$config = CRM_Core_Config::singleton();
* @return self
* An instance of $config->userHookClass
*/
- static function singleton($fresh = FALSE) {
+ public static function singleton($fresh = FALSE) {
if (self::$_singleton == NULL || $fresh) {
$config = CRM_Core_Config::singleton();
$class = $config->userHookClass;
*
* @param string $fnPrefix
*/
- function commonBuildModuleList($fnPrefix) {
+ public function commonBuildModuleList($fnPrefix) {
if (!$this->commonIncluded) {
// include external file
$this->commonIncluded = TRUE;
/**
* @param $moduleList
*/
- function requireCiviModules(&$moduleList) {
+ public function requireCiviModules(&$moduleList) {
$civiModules = CRM_Core_PseudoConstant::getModuleExtensions();
foreach ($civiModules as $civiModule) {
if (!file_exists($civiModule['filePath'])) {
*
* @return null the return value is ignored
*/
- static function pre($op, $objectName, $id, &$params) {
+ public static function pre($op, $objectName, $id, &$params) {
$event = new \Civi\Core\Event\PreEvent($op, $objectName, $id, $params);
\Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_pre", $event);
\Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_pre::$objectName", $event);
* an error message which aborts the operation
* @access public
*/
- static function post($op, $objectName, $objectId, &$objectRef) {
+ public static function post($op, $objectName, $objectId, &$objectRef) {
$event = new \Civi\Core\Event\PostEvent($op, $objectName, $objectId, $objectRef);
\Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_post", $event);
\Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_post::$objectName", $event);
*
* @return null the return value is ignored
*/
- static function links($op, $objectName, &$objectId, &$links, &$mask = NULL, &$values = array()) {
+ public static function links($op, $objectName, &$objectId, &$links, &$mask = NULL, &$values = array()) {
return self::singleton()->invoke(6, $op, $objectName, $objectId, $links, $mask, $values, 'civicrm_links');
}
*
* @return null the return value is ignored
*/
- static function preProcess($formName, &$form) {
+ public static function preProcess($formName, &$form) {
return self::singleton()->invoke(2, $formName, $form, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_preProcess');
}
*
* @return null the return value is ignored
*/
- static function buildForm($formName, &$form) {
+ public static function buildForm($formName, &$form) {
return self::singleton()->invoke(2, $formName, $form, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_buildForm');
}
*
* @return null the return value is ignored
*/
- static function postProcess($formName, &$form) {
+ public static function postProcess($formName, &$form) {
return self::singleton()->invoke(2, $formName, $form, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_postProcess');
}
* @return mixed formRule hooks return a boolean or
* an array of error messages which display a QF Error
*/
- static function validate($formName, &$fields, &$files, &$form) {
+ public static function validate($formName, &$fields, &$files, &$form) {
return self::singleton()->invoke(4, $formName, $fields, $files, $form, self::$_nullObject, self::$_nullObject, 'civicrm_validate');
}
* @return mixed formRule hooks return a boolean or
* an array of error messages which display a QF Error
*/
- static function validateForm($formName, &$fields, &$files, &$form, &$errors) {
+ public static function validateForm($formName, &$fields, &$files, &$form, &$errors) {
return self::singleton()->invoke(5, $formName, $fields, $files, $form, $errors, self::$_nullObject, 'civicrm_validateForm');
}
*
* @return null the return value is ignored
*/
- static function custom($op, $groupID, $entityID, &$params) {
+ public static function custom($op, $groupID, $entityID, &$params) {
return self::singleton()->invoke(4, $op, $groupID, $entityID, $params, self::$_nullObject, self::$_nullObject, 'civicrm_custom');
}
*
* @return null the return value is ignored
*/
- static function aclWhereClause($type, &$tables, &$whereTables, &$contactID, &$where) {
+ public static function aclWhereClause($type, &$tables, &$whereTables, &$contactID, &$where) {
return self::singleton()->invoke(5, $type, $tables, $whereTables, $contactID, $where, self::$_nullObject, 'civicrm_aclWhereClause');
}
*
* @return null the return value is ignored
*/
- static function aclGroup($type, $contactID, $tableName, &$allGroups, &$currentGroups) {
+ public static function aclGroup($type, $contactID, $tableName, &$allGroups, &$currentGroups) {
return self::singleton()->invoke(5, $type, $contactID, $tableName, $allGroups, $currentGroups, self::$_nullObject, 'civicrm_aclGroup');
}
*
* @return null the return value is ignored
*/
- static function xmlMenu(&$files) {
+ public static function xmlMenu(&$files) {
return self::singleton()->invoke(1, $files,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_xmlMenu'
* @return null the return value is ignored
* @access public
*/
- static function managed(&$entities) {
+ public static function managed(&$entities) {
return self::singleton()->invoke(1, $entities,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_managed'
* @return string the html snippet to include in the dashboard
* @access public
*/
- static function dashboard($contactID, &$contentPlacement = self::DASHBOARD_BELOW) {
+ public static function dashboard($contactID, &$contentPlacement = self::DASHBOARD_BELOW) {
$retval = self::singleton()->invoke(2, $contactID, $contentPlacement,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_dashboard'
* @return array
* @access public
*/
- static function recent(&$recentArray) {
+ public static function recent(&$recentArray) {
return self::singleton()->invoke(1, $recentArray,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_recent'
* - count: int, eg "5" if there are 5 email addresses that refer to $dao
* @return void
*/
- static function referenceCounts($dao, &$refCounts) {
+ public static function referenceCounts($dao, &$refCounts) {
return self::singleton()->invoke(2, $dao, $refCounts,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_referenceCounts'
* @return null
* @access public
*/
- static function buildAmount($pageType, &$form, &$amount) {
+ public static function buildAmount($pageType, &$form, &$amount) {
return self::singleton()->invoke(3, $pageType, $form, $amount, self::$_nullObject,
self::$_nullObject, self::$_nullObject, 'civicrm_buildAmount');
}
*
* @return null
*/
- static function buildStateProvinceForCountry($countryID, &$states) {
+ public static function buildStateProvinceForCountry($countryID, &$states) {
return self::singleton()->invoke(2, $countryID, $states,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_buildStateProvinceForCountry'
*
* @return null
*/
- static function tabs(&$tabs, $contactID) {
+ public static function tabs(&$tabs, $contactID) {
return self::singleton()->invoke(2, $tabs, $contactID,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_tabs'
);
*
* @return null
*/
- static function tabset($tabsetName, &$tabs, $context) {
+ public static function tabset($tabsetName, &$tabs, $context) {
return self::singleton()->invoke(3, $tabsetName, $tabs,
$context, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_tabset'
);
* @return null
* @access public
*/
- static function tokens(&$tokens) {
+ public static function tokens(&$tokens) {
return self::singleton()->invoke(1, $tokens,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_tokens'
);
* @return null
* @access public
*/
- static function pageRun(&$page) {
+ public static function pageRun(&$page) {
return self::singleton()->invoke(1, $page,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_pageRun'
* @return null
* @access public
*/
- static function copy($objectName, &$object) {
+ public static function copy($objectName, &$object) {
return self::singleton()->invoke(2, $objectName, $object,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_copy'
*
* @return mixed
*/
- static function unsubscribeGroups($op, $mailingId, $contactId, &$groups, &$baseGroups) {
+ public static function unsubscribeGroups($op, $mailingId, $contactId, &$groups, &$baseGroups) {
return self::singleton()->invoke(5, $op, $mailingId, $contactId, $groups, $baseGroups, self::$_nullObject, 'civicrm_unsubscribeGroups');
}
*
* @return mixed
*/
- static function customFieldOptions($customFieldID, &$options, $detailedFormat = FALSE, $selectAttributes = array()) {
+ public static function customFieldOptions($customFieldID, &$options, $detailedFormat = FALSE, $selectAttributes = array()) {
return self::singleton()->invoke(3, $customFieldID, $options, $detailedFormat,
self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_customFieldOptions'
*
* @return mixed
*/
- static function searchTasks($objectType, &$tasks) {
+ public static function searchTasks($objectType, &$tasks) {
return self::singleton()->invoke(2, $objectType, $tasks,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_searchTasks'
*
* @return mixed
*/
- static function eventDiscount(&$form, &$params) {
+ public static function eventDiscount(&$form, &$params) {
return self::singleton()->invoke(2, $form, $params,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_eventDiscount'
*
* @return mixed
*/
- static function mailingGroups(&$form, &$groups, &$mailings) {
+ public static function mailingGroups(&$form, &$groups, &$mailings) {
return self::singleton()->invoke(3, $form, $groups, $mailings,
self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_mailingGroups'
*
* @return mixed
*/
- static function membershipTypeValues(&$form, &$membershipTypes) {
+ public static function membershipTypeValues(&$form, &$membershipTypes) {
return self::singleton()->invoke(2, $form, $membershipTypes,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_membershipTypeValues'
* @return string
* The html snippet to include in the contact summary
*/
- static function summary($contactID, &$content, &$contentPlacement = self::SUMMARY_BELOW) {
+ public static function summary($contactID, &$content, &$contentPlacement = self::SUMMARY_BELOW) {
return self::singleton()->invoke(3, $contactID, $content, $contentPlacement,
self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_summary'
*
* @return mixed
*/
- static function contactListQuery(&$query, $name, $context, $id) {
+ public static function contactListQuery(&$query, $name, $context, $id) {
return self::singleton()->invoke(4, $query, $name, $context, $id,
self::$_nullObject, self::$_nullObject,
'civicrm_contactListQuery'
*
* @return mixed
*/
- static function alterMailParams(&$params, $context = NULL) {
+ public static function alterMailParams(&$params, $context = NULL) {
return self::singleton()->invoke(2, $params, $context,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_alterMailParams'
*
* @return mixed
*/
- static function alterCalculatedMembershipStatus(&$membershipStatus, $arguments, $membership) {
+ public static function alterCalculatedMembershipStatus(&$membershipStatus, $arguments, $membership) {
return self::singleton()->invoke(3, $membershipStatus, $arguments,
$membership, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_alterCalculatedMembershipStatus'
* and the value is an array with keys 'label' and 'value' specifying label/value pairs
* @access public
*/
- static function caseSummary($caseID) {
+ public static function caseSummary($caseID) {
return self::singleton()->invoke(1, $caseID,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_caseSummary'
*
* @return mixed
*/
- static function caseTypes(&$caseTypes) {
+ public static function caseTypes(&$caseTypes) {
return self::singleton()->invoke(1, $caseTypes, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_caseTypes');
}
*
* @return mixed
*/
- static function config(&$config) {
+ public static function config(&$config) {
return self::singleton()->invoke(1, $config,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_config'
*
* @return mixed
*/
- static function enableDisable($recordBAO, $recordID, $isActive) {
+ public static function enableDisable($recordBAO, $recordID, $isActive) {
return self::singleton()->invoke(3, $recordBAO, $recordID, $isActive,
self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_enableDisable'
*
* @return mixed
*/
- static function optionValues(&$options, $name) {
+ public static function optionValues(&$options, $name) {
return self::singleton()->invoke(2, $options, $name,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_optionValues'
*
* @return mixed
*/
- static function navigationMenu(&$params) {
+ public static function navigationMenu(&$params) {
return self::singleton()->invoke(1, $params,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_navigationMenu'
*
* @return mixed
*/
- static function merge($type, &$data, $mainId = NULL, $otherId = NULL, $tables = NULL) {
+ public static function merge($type, &$data, $mainId = NULL, $otherId = NULL, $tables = NULL) {
return self::singleton()->invoke(5, $type, $data, $mainId, $otherId, $tables, self::$_nullObject, 'civicrm_merge');
}
*
* @return mixed
*/
- static function notePrivacy(&$noteValues) {
+ public static function notePrivacy(&$noteValues) {
return self::singleton()->invoke(1, $noteValues,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_notePrivacy'
*
* @return mixed
*/
- static function export(&$exportTempTable, &$headerRows, &$sqlColumns, &$exportMode) {
+ public static function export(&$exportTempTable, &$headerRows, &$sqlColumns, &$exportMode) {
return self::singleton()->invoke(4, $exportTempTable, $headerRows, $sqlColumns, $exportMode,
self::$_nullObject, self::$_nullObject,
'civicrm_export'
* @return mixed
* @access public
*/
- static function dupeQuery($obj, $type, &$query) {
+ public static function dupeQuery($obj, $type, &$query) {
return self::singleton()->invoke(3, $obj, $type, $query,
self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_dupeQuery'
* @return mixed
* @access public
*/
- static function emailProcessor($type, &$params, $mail, &$result, $action = NULL) {
+ public static function emailProcessor($type, &$params, $mail, &$result, $action = NULL) {
return self::singleton()->invoke(5, $type, $params, $mail, $result, $action, self::$_nullObject, 'civicrm_emailProcessor');
}
* @return void
* @access public
*/
- static function import($object, $usage, &$objectRef, &$params) {
+ public static function import($object, $usage, &$objectRef, &$params) {
return self::singleton()->invoke(4, $object, $usage, $objectRef, $params,
self::$_nullObject, self::$_nullObject,
'civicrm_import'
*
* @return mixed
*/
- static function alterAPIPermissions($entity, $action, &$params, &$permissions) {
+ public static function alterAPIPermissions($entity, $action, &$params, &$permissions) {
return self::singleton()->invoke(4, $entity, $action, $params, $permissions,
self::$_nullObject, self::$_nullObject,
'civicrm_alterAPIPermissions'
*
* @return mixed
*/
- static function postSave(&$dao) {
+ public static function postSave(&$dao) {
$hookName = 'civicrm_postSave_' . $dao->getTableName();
return self::singleton()->invoke(1, $dao,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
*
* @return mixed
*/
- static function summaryActions(&$actions, $contactID = NULL) {
+ public static function summaryActions(&$actions, $contactID = NULL) {
return self::singleton()->invoke(2, $actions, $contactID,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_summaryActions'
*
* @return void modify the header and values object to pass the data u need
*/
- static function searchColumns($objectName, &$headers, &$rows, &$selector) {
+ public static function searchColumns($objectName, &$headers, &$rows, &$selector) {
return self::singleton()->invoke(4, $objectName, $headers, $rows, $selector,
self::$_nullObject, self::$_nullObject,
'civicrm_searchColumns'
* @return null
* @access public
*/
- static function buildUFGroupsForModule($moduleName, &$ufGroups) {
+ public static function buildUFGroupsForModule($moduleName, &$ufGroups) {
return self::singleton()->invoke(2, $moduleName, $ufGroups,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_buildUFGroupsForModule'
* @return null
* @access public
*/
- static function emailProcessorContact($email, $contactID, &$result) {
+ public static function emailProcessorContact($email, $contactID, &$result) {
return self::singleton()->invoke(3, $email, $contactID, $result,
self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_emailProcessorContact'
*
* @return mixed
*/
- static function alterMailingLabelParams(&$args) {
+ public static function alterMailingLabelParams(&$args) {
return self::singleton()->invoke(1, $args,
self::$_nullObject, self::$_nullObject,
self::$_nullObject, self::$_nullObject, self::$_nullObject,
* @return mixed
* @access public
*/
- static function alterContent(&$content, $context, $tplName, &$object) {
+ public static function alterContent(&$content, $context, $tplName, &$object) {
return self::singleton()->invoke(4, $content, $context, $tplName, $object,
self::$_nullObject, self::$_nullObject,
'civicrm_alterContent'
* @return mixed
* @access public
*/
- static function alterTemplateFile($formName, &$form, $context, &$tplName) {
+ public static function alterTemplateFile($formName, &$form, $context, &$tplName) {
return self::singleton()->invoke(4, $formName, $form, $context, $tplName,
self::$_nullObject, self::$_nullObject,
'civicrm_alterTemplateFile'
* templatizing logging and other hooks
* @return mixed
*/
- static function triggerInfo(&$info, $tableName = NULL) {
+ public static function triggerInfo(&$info, $tableName = NULL) {
return self::singleton()->invoke(2, $info, $tableName,
self::$_nullObject, self::$_nullObject, self::$_nullObject,
self::$_nullObject,
* Each module will receive hook_civicrm_install during its own installation (but not during the
* installation of unrelated modules).
*/
- static function install() {
+ public static function install() {
return self::singleton()->invoke(0, self::$_nullObject,
self::$_nullObject, self::$_nullObject,
self::$_nullObject, self::$_nullObject, self::$_nullObject,
* Each module will receive hook_civicrm_uninstall during its own uninstallation (but not during the
* uninstallation of unrelated modules).
*/
- static function uninstall() {
+ public static function uninstall() {
return self::singleton()->invoke(0, self::$_nullObject,
self::$_nullObject, self::$_nullObject,
self::$_nullObject, self::$_nullObject, self::$_nullObject,
* Each module will receive hook_civicrm_enable during its own re-enablement (but not during the
* re-enablement of unrelated modules).
*/
- static function enable() {
+ public static function enable() {
return self::singleton()->invoke(0, self::$_nullObject,
self::$_nullObject, self::$_nullObject,
self::$_nullObject, self::$_nullObject, self::$_nullObject,
* Each module will receive hook_civicrm_disable during its own disablement (but not during the
* disablement of unrelated modules).
*/
- static function disable() {
+ public static function disable() {
return self::singleton()->invoke(0, self::$_nullObject,
self::$_nullObject, self::$_nullObject,
self::$_nullObject, self::$_nullObject, self::$_nullObject,
*
* @return mixed
*/
- static function alterReportVar($varType, &$var, &$object) {
+ public static function alterReportVar($varType, &$var, &$object) {
return self::singleton()->invoke(3, $varType, $var, $object,
self::$_nullObject,
self::$_nullObject, self::$_nullObject,
* TRUE, if $op is 'check' and upgrades are pending.
* FALSE, if $op is 'check' and upgrades are not pending.
*/
- static function upgrade($op, CRM_Queue_Queue $queue = NULL) {
+ public static function upgrade($op, CRM_Queue_Queue $queue = NULL) {
return self::singleton()->invoke(2, $op, $queue,
self::$_nullObject, self::$_nullObject, self::$_nullObject,
self::$_nullObject,
*
* @return mixed
*/
- static function postEmailSend(&$params) {
+ public static function postEmailSend(&$params) {
return self::singleton()->invoke(1, $params,
self::$_nullObject, self::$_nullObject,
self::$_nullObject, self::$_nullObject, self::$_nullObject,
*
* @return mixed
*/
- static function alterSettingsFolders(&$settingsFolders) {
+ public static function alterSettingsFolders(&$settingsFolders) {
return self::singleton()->invoke(1, $settingsFolders,
self::$_nullObject, self::$_nullObject,
self::$_nullObject, self::$_nullObject, self::$_nullObject,
*
* @return mixed
*/
- static function alterSettingsMetaData(&$settingsMetaData, $domainID, $profile) {
+ public static function alterSettingsMetaData(&$settingsMetaData, $domainID, $profile) {
return self::singleton()->invoke(3, $settingsMetaData,
$domainID, $profile,
self::$_nullObject, self::$_nullObject, self::$_nullObject,
* @return null
* The return value is ignored
*/
- static function apiWrappers(&$wrappers, $apiRequest) {
+ public static function apiWrappers(&$wrappers, $apiRequest) {
return self::singleton()
->invoke(2, $wrappers, $apiRequest, self::$_nullObject, self::$_nullObject, self::$_nullObject,
self::$_nullObject, 'civicrm_apiWrappers'
* @return null
* The return value is ignored.
*/
- static function cron($jobManager) {
+ public static function cron($jobManager) {
return self::singleton()->invoke(1,
$jobManager, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_cron'
* @return null
* The return value is ignored
*/
- static function permission(&$permissions) {
+ public static function permission(&$permissions) {
return self::singleton()->invoke(1, $permissions,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_permission'
* @return null
* The return value is ignored
*/
- static function entityTypes(&$entityTypes) {
+ public static function entityTypes(&$entityTypes) {
return self::singleton()->invoke(1, $entityTypes, self::$_nullObject, self::$_nullObject,
self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_entityTypes'
);
* @param string $name
* @return mixed
*/
- static function buildProfile($name) {
+ public static function buildProfile($name) {
return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject,
self::$_nullObject, self::$_nullObject, 'civicrm_buildProfile');
}
* @param string $name
* @return mixed
*/
- static function validateProfile($name) {
+ public static function validateProfile($name) {
return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject,
self::$_nullObject, self::$_nullObject, 'civicrm_validateProfile');
}
* @param string $name
* @return mixed
*/
- static function processProfile($name) {
+ public static function processProfile($name) {
return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject,
self::$_nullObject, self::$_nullObject, 'civicrm_processProfile');
}
* @param string $name
* @return mixed
*/
- static function viewProfile($name) {
+ public static function viewProfile($name) {
return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject,
self::$_nullObject, self::$_nullObject, 'civicrm_viewProfile');
}
* @param string $name
* @return mixed
*/
- static function searchProfile($name) {
+ public static function searchProfile($name) {
return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject,
self::$_nullObject, self::$_nullObject, 'civicrm_searchProfile');
}
*
* @return null the return value is ignored
*/
- static function alterBadge($labelName, &$label, &$format, &$participant) {
+ public static function alterBadge($labelName, &$label, &$format, &$participant) {
return self::singleton()->invoke(4, $labelName, $label, $format, $participant, self::$_nullObject, self::$_nullObject, 'civicrm_alterBadge');
}
*
* @return mixed
*/
- static function alterBarcode( &$data, $type = 'barcode', $context = 'name_badge' ) {
+ public static function alterBarcode( &$data, $type = 'barcode', $context = 'name_badge' ) {
return self::singleton()->invoke(3, $data, $type, $context, self::$_nullObject,
self::$_nullObject, self::$_nullObject, 'civicrm_alterBarcode');
}
* @return mixed
* @see Mail::factory
*/
- static function alterMail(&$mailer, $driver, $params) {
+ public static function alterMail(&$mailer, $driver, $params) {
return self::singleton()
->invoke(3, $mailer, $driver, $params, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_alterMailer');
}
*
* @return mixed
*/
- static function queryObjects(&$queryObjects, $type = 'Contact') {
+ public static function queryObjects(&$queryObjects, $type = 'Contact') {
return self::singleton()->invoke(2, $queryObjects, $type, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_queryObjects');
}
*
* @return mixed
*/
- static function dashboard_defaults($availableDashlets, &$defaultDashlets) {
+ public static function dashboard_defaults($availableDashlets, &$defaultDashlets) {
return self::singleton()->invoke(2, $availableDashlets, $defaultDashlets, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_dashboard_defaults');
}
*
* @return void
*/
- static function pre_case_merge($mainContactId, $mainCaseId = NULL, $otherContactId = NULL, $otherCaseId = NULL, $changeClient = FALSE) {
+ public static function pre_case_merge($mainContactId, $mainCaseId = NULL, $otherContactId = NULL, $otherCaseId = NULL, $changeClient = FALSE) {
return self::singleton()->invoke(5, $mainContactId, $mainCaseId, $otherContactId, $otherCaseId, $changeClient, self::$_nullObject, 'civicrm_pre_case_merge');
}
*
* @return void
*/
- static function post_case_merge($mainContactId, $mainCaseId = NULL, $otherContactId = NULL, $otherCaseId = NULL, $changeClient = FALSE) {
+ public static function post_case_merge($mainContactId, $mainCaseId = NULL, $otherContactId = NULL, $otherCaseId = NULL, $changeClient = FALSE) {
return self::singleton()->invoke(5, $mainContactId, $mainCaseId, $otherContactId, $otherCaseId, $changeClient, self::$_nullObject, 'civicrm_post_case_merge');
}
*
* @return mixed
*/
- static function alterDisplayName($displayName, $contactId, $dao) {
+ public static function alterDisplayName($displayName, $contactId, $dao) {
return self::singleton()->invoke(3,
$displayName, $contactId, $dao, self::$_nullObject, self::$_nullObject,
self::$_nullObject, 'civicrm_contact_get_displayname'
* }
* @endcode
*/
- static function angularModules(&$angularModules) {
+ public static function angularModules(&$angularModules) {
return self::singleton()->invoke(1, $angularModules,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_angularModules'
*
* @param \Civi\CCase\Analyzer $analyzer
*/
- static function caseChange(\Civi\CCase\Analyzer $analyzer) {
+ public static function caseChange(\Civi\CCase\Analyzer $analyzer) {
$event = new \Civi\CCase\Event\CaseChangeEvent($analyzer);
\Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_caseChange", $event);
* Note: if making "url" CRM_Utils_System::url(), set $htmlize=false
* @return mixed
*/
- static function crudLink($spec, $bao, &$link) {
+ public static function crudLink($spec, $bao, &$link) {
return self::singleton()->invoke(3, $spec, $bao, $link,
self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_crudLink'
* @param array<CRM_Core_FileSearchInterface> $fileSearches
* @return mixed
*/
- static function fileSearches(&$fileSearches) {
+ public static function fileSearches(&$fileSearches) {
return self::singleton()->invoke(1, $fileSearches,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_fileSearches'
/**
* Build the list of modules to be processed for hooks.
*/
- function buildModuleList() {
+ public function buildModuleList() {
if ($this->isBuilt === FALSE) {
if ($this->drupalModules === NULL) {
if (function_exists('module_list')) {
protected $civiModules = NULL;
// Call this in CiviUnitTestCase::setUp()
- function reset() {
+ public function reset() {
$this->mockObject = NULL;
$this->adhocHooks = array();
}
* Use a unit-testing mock object to handle hook invocations
* e.g. hook_civicrm_foo === $mockObject->foo()
*/
- function setMock($mockObject) {
+ public function setMock($mockObject) {
$this->mockObject = $mockObject;
}
/**
* Register a piece of code to run when invoking a hook
*/
- function setHook($hook, $callable) {
+ public function setHook($hook, $callable) {
$this->adhocHooks[$hook] = $callable;
}
*
* Copied and adapted from: CRM/Utils/Hook/Drupal6.php
*/
- function buildModuleList() {
+ public function buildModuleList() {
if ($this->isBuilt === FALSE) {
if ($this->wordpressModules === NULL) {
* @return Escaped text
*
*/
- static function formatText($text) {
+ public static function formatText($text) {
$text = strip_tags($text);
$text = str_replace("\"", "DQUOTE", $text);
$text = str_replace("\\", "\\\\", $text);
*
* @return Escaped date
*/
- static function formatDate($date, $gdata = FALSE) {
+ public static function formatDate($date, $gdata = FALSE) {
if ($gdata) {
return date("Y-m-d\TH:i:s.000",
*
* @return void
*/
- static function send($calendar, $content_type = 'text/calendar', $charset = 'us-ascii', $fileName = NULL, $disposition = NULL) {
+ public static function send($calendar, $content_type = 'text/calendar', $charset = 'us-ascii', $fileName = NULL, $disposition = NULL) {
$config = CRM_Core_Config::singleton();
$lang = $config->lcMessages;
header("Content-Language: $lang");
* Output json to the client
* @param mixed $input
*/
- static function output($input) {
+ public static function output($input) {
header('Content-Type: application/json');
echo json_encode($input);
CRM_Utils_System::civiExit();
* @return string $jsonObject JSON array
* @static
*/
- static function encode($params, $identifier = 'id') {
+ public static function encode($params, $identifier = 'id') {
$buildObject = array();
foreach ($params as $value) {
$name = addslashes($value['name']);
*
* @return json encode string
*/
- static function encodeSelector(&$params, $page, $total, $selectorElements) {
+ public static function encodeSelector(&$params, $page, $total, $selectorElements) {
$json = "";
$json .= "{\n";
$json .= "page: $page,\n";
* @return string
*
*/
- static function encodeDataTableSelector($params, $sEcho, $iTotal, $iFilteredTotal, $selectorElements) {
+ public static function encodeDataTableSelector($params, $sEcho, $iTotal, $iFilteredTotal, $selectorElements) {
$sOutput = '{';
$sOutput .= '"sEcho": ' . intval($sEcho) . ', ';
$sOutput .= '"iTotalRecords": ' . $iTotal . ', ';
*
* @return boolean true if a mail was sent, else false
*/
- static function send(&$params) {
+ public static function send(&$params) {
$returnPath = CRM_Core_BAO_MailSettings::defaultReturnPath();
$includeMessageId = CRM_Core_BAO_MailSettings::includeMessageId();
$emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
*
* @return string
*/
- static function errorMessage($mailer, $result) {
+ 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')) . '</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>';
* @param $headers
* @param $message
*/
- static function logger(&$to, &$headers, &$message) {
+ public static function logger(&$to, &$headers, &$message) {
if (is_array($to)) {
$toString = implode(', ', $to);
$fileName = $to[0];
* @return string the plucked email address
* @static
*/
- static function pluckEmailFromHeader($header) {
+ public static function pluckEmailFromHeader($header) {
preg_match('/<([^<]*)>$/', $header, $matches);
if (isset($matches[1])) {
* @access public
* @static
*/
- static function validOutBoundMail() {
+ public static function validOutBoundMail() {
$mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
'mailing_backend'
);
*
* @return mixed
*/
- static function &setMimeParams(&$message, $params = NULL) {
+ public static function &setMimeParams(&$message, $params = NULL) {
static $mimeParams = NULL;
if (!$params) {
if (!$mimeParams) {
*
* @return null|string
*/
- static function formatRFC822Email($name, $email, $useQuote = FALSE) {
+ public static function formatRFC822Email($name, $email, $useQuote = FALSE) {
$result = NULL;
$name = trim($name);
*
* This code has been copied and adapted from ezc/Mail/src/tools.php
*/
- static function formatRFC2822Name($name) {
+ public static function formatRFC2822Name($name) {
$name = trim($name);
if (!empty($name)) {
// remove the quotes around the name part if they are already there
*
* @return array $attachments
*/
- static function appendPDF($fileName, $html, $format = NULL) {
+ public static function appendPDF($fileName, $html, $format = NULL) {
$pdf_filename = CRM_Core_Config::singleton()->templateCompileDir . CRM_Utils_File::makeFileName($fileName);
//FIXME : CRM-7894
* @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
*/
- static function processBounces() {
+ public static function processBounces() {
$dao = new CRM_Core_DAO_MailSettings;
$dao->domain_id = CRM_Core_Config::domainID();
$dao->is_default = TRUE;
*
* @return void
*/
- static function cleanupDir($dir, $age = 5184000) {
+ public static function cleanupDir($dir, $age = 5184000) {
// return early if we can’t read/write the dir
if (!is_writable($dir) or !is_readable($dir) or !is_dir($dir)) {
return;
*
* @return void
*/
- static function processActivities() {
+ public static function processActivities() {
$dao = new CRM_Core_DAO_MailSettings;
$dao->domain_id = CRM_Core_Config::domainID();
$dao->is_default = FALSE;
*
* @return void
*/
- static function process($civiMail = TRUE) {
+ public static function process($civiMail = TRUE) {
$dao = new CRM_Core_DAO_MailSettings;
$dao->domain_id = CRM_Core_Config::domainID();
$dao->find();
*
* @throws Exception
*/
- static function _process($civiMail, $dao) {
+ public static function _process($civiMail, $dao) {
// 0 = activities; 1 = bounce;
$usedfor = $dao->is_default;
*
* @return string
*/
- function formatMail($mail, &$attachments) {
+ public function formatMail($mail, &$attachments) {
$t = '';
$t .= "From: " . self::formatAddress($mail->from) . "\n";
$t .= "To: " . self::formatAddresses($mail->to) . "\n";
*
* @throws Exception
*/
- function formatMailMultipart($part, &$attachments) {
+ public function formatMailMultipart($part, &$attachments) {
if ($part instanceof ezcMailMultiPartAlternative) {
return self::formatMailMultipartAlternative($part, $attachments);
}
*
* @return string
*/
- function formatMailMultipartMixed($part, &$attachments) {
+ public function formatMailMultipartMixed($part, &$attachments) {
$t = '';
foreach ($part->getParts() as $key => $alternativePart) {
$t .= self::formatMailPart($alternativePart, $attachments);
*
* @return string
*/
- function formatMailMultipartRelated($part, &$attachments) {
+ public function formatMailMultipartRelated($part, &$attachments) {
$t = '';
$t .= "-RELATED MAIN PART-\n";
$t .= self::formatMailPart($part->getMainPart(), $attachments);
*
* @return string
*/
- function formatMailMultipartDigest($part, &$attachments) {
+ public function formatMailMultipartDigest($part, &$attachments) {
$t = '';
foreach ($part->getParts() as $key => $alternativePart) {
$t .= "-DIGEST-$key-\n";
*
* @return string
*/
- function formatMailRfc822Digest($part, &$attachments) {
+ public function formatMailRfc822Digest($part, &$attachments) {
$t = '';
$t .= "-DIGEST-ITEM-\n";
$t .= "Item:\n\n";
*
* @return string
*/
- function formatMailMultipartAlternative($part, &$attachments) {
+ public function formatMailMultipartAlternative($part, &$attachments) {
$t = '';
foreach ($part->getParts() as $key => $alternativePart) {
$t .= "-ALTERNATIVE ITEM $key-\n";
*
* @return string
*/
- function formatMailMultipartReport($part, &$attachments) {
+ public function formatMailMultipartReport($part, &$attachments) {
$t = '';
foreach ($part->getParts() as $key => $reportPart) {
$t .= "-REPORT-$key-\n";
*
* @return null
*/
- function formatMailFile($part, &$attachments) {
+ public function formatMailFile($part, &$attachments) {
$attachments[] = array(
'dispositionType' => $part->dispositionType,
'contentType' => $part->contentType,
*
* @return string
*/
- function formatAddresses($addresses) {
+ public function formatAddresses($addresses) {
$fa = array();
foreach ($addresses as $address) {
$fa[] = self::formatAddress($address);
*
* @return string
*/
- function formatAddress($address) {
+ public function formatAddress($address) {
$name = '';
if (!empty($address->name)) {
$name = "{$address->name} ";
* @return array
* @throws Exception
*/
- function &parse(&$file) {
+ public function &parse(&$file) {
// check that the file exists and has some content
if (!file_exists($file) ||
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_xml = array(
'customGroup' => array(
'data' => array(),
*
* @return void
*/
- function build() {
+ public function build() {
// fetch the option group / values for
// activity type and event_type
* @param array $customGroupIds list of custom groups to export
* @return void
*/
- function buildCustomGroups($customGroupIds) {
+ public function buildCustomGroups($customGroupIds) {
$customGroupIdsSql = implode(',', array_filter($customGroupIds, 'is_numeric'));
if (empty($customGroupIdsSql)) {
return;
* @param array $ufGroupIds list of custom groups to export
* @return void
*/
- function buildUFGroups($ufGroupIds) {
+ public function buildUFGroups($ufGroupIds) {
$ufGroupIdsSql = implode(',', array_filter($ufGroupIds, 'is_numeric'));
if (empty($ufGroupIdsSql)) {
return;
*
* @return string XML
*/
- function toXML() {
+ public function toXML() {
$buffer = '<?xml version="1.0" encoding="iso-8859-1" ?>';
$buffer .= "\n\n<CustomData>\n";
foreach (array_keys($this->_xml) as $key) {
*
* @return array
*/
- function toArray() {
+ public function toArray() {
$result = array();
foreach (array_keys($this->_xml) as $key) {
if (!empty($this->_xml[$key]['data'])) {
* @param string $daoName
* @param null $sql
*/
- function fetch($groupName, $daoName, $sql = NULL) {
+ public function fetch($groupName, $daoName, $sql = NULL) {
$idNameFields = isset($this->_xml[$groupName]['idNameFields']) ? $this->_xml[$groupName]['idNameFields'] : NULL;
$mappedFields = isset($this->_xml[$groupName]['mappedFields']) ? $this->_xml[$groupName]['mappedFields'] : NULL;
*
* @return array
*/
- function exportDAO($objectName, $object, $mappedFields) {
+ public function exportDAO($objectName, $object, $mappedFields) {
$dbFields = & $object->fields();
// Filter the list of keys and values so that we only export interesting stuff
* @throws Exception
* @return string XML
*/
- function renderTextTag($name, $value, $prefix = '') {
+ public function renderTextTag($name, $value, $prefix = '') {
if (!preg_match('/^[a-zA-Z0-9\_]+$/', $name)) {
throw new Exception("Malformed tag name: $name");
}
/**
* @param array $params
*/
- function __construct(&$params) {
+ public function __construct(&$params) {
foreach ($params as $name => $value) {
$varName = '_' . $name;
$this->$varName = $value;
/**
* Split a large array of contactIDs into more manageable smaller chunks
*/
- function &splitContactIDs(&$contactIDs) {
+ public function &splitContactIDs(&$contactIDs) {
// contactIDs could be a real large array, so we split it up into
// smaller chunks and then general xml for each chunk
$chunks = array();
/**
* Given a set of contact IDs get the values
*/
- function getValues(&$contactIDs, &$additionalContactIDs) {
+ public function getValues(&$contactIDs, &$additionalContactIDs) {
$this->contact($contactIDs);
$this->address($contactIDs);
$this->activity($contactIDs, $additionalContactIDs);
}
- function metaData() {
+ public function metaData() {
$optionGroupVars = array(
'prefix_id' => 'individual_prefix',
'suffix_id' => 'individual_suffix',
/**
* @param $tables
*/
- function auxTable($tables) {
+ public function auxTable($tables) {
foreach ($tables as $tableName => $daoName) {
$fields = & $this->dbFields($daoName, TRUE);
/**
* @param $optionGroupVars
*/
- function optionGroup($optionGroupVars) {
+ public function optionGroup($optionGroupVars) {
$names = array_values($optionGroupVars);
$str = array();
foreach ($names as $name) {
* @param string $tableName
* @param $fields
*/
- function sql($sql, $tableName, &$fields) {
+ public function sql($sql, $tableName, &$fields) {
$dao = & CRM_Core_DAO::executeQuery($sql);
while ($dao->fetch()) {
/**
* @param $contactIDs
*/
- function contact(&$contactIDs) {
+ public function contact(&$contactIDs) {
$fields = & $this->dbFields('CRM_Contact_DAO_Contact', TRUE);
$this->table($contactIDs, 'civicrm_contact', $fields, 'id', NULL);
}
/**
* @param $contactIDs
*/
- function note(&$contactIDs) {
+ public function note(&$contactIDs) {
$fields = & $this->dbFields('CRM_Core_DAO_Note', TRUE);
$this->table($contactIDs, 'civicrm_note', $fields, 'entity_id', "entity_table = 'civicrm_contact'");
}
/**
* @param $contactIDs
*/
- function phone(&$contactIDs) {
+ public function phone(&$contactIDs) {
$fields = & $this->dbFields('CRM_Core_DAO_Phone', TRUE);
$this->table($contactIDs, 'civicrm_phone', $fields, 'contact_id', NULL);
}
/**
* @param $contactIDs
*/
- function email(&$contactIDs) {
+ public function email(&$contactIDs) {
$fields = & $this->dbFields('CRM_Core_DAO_Email', TRUE);
$this->table($contactIDs, 'civicrm_email', $fields, 'contact_id', NULL);
}
/**
* @param $contactIDs
*/
- function im(&$contactIDs) {
+ public function im(&$contactIDs) {
$fields = & $this->dbFields('CRM_Core_DAO_IM', TRUE);
$this->table($contactIDs, 'civicrm_im', $fields, 'contact_id', NULL);
}
/**
* @param $contactIDs
*/
- function website(&$contactIDs) {
+ public function website(&$contactIDs) {
$fields = & $this->dbFields('CRM_Core_DAO_Website', TRUE);
$this->table($contactIDs, 'civicrm_website', $fields, 'contact_id', NULL);
}
/**
* @param $contactIDs
*/
- function address(&$contactIDs) {
+ public function address(&$contactIDs) {
$fields = & $this->dbFields('CRM_Core_DAO_Email', TRUE);
$this->table($contactIDs, 'civicrm_address', $fields, 'contact_id', NULL);
}
/**
* @param $contactIDs
*/
- function groupContact(&$contactIDs) {
+ public function groupContact(&$contactIDs) {
$fields = & $this->dbFields('CRM_Contact_DAO_GroupContact', TRUE);
$this->table($contactIDs, 'civicrm_group_contact', $fields, 'contact_id', NULL);
}
/**
* @param $contactIDs
*/
- function group(&$contactIDs) {
+ public function group(&$contactIDs) {
// handle groups only once
static $_groupsHandled = array();
/**
* @param $groupIDs
*/
- function savedSearch(&$groupIDs) {
+ public function savedSearch(&$groupIDs) {
if (empty($groupIDs)) {
return;
}
/**
* @param $contactIDs
*/
- function entityTag(&$contactIDs) {
+ public function entityTag(&$contactIDs) {
$fields = & $this->dbFields('CRM_Core_DAO_EntityTag', TRUE);
$this->table($contactIDs, 'civicrm_entity_tag', $fields, 'entity_id', "entity_table = 'civicrm_contact'");
}
/**
* @param $contactIDs
*/
- function tag(&$contactIDs) {
+ public function tag(&$contactIDs) {
// handle tags only once
static $_tagsHandled = array();
* @param $contactIDs
* @param $additionalContacts
*/
- function relationship(&$contactIDs, &$additionalContacts) {
+ public function relationship(&$contactIDs, &$additionalContacts) {
// handle relationships only once
static $_relationshipsHandled = array();
* @param $contactIDs
* @param $additionalContacts
*/
- function activity(&$contactIDs, &$additionalContacts) {
+ public function activity(&$contactIDs, &$additionalContacts) {
static $_activitiesHandled = array();
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
* @param string $name
* @param $value
*/
- function appendValue($id, $name, $value) {
+ public function appendValue($id, $name, $value) {
if (empty($value)) {
return;
}
*
* @return array
*/
- function dbFields($daoName, $onlyKeys = FALSE) {
+ public function dbFields($daoName, $onlyKeys = FALSE) {
static $_fieldsRetrieved = array();
if (!isset($_fieldsRetrieved[$daoName])) {
* @param $contactIDs
* @param $additionalContacts
*/
- function addAdditionalContacts($contactIDs, &$additionalContacts) {
+ public function addAdditionalContacts($contactIDs, &$additionalContacts) {
if (!$this->_discoverContacts) {
return;
}
/**
* @param $contactIDs
*/
- function export(&$contactIDs) {
+ public function export(&$contactIDs) {
$chunks = & $this->splitContactIDs($contactIDs);
$additionalContactIDs = array();
/**
*
*/
- function __construct() {
+ public function __construct() {
}
/**
* @throws CRM_Core_Exception
* @return void;
*/
- function run($file) {
+ public function run($file) {
// read xml file
$dom = new DomDocument();
if (! $dom->load($file)) {
* @param SimpleXMLElement $xml
* @return void
*/
- function runXmlElement($xml) {
+ public function runXmlElement($xml) {
$idMap = array(
'custom_group' => array(),
'option_group' => array(),
*
* @return bool
*/
- function copyData(&$dao, &$xml, $save = FALSE, $keyName = NULL) {
+ public function copyData(&$dao, &$xml, $save = FALSE, $keyName = NULL) {
if ($keyName) {
if (isset($xml->$keyName)) {
$dao->$keyName = (string ) $xml->$keyName;
* @param $xml
* @param $idMap
*/
- function optionGroups(&$xml, &$idMap) {
+ public function optionGroups(&$xml, &$idMap) {
foreach ($xml->OptionGroups as $optionGroupsXML) {
foreach ($optionGroupsXML->OptionGroup as $optionGroupXML) {
$optionGroup = new CRM_Core_DAO_OptionGroup();
* @param $xml
* @param $idMap
*/
- function optionValues(&$xml, &$idMap) {
+ public function optionValues(&$xml, &$idMap) {
foreach ($xml->OptionValues as $optionValuesXML) {
foreach ($optionValuesXML->OptionValue as $optionValueXML) {
$optionValue = new CRM_Core_DAO_OptionValue();
/**
* @param $xml
*/
- function relationshipTypes(&$xml) {
+ public function relationshipTypes(&$xml) {
foreach ($xml->RelationshipTypes as $relationshipTypesXML) {
foreach ($relationshipTypesXML->RelationshipType as $relationshipTypeXML) {
/**
* @param $xml
*/
- function contributionTypes(&$xml) {
+ public function contributionTypes(&$xml) {
foreach ($xml->ContributionTypes as $contributionTypesXML) {
foreach ($contributionTypesXML->ContributionType as $contributionTypeXML) {
* @param $xml
* @param $idMap
*/
- function customGroups(&$xml, &$idMap) {
+ public function customGroups(&$xml, &$idMap) {
foreach ($xml->CustomGroups as $customGroupsXML) {
foreach ($customGroupsXML->CustomGroup as $customGroupXML) {
$customGroup = new CRM_Core_DAO_CustomGroup();
* @param $xml
* @param $idMap
*/
- function customFields(&$xml, &$idMap) {
+ public function customFields(&$xml, &$idMap) {
// Re-index by group id so we can build out the custom fields one table
// at a time, and then rebuild the table triggers at the end, rather than
// rebuilding the table triggers after each field is added (which is
* @param $xml
* @param $idMap
*/
- function dbTemplateString(&$xml, &$idMap) {
+ public function dbTemplateString(&$xml, &$idMap) {
foreach ($xml->Persistent as $persistentXML) {
foreach ($persistentXML->Persistent as $persistent) {
$persistentObj = new CRM_Core_DAO_Persistent();
* @param $xml
* @param $idMap
*/
- function profileGroups(&$xml, &$idMap) {
+ public function profileGroups(&$xml, &$idMap) {
foreach ($xml->ProfileGroups as $profileGroupsXML) {
foreach ($profileGroupsXML->ProfileGroup as $profileGroupXML) {
$profileGroup = new CRM_Core_DAO_UFGroup();
*
* @throws Exception
*/
- function profileFields(&$xml, &$idMap) {
+ public function profileFields(&$xml, &$idMap) {
foreach ($xml->ProfileFields as $profileFieldsXML) {
foreach ($profileFieldsXML->ProfileField as $profileFieldXML) {
$profileField = new CRM_Core_DAO_UFField();
* @param $xml
* @param $idMap
*/
- function profileJoins(&$xml, &$idMap) {
+ public function profileJoins(&$xml, &$idMap) {
foreach ($xml->ProfileJoins as $profileJoinsXML) {
foreach ($profileJoinsXML->ProfileJoin as $profileJoinXML) {
$profileJoin = new CRM_Core_DAO_UFJoin();
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->_lookupCache = array();
$this->_saveMapping = array();
}
/**
* @param $file
*/
- function run($file) {
+ public function run($file) {
$json = file_get_contents($file);
$decodedContacts = json_decode($json);
/**
* @param $contact
*/
- function contact(&$contact) {
+ public function contact(&$contact) {
$this->restore($contact,
'CRM_Contact_DAO_Contact',
array('id' => 'civicrm_contact'),
/**
* @param $email
*/
- function email(&$email) {
+ public function email(&$email) {
$this->restore($email,
'CRM_Core_DAO_Email',
array('contact_id' => 'civicrm_contact')
/**
* @param $phone
*/
- function phone(&$phone) {
+ public function phone(&$phone) {
$this->restore($phone,
'CRM_Core_DAO_Phone',
array('contact_id' => 'civicrm_contact')
/**
* @param $address
*/
- function address(&$address) {
+ public function address(&$address) {
$this->restore($address,
'CRM_Core_DAO_Address',
array('contact_id' => 'civicrm_contact')
/**
* @param $note
*/
- function note(&$note) {
+ public function note(&$note) {
$this->restore($note,
'CRM_Core_DAO_Note',
array('contact_id' => 'civicrm_contact'),
/**
* @param $relationship
*/
- function relationship(&$relationship) {
+ public function relationship(&$relationship) {
$this->restore($relationship,
'CRM_Contact_DAO_Relationship',
array(
* @param $activity
* @param $activityContacts
*/
- function activity($activity, $activityContacts) {
+ public function activity($activity, $activityContacts) {
$this->restore($activity,
'CRM_Activity_DAO_Activity',
NULL,
* @param $group
* @param $groupContact
*/
- function group($group, $groupContact) {
+ public function group($group, $groupContact) {
$this->restore($group,
'CRM_Contact_DAO_Group',
NULL,
* @param $tag
* @param $entityTag
*/
- function tag($tag, $entityTag) {
+ public function tag($tag, $entityTag) {
$this->restore($tag,
'CRM_Core_DAO_Tag',
array(
* @param null $lookUpMapping
* @param null $dateFields
*/
- function restore(&$chunk, $daoName, $lookUpMapping = NULL, $dateFields = NULL) {
+ public function restore(&$chunk, $daoName, $lookUpMapping = NULL, $dateFields = NULL) {
$object = new $daoName();
$tableName = $object->__table;
}
}
- function saveCache() {
+ public function saveCache() {
$sql = "INSERT INTO civicrm_migration_mapping (master_id, slave_id, entity_table ) VALUES ";
foreach ($this->_lookupCache as $tableName => & $values) {
/**
* @param string $tableName
*/
- function populateCache($tableName) {
+ public function populateCache($tableName) {
if (isset($this->_lookupCache[$tableName])) {
return;
}
*
* @static
*/
- static function format($amount, $currency = NULL, $format = NULL, $onlyNumber = FALSE, $valueFormat = NULL) {
+ public static function format($amount, $currency = NULL, $format = NULL, $onlyNumber = FALSE, $valueFormat = NULL) {
if (CRM_Utils_System::isNull($amount)) {
return '';
* @return float
* @link https://dev.mysql.com/doc/refman/5.1/en/fixed-point-types.html
*/
- static function createRandomDecimal($precision) {
+ public static function createRandomDecimal($precision) {
list ($sigFigs, $decFigs) = $precision;
$rand = rand(0, pow(10, $sigFigs) - 1);
return $rand / pow(10, $decFigs);
* @return float
* @link https://dev.mysql.com/doc/refman/5.1/en/fixed-point-types.html
*/
- static function createTruncatedDecimal($keyValue, $precision) {
+ public static function createTruncatedDecimal($keyValue, $precision) {
list ($sigFigs, $decFigs) = $precision;
$sign = ($keyValue < 0) ? '-1' : 1;
$val = str_replace('.', '', abs($keyValue)); // ex: -123.456 ==> 123456
* @return object $chart object of open flash chart.
* @static
*/
- static function &barChart(&$params) {
+ public static function &barChart(&$params) {
$chart = NULL;
if (empty($params)) {
return $chart;
* @return object $chart object of open flash chart.
* @static
*/
- static function &pieChart(&$params) {
+ public static function &pieChart(&$params) {
$chart = NULL;
if (empty($params)) {
return $chart;
* @return object $chart object of open flash chart.
* @static
*/
- static function &bar_3dChart(&$params) {
+ public static function &bar_3dChart(&$params) {
$chart = NULL;
if (empty($params)) {
return $chart;
*
* @return array
*/
- static function chart($rows, $chart, $interval) {
+ public static function chart($rows, $chart, $interval) {
$chartData = $dateKeys = array();
switch ($interval) {
*
* @return array
*/
- static function reportChart($rows, $chart, $interval, &$chartInfo) {
+ public static function reportChart($rows, $chart, $interval, &$chartInfo) {
foreach ($interval as $key => $val) {
$graph[$val] = $rows['value'][$key];
}
*
* @return array
*/
- static function buildChart(&$params, $chart) {
+ public static function buildChart(&$params, $chart) {
$openFlashChart = array();
if ($chart && is_array($params) && !empty($params)) {
// build the chart objects.
*
* @access public
*/
- function __construct($format, $unit = 'mm') {
+ public function __construct($format, $unit = 'mm') {
if (is_array($format)) {
// Custom format
$tFormat = $format;
* @param $objectinstance
* @param string $methodname
*/
- function SetGenerator($objectinstance, $methodname = 'generateLabel') {
+ public function SetGenerator($objectinstance, $methodname = 'generateLabel') {
$this->generatorMethod = $methodname;
$this->generatorObject = $objectinstance;
}
*
* @return float|int|mixed
*/
- function getFormatValue($name, $convert = FALSE) {
+ public function getFormatValue($name, $convert = FALSE) {
if (isset($this->format[$name])) {
$value = $this->format[$name];
$metric = $this->format['metric'];
* @param $format
* @param $unit
*/
- function LabelSetFormat(&$format, $unit) {
+ public function LabelSetFormat(&$format, $unit) {
$this->defaults = CRM_Core_BAO_LabelFormat::getDefaultValues();
$this->format = &$format;
$this->formatName = $this->getFormatValue('name');
/**
* @param $text
*/
- function generateLabel($text) {
+ public function generateLabel($text) {
$args = array(
'w' => $this->width,
'h' => 0,
/**
* @param $texte
*/
- function AddPdfLabel($texte) {
+ public function AddPdfLabel($texte) {
if ($this->countX == $this->xNumber) {
// Page full, we start a new one
$this->AddPage();
}
}
- function getFontNames() {
+ public function getFontNames() {
// Define labels for TCPDF core fonts
$fontLabel = array(
'courier' => ts('Courier'),
*
* @return string|void
*/
- static function html2pdf(&$text, $fileName = 'civicrm.pdf', $output = FALSE, $pdfFormat = NULL) {
+ public static function html2pdf(&$text, $fileName = 'civicrm.pdf', $output = FALSE, $pdfFormat = NULL) {
if (is_array($text)) {
$pages = &$text;
}
}
}
- static function _html2pdf_tcpdf($paper_size, $orientation, $margins, $html, $output, $fileName, $stationery_path) {
+ public static function _html2pdf_tcpdf($paper_size, $orientation, $margins, $html, $output, $fileName, $stationery_path) {
// Documentation on the TCPDF library can be found at: http://www.tcpdf.org
// This function also uses the FPDI library documented at: http://www.setasign.com/products/fpdi/about/
// Syntax borrowed from https://github.com/jake-mw/CDNTaxReceipts/blob/master/cdntaxreceipts.functions.inc
*
* @return string
*/
- static function _html2pdf_dompdf($paper_size, $orientation, $html, $output, $fileName) {
+ public static function _html2pdf_dompdf($paper_size, $orientation, $html, $output, $fileName) {
require_once 'packages/dompdf/dompdf_config.inc.php';
spl_autoload_register('DOMPDF_autoload');
$dompdf = new DOMPDF();
* @param $output
* @param string $fileName
*/
- static function _html2pdf_wkhtmltopdf($paper_size, $orientation, $margins, $html, $output, $fileName) {
+ public static function _html2pdf_wkhtmltopdf($paper_size, $orientation, $margins, $html, $output, $fileName) {
require_once 'packages/snappy/src/autoload.php';
$config = CRM_Core_Config::singleton();
$snappy = new Knp\Snappy\Pdf($config->wkhtmltopdfPath);
*
* @return float|int
*/
- static function convertMetric($value, $from, $to, $precision = NULL) {
+ public static function convertMetric($value, $from, $to, $precision = NULL) {
switch ($from . $to) {
case 'incm':
$value *= 2.54;
*
* @return \CRM_Utils_Pager the newly created and initialized pager object@access public
*/
- function __construct($params) {
+ public function __construct($params) {
if ($params['status'] === NULL) {
$params['status'] = ts('Contacts %%StatusMessage%%');
}
* @return void
*
*/
- function initialize(&$params) {
+ public function initialize(&$params) {
/* set the mode for the pager to Sliding */
$params['mode'] = 'Sliding';
* @return int new pageId to display to the user
* @access public
*/
- function getPageID($defaultPageId = 1, &$params) {
+ public function getPageID($defaultPageId = 1, &$params) {
// POST has higher priority than GET vars
// else if a value is set that has higher priority and finally the GET var
$currentPage = $defaultPageId;
* @access public
*
*/
- function getPageRowCount($defaultPageRowCount = self::ROWCOUNT) {
+ public function getPageRowCount($defaultPageRowCount = self::ROWCOUNT) {
// POST has higher priority than GET vars
if (isset($_POST[self::PAGE_ROWCOUNT])) {
$rowCount = max((int )@$_POST[self::PAGE_ROWCOUNT], 1);
* @access public
*
*/
- function getOffsetAndRowCount() {
+ public function getOffsetAndRowCount() {
$pageId = $this->getCurrentPageID();
if (!$pageId) {
$pageId = 1;
/**
* @return string
*/
- function getCurrentLocation() {
+ public function getCurrentLocation() {
$config = CRM_Core_Config::singleton();
$path = CRM_Utils_Array::value($config->userFrameworkURLVar, $_GET);
return CRM_Utils_System::url($path, CRM_Utils_System::getLinksUrl(self::PAGE_ID, FALSE, TRUE), FALSE, NULL, FALSE) . $this->getCurrentPageID();
/**
* @return string
*/
- function getFirstPageLink() {
+ public function getFirstPageLink() {
if ($this->isFirstPage()) {
return '';
}
/**
* @return string
*/
- function getLastPageLink() {
+ public function getLastPageLink() {
if ($this->isLastPage()) {
return '';
}
/**
* @return string
*/
- function getBackPageLink() {
+ public function getBackPageLink() {
if ($this->_currentPage > 1) {
$href = $this->makeURL(self::PAGE_ID, $this->getPreviousPageID());
return $this->formatLink($href, $this->_altPrev, $this->_prevImg) . $this->_spacesBefore . $this->_spacesAfter;
/**
* @return string
*/
- function getNextPageLink() {
+ public function getNextPageLink() {
if ($this->_currentPage < $this->_totalPages) {
$href = $this->makeURL(self::PAGE_ID, $this->getNextPageID());
return $this->_spacesAfter .
/**
* Build a url for pager links
*/
- function makeURL($key, $value) {
+ public function makeURL($key, $value) {
$href = CRM_Utils_System::makeURL($key, TRUE);
// CRM-12212 Remove alpha sort param
if (strpos($href, '&sortByCharacter=')) {
* @access public
* @static
*/
- static function getAToZBar(&$query, $sortByCharacter, $isDAO = FALSE) {
+ public static function getAToZBar(&$query, $sortByCharacter, $isDAO = FALSE) {
$AToZBar = self::createLinks($query, $sortByCharacter, $isDAO);
return $AToZBar;
}
* @access private
* @static
*/
- static function getStaticCharacters() {
+ public static function getStaticCharacters() {
$staticAlphabets = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
return $staticAlphabets;
}
* @access private
* @static
*/
- static function getDynamicCharacters(&$query, $isDAO) {
+ public static function getDynamicCharacters(&$query, $isDAO) {
if ($isDAO) {
$result = $query;
}
* @access private
* @static
*/
- static function createLinks(&$query, $sortByCharacter, $isDAO) {
+ public static function createLinks(&$query, $sortByCharacter, $isDAO) {
$AToZBar = self::getStaticCharacters();
$dynamicAlphabets = self::getDynamicCharacters($query, $isDAO);
/**
* @param string $mode eg MODE_NONE
*/
- function __construct($mode) {
+ public function __construct($mode) {
$this->mode = $mode;
}
*
* @return array
*/
- static function error($message = 'Unknown Error') {
+ public static function error($message = 'Unknown Error') {
$values = array(
'error_message' => $message,
'is_error' => 1,
*
* @return array
*/
- static function simple($params) {
+ public static function simple($params) {
$values = array('is_error' => 0);
$values += $params;
return $values;
/**
* @return string
*/
- function run() {
+ public function run() {
$result = self::handle();
return self::output($result);
}
/**
* @return string
*/
- function bootAndRun() {
+ public function bootAndRun() {
$response = $this->loadCMSBootstrap();
if (is_array($response)) {
return self::output($response);
*
* @return string
*/
- static function output(&$result) {
+ public static function output(&$result) {
$requestParams = CRM_Utils_Request::exportValues();
$hier = FALSE;
*
* @return string
*/
- static function jsonFormated($json) {
+ public static function jsonFormated($json) {
$tabcount = 0;
$result = '';
$inquote = FALSE;
/**
* @return array|int
*/
- static function handle() {
+ public static function handle() {
$requestParams = CRM_Utils_Request::exportValues();
// Get the function name being called from the q parameter in the query string
*
* @return array|int
*/
- static function process(&$args, $params) {
+ public static function process(&$args, $params) {
$params['check_permissions'] = TRUE;
$fnName = $apiFile = NULL;
// clean up all function / class names. they should be alphanumeric and _ only
/**
* @return array|mixed|null
*/
- static function &buildParamList() {
+ public static function &buildParamList() {
$requestParams = CRM_Utils_Request::exportValues();
$params = array();
/**
* @param $pearError
*/
- static function fatal($pearError) {
+ public static function fatal($pearError) {
header('Content-Type: text/xml');
$error = array();
$error['code'] = $pearError->getCode();
CRM_Utils_System::civiExit();
}
- static function APIDoc() {
+ public static function APIDoc() {
CRM_Utils_System::setTitle("API Parameters");
$template = CRM_Core_Smarty::singleton();
);
}
- static function ajaxDoc() {
+ public static function ajaxDoc() {
return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/api/explorer'));
}
* 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)
**/
- static function ajaxJson() {
+ public static function ajaxJson() {
$requestParams = CRM_Utils_Request::exportValues();
require_once 'api/v3/utils.php';
CRM_Utils_System::civiExit();
}
- static function ajax() {
+ public static function ajax() {
$requestParams = CRM_Utils_Request::exportValues();
// this is driven by the menu system, so we can use permissioning to
* Callback for multiple ajax api calls from CRM.api3()
* @return array
*/
- static function processMultiple() {
+ public static function processMultiple() {
$output = array();
foreach (json_decode($_REQUEST['json'], TRUE) as $key => $call) {
$args = array(
/**
* @return array|NULL NULL if execution should proceed; array if the response is already known
*/
- function loadCMSBootstrap() {
+ public function loadCMSBootstrap() {
$requestParams = CRM_Utils_Request::exportValues();
$q = CRM_Utils_array::value('q', $requestParams);
$args = explode('/', $q);
* @static
*
*/
- static function &singleton() {
+ public static function &singleton() {
if (self::$_singleton === NULL) {
self::$_singleton = new CRM_Utils_ReCAPTCHA();
}
/**
*
*/
- function __construct() {}
+ public function __construct() {}
/**
* Add element to form
*
*/
- static function add(&$form) {
+ public static function add(&$form) {
$error = NULL;
$config = CRM_Core_Config::singleton();
$useSSL = FALSE;
*
* @return mixed
*/
- static function validate($value, $form) {
+ public static function validate($value, $form) {
$config = CRM_Core_Config::singleton();
$resp = recaptcha_check_answer($config->recaptchaPrivateKey,
* @access public
* @static
*/
- static function initialize() {
+ public static function initialize() {
if (!self::$_recent) {
$session = CRM_Core_Session::singleton();
self::$_recent = $session->get(self::STORE_NAME);
* @access public
* @static
*/
- static function &get() {
+ public static function &get() {
self::initialize();
return self::$_recent;
}
* @access public
* @static
*/
- static function del($recentItem) {
+ public static function del($recentItem) {
self::initialize();
$tempRecent = self::$_recent;
* @access public
* @static
*/
- static function delContact($id) {
+ public static function delContact($id) {
self::initialize();
$tempRecent = self::$_recent;
/**
* Class constructor
*/
- function __construct() {}
+ public function __construct() {}
/**
* Retrieve a value from the request (GET/POST/REQUEST)
* @access public
* @static
*/
- static function retrieve($name, $type, &$store = NULL, $abort = FALSE, $default = NULL, $method = 'REQUEST') {
+ public static function retrieve($name, $type, &$store = NULL, $abort = FALSE, $default = NULL, $method = 'REQUEST') {
// hack to detect stuff not yet converted to new style
if (!is_string($type)) {
*
* @return array
*/
- static function exportValues() {
+ public static function exportValues() {
// For more discussion of default $_REQUEST handling, see:
// http://www.php.net/manual/en/reserved.variables.request.php
// http://www.php.net/manual/en/ini.core.php#ini.request-order
*
* @return bool
*/
- static function title($str, $maxLength = 127) {
+ public static function title($str, $maxLength = 127) {
// check length etc
if (empty($str) || strlen($str) > $maxLength) {
*
* @return bool
*/
- static function longTitle($str) {
+ public static function longTitle($str) {
return self::title($str, 255);
}
*
* @return bool
*/
- static function variable($str) {
+ public static function variable($str) {
// check length etc
if (empty($str) || strlen($str) > 31) {
return FALSE;
*
* @return bool
*/
- static function qfVariable($str) {
+ public static function qfVariable($str) {
// check length etc
//if ( empty( $str ) || strlen( $str ) > 31 ) {
if (strlen(trim($str)) == 0 || strlen($str) > 31) {
*
* @return bool
*/
- static function phone($phone) {
+ public static function phone($phone) {
// check length etc
if (empty($phone) || strlen($phone) > 16) {
return FALSE;
*
* @return bool
*/
- static function query($query) {
+ public static function query($query) {
// check length etc
if (empty($query) || strlen($query) < 3 || strlen($query) > 127) {
return FALSE;
*
* @return bool
*/
- static function url($url) {
+ public static function url($url) {
if (preg_match('/^\//', $url)) {
// allow relative URL's (CRM-15598)
$url = 'http://' . $_SERVER['HTTP_HOST'] . $url;
*
* @return bool
*/
- static function wikiURL($string) {
+ public static function wikiURL($string) {
$items = explode(' ', trim($string), 2);
return self::url($items[0]);
}
*
* @return bool
*/
- static function domain($domain) {
+ public static function domain($domain) {
// not perfect, but better than the previous one; see CRM-1502
if (!preg_match('/^[A-Za-z0-9]([A-Za-z0-9\.\-]*[A-Za-z0-9])?$/', $domain)) {
return FALSE;
*
* @return null
*/
- static function date($value, $default = NULL) {
+ public static function date($value, $default = NULL) {
if (is_string($value) &&
preg_match('/^\d\d\d\d-?\d\d-?\d\d$/', $value)
) {
*
* @return null|string
*/
- static function dateTime($value, $default = NULL) {
+ public static function dateTime($value, $default = NULL) {
$result = $default;
if (is_string($value) &&
preg_match('/^\d\d\d\d-?\d\d-?\d\d(\s\d\d:\d\d(:\d\d)?|\d\d\d\d(\d\d)?)?$/', $value)
* @static
* @access public
*/
- static function currentDate($date, $monthRequired = TRUE) {
+ public static function currentDate($date, $monthRequired = TRUE) {
$config = CRM_Core_Config::singleton();
$d = CRM_Utils_Array::value('d', $date);
* @static
* @access public
*/
- static function mysqlDate($date) {
+ public static function mysqlDate($date) {
// allow date to be null
if ($date == NULL) {
return TRUE;
*
* @return bool
*/
- static function integer($value) {
+ public static function integer($value) {
if (is_int($value)) {
return TRUE;
}
*
* @return bool
*/
- static function positiveInteger($value) {
+ public static function positiveInteger($value) {
if (is_int($value)) {
return ($value < 0) ? FALSE : TRUE;
}
*
* @return bool
*/
- static function numeric($value) {
+ public static function numeric($value) {
// lets use a php gatekeeper to ensure this is numeric
if (!is_numeric($value)) {
return FALSE;
*
* @return bool
*/
- static function numberOfDigit($value, $noOfDigit) {
+ public static function numberOfDigit($value, $noOfDigit) {
return preg_match('/^\d{' . $noOfDigit . '}$/', $value) ? TRUE : FALSE;
}
*
* @return mixed
*/
- static function cleanMoney($value) {
+ public static function cleanMoney($value) {
// first remove all white space
$value = str_replace(array(' ', "\t", "\n"), '', $value);
*
* @return bool
*/
- static function money($value) {
+ public static function money($value) {
$config = CRM_Core_Config::singleton();
//only edge case when we have a decimal point in the input money
*
* @return bool
*/
- static function string($value, $maxLength = 0) {
+ public static function string($value, $maxLength = 0) {
if (is_string($value) &&
($maxLength === 0 || strlen($value) <= $maxLength)
) {
*
* @return bool
*/
- static function boolean($value) {
+ public static function boolean($value) {
return preg_match(
'/(^(1|0)$)|(^(Y(es)?|N(o)?)$)|(^(T(rue)?|F(alse)?)$)/i', $value
) ? TRUE : FALSE;
*
* @return bool
*/
- static function email($value) {
+ public static function email($value) {
return (bool) filter_var($value, FILTER_VALIDATE_EMAIL);
}
*
* @return bool
*/
- static function emailList($list) {
+ public static function emailList($list) {
$emails = explode(',', $list);
foreach ($emails as $email) {
$email = trim($email);
*
* @return bool
*/
- static function postalCode($value) {
+ public static function postalCode($value) {
if (preg_match('/^\d{4,6}(-\d{4})?$/', $value)) {
return TRUE;
}
*
* @return bool true if file has been uploaded, false otherwise
*/
- static function asciiFile($elementValue) {
+ public static function asciiFile($elementValue) {
if ((isset($elementValue['error']) && $elementValue['error'] == 0) ||
(!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')
) {
*
* @return bool whether file has been uploaded properly and is now in UTF-8
*/
- static function utf8File($elementValue) {
+ public static function utf8File($elementValue) {
$success = FALSE;
if ((isset($elementValue['error']) && $elementValue['error'] == 0) ||
*
* @return bool true if file has been uploaded, false otherwise
*/
- static function htmlFile($elementValue) {
+ public static function htmlFile($elementValue) {
if ((isset($elementValue['error']) && $elementValue['error'] == 0) ||
(!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')
) {
* @access public
* @static
*/
- static function objectExists($value, $options) {
+ public static function objectExists($value, $options) {
$name = 'name';
if (isset($options[2])) {
$name = $options[2];
*
* @return bool
*/
- static function optionExists($value, $options) {
+ public static function optionExists($value, $options) {
return CRM_Core_OptionValue::optionExists($value, $options[0], $options[1], $options[2], CRM_Utils_Array::value(3, $options, 'name'));
}
*
* @return bool
*/
- static function creditCardNumber($value, $type) {
+ public static function creditCardNumber($value, $type) {
require_once 'Validate/Finance/CreditCard.php';
return Validate_Finance_CreditCard::number($value, $type);
}
*
* @return bool
*/
- static function cvv($value, $type) {
+ public static function cvv($value, $type) {
require_once 'Validate/Finance/CreditCard.php';
return Validate_Finance_CreditCard::cvv($value, $type);
*
* @return bool
*/
- static function currencyCode($value) {
+ public static function currencyCode($value) {
static $currencyCodes = NULL;
if (!$currencyCodes) {
$currencyCodes = CRM_Core_PseudoConstant::currencyCode();
*
* @return bool
*/
- static function xssString($value) {
+ public static function xssString($value) {
if (is_string($value)) {
return preg_match('!<(vb)?script[^>]*>.*</(vb)?script.*>!ims',
$value
*
* @return bool
*/
- static function fileExists($path) {
+ public static function fileExists($path) {
return file_exists($path);
}
*
* @return bool
*/
- static function autocomplete($value, $options) {
+ public static function autocomplete($value, $options) {
if ($value) {
$selectOption = CRM_Core_BAO_CustomOption::valuesByID($options['fieldID'], $options['optionGroupID']);
*
* @return bool
*/
- static function validContact($value, $actualElementValue = NULL) {
+ public static function validContact($value, $actualElementValue = NULL) {
if ($actualElementValue) {
$value = $actualElementValue;
}
* @static
* @access public
*/
- static function qfDate($date) {
+ public static function qfDate($date) {
$config = CRM_Core_Config::singleton();
$d = CRM_Utils_Array::value('d', $date);
*
* @return bool
*/
- static function qfKey($key) {
+ public static function qfKey($key) {
return ($key) ? CRM_Core_Key::valid($key) : FALSE;
}
}
* @param $secret string, private
* @param $paramNames array, fields which should be part of the signature
*/
- function __construct($secret, $paramNames) {
+ public function __construct($secret, $paramNames) {
sort($paramNames); // ensure consistent serialization of payloads
$this->secret = $secret;
$this->paramNames = $paramNames;
* @param $salt string, the salt (if known) or NULL (for auto-generated)
* @return string, the full public token representing the signature
*/
- function sign($params, $salt = NULL) {
+ public function sign($params, $salt = NULL) {
$message = array();
$message['secret'] = $this->secret;
$message['payload'] = array();
* @throws Exception
* @return bool, TRUE iff all $paramNames for the submitted validate($params) and the original sign($params)
*/
- function validate($token, $params) {
+ public function validate($token, $params) {
list ($salt, $signature) = explode($this->signDelim, $token);
if (strlen($salt) != self::SALT_LEN) {
throw new Exception("Invalid salt [$token]=[$salt][$signature]");
/**
* @return string
*/
- function createSalt() {
+ public function createSalt() {
// It would be more secure to generate a new value but liable to run this
// many times on certain admin pages; so instead we'll re-use the hash.
return $this->defaultSalt;
* @return \CRM_Utils_Sort
@access public
*/
- function __construct(&$vars, $defaultSortOrder = NULL) {
+ public function __construct(&$vars, $defaultSortOrder = NULL) {
$this->_vars = array();
$this->_response = array();
* @return string the order by clause
* @access public
*/
- function orderBy() {
+ public function orderBy() {
if (empty($this->_vars[$this->_currentSortID])) {
return '';
}
* @static
* @access public
*/
- static function sortIDValue($index, $dir) {
+ public static function sortIDValue($index, $dir) {
return ($dir == self::DESCENDING) ? $index . '_d' : $index . '_u';
}
* @return returns null if $url- (sort url) is not found
* @access public
*/
- function initSortID($defaultSortOrder) {
+ public function initSortID($defaultSortOrder) {
$url = CRM_Utils_Array::value(self::SORT_ID, $_GET, $defaultSortOrder);
if (empty($url)) {
* @return void
* @access public
*/
- function initialize($defaultSortOrder) {
+ public function initialize($defaultSortOrder) {
$this->initSortID($defaultSortOrder);
$this->_response = array();
* @return int returns of the current sort id
* @acccess public
*/
- function getCurrentSortID() {
+ public function getCurrentSortID() {
return $this->_currentSortID;
}
* @return int returns of the current sort direction
* @acccess public
*/
- function getCurrentSortDirection() {
+ public function getCurrentSortDirection() {
return $this->_currentSortDirection;
}
* @return int (-1 or 1)
* @access public
*/
- static function cmpFunc($a, $b) {
+ public static function cmpFunc($a, $b) {
$cmp_order = array('weight', 'id', 'title', 'name');
foreach ($cmp_order as $attribute) {
if (isset($a[$attribute]) && isset($b[$attribute])) {
* @return string (or null)
* @static
*/
- static function titleToVar($title, $maxLength = 31) {
+ public static function titleToVar($title, $maxLength = 31) {
$variable = self::munge($title, '_', $maxLength);
if (CRM_Utils_Rule::title($variable, $maxLength)) {
* @return string returns the manipulated string
* @static
*/
- static function munge($name, $char = '_', $len = 63) {
+ public static function munge($name, $char = '_', $len = 63) {
// replace all white space and non-alpha numeric with $char
// we only use the ascii character set since mysql does not create table names / field names otherwise
// CRM-11744
*
* @return string string
*/
- static function convertStringToCamel($string) {
+ public static function convertStringToCamel($string) {
$fragments = explode('_', $string);
foreach ($fragments as & $fragment) {
$fragment = ucfirst($fragment);
* @access public
* @static
*/
- static function rename($name, $len = 4) {
+ public static function rename($name, $len = 4) {
$rand = substr(uniqid(), 0, $len);
return substr_replace($name, $rand, -$len, $len);
}
* @return string the last component
* @static
*/
- static function getClassName($string, $char = '_') {
+ public static function getClassName($string, $char = '_') {
$names = array();
if (!is_array($string)) {
$names = explode($char, $string);
* @access public
* @static
*/
- static function append(&$str, $delim, $name) {
+ public static function append(&$str, $delim, $name) {
if (empty($name)) {
return;
}
* @access public
* @static
*/
- static function isAscii($str, $utf8 = TRUE) {
+ public static function isAscii($str, $utf8 = TRUE) {
if (!function_exists('mb_detect_encoding')) {
// eliminate all white space from the string
$str = preg_replace('/\s+/', '', $str);
* @access public
* @static
*/
- static function regex($str, $regexRules) {
+ public static function regex($str, $regexRules) {
//redact the regular expressions
if (!empty($regexRules) && isset($str)) {
static $matches, $totalMatches, $match = array();
*
* @return mixed
*/
- static function redaction($str, $stringRules) {
+ public static function redaction($str, $stringRules) {
//redact the strings
if (!empty($stringRules)) {
foreach ($stringRules as $match => $replace) {
*
* @return boolean
*/
- static function isUtf8($str) {
+ public static function isUtf8($str) {
if (!function_exists(mb_detect_encoding)) {
// eliminate all white space from the string
$str = preg_replace('/\s+/', '', $str);
* @access public
* @static
*/
- static function match($url1, $url2) {
+ public static function match($url1, $url2) {
$url1 = strtolower($url1);
$url2 = strtolower($url2);
* @access public
* @static
*/
- static function extractURLVarValue($query) {
+ public static function extractURLVarValue($query) {
$config = CRM_Core_Config::singleton();
$urlVar = $config->userFrameworkURLVar;
* @access public
* @static
*/
- static function strtobool($str) {
+ public static function strtobool($str) {
if (!is_scalar($str)) {
return FALSE;
}
* @access public
* @static
*/
- static function strtoboolstr($str) {
+ public static function strtoboolstr($str) {
if (!is_scalar($str)) {
return FALSE;
}
* @access public
* @static
*/
- static function htmlToText($html) {
+ public static function htmlToText($html) {
require_once 'packages/html2text/rcube_html2text.php';
$token_html = preg_replace('!\{([a-z_.]+)\}!i', 'token:{$1}', $html);
$converter = new rcube_html2text($token_html);
* @param $string
* @param array $params
*/
- static function extractName($string, &$params) {
+ public static function extractName($string, &$params) {
$name = trim($string);
if (empty($name)) {
return;
*
* @return array
*/
- static function &makeArray($string) {
+ public static function &makeArray($string) {
$string = trim($string);
$values = explode("\n", $string);
*
* @return string only the first alternative found (or the text without alternatives)
*/
- static function stripAlternatives($full) {
+ public static function stripAlternatives($full) {
$matches = array();
preg_match('/-ALTERNATIVE ITEM 0-(.*?)-ALTERNATIVE ITEM 1-.*-ALTERNATIVE END-/s', $full, $matches);
* @access public
* @static
*/
- static function stripSpaces($string) {
+ public static function stripSpaces($string) {
return (empty($string)) ? $string : preg_replace("/\s{2,}/", " ", trim($string));
}
* @public
* @static
*/
- static function purifyHTML($string) {
+ public static function purifyHTML($string) {
static $_filter = null;
if (!$_filter) {
$config = HTMLPurifier_Config::createDefault();
*
* @return string
*/
- static function ellipsify($string, $maxLen) {
+ public static function ellipsify($string, $maxLen) {
$len = strlen($string);
if ($len <= $maxLen) {
return $string;
* @return SimpleXMLElement
* @throws Exception
*/
- static function makeAPICall($uri) {
+ public static function makeAPICall($uri) {
require_once 'HTTP/Request.php';
$params = array(
'method' => HTTP_REQUEST_METHOD_GET,
*
* @return array
*/
- static function getCityState($zipcode) {
+ public static function getCityState($zipcode) {
$key = self::$_apiKey;
$uri = "places.getCityStateFromZip.php?zip={$zipcode}&apikey={$key}&output=xml";
$xml = self::makeAPICall($uri);
*
* @return array
*/
- static function getDetailedInfo($peopleID) {
+ public static function getDetailedInfo($peopleID) {
$key = self::$_apiKey;
$uri = "people.getPersonInfo.php?id={$peopleID}&apikey={$key}&output=xml";
$xml = self::makeAPICall($uri);
*
* @return array
*/
- static function getPeopleInfo($uri) {
+ public static function getPeopleInfo($uri) {
$xml = self::makeAPICall($uri);
$result = array();
*
* @return array|null
*/
- static function getRepresentativeInfo($city, $state) {
+ public static function getRepresentativeInfo($city, $state) {
if (!$city ||
!$state
) {
*
* @return array|null
*/
- static function getSenatorInfo($state) {
+ public static function getSenatorInfo($state) {
if (!$state) {
return NULL;
}
*
* @return array
*/
- static function getInfo($city, $state, $zipcode = NULL) {
+ public static function getInfo($city, $state, $zipcode = NULL) {
if ($zipcode) {
list($city, $state) = self::getCityState($zipcode);
}
* The URL fragment.
* @access public
*/
- static function makeURL($urlVar, $includeReset = FALSE, $includeForce = TRUE, $path = NULL, $absolute = FALSE) {
+ public static function makeURL($urlVar, $includeReset = FALSE, $includeForce = TRUE, $path = NULL, $absolute = FALSE) {
if (empty($path)) {
$config = CRM_Core_Config::singleton();
$path = CRM_Utils_Array::value($config->userFrameworkURLVar, $_GET);
* @return string
* @access public
*/
- static function getLinksUrl($urlVar, $includeReset = FALSE, $includeForce = TRUE, $skipUFVar = TRUE) {
+ public static function getLinksUrl($urlVar, $includeReset = FALSE, $includeForce = TRUE, $skipUFVar = TRUE) {
// Sort out query string to prevent messy urls
$querystring = array();
$qs = array();
* @param array|string $query
* @return string
*/
- static function makeQueryString($query) {
+ public static function makeQueryString($query) {
if (is_array($query)) {
$buf = '';
foreach ($query as $key => $value) {
/**
* @return mixed
*/
- static function permissionDenied() {
+ public static function permissionDenied() {
$config = CRM_Core_Config::singleton();
return $config->userSystem->permissionDenied();
}
/**
* @return mixed
*/
- static function logout() {
+ public static function logout() {
$config = CRM_Core_Config::singleton();
return $config->userSystem->logout();
}
// this is a very drupal specific function for now
- static function updateCategories() {
+ public static function updateCategories() {
$config = CRM_Core_Config::singleton();
if ($config->userSystem->is_drupal) {
$config->userSystem->updateCategories();
* @return string the current menu path
* @access public
*/
- static function currentPath() {
+ public static function currentPath() {
$config = CRM_Core_Config::singleton();
return trim(CRM_Utils_Array::value($config->userFrameworkURLVar, $_GET), '/');
}
* @return string url
* @access public
*/
- static function crmURL($params) {
+ public static function crmURL($params) {
$p = CRM_Utils_Array::value('p', $params);
if (!isset($p)) {
$p = self::currentPath();
*
* @access public
*/
- static function setTitle($title, $pageTitle = NULL) {
+ public static function setTitle($title, $pageTitle = NULL) {
self::$title = $title;
$config = CRM_Core_Config::singleton();
return $config->userSystem->setTitle($title, $pageTitle);
*
* @access public
*/
- static function setUserContext($names, $default = NULL) {
+ public static function setUserContext($names, $default = NULL) {
$url = $default;
$session = CRM_Core_Session::singleton();
*
* @access public
*/
- static function getClassName($object) {
+ public static function getClassName($object) {
return get_class($object);
}
*
* @access public
*/
- static function redirect($url = NULL) {
+ public static function redirect($url = NULL) {
if (!$url) {
$url = self::url('civicrm/dashboard', 'reset=1');
}
*
* @access public
*/
- static function appendBreadCrumb($breadCrumbs) {
+ public static function appendBreadCrumb($breadCrumbs) {
$config = CRM_Core_Config::singleton();
return $config->userSystem->appendBreadCrumb($breadCrumbs);
}
*
* @access public
*/
- static function resetBreadCrumb() {
+ public static function resetBreadCrumb() {
$config = CRM_Core_Config::singleton();
return $config->userSystem->resetBreadCrumb();
}
*
* @access public
*/
- static function addHTMLHead($bc) {
+ public static function addHTMLHead($bc) {
$config = CRM_Core_Config::singleton();
return $config->userSystem->addHTMLHead($bc);
}
* The URL to post the form.
* @access public
*/
- static function postURL($action) {
+ public static function postURL($action) {
$config = CRM_Core_Config::singleton();
return $config->userSystem->postURL($action);
}
*
* @access public
*/
- static function mapConfigToSSL() {
+ public static function mapConfigToSSL() {
$config = CRM_Core_Config::singleton();
$config->userFrameworkResourceURL = str_replace('http://', 'https://', $config->userFrameworkResourceURL);
$config->resourceBase = $config->userFrameworkResourceURL;
* @return string
* @access public
*/
- static function baseURL() {
+ public static function baseURL() {
$config = CRM_Core_Config::singleton();
return $config->userFrameworkBaseURL;
}
/**
*/
- static function authenticateAbort($message, $abort) {
+ public static function authenticateAbort($message, $abort) {
if ($abort) {
echo $message;
self::civiExit(0);
*
* @return bool
*/
- static function authenticateKey($abort = TRUE) {
+ public static function authenticateKey($abort = TRUE) {
// also make sure the key is sent and is valid
$key = trim(CRM_Utils_Array::value('key', $_REQUEST));
*
* @return bool
*/
- static function authenticateScript($abort = TRUE, $name = NULL, $pass = NULL, $storeInSession = TRUE, $loadCMSBootstrap = TRUE, $requireKey = TRUE) {
+ public static function authenticateScript($abort = TRUE, $name = NULL, $pass = NULL, $storeInSession = TRUE, $loadCMSBootstrap = TRUE, $requireKey = TRUE) {
// auth to make sure the user has a login/password to do a shell operation
// later on we'll link this to acl's
if (!$name) {
* @return false|array
* @access public
*/
- static function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
+ public static function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
$config = CRM_Core_Config::singleton();
/* Before we do any loading, let's start the session and write to it.
*
* @access public
*/
- static function setUFMessage($message) {
+ public static function setUFMessage($message) {
$config = CRM_Core_Config::singleton();
return $config->userSystem->setMessage($message);
}
* The value to check for null.
* @return bool
*/
- static function isNull($value) {
+ public static function isNull($value) {
// FIXME: remove $value = 'null' string test when we upgrade our DAO code to handle passing null in a better way.
if (!isset($value) || $value === NULL || $value === '' || $value === 'null') {
return TRUE;
* @return string
* The obscured credit card number.
*/
- static function mungeCreditCard($number, $keep = 4) {
+ public static function mungeCreditCard($number, $keep = 4) {
$number = trim($number);
if (empty($number)) {
return NULL;
*
* @return mixed|string
*/
- static function memory($title = NULL) {
+ public static function memory($title = NULL) {
static $pid = NULL;
if (!$pid) {
$pid = posix_getpid();
* @param bool $log
* (optional) Whether to log the memory usage information.
*/
- static function xMemory($title = NULL, $log = FALSE) {
+ public static function xMemory($title = NULL, $log = FALSE) {
$mem = (float ) xdebug_memory_usage() / (float )(1024);
$mem = number_format($mem, 5) . ", " . time();
if ($log) {
* @return string
* The fixed URL.
*/
- static function fixURL($url) {
+ public static function fixURL($url) {
$components = parse_url($url);
if (!$components) {
*
* @return bool
*/
- static function validCallback($callback) {
+ public static function validCallback($callback) {
if (self::$_callbacks === NULL) {
self::$_callbacks = array();
}
* @param int $limit
* @return string[]
*/
- static function explode($separator, $string, $limit) {
+ public static function explode($separator, $string, $limit) {
$result = explode($separator, $string, $limit);
for ($i = count($result); $i < $limit; $i++) {
$result[$i] = NULL;
*
* @return mixed
*/
- static function checkURL($url, $addCookie = FALSE) {
+ public static function checkURL($url, $addCookie = FALSE) {
// make a GET request to $url
$ch = curl_init($url);
if ($addCookie) {
* met and we're not aborting due to the failed requirement. If $abort is
* TRUE and the requirement fails, this function does not return.
*/
- static function checkPHPVersion($ver = 5, $abort = TRUE) {
+ public static function checkPHPVersion($ver = 5, $abort = TRUE) {
$phpVersion = substr(PHP_VERSION, 0, 1);
if ($phpVersion >= $ver) {
return TRUE;
*
* @return string
*/
- static function formatWikiURL($string, $encode = FALSE) {
+ public static function formatWikiURL($string, $encode = FALSE) {
$items = explode(' ', trim($string), 2);
if (count($items) == 2) {
$title = $items[1];
*
* @return null|string
*/
- static function urlEncode($url) {
+ public static function urlEncode($url) {
$items = parse_url($url);
if ($items === FALSE) {
return NULL;
* civicrm version
* @access public
*/
- static function version() {
+ public static function version() {
static $version;
if (!$version) {
* Version string to be checked.
* @return bool
*/
- static function isVersionFormatValid($version) {
+ public static function isVersionFormatValid($version) {
return preg_match("/^(\d{1,2}\.){2,3}(\d{1,2}|(alpha|beta)\d{1,2})(\.upgrade)?$/", $version);
}
/**
* Wraps or emulates PHP's getallheaders() function.
*/
- static function getAllHeaders() {
+ public static function getAllHeaders() {
if (function_exists('getallheaders')) {
return getallheaders();
}
/**
*/
- static function getRequestHeaders() {
+ public static function getRequestHeaders() {
if (function_exists('apache_request_headers')) {
return apache_request_headers();
}
* Note that we inline this function in install/civicrm.php, so if you change
* this function, please go and change the code in the install script as well.
*/
- static function isSSL( ) {
+ public static function isSSL( ) {
return
(isset($_SERVER['HTTPS']) &&
!empty($_SERVER['HTTPS']) &&
/**
*/
- static function redirectToSSL($abort = FALSE) {
+ public static function redirectToSSL($abort = FALSE) {
$config = CRM_Core_Config::singleton();
$req_headers = self::getRequestHeaders();
if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enableSSL') &&
*
* @return mixed|string
*/
- static function ipAddress($strictIPV4 = TRUE) {
+ public static function ipAddress($strictIPV4 = TRUE) {
$address = CRM_Utils_Array::value('REMOTE_ADDR', $_SERVER);
$config = CRM_Core_Config::singleton();
* The previous page URL
* @access public
*/
- static function refererPath() {
+ public static function refererPath() {
return CRM_Utils_Array::value('HTTP_REFERER', $_SERVER);
}
* Base URL of the CRM documentation.
* @access public
*/
- static function getDocBaseURL() {
+ public static function getDocBaseURL() {
// FIXME: move this to configuration at some stage
return 'http://book.civicrm.org/';
}
* @return string documentation url
* @access public
*/
- static function getWikiBaseURL() {
+ public static function getWikiBaseURL() {
// FIXME: move this to configuration at some stage
return 'http://wiki.civicrm.org/confluence/display/CRMDOC/';
}
* URL or link to documentation page, based on provided parameters.
* @access public
*/
- static function docURL2($page, $URLonly = FALSE, $text = NULL, $title = NULL, $style = NULL, $resource = NULL) {
+ public static function docURL2($page, $URLonly = FALSE, $text = NULL, $title = NULL, $style = NULL, $resource = NULL) {
// if ts function doesn't exist, it means that CiviCRM hasn't been fully initialised yet -
// return just the URL, no matter what other parameters are defined
if (!function_exists('ts')) {
* URL or link to documentation page, based on provided parameters.
* @access public
*/
- static function docURL($params) {
+ public static function docURL($params) {
if (!isset($params['page'])) {
return;
* @return string
* The used locale or null for none.
*/
- static function getUFLocale() {
+ public static function getUFLocale() {
$config = CRM_Core_Config::singleton();
return $config->userSystem->getUFLocale();
}
* @return string
* Response from URL.
*/
- static function getServerResponse($url, $addCookie = TRUE) {
+ public static function getServerResponse($url, $addCookie = TRUE) {
CRM_Core_TemporaryErrorScope::ignoreException();
require_once 'HTTP/Request.php';
$request = new HTTP_Request($url);
/**
*/
- static function isDBVersionValid(&$errorMessage) {
+ public static function isDBVersionValid(&$errorMessage) {
$dbVersion = CRM_Core_BAO_Domain::version();
if (!$dbVersion) {
* @param int $status
* (optional) Code with which to exit.
*/
- static function civiExit($status = 0) {
+ public static function civiExit($status = 0) {
// move things to CiviCRM cache as needed
CRM_Core_Session::storeSessionObjects();
/**
* Reset the various system caches and some important static variables.
*/
- static function flushCache( ) {
+ public static function flushCache( ) {
// flush out all cache entries so we can reload new data
// a bit aggressive, but livable for now
$cache = CRM_Utils_Cache::singleton();
* @param bool $throwError
* @param $realPath
*/
- static function loadBootStrap($params = array(), $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) {
+ public static function loadBootStrap($params = array(), $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) {
if (!is_array($params)) {
$params = array();
}
/**
*/
- static function baseCMSURL() {
+ public static function baseCMSURL() {
static $_baseURL = NULL;
if (!$_baseURL) {
$config = CRM_Core_Config::singleton();
* @param string $url
* @return string
*/
- static function relativeURL($url) {
+ public static function relativeURL($url) {
// check if url is relative, if so return immediately
if (substr($url, 0, 4) != 'http') {
return $url;
*
* @return string
*/
- static function absoluteURL($url, $removeLanguagePart = FALSE) {
+ public static function absoluteURL($url, $removeLanguagePart = FALSE) {
// check if url is already absolute, if so return immediately
if (substr($url, 0, 4) == 'http') {
return $url;
*
* @return string $url, clean url
*/
- static function cleanUrl($url) {
+ public static function cleanUrl($url) {
if (!$url) {
return NULL;
}
* include path.
* @access public
*/
- static function listIncludeFiles($relpath) {
+ public static function listIncludeFiles($relpath) {
$file_list = array();
$inc_dirs = explode(PATH_SEPARATOR, get_include_path());
foreach ($inc_dirs as $inc_dir) {
* each element.
* @access public
*/
- static function getPluginList($relpath, $fext = '.php', $skipList = array()) {
+ public static function getPluginList($relpath, $fext = '.php', $skipList = array()) {
$fext_len = strlen($fext);
$plugins = array();
$inc_files = CRM_Utils_System::listIncludeFiles($relpath);
/**
*
*/
- static function executeScheduledJobs() {
+ public static function executeScheduledJobs() {
$facility = new CRM_Core_JobManager();
$facility->execute(FALSE);
*
* @return bool
*/
- static function isDevelopment() {
+ public static function isDevelopment() {
static $cache = NULL;
if ($cache === NULL) {
global $civicrm_root;
/**
* @return bool
*/
- static function isInUpgradeMode() {
+ public static function isInUpgradeMode() {
$args = explode('/', $_GET['q']);
$upgradeInProcess = CRM_Core_Session::singleton()->get('isUpgradePending');
if ((isset($args[1]) && $args[1] == 'upgrade') || $upgradeInProcess) {
* - title: string
* - url: string
*/
- static function createDefaultCrudLink($crudLinkSpec) {
+ public static function createDefaultCrudLink($crudLinkSpec) {
$crudLinkSpec['action'] = CRM_Utils_Array::value('action', $crudLinkSpec, CRM_Core_Action::VIEW);
$daoClass = CRM_Core_DAO_AllCoreTables::getClassForTable($crudLinkSpec['entity_table']);
if (!$daoClass) {
* @return void prints content on stdout
* @access public
*/
- function theme(&$content, $print = FALSE, $maintenance = FALSE) {
+ public function theme(&$content, $print = FALSE, $maintenance = FALSE) {
$ret = FALSE;
// TODO: Split up; this was copied verbatim from CiviCRM 4.0's multi-UF theming function
/**
* @return string
*/
- function getDefaultBlockLocation() {
+ public function getDefaultBlockLocation() {
return 'left';
}
/**
* @return string
*/
- function getVersion() {
+ public function getVersion() {
return 'Unknown';
}
*
* @return string|NULL local file system path to CMS root, or NULL if it cannot be determined
*/
- function cmsRootPath() {
+ public function cmsRootPath() {
return NULL;
}
* @throws CRM_Core_Exception
* @return int|NULL
*/
- function getUfId($username) {
+ public function getUfId($username) {
$className = get_class($this);
throw new CRM_Core_Exception("Not implemented: {$className}->getUfId");
}
*
* @access public
*/
- function setUserSession($data) {
+ public function setUserSession($data) {
list($userID, $ufID) = $data;
$session = CRM_Core_Session::singleton();
$session->set('ufID', $ufID);
* Reset any system caches that may be required for proper CiviCRM
* integration.
*/
- function flush() {
+ public function flush() {
// nullop by default
}
/**
* Flush css/js caches
*/
- function clearResourceCache() {
+ public function clearResourceCache() {
// nullop by default
}
* - $siteName,
* - $siteRoot
*/
- function getDefaultSiteSettings($dir) {
+ public function getDefaultSiteSettings($dir) {
$config = CRM_Core_Config::singleton();
$url = $config->userFrameworkBaseURL;
return array($url, NULL, NULL);
*
* FIXME: Document values accepted/required by $params
*/
- function userLoginFinalize($params = array()){
+ public function userLoginFinalize($params = array()){
}
/**
* Set timezone in mysql so that timestamp fields show the correct time
*/
- function setMySQLTimeZone(){
+ public function setMySQLTimeZone(){
$timeZoneOffset = $this->getTimeZoneOffset();
if($timeZoneOffset){
$sql = "SET time_zone = '$timeZoneOffset'";
* Get timezone from Drupal
* @return boolean|string
*/
- function getTimeZoneOffset(){
+ public function getTimeZoneOffset(){
$timezone = $this->getTimeZoneString();
if($timezone){
$tzObj = new DateTimeZone($timezone);
* Over-ridable function to get timezone as a string eg.
* @return string Timezone e.g. 'America/Los_Angeles'
*/
- function getTimeZoneString() {
+ public function getTimeZoneString() {
return date_default_timezone_get();
}
* @return mixed $uniqueIdentifer Unique identifier from the user Framework system
*
*/
- function getUniqueIdentifierFromUserObject($user) {}
+ public function getUniqueIdentifierFromUserObject($user) {}
/**
* Get User ID from UserFramework system (CMS)
* @return mixed <NULL, number>
*
*/
- function getUserIDFromUserObject($user) {}
+ public function getUserIDFromUserObject($user) {}
/**
* Get currently logged in user uf id.
*
* @return int $userID logged in user uf id.
*/
- function getLoggedInUfID() {}
+ public function getLoggedInUfID() {}
/**
* Get currently logged in user unique identifier - this tends to be the email address or user name.
*
* @return string $userID logged in user unique identifier
*/
- function getLoggedInUniqueIdentifier() {}
+ public function getLoggedInUniqueIdentifier() {}
/**
* Return a UFID (user account ID from the UserFramework / CMS system being based on the user object
* @param object $user
* @return int $ufid - user ID of UF System
*/
- function getBestUFID($user = NULL) {
+ public function getBestUFID($user = NULL) {
if($user) {
return $this->getUserIDFromUserObject($user);
}
* @param object $user
* @return string $uniqueIdentifier - unique identifier from the UF System
*/
- function getBestUFUniqueIdentifier($user = NULL) {
+ public function getBestUFUniqueIdentifier($user = NULL) {
if($user) {
return $this->getUniqueIdentifierFromUserObject($user);
}
*
* @return string
*/
- function getUserRecordUrl($contactID) {
+ public function getUserRecordUrl($contactID) {
return NULL;
}
/**
* Is the current user permitted to add a user
* @return bool
*/
- function checkPermissionAddUser() {
+ public function checkPermissionAddUser() {
return FALSE;
}
* Output code from error function
* @param string $content
*/
- function outputError($content) {
+ public function outputError($content) {
echo CRM_Utils_System::theme($content);
}
/**
* Log error to CMS
*/
- function logger($message) {
+ public function logger($message) {
}
/**
* Append to coreResourcesList
*/
- function appendCoreResources(&$list) {}
+ public function appendCoreResources(&$list) {}
}
* @access public
*
*/
- function createUser(&$params, $mail) {
+ public function createUser(&$params, $mail) {
$form_state = form_state_defaults();
$form_state['input'] = array(
* @param int $ufID
* @param string $ufName
*/
- function updateCMSName($ufID, $ufName) {
+ public function updateCMSName($ufID, $ufName) {
// CRM-5555
if (function_exists('user_load')) {
$user = user_load($ufID);
*
* @return void
*/
- static function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
+ public static function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
$config = CRM_Core_Config::singleton();
$dao = new CRM_Core_DAO();
*
* @return null|string
*/
- function getLoginDestination(&$form) {
+ public function getLoginDestination(&$form) {
$args = NULL;
$id = $form->get('id');
* @return void
* @access public
*/
- function setTitle($title, $pageTitle = NULL) {
+ public function setTitle($title, $pageTitle = NULL) {
if (arg(0) == 'civicrm') {
if (!$pageTitle) {
$pageTitle = $title;
* @return void
* @access public
*/
- function appendBreadCrumb($breadCrumbs) {
+ public function appendBreadCrumb($breadCrumbs) {
$breadCrumb = drupal_get_breadcrumb();
if (is_array($breadCrumbs)) {
* @return void
* @access public
*/
- function resetBreadCrumb() {
+ public function resetBreadCrumb() {
$bc = array();
drupal_set_breadcrumb($bc);
}
* @return void
* @access public
*/
- function addHTMLHead($header) {
+ public function addHTMLHead($header) {
static $count = 0;
if (!empty($header)) {
$key = 'civi_' . ++$count;
* @return void
* @access public
*/
- function mapConfigToSSL() {
+ public function mapConfigToSSL() {
global $base_url;
$base_url = str_replace('http://', 'https://', $base_url);
}
* @return string the url to post the form
* @access public
*/
- function postURL($action) {
+ public function postURL($action) {
if (!empty($action)) {
return $action;
}
* contactID, ufID, unique string ) if success
* @access public
*/
- static function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
+ public static function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
require_once 'DB.php';
$config = CRM_Core_Config::singleton();
*
* @return bool
*/
- function loadUser($username) {
+ public function loadUser($username) {
global $user;
$user = user_load_by_name($username);
*
* FIXME: Document values accepted/required by $params
*/
- function userLoginFinalize($params = array()){
+ public function userLoginFinalize($params = array()){
user_login_finalize($params);
}
* @param string $username
* @return int|NULL
*/
- function getUfId($username) {
+ public function getUfId($username) {
$user = user_load_by_name($username);
if (empty($user->uid)) {
return NULL;
*
* @access public
*/
- function setMessage($message) {
+ public function setMessage($message) {
drupal_set_message($message);
}
/**
* @return mixed
*/
- function logout() {
+ public function logout() {
module_load_include('inc', 'user', 'user.pages');
return user_logout();
}
- function updateCategories() {
+ public function updateCategories() {
// copied this from profile.module. Seems a bit inefficient, but i dont know a better way
// CRM-3600
cache_clear_all();
*
* @return string
*/
- function getDefaultBlockLocation() {
+ public function getDefaultBlockLocation() {
return 'sidebar_first';
}
*
* @return string with the locale or null for none
*/
- function getUFLocale() {
+ public function getUFLocale() {
// return CiviCRM’s xx_YY locale that either matches Drupal’s Chinese locale
// (for CRM-6281), Drupal’s xx_YY or is retrieved based on Drupal’s xx
// sometimes for CLI based on order called, this might not be set and/or empty
/**
* @return string
*/
- function getVersion() {
+ public function getVersion() {
return defined('VERSION') ? VERSION : 'Unknown';
}
*
* @return bool
*/
- function loadBootStrap($params = array(), $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) {
+ public function loadBootStrap($params = array(), $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) {
//take the cms root path.
$cmsPath = $this->cmsRootPath($realPath);
/**
*
*/
- function cmsRootPath($scriptFilename = NULL) {
+ public function cmsRootPath($scriptFilename = NULL) {
$cmsRoot = $valid = NULL;
if (!is_null($scriptFilename)) {
* @return string $url, formatted url.
* @static
*/
- function languageNegotiationURL($url, $addLanguagePart = TRUE, $removeLanguagePart = FALSE) {
+ public function languageNegotiationURL($url, $addLanguagePart = TRUE, $removeLanguagePart = FALSE) {
if (empty($url)) {
return $url;
}
*
* @return void
*/
- function replacePermission($oldPerm, $newPerms) {
+ public function replacePermission($oldPerm, $newPerms) {
$roles = user_roles(FALSE, $oldPerm);
if (!empty($roles)) {
foreach (array_keys($roles) as $rid) {
*
* @return array CRM_Core_Module
*/
- function getModules() {
+ public function getModules() {
$result = array();
$q = db_query('SELECT name, status FROM {system} WHERE type = \'module\' AND schema_version <> -1');
foreach ($q as $row) {
* @param integer $ogID Organic Group ID
* @param integer $drupalID drupal User ID
*/
- function og_membership_create($ogID, $drupalID){
+ public function og_membership_create($ogID, $drupalID){
if (function_exists('og_entity_query_alter')) {
// sort-of-randomly chose a function that only exists in the // 7.x-2.x branch
//
* @param integer $ogID Organic Group ID
* @param integer $drupalID drupal User ID
*/
- function og_membership_delete($ogID, $drupalID) {
+ public function og_membership_delete($ogID, $drupalID) {
if (function_exists('og_entity_query_alter')) {
// sort-of-randomly chose a function that only exists in the 7.x-2.x branch
// TODO: Find a more solid way to make this test
* Over-ridable function to get timezone as a string eg.
* @return string Timezone e.g. 'America/Los_Angeles'
*/
- function getTimeZoneString() {
+ public function getTimeZoneString() {
global $user;
if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) {
$timezone = $user->timezone;
* Reset any system caches that may be required for proper CiviCRM
* integration.
*/
- function flush() {
+ public function flush() {
drupal_flush_all_caches();
}
}
* @return void prints content on stdout
* @access public
*/
- function theme(&$content, $print = FALSE, $maintenance = FALSE) {
+ public function theme(&$content, $print = FALSE, $maintenance = FALSE) {
// TODO: Simplify; this was copied verbatim from CiviCRM 3.4's multi-UF theming function, but that's more complex than necessary
if (function_exists('theme') && !$print) {
if ($maintenance) {
*
* @access public
*/
- function createUser(&$params, $mail) {
+ public function createUser(&$params, $mail) {
$form_state = array();
$form_state['values'] = array(
'name' => $params['cms_name'],
* @param int $ufID
* @param string $ufName
*/
- function updateCMSName($ufID, $ufName) {
+ public function updateCMSName($ufID, $ufName) {
// CRM-5555
if (function_exists('user_load')) {
$user = user_load(array('uid' => $ufID));
*
* @return void
*/
- function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
+ public function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
$config = CRM_Core_Config::singleton();
$dao = new CRM_Core_DAO();
* @return string $destination destination value for URL
*
*/
- function getLoginDestination(&$form) {
+ public function getLoginDestination(&$form) {
$args = NULL;
$id = $form->get('id');
* @return void
* @access public
*/
- function setTitle($title, $pageTitle = NULL) {
+ public function setTitle($title, $pageTitle = NULL) {
if (!$pageTitle) {
$pageTitle = $title;
}
* @return void
* @access public
*/
- function appendBreadCrumb($breadCrumbs) {
+ public function appendBreadCrumb($breadCrumbs) {
$breadCrumb = drupal_get_breadcrumb();
if (is_array($breadCrumbs)) {
* @return void
* @access public
*/
- function resetBreadCrumb() {
+ public function resetBreadCrumb() {
$bc = array();
drupal_set_breadcrumb($bc);
}
* @return void
* @access public
*/
- function addHTMLHead($head) {
+ public function addHTMLHead($head) {
drupal_set_html_head($head);
}
* @return void
* @access public
*/
- function mapConfigToSSL() {
+ public function mapConfigToSSL() {
global $base_url;
$base_url = str_replace('http://', 'https://', $base_url);
}
* @return string the url to post the form
* @access public
*/
- function postURL($action) {
+ public function postURL($action) {
if (!empty($action)) {
return $action;
}
* contactID, ufID, unique string ) if success
* @access public
*/
- function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
+ public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
//@todo this 'PEAR-y' stuff is only required when bookstrap is not being loaded which is rare
// if ever now.
// probably if bootstrap is loaded this call
/**
* Load user into session
*/
- function loadUser($username) {
+ public function loadUser($username) {
global $user;
$user = user_load(array('name' => $username));
if (empty($user->uid)) {
*
* FIXME: Document values accepted/required by $params
*/
- function userLoginFinalize($params = array()) {
+ public function userLoginFinalize($params = array()) {
user_authenticate_finalize($params);
}
* @param string $username
* @return int|NULL
*/
- function getUfId($username) {
+ public function getUfId($username) {
$user = user_load(array('name' => $username));
if (empty($user->uid)) {
return NULL;
*
* @access public
*/
- function setMessage($message) {
+ public function setMessage($message) {
drupal_set_message($message);
}
/**
* @return mixed
*/
- function logout() {
+ public function logout() {
module_load_include('inc', 'user', 'user.pages');
return user_logout();
}
- function updateCategories() {
+ public function updateCategories() {
// copied this from profile.module. Seems a bit inefficient, but i dont know a better way
// CRM-3600
cache_clear_all();
*
* @return string with the locale or null for none
*/
- function getUFLocale() {
+ public function getUFLocale() {
// return CiviCRM’s xx_YY locale that either matches Drupal’s Chinese locale
// (for CRM-6281), Drupal’s xx_YY or is retrieved based on Drupal’s xx
// sometimes for CLI based on order called, this might not be set and/or empty
/**
* @return string
*/
- function getVersion() {
+ public function getVersion() {
return defined('VERSION') ? VERSION : 'Unknown';
}
*
* @return bool
*/
- function loadBootStrap($params = array(), $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) {
+ public function loadBootStrap($params = array(), $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) {
//take the cms root path.
$cmsPath = $this->cmsRootPath($realPath);
/**
*
*/
- function cmsRootPath($scriptFilename = NULL) {
+ public function cmsRootPath($scriptFilename = NULL) {
$cmsRoot = $valid = NULL;
if (!is_null($scriptFilename)) {
* @return string $url, formatted url.
* @static
*/
- function languageNegotiationURL($url, $addLanguagePart = TRUE, $removeLanguagePart = FALSE) {
+ public function languageNegotiationURL($url, $addLanguagePart = TRUE, $removeLanguagePart = FALSE) {
if (empty($url)) {
return $url;
}
*
* @return void
*/
- function replacePermission($oldPerm, $newPerms) {
+ public function replacePermission($oldPerm, $newPerms) {
$roles = user_roles(FALSE, $oldPerm);
foreach ($roles as $rid => $roleName) {
$permList = db_result(db_query('SELECT perm FROM {permission} WHERE rid = %d', $rid));
*
* @return array CRM_Core_Module
*/
- function getModules() {
+ public function getModules() {
$result = array();
$q = db_query('SELECT name, status FROM {system} WHERE type = \'module\' AND schema_version <> -1');
while ($row = db_fetch_object($q)) {
* @param integer $ogID Organic Group ID
* @param integer $drupalID drupal User ID
*/
- function og_membership_create($ogID, $drupalID){
+ public function og_membership_create($ogID, $drupalID){
og_save_subscription( $ogID, $drupalID, array( 'is_active' => 1 ) );
}
* @param integer $ogID Organic Group ID
* @param integer $drupalID drupal User ID
*/
- function og_membership_delete($ogID, $drupalID) {
+ public function og_membership_delete($ogID, $drupalID) {
og_delete_subscription( $ogID, $drupalID );
}
* Over-ridable function to get timezone as a string eg.
* @return string Timezone e.g. 'America/Los_Angeles'
*/
- function getTimeZoneString() {
+ public function getTimeZoneString() {
global $user;
if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) {
$timezone = $user->timezone;
* Reset any system caches that may be required for proper CiviCRM
* integration.
*/
- function flush() {
+ public function flush() {
drupal_flush_all_caches();
}
}
* @access public
*
*/
- function createUser(&$params, $mail) {
+ public function createUser(&$params, $mail) {
$user = \Drupal::currentUser();
$user_register_conf = \Drupal::config('user.settings')->get('register');
$verify_mail_conf = \Drupal::config('user.settings')->get('verify_mail');
* @param integer $ufID User ID in CMS
* @param string $email Primary contact email address
*/
- function updateCMSName($ufID, $email) {
+ public function updateCMSName($ufID, $email) {
$user = user_load($ufID);
if ($user && $user->getEmail() != $email) {
$user->setEmail($email);
*
* @return void
*/
- static function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
+ public static function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
// If we are given a name, let's check to see if it already exists.
if (!empty($params['name'])) {
$name = $params['name'];
* @return string $destination destination value for URL
*
*/
- function getLoginDestination(&$form) {
+ public function getLoginDestination(&$form) {
$args = NULL;
$id = $form->get('id');
* @return void
* @access public
*/
- function setTitle($title, $pageTitle = NULL) {
+ public function setTitle($title, $pageTitle = NULL) {
if (!$pageTitle) {
$pageTitle = $title;
}
* @return void
* @access public
*/
- function appendBreadCrumb($breadcrumbs) {
+ public function appendBreadCrumb($breadcrumbs) {
$civicrmPageState = \Drupal::service('civicrm.page_state');
foreach ($breadcrumbs as $breadcrumb) {
$civicrmPageState->addBreadcrumb($breadcrumb['title'], $breadcrumb['url']);
* @return void
* @access public
*/
- function resetBreadCrumb() {
+ public function resetBreadCrumb() {
\Drupal::service('civicrm.page_state')->resetBreadcrumbs();
}
* @return void
* @access public
*/
- function addHTMLHead($header) {
+ public function addHTMLHead($header) {
\Drupal::service('civicrm.page_state')->addHtmlHeader($header);
}
*
* @return bool
*/
- function formatResourceUrl(&$url) {
+ public function formatResourceUrl(&$url) {
// Remove leading slash if present.
$url = ltrim($url, '/');
* @return void
* @access public
*/
- function mapConfigToSSL() {
+ public function mapConfigToSSL() {
}
/**
* @param bool $forceBackend A joomla jack (unused)
* @return string
*/
- function url($path = '', $query = '', $absolute = FALSE, $fragment = '', $htmlize = FALSE, $frontend = FALSE, $forceBackend = FALSE) {
+ public function url($path = '', $query = '', $absolute = FALSE, $fragment = '', $htmlize = FALSE, $frontend = FALSE, $forceBackend = FALSE) {
$query = html_entity_decode($query);
$url = \Drupal\civicrm\CivicrmHelper::parseURL("{$path}?{$query}");
*
* This always bootstraps Drupal
*/
- function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
+ public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
(new CRM_Utils_System_Drupal8())->loadBootStrap(array(), FALSE);
$uid = \Drupal::service('user.auth')->authenticate($name, $password);
/**
* Load user into session
*/
- function loadUser($username) {
+ public function loadUser($username) {
$user = user_load_by_name($username);
if (!$user) {
return FALSE;
* @param string $username
* @return int|NULL
*/
- function getUfId($username) {
+ public function getUfId($username) {
if ($id = user_load_by_name($username)->id()) {
return $id;
}
*
* @access public
*/
- function setMessage($message) {
+ public function setMessage($message) {
drupal_set_message($message);
}
- function permissionDenied() {
+ public function permissionDenied() {
\Drupal::service('civicrm.page_state')->setAccessDenied();
}
* In previous versions, this function was the controller for logging out. In Drupal 8, we rewrite the route
* to hand off logout to the standard Drupal logout controller. This function should therefore never be called.
*/
- function logout() {
+ public function logout() {
// Pass
}
* @return bool
* @Todo Handle setting cleanurls configuration for CiviCRM?
*/
- function loadBootStrap($params = array(), $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) {
+ public function loadBootStrap($params = array(), $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) {
static $run_once = FALSE;
if ($run_once) return TRUE; else $run_once = TRUE;
*
* @return NULL|string
*/
- function cmsRootPath($path = NULL) {
+ public function cmsRootPath($path = NULL) {
if (defined('DRUPAL_ROOT')) {
return DRUPAL_ROOT;
}
* @return string
*
*/
- function getDefaultBlockLocation() {
+ public function getDefaultBlockLocation() {
return 'sidebar_first';
}
}
/**
*
*/
- function __construct() {
+ public function __construct() {
/**
* deprecated property to check if this is a drupal install. The correct method is to have functions on the UF classes for all UF specific
* functions and leave the codebase oblivious to the type of CMS
* - $siteName,
* - $siteRoot
*/
- function getDefaultSiteSettings($dir){
+ public function getDefaultSiteSettings($dir){
$config = CRM_Core_Config::singleton();
$siteName = $siteRoot = NULL;
$matches = array();
* @return bool: TRUE for internal paths, FALSE for external. The drupal_add_js fn is able to add js more
* efficiently if it is known to be in the drupal site
*/
- function formatResourceUrl(&$url) {
+ public function formatResourceUrl(&$url) {
$internal = FALSE;
$base = CRM_Core_Config::singleton()->resourceBase;
global $base_url;
* @param string $url potential resource url based on standard folder assumptions
* @return string $url with civicrm-core directory appended if not standard civi dir
*/
- function appendCoreDirectoryToResourceBase($url) {
+ public function appendCoreDirectoryToResourceBase($url) {
global $civicrm_root;
$lastDirectory = basename($civicrm_root);
if($lastDirectory != 'civicrm') {
* @param object $user object as described by the CMS
* @return mixed <NULL, number>
*/
- function getUserIDFromUserObject($user) {
+ public function getUserIDFromUserObject($user) {
return !empty($user->uid) ? $user->uid : NULL;
}
* @return mixed $uniqueIdentifer Unique identifier from the user Framework system
*
*/
- function getUniqueIdentifierFromUserObject($user) {
+ public function getUniqueIdentifierFromUserObject($user) {
return empty($user->mail) ? NULL : $user->mail;
}
*
* @return string $userID logged in user unique identifier
*/
- function getLoggedInUniqueIdentifier() {
+ public function getLoggedInUniqueIdentifier() {
global $user;
return $this->getUniqueIdentifierFromUserObject($user);
}
/**
* Action to take when access is not permitted
*/
- function permissionDenied() {
+ public function permissionDenied() {
drupal_access_denied();
}
*
* @return string
*/
- function getUserRecordUrl($contactID) {
+ public function getUserRecordUrl($contactID) {
$uid = CRM_Core_BAO_UFMatch::getUFId($contactID);
if (CRM_Core_Session::singleton()->get('userID') == $contactID || CRM_Core_Permission::checkAnyPerm(array('cms:administer users', 'cms:view user account'))) {
return CRM_Utils_System::url('user/' . $uid);
* Is the current user permitted to add a user
* @return bool
*/
- function checkPermissionAddUser() {
+ public function checkPermissionAddUser() {
if (CRM_Core_Permission::check('administer users')) {
return TRUE;
}
/**
* Log error to CMS
*/
- function logger($message) {
+ public function logger($message) {
if (CRM_Core_Config::singleton()->userFrameworkLogging) {
watchdog('civicrm', $message, NULL, WATCHDOG_DEBUG);
}
/**
* Flush css/js caches
*/
- function clearResourceCache() {
+ public function clearResourceCache() {
_drupal_flush_css_js();
}
/**
* Append to coreResourcesList
*/
- function appendCoreResources(&$list) {
+ public function appendCoreResources(&$list) {
$list[] = 'js/crm.drupal.js';
}
* Reset any system caches that may be required for proper CiviCRM
* integration.
*/
- function flush() {
+ public function flush() {
drupal_flush_all_caches();
}
* @return array CRM_Core_Module
*
*/
- function getModules() {
+ public function getModules() {
$result = array();
$q = db_query('SELECT name, status FROM {system} WHERE type = \'module\' AND schema_version <> -1');
foreach ($q as $row) {
*
* @return void
*/
- function replacePermission($oldPerm, $newPerms) {
+ public function replacePermission($oldPerm, $newPerms) {
$roles = user_roles(FALSE, $oldPerm);
if (!empty($roles)) {
foreach (array_keys($roles) as $rid) {
* @return string $url, formatted url.
* @static
*/
- function languageNegotiationURL($url, $addLanguagePart = TRUE, $removeLanguagePart = FALSE) {
+ public function languageNegotiationURL($url, $addLanguagePart = TRUE, $removeLanguagePart = FALSE) {
if (empty($url)) {
return $url;
}
* GET CMS Version
* @return string
*/
- function getVersion() {
+ public function getVersion() {
return defined('VERSION') ? VERSION : 'Unknown';
}
/**
*/
- function updateCategories() {
+ public function updateCategories() {
// copied this from profile.module. Seems a bit inefficient, but i dont know a better way
// CRM-3600
cache_clear_all();
* @return string with the locale or null for none
*
*/
- function getUFLocale() {
+ public function getUFLocale() {
// return CiviCRM’s xx_YY locale that either matches Drupal’s Chinese locale
// (for CRM-6281), Drupal’s xx_YY or is retrieved based on Drupal’s xx
// sometimes for CLI based on order called, this might not be set and/or empty
* FIXME: Document values accepted/required by $params
*
*/
- function userLoginFinalize($params = array()){
+ public function userLoginFinalize($params = array()){
user_login_finalize($params);
}
* @return string the url to post the form
* @access public
*/
- function postURL($action) {
+ public function postURL($action) {
if (!empty($action)) {
return $action;
}
/**
*
*/
- function __construct() {
+ public function __construct() {
/**
* deprecated property to check if this is a drupal install. The correct method is to have functions on the UF classes for all UF specific
* functions and leave the codebase oblivious to the type of CMS
*
* @access public
*/
- function createUser(&$params, $mail) {
+ public function createUser(&$params, $mail) {
$baseDir = JPATH_SITE;
require_once $baseDir . '/components/com_users/models/registration.php';
* @param integer $ufID User ID in CMS
* @param string $ufName User name
*/
- function updateCMSName($ufID, $ufName) {
+ public function updateCMSName($ufID, $ufName) {
$ufID = CRM_Utils_Type::escape($ufID, 'Integer');
$ufName = CRM_Utils_Type::escape($ufName, 'String');
*
* @return void
*/
- function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
+ public function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
$config = CRM_Core_Config::singleton();
$dao = new CRM_Core_DAO();
* @return void
* @access public
*/
- function setTitle($title, $pageTitle = NULL) {
+ public function setTitle($title, $pageTitle = NULL) {
if (!$pageTitle) {
$pageTitle = $title;
}
* @return void
* @access public
*/
- function appendBreadCrumb($breadCrumbs) {
+ public function appendBreadCrumb($breadCrumbs) {
$template = CRM_Core_Smarty::singleton();
$bc = $template->get_template_vars('breadcrumb');
* @return void
* @access public
*/
- function resetBreadCrumb() {
+ public function resetBreadCrumb() {
return;
}
* @return void
* @access public
*/
- static function addHTMLHead($string = NULL) {
+ public static function addHTMLHead($string = NULL) {
if ($string) {
$document = JFactory::getDocument();
$document->addCustomTag($string);
* @return void
* access public
*/
- function mapConfigToSSL() {
+ public function mapConfigToSSL() {
// dont need to do anything, let CMS handle their own switch to SSL
return;
}
* @return string the url to post the form
* @access public
*/
- function postURL($action) {
+ public function postURL($action) {
if (!empty($action)) {
return $action;
}
* @return void
* @access public
*/
- function setEmail(&$user) {
+ public function setEmail(&$user) {
global $database;
$query = "SELECT email FROM #__users WHERE id='$user->id'";
$database->setQuery($query);
contactID, ufID, unique string ) if success
* @access public
*/
- function authenticate($name, $password, $loadCMSBootstrap = FALSE) {
+ public function authenticate($name, $password, $loadCMSBootstrap = FALSE) {
require_once 'DB.php';
$config = CRM_Core_Config::singleton();
*
* @access public
*/
- function setUserSession($data) {
+ public function setUserSession($data) {
list($userID, $ufID) = $data;
$user = new JUser( $ufID );
$session = JFactory::getSession();
*
* @access public
*/
- function setMessage($message) {
+ public function setMessage($message) {
return;
}
*
* @return bool
*/
- function loadUser($user) {
+ public function loadUser($user) {
return TRUE;
}
- function permissionDenied() {
+ public function permissionDenied() {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
- function logout() {
+ public function logout() {
session_destroy();
header("Location:index.php");
}
*
* @return string the used locale or null for none
*/
- function getUFLocale() {
+ public function getUFLocale() {
if (defined('_JEXEC')) {
$conf = JFactory::getConfig();
$locale = $conf->get('language');
/**
* @return string
*/
- function getVersion() {
+ public function getVersion() {
if (class_exists('JVersion')) {
$version = new JVersion;
return $version->getShortVersion();
*
* @return bool
*/
- function loadBootStrap($params = array(), $loadUser = TRUE, $throwError = TRUE, $realPath = NULL, $loadDefines = TRUE) {
+ public function loadBootStrap($params = array(), $loadUser = TRUE, $throwError = TRUE, $realPath = NULL, $loadDefines = TRUE) {
// Setup the base path related constant.
$joomlaBase = dirname(dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__))))))));
*
* @return string $userID logged in user unique identifier
*/
- function getLoggedInUniqueIdentifier() {
+ public function getLoggedInUniqueIdentifier() {
$user = JFactory::getUser();
return $this->getUniqueIdentifierFromUserObject($user);
}
* @param object $user object as described by the CMS
* @return mixed <NULL, number>
*/
- function getUserIDFromUserObject($user) {
+ public function getUserIDFromUserObject($user) {
return !empty($user->id) ? $user->id : NULL;
}
* @return mixed $uniqueIdentifer Unique identifier from the user Framework system
*
*/
- function getUniqueIdentifierFromUserObject($user) {
+ public function getUniqueIdentifierFromUserObject($user) {
return ($user->guest) ? NULL : $user->email;
}
*
* @return array CRM_Core_Module
*/
- function getModules() {
+ public function getModules() {
$result = array();
$db = JFactory::getDbo();
* - $siteName,
* - $siteRoot
*/
- function getDefaultSiteSettings($dir){
+ public function getDefaultSiteSettings($dir){
$config = CRM_Core_Config::singleton();
$url = preg_replace(
'|/administrator|',
*
* @return string
*/
- function getUserRecordUrl($contactID) {
+ public function getUserRecordUrl($contactID) {
$uid = CRM_Core_BAO_UFMatch::getUFId($contactID);
$userRecordUrl = NULL;
// if logged in user is super user, then he can view other users joomla profile
* Is the current user permitted to add a user
* @return bool
*/
- function checkPermissionAddUser() {
+ public function checkPermissionAddUser() {
if (JFactory::getUser()->authorise('core.create', 'com_users')) {
return TRUE;
}
* Output code from error function
* @param string $content
*/
- function outputError($content) {
+ public function outputError($content) {
if (class_exists('JErrorPage')) {
$error = new Exception($content);
JErrorPage::render($error);
/**
* Append to coreResourcesList
*/
- function appendCoreResources(&$list) {
+ public function appendCoreResources(&$list) {
$list[] = 'js/crm.joomla.js';
}
}
* @return void
* @access public
*/
- function setTitle($title, $pageTitle) {
+ public function setTitle($title, $pageTitle) {
return;
}
* @static
* @access public
*/
- function checkPermission($str) {
+ public function checkPermission($str) {
return TRUE;
}
* @return void
* @access public
*/
- function appendBreadCrumb($title, $url) {
+ public function appendBreadCrumb($title, $url) {
return;
}
* @return void
* @access public
*/
- function addHTMLHead($head) {
+ public function addHTMLHead($head) {
return;
}
* @access public
*
*/
- function url($path = NULL, $query = NULL, $absolute = TRUE, $fragment = NULL) {
+ public function url($path = NULL, $query = NULL, $absolute = TRUE, $fragment = NULL) {
if (isset(self::$ufClass)) {
$className = self::$ufClass;
$url = $className::url($path, $query, $absolute, $fragment);
* @return string the url to post the form
* @access public
*/
- function postURL($action) {
+ public function postURL($action) {
return NULL;
}
* @return void
* @access public
*/
- function setEmail(&$user) {}
+ public function setEmail(&$user) {}
/**
* Authenticate a user against the real UF
* @return array Result array
* @access public
*/
- function &authenticate($name, $pass) {
+ public function &authenticate($name, $pass) {
if (isset(self::$ufClass)) {
$className = self::$ufClass;
$result =& $className::authenticate($name, $pass);
*
* @return null as the language is set elsewhere
*/
- function getUFLocale() {
+ public function getUFLocale() {
return NULL;
}
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->is_drupal = FALSE;
$this->supports_form_extensions = False;
}
* @param string $title
* @param null $pageTitle
*/
- function setTitle($title, $pageTitle = NULL) {
+ public function setTitle($title, $pageTitle = NULL) {
return;
}
*
* @return mixed
*/
- static function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
+ public static function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
$retVal = array(1, 1, 12345);
return $retVal;
}
/**
* @param $breadCrumbs
*/
- function appendBreadCrumb($breadCrumbs) {
+ public function appendBreadCrumb($breadCrumbs) {
return;
}
- function resetBreadCrumb() {
+ public function resetBreadCrumb() {
return;
}
/**
* @param string $head
*/
- function addHTMLHead($head) {
+ public function addHTMLHead($head) {
return;
}
- function mapConfigToSSL() {
+ public function mapConfigToSSL() {
global $base_url;
$base_url = str_replace('http://', 'https://', $base_url);
}
*
* @return string
*/
- function postURL($action) {
+ public function postURL($action) {
return;
}
/**
* @param $user
*/
- function getUserID($user) {
+ public function getUserID($user) {
//FIXME: look here a bit closer when testing UFMatch
// this puts the appropriate values in the session, so
*
* @return bool
*/
- function getAllowedToLogin($user) {
+ public function getAllowedToLogin($user) {
return TRUE;
}
/**
* @param string $message
*/
- function setMessage($message) {
+ public function setMessage($message) {
return;
}
- function permissionDenied() {
+ public function permissionDenied() {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
- function logout() {
+ public function logout() {
session_destroy();
header("Location:index.php");
}
/**
* @return string
*/
- function getUFLocale() {
+ public function getUFLocale() {
return NULL;
}
/**
* @return array
*/
- function getModules() {
+ public function getModules() {
return array();
}
* Over-ridable function to get timezone as a string eg.
* @return string Timezone e.g. 'America/Los_Angeles'
*/
- function getTimeZoneString() {
+ public function getTimeZoneString() {
// This class extends Drupal, but we don't want Drupal's behavior; reproduce CRM_Utils_System_Base::getTimeZoneString
return date_default_timezone_get();
}
- function clearResourceCache() {
+ public function clearResourceCache() {
// UGH. Obscure Drupal-specific implementation. Why does UnitTests extend Drupal?
// You should delete this function if the base-classes are properly rearranged.
}
/**
*
*/
- function __construct() {
+ public function __construct() {
/**
* deprecated property to check if this is a drupal install. The correct method is to have functions on the UF classes for all UF specific
* functions and leave the codebase oblivious to the type of CMS
* @return void
* @access public
*/
- function setTitle($title, $pageTitle = NULL) {
+ public function setTitle($title, $pageTitle = NULL) {
if (!$pageTitle) {
$pageTitle = $title;
}
* @access public
* @static
*/
- function appendBreadCrumb($breadCrumbs) {
+ public function appendBreadCrumb($breadCrumbs) {
$breadCrumb = wp_get_breadcrumb();
if (is_array($breadCrumbs)) {
* @access public
* @static
*/
- function resetBreadCrumb() {
+ public function resetBreadCrumb() {
$bc = array();
wp_set_breadcrumb($bc);
}
* @access public
* @static
*/
- function addHTMLHead($head) {
+ public function addHTMLHead($head) {
static $registered = FALSE;
if (!$registered) {
// front-end view
));
}
- static function _showHTMLHead() {
+ public static function _showHTMLHead() {
$region = CRM_Core_Region::instance('wp_head', FALSE);
if ($region) {
echo $region->render('');
* @access public
* @static
*/
- function mapConfigToSSL() {
+ public function mapConfigToSSL() {
global $base_url;
$base_url = str_replace('http://', 'https://', $base_url);
}
* @access public
* @static
*/
- function postURL($action) {
+ public function postURL($action) {
if (!empty($action)) {
return $action;
}
* @access public
* @static
*/
- function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
+ public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
$config = CRM_Core_Config::singleton();
if ($loadCMSBootstrap) {
* @access public
* @static
*/
- function setMessage($message) {
+ public function setMessage($message) {
}
/**
*
* @return bool
*/
- function loadUser( $user ) {
+ public function loadUser( $user ) {
return true;
}
- function permissionDenied() {
+ public function permissionDenied() {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
- function logout() {
+ public function logout() {
// destroy session
if (session_id()) {
session_destroy();
wp_redirect(wp_login_url());
}
- function updateCategories() {}
+ public function updateCategories() {}
/**
* Get the locale set in the hosting CMS
*
* @return string with the locale or null for none
*/
- function getUFLocale() {
+ public function getUFLocale() {
// WPML plugin
if (defined('ICL_LANGUAGE_CODE')) {
$language = ICL_LANGUAGE_CODE;
*
* @return bool
*/
- function loadBootStrap($name = NULL, $pass = NULL) {
+ public function loadBootStrap($name = NULL, $pass = NULL) {
global $wp, $wp_rewrite, $wp_the_query, $wp_query, $wpdb;
$cmsRootPath = $this->cmsRootPath();
*
* @return bool
*/
- function validInstallDir($dir) {
+ public function validInstallDir($dir) {
$includePath = "$dir/wp-includes";
if (
@opendir($includePath) &&
/**
* @return NULL|string
*/
- function cmsRootPath() {
+ public function cmsRootPath() {
$cmsRoot = $valid = NULL;
if (defined('CIVICRM_CMSDIR')) {
if ($this->validInstallDir(CIVICRM_CMSDIR)) {
*
* @return mixed
*/
- function createUser(&$params, $mail) {
+ public function createUser(&$params, $mail) {
$user_data = array(
'ID' => '',
'user_pass' => $params['cms_pass'],
* @param integer $ufID User ID in CMS
* @param string $ufName User name
*/
- function updateCMSName($ufID, $ufName) {
+ public function updateCMSName($ufID, $ufName) {
// CRM-10620
if (function_exists('wp_update_user')) {
$ufID = CRM_Utils_Type::escape($ufID, 'Integer');
* @param $errors
* @param string $emailName
*/
- function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
+ public function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
$config = CRM_Core_Config::singleton();
$dao = new CRM_Core_DAO();
/**
* @return mixed
*/
- function getLoggedInUserObject() {
+ public function getLoggedInUserObject() {
if (function_exists('is_user_logged_in') &&
is_user_logged_in()) {
global $current_user;
*
* @return string $userID logged in user unique identifier
*/
- function getLoggedInUniqueIdentifier() {
+ public function getLoggedInUniqueIdentifier() {
$user = $this->getLoggedInUserObject();
return $this->getUniqueIdentifierFromUserObject($user);
}
* @param object $user object as described by the CMS
* @return mixed <NULL, number>
*/
- function getUserIDFromUserObject($user) {
+ public function getUserIDFromUserObject($user) {
return !empty($user->ID) ? $user->ID : NULL;
}
* @return mixed $uniqueIdentifer Unique identifier from the user Framework system
*
*/
- function getUniqueIdentifierFromUserObject($user) {
+ public function getUniqueIdentifierFromUserObject($user) {
return empty($user->user_email) ? NULL : $user->user_email;
}
* @return string - version number
*
*/
- function getVersion() {
+ public function getVersion() {
if (function_exists('get_bloginfo')) {
return get_bloginfo('version', 'display');
}
* Get timezone as a string
* @return string Timezone e.g. 'America/Los_Angeles'
*/
- function getTimeZoneString() {
+ public function getTimeZoneString() {
return get_option('timezone_string');
}
*
* @return string
*/
- function getUserRecordUrl($contactID) {
+ public function getUserRecordUrl($contactID) {
$uid = CRM_Core_BAO_UFMatch::getUFId($contactID);
if (CRM_Core_Session::singleton()->get('userID') == $contactID || CRM_Core_Permission::checkAnyPerm(array('cms:administer users'))) {
return CRM_Core_Config::singleton()->userFrameworkBaseURL . "wp-admin/user-edit.php?user_id=" . $uid;
*
* @static
*/
- static function getTime($returnFormat = 'YmdHis') {
+ public static function getTime($returnFormat = 'YmdHis') {
return date($returnFormat, self::getTimeRaw());
}
*
* @return int, seconds since epoch
*/
- static function getTimeRaw() {
+ public static function getTimeRaw() {
return time() + self::$_delta;
}
*
* @static
*/
- static function setTime($newDateTime, $returnFormat = 'YmdHis') {
+ public static function setTime($newDateTime, $returnFormat = 'YmdHis') {
self::$_delta = strtotime($newDateTime) - time();
return self::getTime($returnFormat);
}
/**
* Remove any time overrides
*/
- static function resetTime() {
+ public static function resetTime() {
self::$_delta = 0;
}
* @param int $threshold maximum allowed difference (in seconds)
* @return bool
*/
- static function isEqual($a, $b, $threshold = 0) {
+ public static function isEqual($a, $b, $threshold = 0) {
$diff = strtotime($b) - strtotime($a);
return (abs($diff) <= $threshold);
}
* @return array $tokens array of tokens mentioned in field@access public
* @static
*/
- static function getTokens($string) {
+ public static function getTokens($string) {
$matches = array();
$tokens = array();
preg_match_all('/(?<!\{|\\\\)\{(\w+\.\w+)\}(?!\})/',
* @param string $jobID
* @return array contactDetails with hooks swapped out
*/
- function getAnonymousTokenDetails($contactIDs = array(0),
+ public function getAnonymousTokenDetails($contactIDs = array(0),
$returnProperties = NULL,
$skipOnHold = TRUE,
$skipDeceased = TRUE,
* Get Membership Token Details
* @param array $membershipIDs array of membership IDS
*/
- static function getMembershipTokenDetails($membershipIDs) {
+ public static function getMembershipTokenDetails($membershipIDs) {
$memberships = civicrm_api3('membership', 'get', array('options' => array('limit' => 200000), 'membership_id' => array('IN' => (array) $membershipIDs)));
return $memberships['values'];
}
*
* @access public
*/
- static function replaceGreetingTokens(&$tokenString, $contactDetails = NULL, $contactId = NULL, $className = NULL, $escapeSmarty = FALSE) {
+ public static function replaceGreetingTokens(&$tokenString, $contactDetails = NULL, $contactId = NULL, $className = NULL, $escapeSmarty = FALSE) {
if (!$contactDetails && !$contactId) {
return;
*
* @return array
*/
- static function flattenTokens(&$tokens) {
+ public static function flattenTokens(&$tokens) {
$flattenTokens = array();
foreach (array(
/**
* @return array: legacy_token => new_token
*/
- static function legacyContactTokens() {
+ public static function legacyContactTokens() {
return array(
'individual_prefix' => 'prefix_id',
'individual_suffix' => 'suffix_id',
* @param $tokens
* @return array
*/
- static function formatTokensForDisplay($tokens) {
+ public static function formatTokensForDisplay($tokens) {
$sorted = $output = array();
// Sort in ascending order by ignoring word case
* @return string $string String datatype respective to integer datatype@access public
* @static
*/
- static function typeToString($type) {
+ public static function typeToString($type) {
switch ($type) {
case 1:
$string = 'Int';
*
* @access private
*/
- function __construct() {
+ public function __construct() {
global $civicrm_root;
$config = CRM_Core_Config::singleton();
*
* @return CRM_Utils_VersionCheck
*/
- static function &singleton() {
+ public static function &singleton() {
if (!isset(self::$_singleton)) {
self::$_singleton = new CRM_Utils_VersionCheck();
}
*
* @return bool
*/
- static function correctDuplicateWeights($daoName, $fieldValues = NULL, $weightField = 'weight') {
+ public static function correctDuplicateWeights($daoName, $fieldValues = NULL, $weightField = 'weight') {
$selectField = "MIN(id) AS dupeId, count(id) as dupeCount, $weightField as dupeWeight";
$groupBy = "$weightField having dupeCount>1";
*
* @return bool
*/
- static function delWeight($daoName, $fieldID, $fieldValues = NULL, $weightField = 'weight') {
+ public static function delWeight($daoName, $fieldID, $fieldValues = NULL, $weightField = 'weight') {
$object = new $daoName();
$object->id = $fieldID;
if (!$object->find(TRUE)) {
*
* @return int
*/
- static function updateOtherWeights($daoName, $oldWeight, $newWeight, $fieldValues = NULL, $weightField = 'weight') {
+ public static function updateOtherWeights($daoName, $oldWeight, $newWeight, $fieldValues = NULL, $weightField = 'weight') {
$oldWeight = (int ) $oldWeight;
$newWeight = (int ) $newWeight;
*
* @return integer
*/
- static function getNewWeight($daoName, $fieldValues = NULL, $weightField = 'weight') {
+ public static function getNewWeight($daoName, $fieldValues = NULL, $weightField = 'weight') {
$selectField = "id AS fieldID, $weightField AS weight";
$field = CRM_Utils_Weight::query('SELECT', $daoName, $fieldValues, $selectField);
$sameWeightCount = 0;
*
* @return integer
*/
- static function getMax($daoName, $fieldValues = NULL, $weightField = 'weight') {
+ public static function getMax($daoName, $fieldValues = NULL, $weightField = 'weight') {
$selectField = "MAX(ROUND($weightField)) AS max_weight";
$weightDAO = CRM_Utils_Weight::query('SELECT', $daoName, $fieldValues, $selectField);
$weightDAO->fetch();
*
* @return integer
*/
- static function getDefaultWeight($daoName, $fieldValues = NULL, $weightField = 'weight') {
+ public static function getDefaultWeight($daoName, $fieldValues = NULL, $weightField = 'weight') {
$maxWeight = CRM_Utils_Weight::getMax($daoName, $fieldValues, $weightField);
return $maxWeight + 1;
}
* @param $returnURL
* @param null $filter
*/
- static function addOrder(&$rows, $daoName, $idName, $returnURL, $filter = NULL) {
+ public static function addOrder(&$rows, $daoName, $idName, $returnURL, $filter = NULL) {
if (empty($rows)) {
return;
}
}
}
- static function fixOrder() {
+ public static function fixOrder() {
$signature = CRM_Utils_Request::retrieve( '_sgn', 'String', CRM_Core_DAO::$_nullObject);
$signer = new CRM_Utils_Signer(CRM_Core_Key::privateKey(), self::$SIGNABLE_FIELDS);
/**
* @param $url
*/
- static function fixOrderOutput($url) {
+ public static function fixOrderOutput($url) {
if (empty($_GET['snippet']) || $_GET['snippet'] !== 'json') {
CRM_Utils_System::redirect($url);
}
* @return void.
* @access public
*/
- function run($formName, $formLabel = NULL, $arguments = NULL) {
+ public function run($formName, $formLabel = NULL, $arguments = NULL) {
if (is_array($arguments)) {
$mode = CRM_Utils_Array::value('mode', $arguments);
$imageUpload = (bool) CRM_Utils_Array::value('imageUpload', $arguments, FALSE);
static $_methodTable;
- function initialize() {
+ public function initialize() {
if (!self::$_methodTable) {
self::$_methodTable = array(
'getContributionPageData' => array(
}
}
- function &methodTable() {
+ public function &methodTable() {
self::initialize();
return self::$_methodTable;
*
* @return string
*/
- function registerRequest($contributionPageID, $widgetID, $action) {
+ public function registerRequest($contributionPageID, $widgetID, $action) {
return "I registered a request to $action on $contributionPageID from $widgetID";
}
namespace Civi\CCase;
interface CaseChangeListener {
- function onCaseChange(\Civi\CCase\Event\CaseChangeEvent $event);
+ public function onCaseChange(\Civi\CCase\Event\CaseChangeEvent $event);
}
\ No newline at end of file
*/
public $analyzer;
- function __construct($analyzer) {
+ public function __construct($analyzer) {
$this->analyzer = $analyzer;
}
}
namespace Civi\CiUtil;
class Arrays {
- static function collect($arr, $col) {
+ public static function collect($arr, $col) {
$r = array();
foreach ($arr as $k => $item) {
$r[$k] = $item[$col];
namespace Civi\CiUtil\Command;
class AntagonistCommand {
- static function main($argv) {
+ public static function main($argv) {
if (count($argv) != 3) {
print "usage: {$argv[0]} <TargetTest::testFunc> </path/to/suite>\n";
exit(1);
* - expectedResults: array
* - actualResults: array
*/
- static function findAntagonist($target, $candidateTests) {
+ public static function findAntagonist($target, $candidateTests) {
//$phpUnit = new \Civi\CiUtil\EnvTestRunner('./scripts/phpunit', 'EnvTests');
$phpUnit = new \Civi\CiUtil\EnvTestRunner('phpunit', 'tests/phpunit/EnvTests.php');
$expectedResults = $phpUnit->run(array($target));
namespace Civi\CiUtil\Command;
class CompareCommand {
- static function main($argv) {
+ public static function main($argv) {
if (empty($argv[1])) {
echo "summary: Compares the output of different test runs\n";
echo "usage: phpunit-compare [--out=txt|csv] [--phpunit-json|--jenkins-xml] <file1> <file2>...\n";
namespace Civi\CiUtil\Command;
class LsCommand {
- static function main($argv) {
+ public static function main($argv) {
$paths = $argv;
array_shift($paths);
foreach (\Civi\CiUtil\PHPUnitScanner::findTestsByPath($paths) as $test) {
var $headers;
var $hasHeader = FALSE;
- function __construct($headers) {
+ public function __construct($headers) {
$this->headers = $headers;
}
- function printHeader() {
+ public function printHeader() {
if ($this->hasHeader) {
return;
}
$this->hasHeader = TRUE;
}
- function printRow($test, $values) {
+ public function printRow($test, $values) {
$this->printHeader();
printf("%-90s ", $test);
foreach ($values as $value) {
var $headers;
var $hasHeader = FALSE;
- function __construct($file, $headers) {
+ public function __construct($file, $headers) {
$this->file = fopen($file, "w");
$this->headers = $headers;
}
- function printHeader() {
+ public function printHeader() {
if ($this->hasHeader) {
return;
}
$this->hasHeader = TRUE;
}
- function printRow($test, $values) {
+ public function printRow($test, $values) {
$this->printHeader();
$row = $values;
array_unshift($row, $test);
protected $phpunit;
protected $envTestSuite;
- function __construct($phpunit = "phpunit", $envTestSuite = 'EnvTests') {
+ public function __construct($phpunit = "phpunit", $envTestSuite = 'EnvTests') {
$this->phpunit = $phpunit;
$this->envTestSuite = $envTestSuite;
}
/**
* @return array<string> class names
*/
- static function _findTestClasses($path) {
+ public static function _findTestClasses($path) {
// print_r(array(
// 'loading' => $path,
// get_included_files()
/**
* @return array (string $file => string $class)
*/
- static function findTestClasses($paths) {
+ public static function findTestClasses($paths) {
$testClasses = array();
$finder = new Finder();
* - class: string
* - method: string
*/
- static function findTestsByPath($paths) {
+ public static function findTestsByPath($paths) {
$r = array();
$testClasses = self::findTestClasses($paths);
foreach ($testClasses as $testFile => $testClass) {
*/
public $result;
- function __construct($object, $result) {
+ public function __construct($object, $result) {
$this->object = $object;
$this->result = $result;
}
*/
public $object;
- function __construct($object) {
+ public function __construct($object) {
$this->object = $object;
}
}
*/
public $object;
- function __construct($action, $entity, $id, $object) {
+ public function __construct($action, $entity, $id, $object) {
$this->action = $action;
$this->entity = $entity;
$this->id = $id;
*/
public $params;
- function __construct($action, $entity, $id, $params) {
+ public function __construct($action, $entity, $id, $params) {
$this->action = $action;
$this->entity = $entity;
$this->id = $id;
* @param CRM_Core_DAO $dao handle for the DB connection that will execute transaction statements
* (all we really care about is the query() function)
*/
- function __construct($dao) {
+ public function __construct($dao) {
$this->dao = $dao;
}
/**
* @return array
*/
- function checkServerVariables() {
+ public function checkServerVariables() {
$results = array(
'title' => 'CiviCRM PHP server variables',
'severity' => $this::REQUIREMENT_OK,
*
* @return array
*/
- function checkMysqlLockTables($db_config) {
+ public function checkMysqlLockTables($db_config) {
$results = array(
'title' => 'CiviCRM MySQL Lock Tables',
'severity' => $this::REQUIREMENT_OK,
/**
* Pass zero as an id and make sure no Assignees are retrieved
*/
- function testRetrieveAssigneeIdsByActivityIdNoId() {
+ public function testRetrieveAssigneeIdsByActivityIdNoId() {
$activity = $this->activityCreate();
$activityId = CRM_Activity_BAO_ActivityAssignment::retrieveAssigneeIdsByActivityId(0);
/**
* Pass null as an id and make sure no Assignees are retrieved
*/
- function testRetrieveAssigneeIdsByActivityIdNullId() {
+ public function testRetrieveAssigneeIdsByActivityIdNullId() {
$activity = $this->activityCreate();
$activityId = CRM_Activity_BAO_ActivityAssignment::retrieveAssigneeIdsByActivityId(Null);
/**
* Pass a string as an id and make sure no Assignees are retrieved
*/
- function testRetrieveAssigneeIdsByActivityIdString() {
+ public function testRetrieveAssigneeIdsByActivityIdString() {
$activity = $this->activityCreate();
$activityId = CRM_Activity_BAO_ActivityAssignment::retrieveAssigneeIdsByActivityId('test');
/**
* Pass a known activity id as an id and make sure 1 Assignees is retrieved
*/
- function testRetrieveAssigneeIdsByActivityIdOneId() {
+ public function testRetrieveAssigneeIdsByActivityIdOneId() {
$activity = $this->activityCreate();
$activityId = CRM_Activity_BAO_ActivityAssignment::retrieveAssigneeIdsByActivityId($activity['id']);
/**
* Pass zero as an id and make sure no Assignees are retrieved
*/
- function testGetAssigneeNamesNoId() {
+ public function testGetAssigneeNamesNoId() {
$activity = $this->activityCreate();
$assignees = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames(0);
/**
* Pass Null as an id and make sure no Assignees are retrieved
*/
- function testGetAssigneeNamesNullId() {
+ public function testGetAssigneeNamesNullId() {
$activity = $this->activityCreate();
$assignees = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames(Null);
/**
* Pass a known activity id as an id and make sure 1 Assignees is retrieved
*/
- function testGetAssigneeNamesOneId() {
+ public function testGetAssigneeNamesOneId() {
$activity = $this->activityCreate();
$assignees = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames(array($activity['id']));
$this->assertEquals(count($assignees), 1, '1 assignee names retrieved');
* Class CRM_Activity_BAO_ActivityTest
*/
class CRM_Activity_BAO_ActivityTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function tearDown() {
+ public function tearDown() {
// truncate a few tables
$tablesToTruncate = array('civicrm_contact', 'civicrm_activity', 'civicrm_activity_contact');
$this->quickCleanup($tablesToTruncate);
* Testcases for create() method
* create() method Add/Edit activity.
*/
- function testCreate() {
+ public function testCreate() {
$contactId = Contact::createIndividual();
$params = array(
* Testcase for getContactActivity() method.
* getContactActivity() method get activities detail for given target contact id
*/
- function testGetContactActivity() {
+ public function testGetContactActivity() {
$contactId = Contact::createIndividual();
$params = array(
'first_name' => 'liz',
* retrieve($params, $defaults) method return activity detail for given params
* and set defaults.
*/
- function testRetrieve() {
+ public function testRetrieve() {
$contactId = Contact::createIndividual();
$params = array(
'first_name' => 'liz',
* Testcase for deleteActivity() method.
* deleteActivity($params) method deletes activity for given params.
*/
- function testDeleteActivity() {
+ public function testDeleteActivity() {
$contactId = Contact::createIndividual();
$params = array(
'first_name' => 'liz',
* Testcase for deleteActivityTarget() method.
* deleteActivityTarget($activityId) method deletes activity target for given activity id.
*/
- function testDeleteActivityTarget() {
+ public function testDeleteActivityTarget() {
$contactId = Contact::createIndividual();
$params = array(
'first_name' => 'liz',
* Testcase for deleteActivityAssignment() method.
* deleteActivityAssignment($activityId) method deletes activity assignment for given activity id.
*/
- function testDeleteActivityAssignment() {
+ public function testDeleteActivityAssignment() {
$contactId = Contact::createIndividual();
$params = array(
'first_name' => 'liz',
/**
* Test getActivitiesCount BAO method
*/
- function testGetActivitiesCountforAdminDashboard() {
+ public function testGetActivitiesCountforAdminDashboard() {
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
$this->createFlatXMLDataSet(
/**
* Test getActivitiesCount BAO method
*/
- function testGetActivitiesCountforNonAdminDashboard() {
+ public function testGetActivitiesCountforNonAdminDashboard() {
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
$this->createFlatXMLDataSet(
/**
* Test getActivitiesCount BAO method
*/
- function testGetActivitiesCountforContactSummary() {
+ public function testGetActivitiesCountforContactSummary() {
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
$this->createFlatXMLDataSet(
/**
* Test getActivitiesCount BAO method
*/
- function testGetActivitiesCountforContactSummaryWithNoActivities() {
+ public function testGetActivitiesCountforContactSummaryWithNoActivities() {
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
$this->createFlatXMLDataSet(
/**
* Test getActivities BAO method
*/
- function testGetActivitiesforAdminDashboard() {
+ public function testGetActivitiesforAdminDashboard() {
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
$this->createFlatXMLDataSet(
/**
* Test getActivities BAO method
*/
- function testGetActivitiesforNonAdminDashboard() {
+ public function testGetActivitiesforNonAdminDashboard() {
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
$this->createFlatXMLDataSet(
/**
* Test getActivities BAO method
*/
- function testGetActivitiesforContactSummary() {
+ public function testGetActivitiesforContactSummary() {
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
$this->createFlatXMLDataSet(
/**
* Test getActivities BAO method
*/
- function testGetActivitiesforContactSummaryWithNoActivities() {
+ public function testGetActivitiesforContactSummaryWithNoActivities() {
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
$this->createFlatXMLDataSet(
*/
protected $_contactID4 = NULL;
- function setUp() {
+ public function setUp() {
parent::setUp();
$params = array(
* This method is called after a test is executed.
*
*/
- function tearDown()
+ public function tearDown()
{
$this->quickCleanUpFinancialEntities();
$this->relationshipTypeDelete($this->_relationshipTypeId);
/**
* Test Import
*/
- function testProcessMembership() {
+ public function testProcessMembership() {
$form = new CRM_Batch_Form_Entry();
$params = $this->getMembershipData();
$this->assertTrue($form->testProcessMembership($params));
/**
* Test Contribution Import
*/
- function testProcessContribution() {
+ public function testProcessContribution() {
$this->offsetDefaultPriceSet();
$form = new CRM_Batch_Form_Entry();
$params = $this->getContributionData();
* Data provider for test process membership
* @return array
*/
- function getMembershipData() {
+ public function getMembershipData() {
return array(
'batch_id' => 4,
/**
* @return array
*/
- function getContributionData() {
+ public function getContributionData() {
return array(
//'batch_id' => 4,
'primary_profiles' => array(1 => NULL, 2 => NULL, 3 => NULL),
/*
* Test that one (ane only one) role (option value) is deleted by the updateCiviACLRole function
*/
- function testACLRoleDeleteFunctionality() {
+ public function testACLRoleDeleteFunctionality() {
$optionGroup = civicrm_api('OptionGroup', 'Get', array(
'version' => 3,
'name' => 'acl_role',
*/
class CRM_Case_BAO_CaseTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->tablesToTruncate = array(
$this->quickCleanup($this->tablesToTruncate, TRUE);
}
- function testAddCaseToContact() {
+ public function testAddCaseToContact() {
$params = array(
'case_id' => 1,
'contact_id' => 17,
$this->assertEquals('Test Contact - Housing Support', $recent[0]['title']);
}
- function testGetCaseType() {
+ public function testGetCaseType() {
$caseTypeLabel = CRM_Case_BAO_Case::getCaseType(1);
$this->assertEquals('Housing Support', $caseTypeLabel);
}
- function testRetrieveCaseIdsByContactId() {
+ public function testRetrieveCaseIdsByContactId() {
$caseIds = CRM_Case_BAO_Case::retrieveCaseIdsByContactId(3, FALSE, 'housing_support');
$this->assertEquals(array(1), $caseIds);
}
* }
*/
- function testGetCasesSummary() {
+ public function testGetCasesSummary() {
$cases = CRM_Case_BAO_Case::getCasesSummary(TRUE, 3);
$this->assertEquals(1, $cases['rows']['Housing Support']['Ongoing']['count']);
}
- function testGetUnclosedCases() {
+ public function testGetUnclosedCases() {
$params = array(
'case_type' => 'ousing Suppor',
);
$this->assertEquals('Housing Support', $cases[1]['case_type']);
}
- function testGetContactCases() {
+ public function testGetContactCases() {
$cases = CRM_Case_BAO_Case::getContactCases(3);
$this->assertEquals('Housing Support', $cases[1]['case_type']);
}
CRM_Core_ManagedEntities::singleton(TRUE)->reconcile();
}
- function tearDown() {
+ public function tearDown() {
parent::tearDown();
CRM_Core_ManagedEntities::singleton(TRUE)->reconcile();
}
/**
* Edit the definition of ForkableCaseType
*/
- function testForkable() {
+ public function testForkable() {
$caseTypeId = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseType', 'ForkableCaseType', 'id', 'name');
$this->assertTrue(is_numeric($caseTypeId) && $caseTypeId > 0);
/**
* Attempt to edit the definition of UnforkableCaseType. This fails.
*/
- function testUnforkable() {
+ public function testUnforkable() {
$caseTypeId = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseType', 'UnforkableCaseType', 'id', 'name');
$this->assertTrue(is_numeric($caseTypeId) && $caseTypeId > 0);
$this->assertDBNull('CRM_Case_BAO_CaseType', $caseTypeId, 'definition', 'id', "Should not have DB-based definition");
* @param $caseTypes
* @see \CRM_Utils_Hook::caseTypes
*/
- function hook_caseTypes(&$caseTypes) {
+ public function hook_caseTypes(&$caseTypes) {
$caseTypes['ForkableCaseType'] = array(
'module' => 'civicrm',
'name' => 'ForkableCaseType',
*
* @return array
*/
- function definitionProvider() {
+ public function definitionProvider() {
$fixtures['empty-defn'] = array(
'json' => json_encode(array()),
'xml' => '<?xml version="1.0" encoding="utf-8" ?>
* @param string $inputXml
* @dataProvider definitionProvider
*/
- function testConvertXmlToDefinition($fixtureName, $expectedJson, $inputXml) {
+ public function testConvertXmlToDefinition($fixtureName, $expectedJson, $inputXml) {
$xml = simplexml_load_string($inputXml);
$expectedDefinition = json_decode($expectedJson, TRUE);
$actualDefinition = CRM_Case_BAO_CaseType::convertXmlToDefinition($xml);
* @param string $expectedXml
* @dataProvider definitionProvider
*/
- function testConvertDefinitionToXml($fixtureName, $inputJson, $expectedXml) {
+ public function testConvertDefinitionToXml($fixtureName, $inputJson, $expectedXml) {
$inputDefinition = json_decode($inputJson, TRUE);
$actualXml = CRM_Case_BAO_CaseType::convertDefinitionToXML('Housing Support', $inputDefinition);
$this->assertEquals($this->normalizeXml($expectedXml), $this->normalizeXml($actualXml));
* @param string $inputXml
* @dataProvider definitionProvider
*/
- function testRoundtrip_XmlToJsonToXml($fixtureName, $ignore, $inputXml) {
+ public function testRoundtrip_XmlToJsonToXml($fixtureName, $ignore, $inputXml) {
$tempDefinition = CRM_Case_BAO_CaseType::convertXmlToDefinition(simplexml_load_string($inputXml));
$actualXml = CRM_Case_BAO_CaseType::convertDefinitionToXML('Housing Support', $tempDefinition);
$this->assertEquals($this->normalizeXml($inputXml), $this->normalizeXml($actualXml));
* @param string $ignore
* @dataProvider definitionProvider
*/
- function testRoundtrip_JsonToXmlToJson($fixtureName, $inputJson, $ignore) {
+ public function testRoundtrip_JsonToXmlToJson($fixtureName, $inputJson, $ignore) {
$tempXml = CRM_Case_BAO_CaseType::convertDefinitionToXML('Housing Support', json_decode($inputJson, TRUE));
$actualDefinition = CRM_Case_BAO_CaseType::convertXmlToDefinition(simplexml_load_string($tempXml));
$expectedDefinition = json_decode($inputJson, TRUE);
* @param string $xml
* @return string
*/
- function normalizeXml($xml) {
+ public function normalizeXml($xml) {
return trim(
preg_replace(":\n*<:", "\n<", // tags on new lines
preg_replace("/\n[\n ]+/", "\n", // no leading whitespace
*/
class CRM_Case_PseudoConstantTest extends CiviCaseTestCase {
- function testCaseType() {
+ public function testCaseType() {
CRM_Core_PseudoConstant::flush();
$caseTypes = CRM_Case_PseudoConstant::caseType();
$expectedTypes = array(
}
- function testGetAllDeclaredActivityTypes() {
+ public function testGetAllDeclaredActivityTypes() {
$repo = new CRM_Case_XMLRepository(
array('CaseTypeWithTwoActivityTypes', 'CaseTypeWithThreeActivityTypes'),
array(
$this->assertEquals($expected, $actual);
}
- function testGetAllDeclaredRelationshipTypes() {
+ public function testGetAllDeclaredRelationshipTypes() {
$repo = new CRM_Case_XMLRepository(
array('CaseTypeWithTwoRoles', 'CaseTypeWithThreeRoles', 'CaseTypeWithSingleActivityType'),
array(
$this->assertEquals($expected, $actual);
}
- function testGetActivityReferenceCount_1() {
+ public function testGetActivityReferenceCount_1() {
$repo = new CRM_Case_XMLRepository(
array('CaseTypeWithSingleActivityType'),
array(
$this->assertEquals(0, $repo->getActivityReferenceCount('Third Activity Type'));
}
- function testGetActivityReferenceCount_23() {
+ public function testGetActivityReferenceCount_23() {
$repo = new CRM_Case_XMLRepository(
array('CaseTypeWithTwoActivityTypes', 'CaseTypeWithThreeActivityTypes'),
array(
$this->assertEquals(1, $repo->getActivityReferenceCount('Third Activity Type'));
}
- function testGetRoleReferenceCount_1() {
+ public function testGetRoleReferenceCount_1() {
$repo = new CRM_Case_XMLRepository(
array('CaseTypeWithSingleRole', 'CaseTypeWithSingleActivityType'),
array(
$this->assertEquals(0, $repo->getRelationshipReferenceCount('Third Role'));
}
- function testGetRoleReferenceCount_23() {
+ public function testGetRoleReferenceCount_23() {
$repo = new CRM_Case_XMLRepository(
array('CaseTypeWithTwoRoles', 'CaseTypeWithThreeRoles', 'CaseTypeWithSingleActivityType'),
array(
* Class CRM_Contact_BAO_ContactTest
*/
class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
* Test case for add( )
* test with empty params.
*/
- function testAddWithEmptyParams() {
+ public function testAddWithEmptyParams() {
$params = array( );
$contact = CRM_Contact_BAO_Contact::add($params);
* test with names
* (create and update modes)
*/
- function testAddWithNames() {
+ public function testAddWithNames() {
$firstName = 'Shane';
$lastName = 'Whatson';
$params = array(
* test with all contact params
* (creat and update modes)
*/
- function testAddWithAll() {
+ public function testAddWithAll() {
//take the common contact params
$params = $this->contactParams();
* Test case for add( )
* test with All contact types.
*/
- function testAddWithAllContactTypes() {
+ public function testAddWithAllContactTypes() {
$firstName = 'Bill';
$lastName = 'Adams';
$params = array(
* Test case for create( )
* test with missing params.
*/
- function testCreateWithEmptyParams() {
+ public function testCreateWithEmptyParams() {
$params = array(
'first_name' => 'Bill',
'last_name' => 'Adams',
* test with all params.
* ( create and update modes ).
*/
- function testCreateWithAll() {
+ public function testCreateWithAll() {
//take the common contact params
$params = $this->contactParams();
$params['note'] = 'test note';
* Test case for resolveDefaults( )
* test all pseudoConstant, stateProvince, country.
*/
- function testResolveDefaults() {
+ public function testResolveDefaults() {
$params = array(
'prefix_id' => 3,
'suffix_id' => 2,
* Test case for retrieve( )
* test with all values.
*/
- function testRetrieve() {
+ public function testRetrieve() {
//take the common contact params
$params = $this->contactParams();
$params['note'] = 'test note';
/**
* Test case for deleteContact( )
*/
- function testDeleteContact() {
+ public function testDeleteContact() {
$contactParams = $this->contactParams();
//create custom data
* test with all params.
* ( create and update modes )
*/
- function testCreateProfileContact() {
+ public function testCreateProfileContact() {
$fields = CRM_Contact_BAO_Contact::exportableFields('Individual');
//current employer field for individual
/**
* Test case for getContactDetails( )
*/
- function testGetContactDetails() {
+ public function testGetContactDetails() {
//get the contact params
$params = $this->contactParams();
* Test case for
* importableFields( ) and exportableFields( )
*/
- function testFields() {
+ public function testFields() {
$allImpFileds = CRM_Contact_BAO_Contact::importableFields('All');
$allExpFileds = CRM_Contact_BAO_Contact::importableFields('All');
//Now check all fields
* Test case for getPrimaryEmail( )
*
*/
- function testGetPrimaryEmail() {
+ public function testGetPrimaryEmail() {
//get the contact params
$params = $this->contactParams();
$params['email'][2] = $params['email'][1];
* Test case for getPrimaryOpenId( )
*
*/
- function testGetPrimaryOpenId() {
+ public function testGetPrimaryOpenId() {
//get the contact params
$params = $this->contactParams();
$params['openid'][2] = $params['openid'][1];
* Test case for matchContactOnEmail( )
*
*/
- function testMatchContactOnEmail() {
+ public function testMatchContactOnEmail() {
//get the contact params
$params = $this->contactParams();
//create contact
* Test case for getContactType( )
*
*/
- function testGetContactType() {
+ public function testGetContactType() {
//get the contact params
$params = $this->contactParams();
//create contact
* Test case for displayName( )
*
*/
- function testDisplayName() {
+ public function testDisplayName() {
//get the contact params
$params = $this->contactParams();
* Test case for getDisplayAndImage( )
*
*/
- function testGetDisplayAndImage() {
+ public function testGetDisplayAndImage() {
//get the contact params
$params = $this->contactParams();
/**
* Ensure that created_date and modified_date are set
*/
- function testTimestamps_contact() {
+ public function testTimestamps_contact() {
$test = $this;
$this->_testTimestamps(array(
'UPDATE' => function ($contactId) use ($test) {
/**
* Ensure that civicrm_contact.modified_date is updated when manipulating a phone record
*/
- function testTimestamps_email() {
+ public function testTimestamps_email() {
$test = $this;
$this->_testTimestamps(array(
'INSERT' => function ($contactId) use ($test) {
/**
* Ensure that civicrm_contact.modified_date is updated when manipulating an email
*/
- function testTimestamps_phone() {
+ public function testTimestamps_phone() {
$test = $this;
$this->_testTimestamps(array(
'INSERT' => function ($contactId) use ($test) {
* Ensure that civicrm_contact.modified_date is updated when contact-related
* custom data
*/
- function testTimestamps_custom() {
+ public function testTimestamps_custom() {
$customGroup = Custom::createGroup(array(), 'Individual');
$this->assertNotNull($customGroup);
$fields = array(
*
* @param $callbacks array ($name => $callable)
*/
- function _testTimestamps($callbacks) {
+ public function _testTimestamps($callbacks) {
CRM_Core_DAO::triggerRebuild();
$contactId = Contact::createIndividual();
*/
class CRM_Contact_BAO_ContactType_ContactSearchTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$students = 'indivi_student'.substr(sha1(rand()), 0, 7);
$params = array(
* Search with only type
* success expected.
*/
- function testSearchWithType() {
+ public function testSearchWithType() {
// for type:Individual
$params = array('contact_type' => 'Individual', 'version' => 3);
* Search with only subtype
* success expected.
*/
- function testSearchWithSubype() {
+ public function testSearchWithSubype() {
// for subtype:Student
$params = array('contact_sub_type' => $this->student, 'version' => 3);
* Search with type as well as subtype
* success expected.
*/
- function testSearchWithTypeSubype() {
+ public function testSearchWithTypeSubype() {
// for type:individual subtype:Student
$params = array('contact_sub_type' => $this->student, 'version' => 3);
/**
* Search with invalid type or subtype
*/
- function testSearchWithInvalidData() {
+ public function testSearchWithInvalidData() {
// for invalid type
$params = array('contact_type' => 'Invalid' . CRM_Core_DAO::VALUE_SEPARATOR . 'Invalid', 'version' => 3);
$result = civicrm_api('contact', 'get', $params);
/**
* Search with wrong type or subtype
*/
- function testSearchWithWrongdData() {
+ public function testSearchWithWrongdData() {
// for type:Individual subtype:Sponsor
$defaults = array();
*/
class CRM_Contact_BAO_ContactType_ContactTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$params = array(
$this->team = $params['name'];
}
- function tearDown() {
+ public function tearDown() {
$this->quickCleanup(array('civicrm_contact'));
$query = "
DELETE FROM civicrm_contact_type
* success expected
*
*/
- function testCreateContact() {
+ public function testCreateContact() {
//check for Type:Individual
$params = array(
'first_name' => 'Anne',
* Update the contact with no subtype to a valid subtype
* success expected
*/
- function testUpdateContactNosubtypeToValid() {
+ public function testUpdateContactNosubtypeToValid() {
$params = array(
'first_name' => 'Anne',
'last_name' => 'Grant',
* Update the contact with subtype to another valid subtype
* success expected
*/
- function testUpdateContactSubtype() {
+ public function testUpdateContactSubtype() {
$params = array(
'first_name' => 'Anne',
'last_name' => 'Grant',
*/
class CRM_Contact_BAO_ContactType_ContactTypeTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$labelsub1 = 'sub1_individual'.substr(sha1(rand()), 0, 7);
$params = array(
* Test contactTypes() and subTypes() methods with valid data
* success expected
*/
- function testGetMethods() {
+ public function testGetMethods() {
// check all contact types
$contactTypes = array('Individual', 'Organization', 'Household');
/**
* Test subTypes() methods with invalid data
*/
- function testGetMethodsInvalid() {
+ public function testGetMethodsInvalid() {
$params = 'invalid';
$result = CRM_Contact_BAO_ContactType::subTypes($params);
* Test add() methods with valid data
* success expected
*/
- function testAdd() {
+ public function testAdd() {
$params = array(
'label' => 'indiviSubType',
/**
* Test add() with invalid data
*/
- function testAddInvalid1() {
+ public function testAddInvalid1() {
// parent id does not exist in db
$params = array(
$this->assertEquals($result, NULL, 'In line ' . __LINE__);
}
- function testAddInvalid2() {
+ public function testAddInvalid2() {
// params does not have name and label keys
$params = array(
$this->assertEquals($result, NULL, 'In line ' . __LINE__);
}
- function testAddInvalid3() {
+ public function testAddInvalid3() {
// params does not have parent_id
$params = array(
* Test del() with valid data
* success expected
*/
- function testDel() {
+ public function testDel() {
$params = array(
'label' => 'indiviSubType',
/**
* Test del() with invalid data
*/
- function testDelInvalid() {
+ public function testDelInvalid() {
$del = CRM_Contact_BAO_ContactType::del(NULL);
$this->assertEquals($del, FALSE, 'In line ' . __LINE__);
*/
class CRM_Contact_BAO_ContactType_RelationshipTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
//create contact subtypes
$this->organization_sponsor = Contact::create($params);
}
- function tearDown() {
+ public function tearDown() {
$this->quickCleanup(array('civicrm_contact'));
$query = "
* success expected
*
*/
- function testRelationshipTypeAddIndiviParent() {
+ public function testRelationshipTypeAddIndiviParent() {
//check Individual to Parent RelationshipType
$params = array(
'name_a_b' => 'indivToparent',
$this->relationshipTypeDelete($result->id);
}
- function testRelationshipTypeAddSponcorIndivi() {
+ public function testRelationshipTypeAddSponcorIndivi() {
//check Sponcor to Individual RelationshipType
$params = array(
'name_a_b' => 'SponsorToIndiv',
$this->relationshipTypeDelete($result->id);
}
- function testRelationshipTypeAddStudentSponcor() {
+ public function testRelationshipTypeAddStudentSponcor() {
//check Student to Sponcer RelationshipType
$params = array(
'name_a_b' => 'StudentToSponser',
* Methods create relationshipe within same contact type with invalid Relationships
*
*/
- function testRelationshipCreateInvalidWithinSameType() {
+ public function testRelationshipCreateInvalidWithinSameType() {
//check for Individual to Parent
$relTypeParams = array(
'name_a_b' => 'indivToparent',
* Methods create relationshipe within diff contact type with invalid Relationships
*
*/
- function testRelCreateInvalidWithinDiffTypeSpocorIndivi() {
+ public function testRelCreateInvalidWithinDiffTypeSpocorIndivi() {
//check for Sponcer to Individual
$relTypeParams = array(
'name_a_b' => 'SponsorToIndiv',
$this->relationshipTypeDelete($relType->id);
}
- function testRelCreateInvalidWithinDiffTypeStudentSponcor() {
+ public function testRelCreateInvalidWithinDiffTypeStudentSponcor() {
//check for Student to Sponcer
$relTypeParams = array(
'name_a_b' => 'StudentToSponser',
* success expected
*
*/
- function testRelationshipCreateWithinSameType() {
+ public function testRelationshipCreateWithinSameType() {
//check for Individual to Parent
$relTypeParams = array(
'name_a_b' => 'indivToparent',
* success expected
*
*/
- function testRelCreateWithinDiffTypeSponsorIndivi() {
+ public function testRelCreateWithinDiffTypeSponsorIndivi() {
//check for Sponcer to Individual
$relTypeParams = array(
'name_a_b' => 'SponsorToIndiv',
$this->relationshipTypeDelete($relType->id);
}
- function testRelCreateWithinDiffTypeStudentSponsor() {
+ public function testRelCreateWithinDiffTypeStudentSponsor() {
//check for Student to Sponcer
$relTypeParams = array(
'name_a_b' => 'StudentToSponsor',
/**
* Manually add and remove contacts from a smart group
*/
- function testManualAddRemove() {
+ public function testManualAddRemove() {
// Create smart group $g
$params = array(
'name' => 'Deceased Contacts',
* Allow removing contact from a parent group even if contact is in
* a child group. (CRM-8858)
*/
- function testRemoveFromParentSmartGroup() {
+ public function testRemoveFromParentSmartGroup() {
// Create smart group $parent
$params = array(
'name' => 'Deceased Contacts',
* @param $expectedContactIds array(int)
* @param $groupId int
*/
- function assertCacheMatches($expectedContactIds, $groupId) {
+ public function assertCacheMatches($expectedContactIds, $groupId) {
$sql = 'SELECT contact_id FROM civicrm_group_contact_cache WHERE group_id = %1';
$params = array(1 => array($groupId, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($sql, $params);
/**
* @param $objects array DAO or BAO objects
*/
- function registerTestObjects($objects) {
+ public function registerTestObjects($objects) {
//if (is_object($objects)) {
// $objects = array($objects);
//}
}
}
- function deleteTestObjects() {
+ public function deleteTestObjects() {
// Note: You might argue that the FK relations between test
// objects could make this problematic; however, it should
// behave intuitively as long as we mentally split our
/**
* Test case for add( )
*/
- function testAdd() {
+ public function testAdd() {
//creates a test group contact by recursively creation
//lets create 10 groupContacts for fun
/**
* Test case for getGroupId( )
*/
- function testGetGroupId() {
+ public function testGetGroupId() {
//creates a test groupContact object
/**
* Test case for contact search: CRM-6706, CRM-6586 Parent Group search should return contacts from child groups too.
*/
- function testContactSearchByParentGroup() {
+ public function testContactSearchByParentGroup() {
// create a parent group
// TODO: This is not an API test!!
$groupParams1 = array(
/**
* Test case for add( )
*/
- function testAddSimple() {
+ public function testAddSimple() {
$checkParams = $params = array(
'title' => 'Group Uno',
);
}
- function testAddSmart() {
+ public function testAddSmart() {
$checkParams = $params = array(
'title' => 'Group Dos',
* Load all sql data sets & return an array of saved searches
* @return array
*/
- function dataProviderSavedSearch() {
+ public function dataProviderSavedSearch() {
$this->loadSavedSearches();
$results = CRM_Core_DAO::singleValueQuery('SELECT GROUP_CONCAT(id) FROM civicrm_group WHERE saved_search_id IS NOT NULL');
/**
* Load saved search sql files into the DB
*/
- function loadSavedSearches() {
+ public function loadSavedSearches() {
$dsn = CRM_Core_Config::singleton()->dsn;
foreach (glob(dirname(__FILE__) . "/SavedSearchDataSets/*.sql") as $file) {
CRM_Utils_File::sourceSQLFile($dsn, $file);
* Copy the output to a single sql file and place in the SavedSearchDataSets folder - use the group number as the prefix.
* Try to keep as much of the real world irregular glory as you can! Don't change the table ids to be number 1 as this can hide errors
*/
- function testGroupData() {
+ public function testGroupData() {
$groups = $this->dataProviderSavedSearch();
foreach ($groups[0] as $groupID) {
$group = new CRM_Contact_BAO_Group();
return new CRM_Contact_BAO_QueryTestDataProvider;
}
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function tearDown() {
+ public function tearDown() {
$tablesToTruncate = array(
'civicrm_group_contact',
'civicrm_group',
* Test CRM_Contact_BAO_Query::searchQuery()
* @dataProvider dataProvider
*/
- function testSearch($fv, $count, $ids, $full) {
+ public function testSearch($fv, $count, $ids, $full) {
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
$this->createFlatXMLDataSet(
* Check that we get a successful result querying for home address
* CRM-14263 search builder failure with search profile & address in criteria
*/
- function testSearchProfileHomeCityCRM14263() {
+ public function testSearchProfileHomeCityCRM14263() {
$contactID = $this->individualCreate();
CRM_Core_Config::singleton()->defaultSearchProfileID = 1;
$this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1,));
* Check that we get a successful result querying for home address
* CRM-14263 search builder failure with search profile & address in criteria
*/
- function testSearchProfileHomeCityNoResultsCRM14263() {
+ public function testSearchProfileHomeCityNoResultsCRM14263() {
$contactID = $this->individualCreate();
CRM_Core_Config::singleton()->defaultSearchProfileID = 1;
$this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1,));
* We are retrieving primary here - checking the actual sql seems super prescriptive - but since the massive query object has
* so few tests detecting any change seems good here :-)
*/
- function testSearchProfilePrimaryCityCRM14263()
+ public function testSearchProfilePrimaryCityCRM14263()
{
$contactID = $this->individualCreate();
CRM_Core_Config::singleton()->defaultSearchProfileID = 1;
return new CRM_Contact_Form_Search_Custom_GroupTestDataProvider;
}
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function tearDown() {}
+ public function tearDown() {}
/**
* Test CRM_Contact_Form_Search_Custom_Group::count()
*/
class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->_financialTypeID = 1;
}
- function tearDown() {
+ public function tearDown() {
}
/**
* Create() method (create Contribution Page)
*/
- function testCreate() {
+ public function testCreate() {
$params = array(
'qfkey' => '9a3ef3c08879ad4c8c109b21c583400e',
/**
* test setIsActive() method
*/
- function testsetIsActive() {
+ public function testsetIsActive() {
$params = array(
'title' => 'Test Contribution Page',
/**
* Test setValues() method
*/
- function testSetValues() {
+ public function testSetValues() {
$params = array(
'title' => 'Test Contribution Page',
/**
* Test copy() method
*/
- function testcopy() {
+ public function testcopy() {
$params = array(
'qfkey' => '9a3ef3c08879ad4c8c109b21c583400e',
'title' => 'Test Contribution Page',
/**
* Test checkRecurPaymentProcessor() method
*/
- function testcheckRecurPaymentProcessor() {
+ public function testcheckRecurPaymentProcessor() {
//@todo paypalpro create seems to fail silently without causing this class to fail
// $this->paymentProcessorCreate may be a better option
$paymentProcessor = PaypalPro::create();
class CRM_Contribute_BAO_ContributionRecurTest extends CiviUnitTestCase {
protected $_params = array();
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->_ids['payment_processor'] = $this->paymentProcessorCreate();
$this->_params = array(
);
}
- function teardown() {
+ public function teardown() {
$this->quickCleanup(array('civicrm_contribution_recur', 'civicrm_payment_processor'));
}
* Test that an object can be retrieved & saved (per CRM-14986)
* this has been causing a DB error so we are checking for absence of error
*/
- function testFindSave() {
+ public function testFindSave() {
$contributionRecur = $this->callAPISuccess('contribution_recur', 'create', $this->_params);
$dao = new CRM_Contribute_BAO_ContributionRecur();
$dao->id = $contributionRecur['id'];
* Test cancellation works per CRM-14986
* we are checking for absence of error
*/
- function testCancelRecur() {
+ public function testCancelRecur() {
$contributionRecur = $this->callAPISuccess('contribution_recur', 'create', $this->_params);
CRM_Contribute_BAO_ContributionRecur::cancelRecurContribution($contributionRecur['id'], CRM_Core_DAO::$_nullObject);
}
*/
class CRM_Contribute_BAO_ContributionTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function teardown() {
+ public function teardown() {
}
/**
* Create() method (create and update modes)
*/
- function testCreate() {
+ public function testCreate() {
$contactId = Contact::createIndividual();
$ids = array('contribution' => NULL);
/**
* Create() method with custom data
*/
- function testCreateWithCustomData() {
+ public function testCreateWithCustomData() {
$contactId = Contact::createIndividual();
$ids = array('contribution' => NULL);
/**
* DeleteContribution() method
*/
- function testDeleteContribution() {
+ public function testDeleteContribution() {
$contactId = Contact::createIndividual();
$ids = array('contribution' => NULL);
/**
* Create honor-contact method
*/
- function testcreateAndGetHonorContact() {
+ public function testcreateAndGetHonorContact() {
$firstName = 'John_' . substr(sha1(rand()), 0, 7);
$lastName = 'Smith_' . substr(sha1(rand()), 0, 7);
$email = "{$firstName}.{$lastName}@example.com";
* contribution batch update through profile
* sortName();
*/
- function testsortName() {
+ public function testsortName() {
$params = array(
'first_name' => 'Shane',
'last_name' => 'Whatson',
*
* AddPremium();
*/
- function testAddPremium() {
+ public function testAddPremium() {
$contactId = Contact::createIndividual();
$ids = array(
* during the contribution import
* checkDuplicateIds();
*/
- function testcheckDuplicateIds() {
+ public function testcheckDuplicateIds() {
$contactId = Contact::createIndividual();
$ids = array('contribution' => NULL);
*/
class CRM_Contribute_BAO_ContributionTypeTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->organizationCreate();
}
- function teardown() {
+ public function teardown() {
$this->financialAccountDelete('Donations');
}
/**
* Check method add()
*/
- function testAdd() {
+ public function testAdd() {
$params = array(
'name' => 'Donations',
'is_deductible' => 0,
/**
* Check method retrive()
*/
- function testRetrieve() {
+ public function testRetrieve() {
$params = array(
'name' => 'Donations',
'is_deductible' => 0,
/**
* Check method setIsActive()
*/
- function testSetIsActive() {
+ public function testSetIsActive() {
$params = array(
'name' => 'Donations',
'is_deductible' => 0,
/**
* Check method del()
*/
- function testdel() {
+ public function testdel() {
$params = array(
'name' => 'Donations',
'is_deductible' => 0,
*/
class CRM_Contribute_BAO_ManagePremiumsTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
/**
* Check method add()
*/
- function testAdd() {
+ public function testAdd() {
$ids = array();
$params = array(
'name' => 'Test Product',
/**
* Check method retrieve( )
*/
- function testRetrieve() {
+ public function testRetrieve() {
$ids = array();
$params = array(
'name' => 'Test Product',
/**
* Check method setIsActive( )
*/
- function testSetIsActive() {
+ public function testSetIsActive() {
$ids = array();
$params = array(
'name' => 'Test Product',
/**
* Check method del( )
*/
- function testDel() {
+ public function testDel() {
$ids = array();
$params = array(
'name' => 'Test Product',
*/
var $mut;
- function setUp() {
+ public function setUp() {
parent::setUp();
require_once 'CiviTest/CiviMailUtils.php';
*
* @access protected
*/
- function tearDown() {
+ public function tearDown() {
parent::tearDown();
$this->mut->clearMessages();
$this->_tearDown();
}
- function testActivityDateTime_Match_NonRepeatableSchedule() {
+ public function testActivityDateTime_Match_NonRepeatableSchedule() {
$actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($this->fixtures['sched_activity_1day']);
$this->assertTrue(is_numeric($actionScheduleDao->id));
));
}
- function testActivityDateTime_Match_RepeatableSchedule() {
+ public function testActivityDateTime_Match_RepeatableSchedule() {
$actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($this->fixtures['sched_activity_1day_r']);
$this->assertTrue(is_numeric($actionScheduleDao->id));
* For contacts/members which match schedule based on join date,
* an email should be sent.
*/
- function testMembershipJoinDate_Match() {
+ public function testMembershipJoinDate_Match() {
$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(
* For contacts/members which match schedule based on join date,
* an email should be sent.
*/
- function testMembershipJoinDate_NonMatch() {
+ public function testMembershipJoinDate_NonMatch() {
$membership = $this->createTestObject('CRM_Member_DAO_Membership', $this->fixtures['rolling_membership']);
$this->assertTrue(is_numeric($membership->id));
$result = $this->callAPISuccess('Email', 'create', array(
* Test that the first and SECOND notifications are sent out
*
*/
- function testMembershipEndDate_Repeat() {
+ public function testMembershipEndDate_Repeat() {
// 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(
* between
* see CRM-15376
*/
- function testMembershipEndDate_Repeat_ChangedEndDate_CRM_15376() {
+ public function testMembershipEndDate_Repeat_ChangedEndDate_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(
* For contacts/members which match schedule based on end date,
* an email should be sent.
*/
- function testMembershipEndDate_Match() {
+ public function testMembershipEndDate_Match() {
// 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));
* For contacts/members which match schedule based on end date,
* an email should be sent.
*/
- function testMembershipEndDate_NoMatch() {
+ public function testMembershipEndDate_NoMatch() {
// 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));
));
}
- function testContactBirthDate_noAnniv() {
+ public function testContactBirthDate_noAnniv() {
$contact = $this->callAPISuccess('Contact', 'create', $this->fixtures['contact_birthdate']);
$this->_testObjects['CRM_Contact_DAO_Contact'][] = $contact['id'];
$actionSchedule = $this->fixtures['sched_contact_bday_yesterday'];
));
}
- function testContactBirthDate_Anniv() {
+ public function testContactBirthDate_Anniv() {
$contact = $this->callAPISuccess('Contact', 'create', $this->fixtures['contact_birthdate']);
$this->_testObjects['CRM_Contact_DAO_Contact'][] = $contact['id'];
$actionSchedule = $this->fixtures['sched_contact_bday_anniv'];
));
}
- function testContactCustomDate_noAnniv() {
+ public function testContactCustomDate_noAnniv() {
$group = array(
'title' => 'Test_Group',
'name' => 'test_group',
/**
* Check that limit_to + an empty recipients doesn't sent to multiple contacts
*/
- function testMembershipLimitToNone() {
+ public function testMembershipLimitToNone() {
// creates membership with end_date = 20120615
$membership = $this->createTestObject('CRM_Member_DAO_Membership', array_merge($this->fixtures['rolling_membership'], array('status_id' => 2)));
- function testContactCustomDate_Anniv() {
+ public function testContactCustomDate_Anniv() {
$group = array(
'title' => 'Test_Group now',
'name' => 'test_group_now',
* - time: string, e.g. '2012-06-15 21:00:01'
* - recipients: array(array(string)), list of email addresses which should receive messages
*/
- function assertCronRuns($cronRuns) {
+ public function assertCronRuns($cronRuns) {
foreach ($cronRuns as $cronRun) {
CRM_Utils_Time::setTime($cronRun['time']);
$this->callAPISuccess('job', 'send_reminder', array());
/**
* @param $objects array DAO or BAO objects
*/
- function registerTestObjects($objects) {
+ public function registerTestObjects($objects) {
//if (is_object($objects)) {
// $objects = array($objects);
//}
}
}
- function deleteTestObjects() {
+ public function deleteTestObjects() {
// Note: You might argue that the FK relations between test
// objects could make this problematic; however, it should
// behave intuitively as long as we mentally split our
* Class CRM_Core_BAO_AddressTest
*/
class CRM_Core_BAO_AddressTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->quickCleanup(array('civicrm_contact', 'civicrm_address'));
/**
* Create() method (create and update modes)
*/
- function testCreate() {
+ public function testCreate() {
$contactId = Contact::createIndividual();
$params = array();
/**
* Add() method ( )
*/
- function testAdd() {
+ public function testAdd() {
$contactId = Contact::createIndividual();
$fixParams = array(
/**
* AllAddress() method ( )
*/
- function testallAddress() {
+ public function testallAddress() {
$contactId = Contact::createIndividual();
$fixParams = array(
/**
* AllAddress() method ( ) with null value
*/
- function testnullallAddress() {
+ public function testnullallAddress() {
$contactId = Contact::createIndividual();
$fixParams = array(
/**
* GetValues() method (get Address fields)
*/
- function testGetValues() {
+ public function testGetValues() {
$contactId = Contact::createIndividual();
$params = array();
/**
* ParseStreetAddress() method (get street address parsed)
*/
- function testParseStreetAddress() {
+ public function testParseStreetAddress() {
// valid Street address to be parsed ( without locale )
$street_address = "54A Excelsior Ave. Apt 1C";
*/
class CRM_Core_BAO_CustomFieldTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function testCreateCustomfield() {
+ public function testCreateCustomfield() {
$customGroup = Custom::createGroup(array(), 'Individual');
$fields = array(
'label' => 'testFld',
Custom::deleteGroup($customGroup);
}
- function testCreateCustomfieldColumnName() {
+ public function testCreateCustomfieldColumnName() {
$customGroup = Custom::createGroup(array(), 'Individual');
$fields = array(
'label' => 'testFld 2',
Custom::deleteGroup($customGroup);
}
- function testCreateCustomfieldName() {
+ public function testCreateCustomfieldName() {
$customGroup = Custom::createGroup(array(), 'Individual');
$fields = array(
'label' => 'testFld 2',
}
- function testGetFields() {
+ public function testGetFields() {
$customGroup = Custom::createGroup(array(), 'Individual');
$fields = array(
'label' => 'testFld1',
Custom::deleteGroup($customGroup);
}
- function testGetDisplayedValues() {
+ public function testGetDisplayedValues() {
$customGroup = Custom::createGroup(array(), 'Individual');
$fields = array(
'label' => 'testCountryFld1',
Custom::deleteGroup($customGroup);
}
- function testDeleteCustomfield() {
+ public function testDeleteCustomfield() {
$customGroup = Custom::createGroup(array(), 'Individual');
$fields = array(
'groupId' => $customGroup->id,
* Move a custom field from $groupA to $groupB. Make sure that data records are
* correctly matched and created.
*/
- function testMoveField() {
+ public function testMoveField() {
$countriesByName = array_flip(CRM_Core_PseudoConstant::country(FALSE, FALSE));
$this->assertTrue($countriesByName['Andorra'] > 0);
$groups = array(
*/
class CRM_Core_BAO_CustomGroupTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
/**
* Test getTree()
*/
- function testGetTree() {
+ public function testGetTree() {
$params = array();
$contactId = Contact::createIndividual();
$customGrouptitle = 'My Custom Group';
/**
* Test retrieve() with Empty Params
*/
- function testRetrieveEmptyParams() {
+ public function testRetrieveEmptyParams() {
$params = array();
$customGroup = CRM_Core_BAO_CustomGroup::retrieve($params, $dafaults);
$this->assertNull($customGroup, 'Check that no custom Group is retreived');
/**
* Test retrieve() with Inalid Params
*/
- function testRetrieveInvalidParams() {
+ public function testRetrieveInvalidParams() {
$params = array('id' => 99);
$customGroup = CRM_Core_BAO_CustomGroup::retrieve($params, $dafaults);
$this->assertNull($customGroup, 'Check that no custom Group is retreived');
/**
* Test retrieve()
*/
- function testRetrieve() {
+ public function testRetrieve() {
$customGrouptitle = 'My Custom Group';
$groupParams = array(
'title' => $customGrouptitle,
/**
* Test setIsActive()
*/
- function testSetIsActive() {
+ public function testSetIsActive() {
$customGrouptitle = 'My Custom Group';
$groupParams = array(
'title' => $customGrouptitle,
/**
* Test getGroupDetail() with Empty Params
*/
- function testGetGroupDetailEmptyParams() {
+ public function testGetGroupDetailEmptyParams() {
$customGroupId = array();
$customGroup = CRM_Core_BAO_CustomGroup::getGroupDetail($customGroupId);
$this->assertTrue(empty($customGroup), 'Check that no custom Group details is retreived');
/**
* Test getGroupDetail() with Inalid Params
*/
- function testGetGroupDetailInvalidParams() {
+ public function testGetGroupDetailInvalidParams() {
$customGroupId = 99;
$customGroup = CRM_Core_BAO_CustomGroup::getGroupDetail($customGroupId);
$this->assertTrue(empty($customGroup), 'Check that no custom Group details is retreived');
/**
* Test getGroupDetail()
*/
- function testGetGroupDetail() {
+ public function testGetGroupDetail() {
$customGrouptitle = 'My Custom Group';
$groupParams = array(
'title' => $customGrouptitle,
/**
* Test getTitle() with Invalid Params()
*/
- function testGetTitleWithInvalidParams() {
+ public function testGetTitleWithInvalidParams() {
$params = 99;
$customGroupTitle = CRM_Core_BAO_CustomGroup::getTitle($params);
/**
* Test getTitle()
*/
- function testGetTitle() {
+ public function testGetTitle() {
$customGrouptitle = 'My Custom Group';
$groupParams = array(
'title' => $customGrouptitle,
/**
* Test deleteGroup()
*/
- function testDeleteGroup() {
+ public function testDeleteGroup() {
$customGrouptitle = 'My Custom Group';
$groupParams = array(
'title' => $customGrouptitle,
/**
* Test createTable()
*/
- function testCreateTable() {
+ public function testCreateTable() {
$customGrouptitle = 'My Custom Group';
$groupParams = array(
'title' => $customGrouptitle,
/**
* Test checkCustomField()
*/
- function testCheckCustomField() {
+ public function testCheckCustomField() {
$customGroupTitle = 'My Custom Group';
$groupParams = array(
'title' => $customGroupTitle,
/**
* Test getActiveGroups() with Invalid Params()
*/
- function testGetActiveGroupsWithInvalidParams() {
+ public function testGetActiveGroupsWithInvalidParams() {
$contactId = Contact::createIndividual();
$activeGroups = CRM_Core_BAO_CustomGroup::getActiveGroups('ABC', 'civicrm/contact/view/cd', $contactId);
$this->assertEquals(empty($activeGroups), TRUE, 'Check that Emprt params are retreived');
}
- function testGetActiveGroups() {
+ public function testGetActiveGroups() {
$contactId = Contact::createIndividual();
$customGrouptitle = 'Test Custom Group';
$groupParams = array(
/**
* Test create()
*/
- function testCreate() {
+ public function testCreate() {
$params = array(
'title' => 'Test_Group_1',
'name' => 'test_group_1',
/**
* Test create() given a table_name
*/
- function testCreateTableName() {
+ public function testCreateTableName() {
$params = array(
'title' => 'Test_Group_2',
'name' => 'test_group_2',
/**
* Test isGroupEmpty()
*/
- function testIsGroupEmpty() {
+ public function testIsGroupEmpty() {
$customGrouptitle = 'Test Custom Group';
$groupParams = array(
'title' => $customGrouptitle,
/**
* Test getGroupTitles() with Invalid Params()
*/
- function testgetGroupTitlesWithInvalidParams() {
+ public function testgetGroupTitlesWithInvalidParams() {
$params = array(99);
$groupTitles = CRM_Core_BAO_CustomGroup::getGroupTitles($params);
$this->assertTrue(empty($groupTitles), 'Check that no titles are recieved');
/**
* Test getGroupTitles()
*/
- function testgetGroupTitles() {
+ public function testgetGroupTitles() {
$customGrouptitle = 'Test Custom Group';
$groupParams = array(
'title' => $customGrouptitle,
*/
class CRM_Core_BAO_CustomValueTableMultipleTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function testCustomGroupMultipleSingle() {
+ public function testCustomGroupMultipleSingle() {
$params = array();
$contactID = Contact::createIndividual();
$customGroup = Custom::createGroup($params, 'Individual', TRUE);
Contact::delete($contactID);
}
- function testCustomGroupMultipleDouble() {
+ public function testCustomGroupMultipleDouble() {
$params = array();
$contactID = Contact::createIndividual();
$customGroup = Custom::createGroup($params, 'Individual', TRUE);
Contact::delete($contactID);
}
- function testCustomGroupMultipleUpdate() {
+ public function testCustomGroupMultipleUpdate() {
$params = array();
$contactID = Contact::createIndividual();
$customGroup = Custom::createGroup($params, 'Individual', TRUE);
Contact::delete($contactID);
}
- function testCustomGroupMultipleOldFormate() {
+ public function testCustomGroupMultipleOldFormate() {
$params = array();
$contactID = Contact::createIndividual();
$customGroup = Custom::createGroup($params, 'Individual', TRUE);
*/
class CRM_Core_BAO_CustomValueTableSetGetTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
/**
* Test setValues() and GetValues() methods with custom Date field
*/
- function testSetGetValuesDate() {
+ public function testSetGetValuesDate() {
$params = array();
$contactID = Contact::createIndividual();
* Test setValues() and getValues() methods with custom field YesNo(Boolean) Radio
*
*/
- function testSetGetValuesYesNoRadio() {
+ public function testSetGetValuesYesNoRadio() {
$params = array();
$contactID = Contact::createIndividual();
*/
class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
* Test store function for country
*
*/
- function testStoreCountry() {
+ public function testStoreCountry() {
$params = array();
$contactID = Contact::createIndividual();
$customGroup = Custom::createGroup($params, 'Individual');
* Test store function for file
*
*/
- function atestStoreFile() {
+ public function atestStoreFile() {
$params = array();
$contactID = Contact::createIndividual();
$customGroup = Custom::createGroup($params, 'Individual');
* Test store function for state province
*
*/
- function testStoreStateProvince() {
+ public function testStoreStateProvince() {
$params = array();
$contactID = Contact::createIndividual();
$customGroup = Custom::createGroup($params, 'Individual');
* Test store function for date
*
*/
- function testStoreDate() {
+ public function testStoreDate() {
$params = array();
$contactID = Contact::createIndividual();
$customGroup = Custom::createGroup($params, 'Individual');
* Test store function for rich text editor
*
*/
- function testStoreRichTextEditor() {
+ public function testStoreRichTextEditor() {
$params = array();
$contactID = Contact::createIndividual();
$customGroup = Custom::createGroup($params, 'Individual');
* Test getEntityValues function for stored value
*
*/
- function testgetEntityValues() {
+ public function testgetEntityValues() {
$params = array();
$contactID = Contact::createIndividual();
Contact::delete($contactID);
}
- function testCustomGroupMultiple() {
+ public function testCustomGroupMultiple() {
$params = array();
$contactID = Contact::createIndividual();
$customGroup = Custom::createGroup($params, 'Individual');
* Class CRM_Core_BAO_CustomValueTest
*/
class CRM_Core_BAO_CustomValueTest extends CiviUnitTestCase {
- function testTypeCheckWithValidInput() {
+ public function testTypeCheckWithValidInput() {
$values = array();
$values = array(
}
}
- function testTypeCheckWithInvalidInput() {
+ public function testTypeCheckWithInvalidInput() {
$values = array();
$values = array('check1' => 'chk');
foreach ($values as $type => $value) {
}
}
- function testTypeCheckWithWrongInput() {
+ public function testTypeCheckWithWrongInput() {
$values = array();
$values = array(
'String' => 1,
}
}
- function testTypeToFieldWithValidInput() {
+ public function testTypeToFieldWithValidInput() {
$values = array();
$values = array(
'String' => 'char_data',
}
}
- function testTypeToFieldWithWrongInput() {
+ public function testTypeToFieldWithWrongInput() {
$values = array();
$values = array(
'String' => 'memo_data',
}
}
- function testFixFieldValueOfTypeMemo() {
+ public function testFixFieldValueOfTypeMemo() {
$customGroup = Custom::createGroup(array(), 'Individual');
$fields = array(
Custom::deleteGroup($customGroup);
}
- function testFixFieldValueOfTypeMemoWithEmptyParams() {
+ public function testFixFieldValueOfTypeMemoWithEmptyParams() {
$params = array();
$result = CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($params);
$this->assertEquals($result, NULL, 'Checking the returned value of type Memo.');
* Class CRM_Core_BAO_EmailTest
*/
class CRM_Core_BAO_EmailTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->quickCleanup( array( 'civicrm_contact', 'civicrm_email' ) );
/**
* Add() method (create and update modes)
*/
- function testAdd() {
+ public function testAdd() {
$contactId = Contact::createIndividual();
$params = array();
/**
* HoldEmail() method (set and reset on_hold condition)
*/
- function testHoldEmail() {
+ public function testHoldEmail() {
$contactId = Contact::createIndividual();
$params = array();
/**
* AllEmails() method - get all emails for our contact, with primary email first
*/
- function testAllEmails() {
+ public function testAllEmails() {
$contactParams = array(
'first_name' => 'Alan',
'last_name' => 'Smith',
* Class CRM_Core_BAO_FinancialTrxnTest
*/
class CRM_Core_BAO_FinancialTrxnTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
/**
* Check method create()
*/
- function testCreate() {
+ public function testCreate() {
$contactId = $this->individualCreate();
$financialTypeId = 1;
$contributionId = $this->contributionCreate($contactId, $financialTypeId);
* Class CRM_Core_BAO_IMTest
*/
class CRM_Core_BAO_IMTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
/**
* Add() method (create and update modes)
*/
- function testAdd() {
+ public function testAdd() {
$contactId = Contact::createIndividual();
$params = array();
/**
* AllIMs() method - get all IMs for our contact, with primary IM first
*/
- function testAllIMs() {
+ public function testAllIMs() {
$op = new PHPUnit_Extensions_Database_Operation_Insert;
$op->execute(
$this->_dbconn,
* Class CRM_Core_BAO_LocationTest
*/
class CRM_Core_BAO_LocationTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->quickCleanup( array( 'civicrm_contact', 'civicrm_address', 'civicrm_loc_block', 'civicrm_email', 'civicrm_phone', 'civicrm_im' ) );
*
* @access protected
*/
- function tearDown() {
+ public function tearDown() {
$tablesToTruncate = array(
'civicrm_contact',
'civicrm_openid',
$this->quickCleanup($tablesToTruncate);
}
- function testCreateWithMissingParams() {
+ public function testCreateWithMissingParams() {
$contactId = Contact::createIndividual();
$params = array(
'contact_id' => $contactId,
* create various elements of location block
* without civicrm_loc_block entry
*/
- function testCreateWithoutLocBlock() {
+ public function testCreateWithoutLocBlock() {
$contactId = Contact::createIndividual();
//create various element of location block
* create various elements of location block
* with civicrm_loc_block
*/
- function testCreateWithLocBlock() {
+ public function testCreateWithLocBlock() {
$this->_contactId = Contact::createIndividual();
//create test event record.
$eventId = Event::create($this->_contactId);
* created with various elements.
*
*/
- function testDeleteLocBlock() {
+ public function testDeleteLocBlock() {
$this->_contactId = Contact::createIndividual();
//create test event record.
$eventId = Event::create($this->_contactId);
* GetValues() method
* get the values of various location elements
*/
- function testLocBlockgetValues() {
+ public function testLocBlockgetValues() {
$contactId = Contact::createIndividual();
//create various element of location block
* Class CRM_Core_BAO_OpenIDTest
*/
class CRM_Core_BAO_OpenIDTest extends CiviUnitTestCase {
- function tearDown() {
+ public function tearDown() {
// If we truncate only contact, then stale domain and openid records will be left.
// If we truncate none of these tables, then contactDelete() will incrementally
// clean correctly.
//$this->quickCleanup($tablesToTruncate);
}
- function setUp() {
+ public function setUp() {
parent::setUp();
}
/**
* Add() method (create and update modes)
*/
- function testAdd() {
+ public function testAdd() {
$contactId = Contact::createIndividual();
$this->assertDBRowExist('CRM_Contact_DAO_Contact', $contactId);
/**
* IfAllowedToLogin() method (set and reset allowed_to_login)
*/
- function testIfAllowedToLogin() {
+ public function testIfAllowedToLogin() {
$contactId = Contact::createIndividual();
$this->assertDBRowExist('CRM_Contact_DAO_Contact', $contactId);
$openIdURL = "http://test-username.civicrm.org/";
/**
* AllOpenIDs() method - get all OpenIDs for the given contact
*/
- function testAllOpenIDs() {
+ public function testAllOpenIDs() {
$contactId = Contact::createIndividual();
$this->assertDBRowExist('CRM_Contact_DAO_Contact', $contactId);
*/
class CRM_Core_BAO_PhoneTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
/**
* Add() method (create and update modes)
*/
- function testAdd() {
+ public function testAdd() {
$contactId = Contact::createIndividual();
$params = array();
/**
* AllPhones() method - get all Phones for our contact, with primary Phone first
*/
- function testAllPhones() {
+ public function testAllPhones() {
$contactParams = array(
'first_name' => 'Alan',
'last_name' => 'Smith',
* AllEntityPhones() method - get all Phones for a location block, with primary Phone first
* @todo FIXME: Fixing this test requires add helper functions in CiviTest to create location block and phone and link them to an event. Punting to 3.1 cycle. DGG
*/
- function SKIPPED_testAllEntityPhones() {}
+ public function SKIPPED_testAllEntityPhones() {}
}
*/
class CRM_Core_BAO_PreferencesTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function testValueOptions() {
+ public function testValueOptions() {
$addressOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'address_options'
$this->assertEquals($addressOptions['country'], 1, 'Country is not set in address options');
}
- function testSetValueOptions() {
+ public function testSetValueOptions() {
$addressOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'address_options'
);
/**
* Testing Activity Generation through Entity Recursion
*/
- function testActivityGeneration() {
+ public function testActivityGeneration() {
//Activity set initial params
$daoActivity = new CRM_Activity_DAO_Activity();
$daoActivity->activity_type_id = 1;
/**
* Testing Event Generation through Entity Recursion
*/
- function testEventGeneration() {
+ public function testEventGeneration() {
//Event set initial params
$daoEvent = new CRM_Event_DAO_Event();
$daoEvent->title = 'Test event for Recurring Entity';
* Class CRM_Core_BAO_SettingTest
*/
class CRM_Core_BAO_SettingTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
global $civicrm_setting;
$this->origSetting = $civicrm_setting;
CRM_Utils_Cache::singleton()->flush();
}
- function tearDown() {
+ public function tearDown() {
global $civicrm_setting;
$civicrm_setting = $this->origSetting;
CRM_Utils_Cache::singleton()->flush();
parent::tearDown();
}
- function testEnableComponentValid() {
+ public function testEnableComponentValid() {
$config = CRM_Core_Config::singleton(TRUE, TRUE);
$result = CRM_Core_BAO_ConfigSetting::enableComponent('CiviCampaign');
$this->assertTrue($result);
}
- function testEnableComponentAlreadyPresent() {
+ public function testEnableComponentAlreadyPresent() {
$config = CRM_Core_Config::singleton(TRUE, TRUE);
$result = CRM_Core_BAO_ConfigSetting::enableComponent('CiviCampaign');
$this->assertTrue($result);
}
- function testEnableComponentInvalid() {
+ public function testEnableComponentInvalid() {
$config = CRM_Core_Config::singleton(TRUE, TRUE);
$result = CRM_Core_BAO_ConfigSetting::enableComponent('CiviFake');
* Ensure that overrides in $civicrm_setting apply when
* using getItem($group,$name).
*/
- function testGetItem_Override() {
+ public function testGetItem_Override() {
global $civicrm_setting;
$civicrm_setting[CRM_Core_BAO_Setting::DIRECTORY_PREFERENCES_NAME]['imageUploadDir'] = '/test/override';
$value = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::DIRECTORY_PREFERENCES_NAME, 'imageUploadDir');
* Ensure that overrides in $civicrm_setting apply when
* using getItem($group).
*/
- function testGetItemGroup_Override() {
+ public function testGetItemGroup_Override() {
global $civicrm_setting;
$civicrm_setting[CRM_Core_BAO_Setting::DIRECTORY_PREFERENCES_NAME]['imageUploadDir'] = '/test/override';
$values = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::DIRECTORY_PREFERENCES_NAME);
* Ensure that overrides in $civicrm_setting apply when
* when using retrieveDirectoryAndURLPreferences().
*/
- function testRetrieveDirectoryAndURLPreferences_Override() {
+ public function testRetrieveDirectoryAndURLPreferences_Override() {
global $civicrm_setting;
$civicrm_setting[CRM_Core_BAO_Setting::DIRECTORY_PREFERENCES_NAME]['imageUploadDir'] = '/test/override';
*
*
**/
- function testConvertAndFillSettings() {
+ public function testConvertAndFillSettings() {
$settings = array('maxAttachments' => 6);
CRM_Core_BAO_ConfigSetting::add($settings);
$config = CRM_Core_Config::singleton(TRUE, TRUE);
* Ensure that overrides in $civicrm_setting apply when
* when using retrieveDirectoryAndURLPreferences().
*/
- function testConvertConfigToSettingNoPrefetch() {
+ public function testConvertConfigToSettingNoPrefetch() {
$settings = array('maxAttachments' => 6);
CRM_Core_BAO_ConfigSetting::add($settings);
$config = CRM_Core_Config::singleton(TRUE, TRUE);
/*
* Check that setting is converted without config value being removed
*
- function testConvertConfigToSettingPrefetch() {
+ public function testConvertConfigToSettingPrefetch() {
$settings = array('debug' => 1);
CRM_Core_BAO_ConfigSetting::add($settings);
$config = CRM_Core_Config::singleton(true, true);
* are very similar, but they exercise different codepaths. The first uses the API
* and setItems [plural]; the second uses setItem [singular].
*/
- function testOnChange() {
+ public function testOnChange() {
global $_testOnChange_hookCalls;
$this->setMockSettingsMetaData(array(
'onChangeExample' => array(
* @param $newValue
* @param $metadata
*/
- static function _testOnChange_onChangeExample($oldValue, $newValue, $metadata) {
+ public static function _testOnChange_onChangeExample($oldValue, $newValue, $metadata) {
global $_testOnChange_hookCalls;
$_testOnChange_hookCalls['count']++;
$_testOnChange_hookCalls['oldValue'] = $oldValue;
*/
class CRM_Core_BAO_UFFieldTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->quickCleanup(array('civicrm_uf_group', 'civicrm_uf_field'));
$this->assertEquals($trials, $freq['<h1>Two</h1>']);
}
- function testEvalMarkup() {
+ public function testEvalMarkup() {
$communityMessages = new CRM_Core_CommunityMessages(
$this->cache,
$this->expectNoHttpRequest()
*/
var $calls;
- function setUp() {
+ public function setUp() {
$this->calls = array(
'civicrm_alterMailer' => 0,
'send' => 0,
parent::setUp();
}
- function testHookAlterMailer() {
+ public function testHookAlterMailer() {
$test = $this;
$mockMailer = new CRM_Utils_FakeObject(array(
'send' => function ($recipients, $headers, $body) use ($test) {
*/
class CRM_Core_DAOTest extends CiviUnitTestCase {
- function testGetReferenceColumns() {
+ public function testGetReferenceColumns() {
// choose CRM_Core_DAO_Email as an arbitrary example
$emailRefs = CRM_Core_DAO_Email::getReferenceColumns();
$refsByTarget = array();
$this->assertEquals('CRM_Core_Reference_Basic', get_class($contactRef));
}
- function testGetReferencesToTable() {
+ public function testGetReferencesToTable() {
$refs = CRM_Core_DAO::getReferencesToTable(CRM_Financial_DAO_FinancialType::getTableName());
$refsBySource = array();
foreach ($refs as $refSpec) {
$this->assertEquals('CRM_Core_Reference_Dynamic', get_class($genericRef));
}
- function testFindReferences() {
+ public function testFindReferences() {
$params = array(
'first_name' => 'Testy',
'last_name' => 'McScallion',
/**
* @return array
*/
- function composeQueryExamples() {
+ public function composeQueryExamples() {
$cases = array();
// $cases[] = array('Input-SQL', 'Input-Params', 'Expected-SQL');
/**
* @dataProvider composeQueryExamples
*/
- function testComposeQuery($inputSql, $inputParams, $expectSql) {
+ public function testComposeQuery($inputSql, $inputParams, $expectSql) {
$actualSql = CRM_Core_DAO::composeQuery($inputSql, $inputParams);
$this->assertEquals($expectSql, $actualSql);
}
// 'SELECT * FROM whatever WHERE name = %1 AND title = %3 AND year LIKE '%2012'
// $params[3] = array('Bob', 'String');
// i.e. the place holder should be unique and should not contain in any other operational use in query
- function testComposeQueryFailure() {
+ public function testComposeQueryFailure() {
$cases[] = array(
'SELECT * FROM whatever WHERE name = %1 AND title = %2 AND year LIKE \'%2012\' ',
array(
/**
* @return array
*/
- function sqlNameDataProvider() {
+ public function sqlNameDataProvider() {
return array(
array('this is a long string', 30, FALSE, 'this is a long string'),
/**
* @dataProvider sqlNameDataProvider
*/
- function testShortenSQLName($inputData, $length, $makeRandom, $expectedResult) {
+ public function testShortenSQLName($inputData, $length, $makeRandom, $expectedResult) {
$this->assertEquals($expectedResult, CRM_Core_DAO::shortenSQLName($inputData, $length, $makeRandom));
}
- function testFindById() {
+ public function testFindById() {
$params = $this->sampleContact('Individual', 4);
$existing_contact = CRM_Contact_BAO_Contact::add($params);
$contact = CRM_Contact_BAO_Contact::findById($existing_contact->id);
*/
class CRM_Core_ErrorTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$config = CRM_Core_Config::singleton();
$this->oldConfigAndLogDir = $config->configAndLogDir;
$config->configAndLogDir = $this->createTempDir('test-log-');
}
- function tearDown() {
+ public function tearDown() {
$config = CRM_Core_Config::singleton();
$config->configAndLogDir= $this->oldConfigAndLogDir;
parent::tearDown();
/**
* Make sure that formatBacktrace() accepts values from debug_backtrace()
*/
- function testFormatBacktrace_debug() {
+ public function testFormatBacktrace_debug() {
$bt = debug_backtrace();
$msg = CRM_Core_Error::formatBacktrace($bt);
$this->assertRegexp('/CRM_Core_ErrorTest->testFormatBacktrace_debug/', $msg);
/**
* Make sure that formatBacktrace() accepts values from Exception::getTrace()
*/
- function testFormatBacktrace_exception() {
+ public function testFormatBacktrace_exception() {
$e = new Exception('foo');
$msg = CRM_Core_Error::formatBacktrace($e->getTrace());
$this->assertRegexp('/CRM_Core_ErrorTest->testFormatBacktrace_exception/', $msg);
*
* This tests a theory about what caused CRM-10766.
*/
- function testMixLog() {
+ public function testMixLog() {
CRM_Core_Error::debug_log_message("static-1");
$logger = CRM_Core_Error::createDebugLogger();
CRM_Core_Error::debug_log_message("static-2");
/**
* @param $pattern
*/
- function assertLogRegexp($pattern) {
+ public function assertLogRegexp($pattern) {
$config = CRM_Core_Config::singleton();
$logFiles = glob($config->configAndLogDir.'/CiviCRM*.log');
$this->assertEquals(1, count($logFiles), 'Expect to find 1 file matching: ' . $config->configAndLogDir.'/CiviCRM*log*/');
* Tests for field options
*/
class CRM_Core_FieldOptionsTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
* Assure CRM_Core_PseudoConstant::get() is working properly for a range of
* DAO fields having a <pseudoconstant> tag in the XML schema.
*/
- function testOptionValues() {
+ public function testOptionValues() {
/**
* baoName/field combinations to test
* Format: array[BAO Name] = $properties, where properties is an array whose
* Class CRM_Core_InnoDBIndexerTest
*/
class CRM_Core_InnoDBIndexerTest extends CiviUnitTestCase {
- function tearDown() {
+ public function tearDown() {
// May or may not cleanup well if there's a bug in the indexer.
// This is better than nothing -- and better than duplicating the
// cleanup logic.
parent::tearDown();
}
- function testHasDeclaredIndex() {
+ public function testHasDeclaredIndex() {
$idx = new CRM_Core_InnoDBIndexer(TRUE, array(
'civicrm_contact' => array(
array('first_name', 'last_name'),
/**
* When disabled, there is no FTS index, so queries that rely on FTS index fail.
*/
- function testDisabled() {
+ public function testDisabled() {
$idx = new CRM_Core_InnoDBIndexer(FALSE, array(
'civicrm_contact' => array(
array('first_name', 'last_name'),
/**
* When enabled, the FTS index is created, so queries that rely on FTS work.
*/
- function testEnabled() {
+ public function testEnabled() {
if (!$this->supportsFts()) {
$this->markTestSkipped("Local installation of InnoDB does not support FTS.");
return;
CRM_Core_DAO::executeQuery('SELECT id FROM civicrm_contact WHERE MATCH(first_name,last_name) AGAINST ("joe")');
}
- function supportsFts() {
+ public function supportsFts() {
return version_compare(CRM_Core_DAO::singleValueQuery('SELECT VERSION()'), '5.6.0', '>=');
}
}
*/
class CRM_Core_JobManagerTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function testHookCron() {
+ public function testHookCron() {
$hook = $this->getMock('stdClass', array('civicrm_cron'));
$hook->expects($this->once())
->method('civicrm_cron')
protected $fixtures;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->modules = array(
'one' => new CRM_Core_Module('com.example.one', TRUE),
$this->apiKernel->registerApiProvider($this->adhocProvider);
}
- function tearDown() {
+ public function tearDown() {
parent::tearDown();
CRM_Core_DAO::singleValueQuery('DELETE FROM civicrm_managed');
CRM_Core_DAO::singleValueQuery('DELETE FROM civicrm_option_value WHERE name like "CRM_Example_%"');
* to (1) create 'foo' entity, (2) create 'bar' entity', (3) remove 'foo'
* entity
*/
- function testAddRemoveEntitiesModule_UpdateAlways_DeleteAlways() {
+ public function testAddRemoveEntitiesModule_UpdateAlways_DeleteAlways() {
$decls = array();
// create first managed entity ('foo')
* Set up an active module with one managed-entity and, over
* time, the content of the entity changes
*/
- function testModifyDeclaration_UpdateAlways() {
+ public function testModifyDeclaration_UpdateAlways() {
$decls = array();
// create first managed entity ('foo')
* Set up an active module with one managed-entity and, over
* time, the content of the entity changes
*/
- function testModifyDeclaration_UpdateNever() {
+ public function testModifyDeclaration_UpdateNever() {
$decls = array();
// create first managed entity ('foo')
* ensure that the policy is followed (ie the entity is not
* deleted).
*/
- function testRemoveDeclaration_CleanupNever() {
+ public function testRemoveDeclaration_CleanupNever() {
$decls = array();
// create first managed entity ('foo')
* ensure that the policy is followed (ie the entity is not
* deleted).
*/
- function testRemoveDeclaration_CleanupUnused() {
+ public function testRemoveDeclaration_CleanupUnused() {
$decls = array();
// create first managed entity ('foo')
/**
* Setup an active module with a malformed entity declaration
*/
- function testInvalidDeclarationModule() {
+ public function testInvalidDeclarationModule() {
// create first managed entity ('foo')
$decls = array();
$decls[] = array(
/**
* Setup an active module with a malformed entity declaration
*/
- function testMissingName() {
+ public function testMissingName() {
// create first managed entity ('foo')
$decls = array();
$decls[] = array(
/**
* Setup an active module with a malformed entity declaration
*/
- function testMissingEntity() {
+ public function testMissingEntity() {
// create first managed entity ('foo')
$decls = array();
$decls[] = array(
* Setup an active module with an entity -- then disable and re-enable the
* module
*/
- function testDeactivateReactivateModule() {
+ public function testDeactivateReactivateModule() {
// create first managed entity ('foo')
$decls = array();
$decls[] = $this->fixtures['com.example.one-foo'];
* Setup an active module with an entity -- then entirely uninstall the
* module
*/
- function testUninstallModule() {
+ public function testUninstallModule() {
// create first managed entity ('foo')
$decls = array();
$decls[] = $this->fixtures['com.example.one-foo'];
*/
class CRM_Core_MenuTest extends CiviUnitTestCase {
- function pathArguments() {
+ public function pathArguments() {
$cases = array(); // array(0 => string $input, 1 => array $expectedOutput)
//$cases[] = array(NULL, array());
//$cases[] = array('', array());
* @param $expectedArray
* @dataProvider pathArguments
*/
- function testGetArrayForPathArgs($inputString, $expectedArray) {
+ public function testGetArrayForPathArgs($inputString, $expectedArray) {
$actual = CRM_Core_Menu::getArrayForPathArgs($inputString);
$this->assertEquals($expectedArray, $actual);
}
* Class CRM_Core_Page_RedirectTest
*/
class CRM_Core_Page_RedirectTest extends CiviUnitTestCase {
- function examples() {
+ public function examples() {
$cases = array();
// $cases[] = array(string $requestPath, string $requestArgs, string $pageArgs, string $expectedUrl)
protected $_contributionPageID;
protected $_paymentProcessorID;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->_paymentProcessorID = $this->paymentProcessorCreate(array(
'payment_processor_type_id' => 'AuthNet',
$this->_contributionPageID = $contributionPage['id'];
}
- function tearDown() {
+ public function tearDown() {
$this->quickCleanUpFinancialEntities();
}
/**
* Test IPN response updates contribution_recur & contribution for first & second contribution
*/
- function testIPNPaymentRecurSuccess() {
+ public function testIPNPaymentRecurSuccess() {
$this->setupRecurringPaymentProcessorTransaction();
$paypalIPN = new CRM_Core_Payment_AuthorizeNetIPN($this->getRecurTransaction());
$paypalIPN->main();
/**
* Test IPN response updates contribution_recur & contribution for first & second contribution
*/
- function testIPNPaymentMembershipRecurSuccess() {
+ public function testIPNPaymentMembershipRecurSuccess() {
$this->setupMembershipRecurringPaymentProcessorTransaction();
$paypalIPN = new CRM_Core_Payment_AuthorizeNetIPN($this->getRecurTransaction());
$paypalIPN->main();
/**
*
*/
- function getRecurTransaction() {
+ public function getRecurTransaction() {
return array(
"x_amount" => "200.00",
"x_country" => 'US',
/**
* @return array
*/
- function getRecurSubsequentTransaction() {
+ public function getRecurSubsequentTransaction() {
return array_merge($this->getRecurTransaction(), array(
'x_trans_id' => 'second_one',
'x_MD5_Hash' => 'EA7A3CD65A85757827F51212CA1486A8',
*/
class CRM_Core_Payment_AuthorizeNetTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->paymentProcessor = new AuthorizeNet();
$this->processorParams = $this->paymentProcessor->create();
$GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'] = array( );
}
- function tearDown() {
+ public function tearDown() {
$this->paymentProcessor->delete($this->processorParams->id);
$this->quickCleanUpFinancialEntities();
}
*
* Test works but not both due to some form of caching going on in the SmartySingleton
*/
- function testCreateSingleNowDated() {
+ public function testCreateSingleNowDated() {
$firstName = 'John_' . substr(sha1(rand()), 0, 7);
$lastName = 'Smith_' . substr(sha1(rand()), 0, 7);
$nameParams = array('first_name' => $firstName, 'last_name' => $lastName);
/**
* Create a single post dated payment as a recurring transaction
*/
- function testCreateSinglePostDated() {
+ public function testCreateSinglePostDated() {
$start_date = date('Ymd', strtotime("+ 1 week"));
$firstName = 'John_' . substr(sha1(rand()), 0, 7);
protected $objects;
public $DBResetRequired = FALSE;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->input = $this->ids = $this->objects = array();
$this->IPN = new CRM_Core_Payment_AuthorizeNetIPN($this->input);
$this->objects['contribution'] = $contribution;
}
- function tearDown() {
+ public function tearDown() {
$this->quickCleanUpFinancialEntities();
CRM_Member_PseudoConstant::membershipType(NULL, TRUE);
CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'name', TRUE);
* Test the LoadObjects function with recurring membership data
*
*/
- function testLoadMembershipObjects() {
+ public function testLoadMembershipObjects() {
$this->_setUpMembershipObjects();
$this->_setUpRecurringContribution();
$this->IPN->loadObjects($this->input, $this->ids, $this->objects, FALSE, $this->_processorId);
* Test the LoadObjects function with recurring membership data
*
*/
- function testLoadMembershipObjectsLoadAll() {
+ public function testLoadMembershipObjectsLoadAll() {
$this->_setUpMembershipObjects();
$this->_setUpRecurringContribution();
unset($this->ids['membership']);
* Test the LoadObjects function with recurring membership data
*
*/
- function testsendMailMembershipObjects() {
+ public function testsendMailMembershipObjects() {
$this->_setUpMembershipObjects();
$values = array();
$this->IPN->loadObjects($this->input, $this->ids, $this->objects, FALSE, $this->_processorId);
* Test the LoadObjects function with recurring membership data
*
*/
- function testsendMailMembershipWithoutLoadObjects() {
+ public function testsendMailMembershipWithoutLoadObjects() {
$this->_setUpMembershipObjects();
$values = array();
$msg = $this->IPN->sendMail($this->input, $this->ids, $this->objects, $values, FALSE, TRUE);
/**
* Test that loadObjects works with participant values
*/
- function testLoadParticipantObjects() {
+ public function testLoadParticipantObjects() {
$this->_setUpParticipantObjects();
$this->IPN->loadObjects($this->input, $this->ids, $this->objects, FALSE, $this->_processorId);
$this->assertFalse(empty($this->objects['participant']), 'in line ' . __LINE__);
/**
* Test the LoadObjects function with a participant
*/
- function testComposeMailParticipant() {
+ public function testComposeMailParticipant() {
$this->_setUpParticipantObjects();
$this->IPN->loadObjects($this->input, $this->ids, $this->objects, FALSE, $this->_processorId);
$values = array();
/**
*
*/
- function testComposeMailParticipantObjects() {
+ public function testComposeMailParticipantObjects() {
$this->_setUpParticipantObjects();
$values = array();
$msg = $this->IPN->sendMail($this->input, $this->ids, $this->objects, $values, FALSE, TRUE);
/**
* Test the LoadObjects function with recurring membership data
*/
- function testsendMailParticipantObjectsCheckLog() {
+ public function testsendMailParticipantObjectsCheckLog() {
$this->_setUpParticipantObjects();
$values = array();
require_once 'CiviTest/CiviMailUtils.php';
/**
* Test the LoadObjects function with recurring membership data
*/
- function testsendMailParticipantObjectsNoMail() {
+ public function testsendMailParticipantObjectsNoMail() {
$this->_setUpParticipantObjects();
$event = new CRM_Event_BAO_Event();
$event->id = $this->_eventId;
/**
* Test that loadObjects works with participant values
*/
- function testLoadPledgeObjects() {
+ public function testLoadPledgeObjects() {
$this->_setUpPledgeObjects();
$this->IPN->loadObjects($this->input, $this->ids, $this->objects, FALSE, $this->_processorId);
$this->assertFalse(empty($this->objects['pledge_payment'][0]), 'in line ' . __LINE__);
/**
* Test that loadObjects works with participant values
*/
- function testLoadPledgeObjectsInvalidPledgeID() {
+ public function testLoadPledgeObjectsInvalidPledgeID() {
$this->_setUpPledgeObjects();
$this->ids['pledge_payment'][0] = 0;
$result = $this->IPN->loadObjects($this->input, $this->ids, $this->objects, TRUE, NULL, array('return_error' => 1));
* Test the LoadObjects function with a pledge
*
*/
- function testsendMailPledge() {
+ public function testsendMailPledge() {
$this->_setUpPledgeObjects();
$values = array();
$this->IPN->loadObjects($this->input, $this->ids, $this->objects, FALSE, NULL);
* Test that an error is returned if required set & no contribution page
*
*/
- function testRequiredWithoutProcessorID() {
+ public function testRequiredWithoutProcessorID() {
$this->_setUpPledgeObjects();
$values = array();
$result = $this->IPN->loadObjects($this->input, $this->ids, $this->objects, TRUE, NULL, array('return_error' => 1));
*
* Test that an error is not if required set & no processor ID
*/
- function testRequiredWithContributionPage() {
+ public function testRequiredWithContributionPage() {
$this->_setUpContributionObjects(TRUE);
$result = $this->IPN->loadObjects($this->input, $this->ids, $this->objects, TRUE, NULL, array('return_error' => 1));
* Test that an error is returned if required set & contribution page exists
*
*/
- function testRequiredWithContributionPageError() {
+ public function testRequiredWithContributionPageError() {
$this->_setUpContributionObjects();
$values = array();
$result = $this->IPN->loadObjects($this->input, $this->ids, $this->objects, TRUE, NULL, array('return_error' => 1));
* fully but the calls to the POST happen in more than one function
* keeping this as good example of data to bring back to life later
- function testMainFunctionActions(){
+ public function testMainFunctionActions(){
$ids = $objects = array( );
$input['component'] = 'Contribute';
$postedParams = array(
*
* @param bool $contributionPage
*/
- function _setUpContributionObjects($contributionPage = FALSE) {
+ public function _setUpContributionObjects($contributionPage = FALSE) {
$contribution = new CRM_Contribute_BAO_Contribution();
/**
* Prepare for membership test
*/
- function _setUpMembershipObjects() {
+ public function _setUpMembershipObjects() {
try {
$this->_membershipTypeID = $this->membershipTypeCreate();
$this->_membershipStatusID = $this->membershipStatusCreate('test status');
$this->ids['membership'] = $this->_membershipId;
}
- function _setUpRecurringContribution() {
+ public function _setUpRecurringContribution() {
$this->_contributionRecurParams = array(
'contact_id' => $this->_contactId,
'amount' => 150.00,
/**
* Set up participant requirements for test
*/
- function _setUpParticipantObjects() {
+ public function _setUpParticipantObjects() {
$event = $this->eventCreate(array('is_email_confirm' => 1));
$this->assertAPISuccess($event, 'line ' . __LINE__ . ' set-up of event');
$this->_eventId = $event['id'];
/**
* Set up participant requirements for test
*/
- function _setUpPledgeObjects() {
+ public function _setUpPledgeObjects() {
$this->_pledgeId = $this->pledgeCreate($this->_contactId);
//we'll create membership payment here because to make setup more re-usable
$pledgePayment = civicrm_api('pledge_payment', 'create', array(
protected $_contributionPageID;
protected $_paymentProcessorID;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->_paymentProcessorID = $this->paymentProcessorCreate();
$this->_contactID = $this->individualCreate();
$this->_contributionPageID = $contributionPage['id'];
}
- function tearDown() {
+ public function tearDown() {
$this->quickCleanUpFinancialEntities();
}
/**
* Test IPN response updates contribution_recur & contribution for first & second contribution
*/
- function testIPNPaymentRecurSuccess() {
+ public function testIPNPaymentRecurSuccess() {
$this->setupRecurringPaymentProcessorTransaction();
$paypalIPN = new CRM_Core_Payment_PayPalProIPN($this->getPaypalProRecurTransaction());
$paypalIPN->main();
/**
* Test IPN response updates contribution_recur & contribution for first & second contribution
*/
- function testIPNPaymentMembershipRecurSuccess() {
+ public function testIPNPaymentMembershipRecurSuccess() {
$this->setupMembershipRecurringPaymentProcessorTransaction();
$this->callAPISuccessGetSingle('membership_payment', array());
$paypalIPN = new CRM_Core_Payment_PayPalProIPN($this->getPaypalProRecurTransaction());
* It seems likely that may change in future & this test will start failing (I point this out in the hope it
* will help future debuggers)
*/
- function testIPNPaymentCRM13743() {
+ public function testIPNPaymentCRM13743() {
$this->setupRecurringPaymentProcessorTransaction();
$firstPaymentParams = $this->getPaypalProRecurTransaction();
$firstPaymentParams['txn_type'] = 'recurring_payment_failed';
*
* Obviously if the behaviour is fixed then the test should be updated!
*/
- function testIPNPaymentExpressNoError() {
+ public function testIPNPaymentExpressNoError() {
$this->setupRecurringPaymentProcessorTransaction();
$paypalIPN = new CRM_Core_Payment_PayPalProIPN($this->getPaypalExpressTransactionIPN());
try{
* Get PaymentExpress IPN for a single transaction
* @return array array representing a Paypal IPN POST
*/
- function getPaypalExpressTransactionIPN() {
+ public function getPaypalExpressTransactionIPN() {
return array(
'mc_gross' => '200.00',
'invoice' => $this->_invoiceID,
* Get IPN results from follow on IPN transactions
* @return array array representing a Paypal IPN POST
*/
- function getSubsequentPaypalExpressTransaction() {
+ public function getSubsequentPaypalExpressTransaction() {
return array(
'mc_gross' => '5.00',
'period_type' => ' Regular',
/**
*
*/
- function getPaypalProRecurTransaction() {
+ public function getPaypalProRecurTransaction() {
return array(
'amount' => '15.00',
'initial_payment_amount' => '0.00',
/**
* @return array
*/
- function getPaypalProRecurSubsequentTransaction() {
+ public function getPaypalProRecurSubsequentTransaction() {
return array_merge($this->getPaypalProRecurTransaction(), array('txn_id' => 'secondone'));
}
}
/**
* Test the payment method is adequately logged - we don't expect the processing to succeed
*/
- function testHandlePaymentMethodLogging() {
+ public function testHandlePaymentMethodLogging() {
$params = array('processor_name' => 'Paypal', 'data' => 'blah');
try {
CRM_Core_Payment::handlePaymentMethod('method', $params);
*/
class CRM_Core_PseudoConstantTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->loadAllFixtures();
* Assure CRM_Core_PseudoConstant::get() is working properly for a range of
* DAO fields having a <pseudoconstant> tag in the XML schema.
*/
- function testOptionValues() {
+ public function testOptionValues() {
// Create a custom field group for testing.
$custom_group_name = md5(microtime());
}
}
- function testContactTypes() {
+ public function testContactTypes() {
$byName = array(
'Individual' => 'Individual',
'Household' => 'Household',
* Class CRM_Core_RegionTest
*/
class CRM_Core_RegionTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
require_once 'CRM/Core/Smarty.php';
require_once 'CRM/Core/Region.php';
* When a {crmRegion} is blank and when there are no extra snippets, the
* output is blank.
*/
- function testBlank() {
+ public function testBlank() {
$smarty = CRM_Core_Smarty::singleton();
$actual = $smarty->fetch('string:{crmRegion name=testBlank}{/crmRegion}');
$expected = '';
* When a {crmRegion} is not blank and when there are no extra snippets,
* the output is only determined by the {crmRegion} block.
*/
- function testDefault() {
+ public function testDefault() {
$smarty = CRM_Core_Smarty::singleton();
$actual = $smarty->fetch('string:{crmRegion name=testDefault}default<br/>{/crmRegion}');
$expected = 'default<br/>';
/**
* Disable the normal content of a {crmRegion} and apply different content from a snippet
*/
- function testOverride() {
+ public function testOverride() {
CRM_Core_Region::instance('testOverride')->update('default', array(
'disabled' => TRUE,
));
/**
* Test that each of the major content formats are correctly evaluated
*/
- function testAllTypes() {
+ public function testAllTypes() {
CRM_Core_Region::instance('testAllTypes')->add(array(
'markup' => 'some-markup<br/>',
));
/**
* Test of nested arrangement in which one {crmRegion} directly includes another {crmRegion}
*/
- function testDirectNest() {
+ public function testDirectNest() {
CRM_Core_Region::instance('testDirectNestOuter')->add(array(
'template' => 'string:O={$snippet.weight} ',
'weight' => -5,
/**
* Test of nested arrangement in which one {crmRegion} is enhanced with a snippet which, in turn, includes another {crmRegion}
*/
- function testIndirectNest() {
+ public function testIndirectNest() {
CRM_Core_Region::instance('testIndirectNestOuter')->add(array(
// Note: all three $snippet references are bound to the $snippet which caused this template to be included,
// regardless of any nested {crmRegion}s
/**
* Output from an inner-region should not be executed verbatim; this is obvious but good to verify
*/
- function testNoInjection() {
+ public function testNoInjection() {
CRM_Core_Region::instance('testNoInjectionOuter')->add(array(
'template' => 'string:{$snippet.scarystuff} ',
'scarystuff' => '{$is_outer_scary}',
* Make sure that standard Smarty variables ($smarty->assign(...)) as well
* as the magical $snippet variable both evaluate correctly.
*/
- function testSmartyVars() {
+ public function testSmartyVars() {
$smarty = CRM_Core_Smarty::singleton();
$smarty->assign('extrainfo', 'one');
CRM_Core_Region::instance('testSmartyVars')->add(array(
$this->assertEquals($expected, $actual);
}
- function testWeight() {
+ public function testWeight() {
CRM_Core_Region::instance('testWeight')->add(array(
'markup' => 'prepend-5<br/>',
'weight' => -5,
*/
protected $mapper;
- function setUp() {
+ public function setUp() {
parent::setUp();
list ($this->basedir, $this->container, $this->mapper) = $this->_createMapper();
civicrm_smarty_register_string_resource( );
}
- function testAddScriptFile() {
+ public function testAddScriptFile() {
$this->res
->addScriptFile('com.example.ext', 'foo%20bar.js', 0, 'testAddScriptFile')
->addScriptFile('com.example.ext', 'foo%20bar.js', 0, 'testAddScriptFile') // extra
*
* FIXME: This can't work because the tests run in English and CRM_Core_Resources optimizes
* away the English data from $settings['strings']
- function testAddScriptFile_strings() {
+ public function testAddScriptFile_strings() {
file_put_contents($this->mapper->keyToBasePath('com.example.ext') . '/hello.js', 'alert(ts("Hello world"));');
$this->res->addScriptFile('com.example.ext', 'hello.js', 0, 'testAddScriptFile_strings');
$settings = $this->res->getSettings();
}
*/
- function testAddScriptURL() {
+ public function testAddScriptURL() {
$this->res
->addScriptUrl('/whiz/foo%20bar.js', 0, 'testAddScriptURL')
->addScriptUrl('/whiz/foo%20bar.js', 0, 'testAddScriptURL') // extra
$this->assertEquals($expected, $actual);
}
- function testAddScript() {
+ public function testAddScript() {
$this->res
->addScript('alert("hi");', 0, 'testAddScript')
->addScript('alert("there");', 0, 'testAddScript')
$this->assertEquals($expected, $actual);
}
- function testAddVars() {
+ public function testAddVars() {
$this->res
->addVars('food', array('fruit' => array('mine' => 'apple', 'ours' => 'banana')))
->addVars('food', array('fruit' => array('mine' => 'new apple', 'yours' => 'orange')))
);
}
- function testAddSetting() {
+ public function testAddSetting() {
$this->res
->addSetting(array('fruit' => array('mine' => 'apple')))
->addSetting(array('fruit' => array('yours' => 'orange')))
$this->assertTrue(strpos($actual, $expected) !== FALSE);
}
- function testAddSettingFactory() {
+ public function testAddSettingFactory() {
$this->res->addSettingsFactory(function() {
return array('fruit' => array('yours' => 'orange'));
});
$this->assertTreeEquals($expected, $actual);
}
- function testAddSettingAndSettingFactory() {
+ public function testAddSettingAndSettingFactory() {
$this->res->addSetting(array('fruit' => array('mine' => 'apple')));
$muckableValue = array('fruit' => array('yours' => 'orange', 'theirs' => 'apricot'));
$this->assertTreeEquals($expected, $actual);
}
- function testCrmJS() {
+ public function testCrmJS() {
$smarty = CRM_Core_Smarty::singleton();
$actual = $smarty->fetch('string:{crmScript ext=com.example.ext file=foo%20bar.js region=testCrmJS}');
$this->assertEquals($expected, $actual);
}
- function testAddStyleFile() {
+ public function testAddStyleFile() {
$this->res
->addStyleFile('com.example.ext', 'foo%20bar.css', 0, 'testAddStyleFile')
->addStyleFile('com.example.ext', 'foo%20bar.css', 0, 'testAddStyleFile') // extra
$this->assertEquals($expected, $actual);
}
- function testAddStyleURL() {
+ public function testAddStyleURL() {
$this->res
->addStyleUrl('/whiz/foo%20bar.css', 0, 'testAddStyleURL')
->addStyleUrl('/whiz/foo%20bar.css', 0, 'testAddStyleURL') // extra
$this->assertEquals($expected, $actual);
}
- function testAddStyle() {
+ public function testAddStyle() {
$this->res
->addStyle('body { background: black; }', 0, 'testAddStyle')
->addStyle('body { text-color: black; }', 0, 'testAddStyle')
$this->assertEquals($expected, $actual);
}
- function testCrmCSS() {
+ public function testCrmCSS() {
$smarty = CRM_Core_Smarty::singleton();
$actual = $smarty->fetch('string:{crmStyle ext=com.example.ext file=foo%20bar.css region=testCrmCSS}');
$this->assertEquals($expected, $actual);
}
- function testGetURL() {
+ public function testGetURL() {
$this->assertEquals(
'http://core-app/dir/file%20name.txt',
$this->res->getURL('civicrm', 'dir/file%20name.txt')
);
}
- function testCrmResURL() {
+ public function testCrmResURL() {
$smarty = CRM_Core_Smarty::singleton();
$actual = $smarty->fetch('string:{crmResURL ext=com.example.ext file=foo%20bar.png}');
* @internal param string $appendPathGarbage
* @return array(string $basedir, CRM_Extension_Container_Interface, CRM_Extension_Mapper)
*/
- function _createMapper(CRM_Utils_Cache_Interface $cache = NULL, $cacheKey = NULL) {
+ public function _createMapper(CRM_Utils_Cache_Interface $cache = NULL, $cacheKey = NULL) {
$basedir = rtrim($this->createTempDir('ext-'), '/');
mkdir("$basedir/com.example.ext");
file_put_contents("$basedir/com.example.ext/info.xml", "<extension key='com.example.ext' type='report'><file>oddball</file></extension>");
* Class CRM_Core_Smarty_plugins_CrmScopeTest
*/
class CRM_Core_Smarty_plugins_CrmScopeTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
require_once 'CRM/Core/Smarty.php';
/**
* @return array
*/
- function scopeCases() {
+ public function scopeCases() {
$cases = array();
$cases[] = array('', '{crmScope}{/crmScope}');
$cases[] = array('', '{crmScope x=1}{/crmScope}');
/**
* @dataProvider scopeCases
*/
- function testBlank($expected, $input) {
+ public function testBlank($expected, $input) {
$smarty = CRM_Core_Smarty::singleton();
$actual = $smarty->fetch('string:' . $input);
$this->assertEquals($expected, $actual, "Process input=[$input]");
*/
private $cids;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->quickCleanup(array('civicrm_contact', 'civicrm_activity'));
$this->callbackLog = array();
$this->cids = array();
}
- function dataCreateStyle() {
+ public function dataCreateStyle() {
return array(
array('sql-insert'),
array('bao-create'),
);
}
- function dataCreateAndCommitStyles() {
+ public function dataCreateAndCommitStyles() {
return array(
array('sql-insert', 'implicit-commit'),
array('sql-insert', 'explicit-commit'),
* @param string $commitStyle 'implicit-commit'|'explicit-commit'
* @dataProvider dataCreateAndCommitStyles
*/
- function testBasicCommit($createStyle, $commitStyle) {
+ public function testBasicCommit($createStyle, $commitStyle) {
$this->createContactWithTransaction('reuse-tx', $createStyle, $commitStyle);
$this->assertCount(1, $this->cids);
$this->assertContactsExistByOffset(array(0 => TRUE));
/**
* @dataProvider dataCreateStyle
*/
- function testBasicRollback($createStyle) {
+ public function testBasicRollback($createStyle) {
$this->createContactWithTransaction('reuse-tx', $createStyle, 'rollback');
$this->assertCount(1, $this->cids);
$this->assertContactsExistByOffset(array(0 => FALSE));
* @param string $commitStyle 'implicit-commit'|'explicit-commit'
* @dataProvider dataCreateAndCommitStyles
*/
- function testBatchRollback($createStyle, $commitStyle) {
+ public function testBatchRollback($createStyle, $commitStyle) {
$this->runBatch(
'reuse-tx',
array(
* @param string $commitStyle 'implicit-commit'|'explicit-commit'
* @dataProvider dataCreateAndCommitStyles
*/
- function testMixedBatchCommit_nesting($createStyle, $commitStyle) {
+ public function testMixedBatchCommit_nesting($createStyle, $commitStyle) {
$this->runBatch(
'reuse-tx',
array(
* @param string $commitStyle 'implicit-commit'|'explicit-commit'
* @dataProvider dataCreateAndCommitStyles
*/
- function testMixedBatchCommit_reuse($createStyle, $commitStyle) {
+ public function testMixedBatchCommit_reuse($createStyle, $commitStyle) {
$this->runBatch(
'reuse-tx',
array(
* @param string $commitStyle 'implicit-commit'|'explicit-commit'
* @dataProvider dataCreateAndCommitStyles
*/
- function testMixedBatchRollback_nesting($createStyle, $commitStyle) {
+ public function testMixedBatchRollback_nesting($createStyle, $commitStyle) {
$this->assertFalse(CRM_Core_Transaction::isActive());
$this->runBatch(
'reuse-tx',
* @param string $outcome 'rollback'|'implicit-commit'|'explicit-commit' how to finish transaction
* @return int cid
*/
- function runBatch($nesting, $callbacks, $existsByOffset, $outcome) {
+ public function runBatch($nesting, $callbacks, $existsByOffset, $outcome) {
if ($nesting != 'reuse-tx' && $nesting != 'nest-tx') {
throw new RuntimeException('Bad test data: nesting=' . $nesting);
}
} // else: implicit-commit
}
- function _preCommit($arg1, $arg2) {
+ public function _preCommit($arg1, $arg2) {
$this->callbackLog[] = array('_preCommit', $arg1, $arg2);
}
- function _postCommit($arg1, $arg2) {
+ public function _postCommit($arg1, $arg2) {
$this->callbackLog[] = array('_postCommit', $arg1, $arg2);
}
- function _preRollback($arg1, $arg2) {
+ public function _preRollback($arg1, $arg2) {
$this->callbackLog[] = array('_preRollback', $arg1, $arg2);
}
- function _postRollback($arg1, $arg2) {
+ public function _postRollback($arg1, $arg2) {
$this->callbackLog[] = array('_postRollback', $arg1, $arg2);
}
}
* Class CRM_Dedupe_DedupeFinderTest
*/
class CRM_Dedupe_DedupeFinderTest extends CiviUnitTestCase {
- function testFuzzyDupes() {
+ public function testFuzzyDupes() {
// make dupe checks based on based on following contact sets:
// FIRST - LAST - EMAIL
// ---------------------------------
civicrm_api('group', 'delete', $params);
}
- function testDupesByParams() {
+ public function testDupesByParams() {
// make dupe checks based on based on following contact sets:
// FIRST - LAST - EMAIL
// ---------------------------------
*/
class CRM_Event_BAO_AdditionalPaymentTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->_contactId = Contact::createIndividual();
$this->_eventId = Event::create($this->_contactId);
}
- function tearDown() {
+ public function tearDown() {
$this->eventDelete($this->_eventId);
$this->quickCleanup(
array(
* @return array
* @throws Exception
*/
- function _addParticipantWithPayment($feeTotal, $actualPaidAmt) {
+ public function _addParticipantWithPayment($feeTotal, $actualPaidAmt) {
// creating price set, price field
$paramsSet['title'] = 'Price Set';
$paramsSet['name'] = CRM_Utils_String::titleToVar('Price Set');
}
// CRM-13964
- function testAddPartialPayment() {
+ public function testAddPartialPayment() {
$feeAmt = 100;
$amtPaid = 60;
$balance = $feeAmt - $amtPaid;
/**
* create() and deleteParticipantStatusType() method
*/
- function testCreateAndDelete() {
+ public function testCreateAndDelete() {
// create using required params
$params = array(
/**
* add() method (add and edit modes of participant status type)
*/
- function testAddStatusType() {
+ public function testAddStatusType() {
$params = array(
'name' => 'testStatus',
/**
* Retrieve() method of participant status type
*/
- function testRetrieveStatusType() {
+ public function testRetrieveStatusType() {
$params = array(
'name' => 'testStatus',
/**
* SetIsActive() method of participant status type
*/
- function testSetIsActiveStatusType() {
+ public function testSetIsActiveStatusType() {
$params = array(
'name' => 'testStatus',
*/
class CRM_Event_BAO_ParticipantTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->_contactId = Contact::createIndividual();
$this->_eventId = Event::create($this->_contactId);
/**
* Add() method (add and edit modes of participant)
*/
- function testAdd() {
+ public function testAdd() {
$params = array(
'send_receipt' => 1,
'is_test' => 0,
/**
* GetValues() method (fetch value of participant)
*/
- function testgetValuesWithValidParams() {
+ public function testgetValuesWithValidParams() {
$participantId = Participant::create($this->_contactId, $this->_eventId);
$params = array('id' => $participantId);
$values = $ids = array();
/**
* GetValues() method (checking for behavior when params are empty )
*/
- function testgetValuesWithoutValidParams() {
+ public function testgetValuesWithoutValidParams() {
$params = $values = $ids = array();
$participantId = Participant::create($this->_contactId, $this->_eventId);
$fetchParticipant = CRM_Event_BAO_Participant::getValues($params, $values, $ids);
/**
* EventFull() method (checking the event for full )
*/
- function testEventFull() {
+ public function testEventFull() {
$eventParams = array(
'max_participants' => 1,
'id' => $this->_eventId,
/**
* ImportableFields() method ( Checking the Event's Importable Fields )
*/
- function testimportableFields() {
+ public function testimportableFields() {
$importableFields = CRM_Event_BAO_Participant::importableFields();
$this->assertNotEquals(count($importableFields), 0, 'Checking array not to be empty.');
/**
* ParticipantDetails() method ( Checking the Participant Details )
*/
- function testparticipantDetails() {
+ public function testparticipantDetails() {
$participantId = Participant::create($this->_contactId, $this->_eventId);
$params = array('name' => 'Doe, John', 'title' => 'Test Event');
/**
* DeleteParticipant() method ( Delete a Participant )
*/
- function testdeleteParticipant() {
+ public function testdeleteParticipant() {
$params = array(
'send_receipt' => 1,
'is_test' => 0,
/**
* CheckDuplicate() method ( Checking for Duplicate Participant returns array of participant id)
*/
- function testcheckDuplicate() {
+ public function testcheckDuplicate() {
$duplicate = array();
//Creating 3 new participants
/**
* Create() method (create and updation of participant)
*/
- function testCreate() {
+ public function testCreate() {
$params = array(
'send_receipt' => 1,
'is_test' => 0,
/**
* ExportableFields() method ( Exportable Fields for Participant)
*/
- function testexportableFields() {
+ public function testexportableFields() {
$exportableFields = CRM_Event_BAO_Participant::exportableFields();
$this->assertNotEquals(count($exportableFields), 0, 'Checking array not to be empty.');
/**
* FixEventLevel() method (Setting ',' values), resolveDefaults(assinging value to array) method
*/
- function testfixEventLevel() {
+ public function testfixEventLevel() {
$paramsSet['title'] = 'Price Set';
$paramsSet['name'] = CRM_Utils_String::titleToVar('Price Set');
* Class CRM_Extension_BrowserTest
*/
class CRM_Extension_BrowserTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function tearDown() {
+ public function tearDown() {
parent::tearDown();
}
- function testDisabled() {
+ public function testDisabled() {
$browser = new CRM_Extension_Browser(FALSE, '/index.html', 'file:///itd/oesn/tmat/ter');
$this->assertEquals(FALSE, $browser->isEnabled());
$this->assertEquals(array(), $browser->checkRequirements());
$this->assertEquals(array(), $browser->getExtensions());
}
- function testCheckRequirements_BadCachedir_false() {
+ public function testCheckRequirements_BadCachedir_false() {
$browser = new CRM_Extension_Browser('file://' . dirname(__FILE__) .'/dataset/good-repository', '/index.html', FALSE);
$this->assertEquals(TRUE, $browser->isEnabled());
$reqs = $browser->checkRequirements();
$this->assertEquals(1, count($reqs));
}
- function testCheckRequirements_BadCachedir_nonexistent() {
+ public function testCheckRequirements_BadCachedir_nonexistent() {
$browser = new CRM_Extension_Browser('file://' . dirname(__FILE__) .'/dataset/good-repository', '/index.html', '/tot/all/yin/v/alid');
$this->assertEquals(TRUE, $browser->isEnabled());
$reqs = $browser->checkRequirements();
$this->assertEquals(1, count($reqs));
}
- function testGetExtensions_good() {
+ public function testGetExtensions_good() {
$browser = new CRM_Extension_Browser('file://' . dirname(__FILE__) .'/dataset/good-repository', '/index.html', $this->createTempDir('ext-cache-'));
$this->assertEquals(TRUE, $browser->isEnabled());
$this->assertEquals(array(), $browser->checkRequirements());
$this->assertEquals('http://example.com/test.crm.extension.browsertest.b-1.2.zip', $exts['test.crm.extension.browsertest.b']->downloadUrl);
}
- function testGetExtension_good() {
+ public function testGetExtension_good() {
$browser = new CRM_Extension_Browser('file://' . dirname(__FILE__) .'/dataset/good-repository', '/index.html', $this->createTempDir('ext-cache-'));
$this->assertEquals(TRUE, $browser->isEnabled());
$this->assertEquals(array(), $browser->checkRequirements());
$this->assertEquals('http://example.com/test.crm.extension.browsertest.b-1.2.zip', $info->downloadUrl);
}
- function testGetExtension_nonexistent() {
+ public function testGetExtension_nonexistent() {
$browser = new CRM_Extension_Browser('file://' . dirname(__FILE__) .'/dataset/good-repository', '/index.html', $this->createTempDir('ext-cache-'));
$this->assertEquals(TRUE, $browser->isEnabled());
$this->assertEquals(array(), $browser->checkRequirements());
* Class CRM_Extension_Container_BasicTest
*/
class CRM_Extension_Container_BasicTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function tearDown() {
+ public function tearDown() {
parent::tearDown();
}
- function testGetKeysEmpty() {
+ public function testGetKeysEmpty() {
$basedir = $this->createTempDir('ext-empty-');
$c = new CRM_Extension_Container_Basic($basedir, 'http://example/basedir', NULL, NULL);
$this->assertEquals($c->getKeys(), array());
}
- function testGetKeys() {
+ public function testGetKeys() {
list($basedir, $c) = $this->_createContainer();
$this->assertEquals($c->getKeys(), array('test.foo', 'test.foo.bar'));
}
- function testGetPath() {
+ public function testGetPath() {
list($basedir, $c) = $this->_createContainer();
try {
$c->getPath('un.kno.wn');
$this->assertEquals("$basedir/foo/bar", $c->getPath('test.foo.bar'));
}
- function testGetPath_extraSlashFromConfig() {
+ public function testGetPath_extraSlashFromConfig() {
list($basedir, $c) = $this->_createContainer(NULL, NULL, '/');
try {
$c->getPath('un.kno.wn');
$this->assertEquals("$basedir/foo/bar", $c->getPath('test.foo.bar'));
}
- function testGetResUrl() {
+ public function testGetResUrl() {
list($basedir, $c) = $this->_createContainer();
try {
$c->getResUrl('un.kno.wn');
$this->assertEquals('http://example/basedir/foo/bar', $c->getResUrl('test.foo.bar'));
}
- function testGetResUrl_extraSlashFromConfig() {
+ public function testGetResUrl_extraSlashFromConfig() {
list($basedir, $c) = $this->_createContainer(NULL, NULL, '/');
try {
$c->getResUrl('un.kno.wn');
$this->assertEquals('http://example/basedir/foo/bar', $c->getResUrl('test.foo.bar'));
}
- function testCaching() {
+ public function testCaching() {
$cache = new CRM_Utils_Cache_Arraycache(array());
$this->assertTrue(!is_array($cache->get('basic-scan')));
list($basedir, $c) = $this->_createContainer($cache, 'basic-scan');
*
* @return array
*/
- function _createContainer(CRM_Utils_Cache_Interface $cache = NULL, $cacheKey = NULL, $appendPathGarbage = '') {
+ public function _createContainer(CRM_Utils_Cache_Interface $cache = NULL, $cacheKey = NULL, $appendPathGarbage = '') {
$basedir = rtrim($this->createTempDir('ext-'), '/');
mkdir("$basedir/foo");
mkdir("$basedir/foo/bar");
return array($basedir, $c);
}
- function testConvertPathsToUrls() {
+ public function testConvertPathsToUrls() {
$relPaths = array(
'foo.bar' => 'foo\bar',
'whiz.bang' => 'tests\extensions\whiz\bang'
// WARNING - NEVER COPY & PASTE $_eNoticeCompliant = FALSE
// new test classes should be compliant.
public $_eNoticeCompliant = FALSE;
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function tearDown() {
+ public function tearDown() {
parent::tearDown();
}
- function testGetKeysEmpty() {
+ public function testGetKeysEmpty() {
$c = new CRM_Extension_Container_Collection(array());
$this->assertEquals($c->getKeys(), array());
}
- function testGetKeys() {
+ public function testGetKeys() {
$c = $this->_createContainer();
$this->assertEquals(array('test.conflict', 'test.whiz', 'test.whizbang', 'test.foo', 'test.foo.bar'), $c->getKeys());
}
- function testGetPath() {
+ public function testGetPath() {
$c = $this->_createContainer();
try {
$c->getPath('un.kno.wn');
$this->assertEquals("/path/to/conflict-b", $c->getPath('test.conflict'));
}
- function testGetResUrl() {
+ public function testGetResUrl() {
$c = $this->_createContainer();
try {
$c->getResUrl('un.kno.wn');
$this->assertEquals('http://conflict-b', $c->getResUrl('test.conflict'));
}
- function testCaching() {
+ public function testCaching() {
$cache = new CRM_Utils_Cache_Arraycache(array());
$this->assertTrue(!is_array($cache->get('ext-collection')));
$c = $this->_createContainer($cache, 'ext-collection');
*
* @return CRM_Extension_Container_Collection
*/
- function _createContainer(CRM_Utils_Cache_Interface $cache = NULL, $cacheKey = NULL) {
+ public function _createContainer(CRM_Utils_Cache_Interface $cache = NULL, $cacheKey = NULL) {
$containers = array();
$containers['a'] = new CRM_Extension_Container_Static(array(
'test.foo' => array(
* Class CRM_Extension_Container_StaticTest
*/
class CRM_Extension_Container_StaticTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function tearDown() {
+ public function tearDown() {
parent::tearDown();
}
- function testGetKeysEmpty() {
+ public function testGetKeysEmpty() {
$c = new CRM_Extension_Container_Static(array());
$this->assertEquals($c->getKeys(), array());
}
- function testGetKeys() {
+ public function testGetKeys() {
$c = $this->_createContainer();
$this->assertEquals($c->getKeys(), array('test.foo', 'test.foo.bar'));
}
- function testGetPath() {
+ public function testGetPath() {
$c = $this->_createContainer();
try {
$c->getPath('un.kno.wn');
$this->assertEquals("/path/to/bar", $c->getPath('test.foo.bar'));
}
- function testGetResUrl() {
+ public function testGetResUrl() {
$c = $this->_createContainer();
try {
$c->getResUrl('un.kno.wn');
/**
* @return CRM_Extension_Container_Static
*/
- function _createContainer() {
+ public function _createContainer() {
return new CRM_Extension_Container_Static(array(
'test.foo' => array(
'path' => '/path/to/foo',
* Class CRM_Extension_InfoTest
*/
class CRM_Extension_InfoTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->file = NULL;
}
- function tearDown() {
+ public function tearDown() {
if ($this->file) {
unlink($this->file);
}
parent::tearDown();
}
- function testGood_file() {
+ public function testGood_file() {
$this->file = tempnam(sys_get_temp_dir(), 'infoxml-');
file_put_contents($this->file, "<extension key='test.foo' type='module'><file>foo</file><typeInfo><extra>zamboni</extra></typeInfo></extension>");
$this->assertEquals('zamboni', $info->typeInfo['extra']);
}
- function testBad_file() {
+ public function testBad_file() {
// <file> vs file>
$this->file = tempnam(sys_get_temp_dir(), 'infoxml-');
file_put_contents($this->file, "<extension key='test.foo' type='module'>file>foo</file></extension>");
$this->assertTrue(is_object($exc));
}
- function testGood_string() {
+ public function testGood_string() {
$data = "<extension key='test.foo' type='module'><file>foo</file><typeInfo><extra>zamboni</extra></typeInfo></extension>";
$info = CRM_Extension_Info::loadFromString($data);
$this->assertEquals('zamboni', $info->typeInfo['extra']);
}
- function testBad_string() {
+ public function testBad_string() {
// <file> vs file>
$data = "<extension key='test.foo' type='module'>file>foo</file></extension>";
// WARNING - NEVER COPY & PASTE $_eNoticeCompliant = FALSE
// new test classes should be compliant.
public $_eNoticeCompliant = FALSE;
- function setUp() {
+ public function setUp() {
parent::setUp();
// $query = "INSERT INTO civicrm_domain ( name, version ) VALUES ( 'domain', 3 )";
// $result = CRM_Core_DAO::executeQuery($query);
$this->setExtensionSystem($this->system);
}
- function tearDown() {
+ public function tearDown() {
parent::tearDown();
$this->system = NULL;
}
/**
* Install an extension with a valid type name
*/
- function testInstallDisableUninstall() {
+ public function testInstallDisableUninstall() {
$manager = $this->system->getManager();
$this->assertModuleActiveByName(FALSE, 'moduletest');
/**
* Install an extension with a valid type name
*/
- function testInstallDisableEnable() {
+ public function testInstallDisableEnable() {
$manager = $this->system->getManager();
$this->assertModuleActiveByName(FALSE, 'moduletest');
$this->assertModuleActiveByKey(FALSE, 'test.extension.manager.moduletest');
/**
* Install an extension then forcibly remove the code and cleanup DB afterwards.
*/
- function testInstall_DirtyRemove_Disable_Uninstall() {
+ public function testInstall_DirtyRemove_Disable_Uninstall() {
// create temporary extension (which can dirtily remove later)
$this->_createExtension('test.extension.manager.module.auto1', 'module', 'test_extension_manager_module_auto1');
$mainfile = $this->basedir . '/test.extension.manager.module.auto1/test_extension_manager_module_auto1.php';
/**
* Install an extension then forcibly remove the code and cleanup DB afterwards.
*/
- function testInstall_DirtyRemove_Disable_Restore() {
+ public function testInstall_DirtyRemove_Disable_Restore() {
// create temporary extension (which can dirtily remove later)
$this->_createExtension('test.extension.manager.module.auto2', 'module', 'test_extension_manager_module_auto2');
$mainfile = $this->basedir . '/test.extension.manager.module.auto2/test_extension_manager_module_auto2.php';
* @param $module
* @param array $counts expected hook invocation counts ($hookName => $count)
*/
- function assertHookCounts($module, $counts) {
+ public function assertHookCounts($module, $counts) {
global $_test_extension_manager_moduletest_counts;
foreach ($counts as $key => $expected) {
$actual = @$_test_extension_manager_moduletest_counts[$module][$key];
* @param $expectedIsActive
* @param $prefix
*/
- function assertModuleActiveByName($expectedIsActive, $prefix) {
+ public function assertModuleActiveByName($expectedIsActive, $prefix) {
$activeModules = CRM_Core_PseudoConstant::getModuleExtensions(TRUE); // FIXME
foreach ($activeModules as $activeModule) {
if ($activeModule['prefix'] == $prefix) {
* @param $expectedIsActive
* @param $key
*/
- function assertModuleActiveByKey($expectedIsActive, $key) {
+ public function assertModuleActiveByKey($expectedIsActive, $key) {
foreach (CRM_Core_Module::getAll() as $module) {
if ($module->name == $key) {
$this->assertEquals((bool)$expectedIsActive, (bool)$module->is_active);
* @param $file
* @param string $template
*/
- function _createExtension($key, $type, $file, $template = self::MODULE_TEMPLATE) {
+ public function _createExtension($key, $type, $file, $template = self::MODULE_TEMPLATE) {
$basedir = $this->basedir;
mkdir("$basedir/$key");
file_put_contents("$basedir/$key/info.xml", "<extension key='$key' type='$type'><file>$file</file></extension>");
// WARNING - NEVER COPY & PASTE $_eNoticeCompliant = FALSE
// new test classes should be compliant.
public $_eNoticeCompliant = FALSE;
- function setUp() {
+ public function setUp() {
parent::setUp();
if (class_exists('test_extension_manager_paymenttest')) {
test_extension_manager_paymenttest::$counts = array();
$this->quickCleanup(array('civicrm_payment_processor'));
}
- function tearDown() {
+ public function tearDown() {
parent::tearDown();
$this->system = NULL;
$this->quickCleanup(array('civicrm_payment_processor'));
/**
* Install an extension with a valid type name
*/
- function testInstallDisableUninstall() {
+ public function testInstallDisableUninstall() {
$manager = $this->system->getManager();
$this->assertDBQuery(0, 'SELECT count(*) FROM civicrm_payment_processor_type WHERE class_name = "test.extension.manager.paymenttest"');
$manager->install(array('test.extension.manager.paymenttest'));
/**
* Install an extension with a valid type name
*/
- function testInstallDisableEnable() {
+ public function testInstallDisableEnable() {
$manager = $this->system->getManager();
$this->assertDBQuery(0, 'SELECT count(*) FROM civicrm_payment_processor_type WHERE class_name = "test.extension.manager.paymenttest"');
* Install an extension and create a payment processor which uses it.
* Attempts to uninstall fail
*/
- function testInstall_Add_FailUninstall() {
+ public function testInstall_Add_FailUninstall() {
$manager = $this->system->getManager();
$this->assertDBQuery(0, 'SELECT count(*) FROM civicrm_payment_processor_type WHERE class_name = "test.extension.manager.paymenttest"');
* Class CRM_Extension_Manager_ReportTest
*/
class CRM_Extension_Manager_ReportTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
//if (class_exists('test_extension_manager_reporttest')) {
// test_extension_manager_reporttest::$counts = array();
));
}
- function tearDown() {
+ public function tearDown() {
parent::tearDown();
}
/**
* Install an extension with a valid type name
*/
- function testInstallDisableUninstall() {
+ public function testInstallDisableUninstall() {
$manager = $this->system->getManager();
$this->assertDBQuery(0, 'SELECT count(*) FROM civicrm_option_value WHERE name = "test.extension.manager.reporttest"');
/**
* Install an extension with a valid type name
*/
- function testInstallDisableEnable() {
+ public function testInstallDisableEnable() {
$manager = $this->system->getManager();
$this->assertDBQuery(0, 'SELECT count(*) FROM civicrm_option_value WHERE name = "test.extension.manager.reporttest"');
* Class CRM_Extension_Manager_SearchTest
*/
class CRM_Extension_Manager_SearchTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
//if (class_exists('test_extension_manager_searchtest')) {
// test_extension_manager_searchtest::$counts = array();
));
}
- function tearDown() {
+ public function tearDown() {
parent::tearDown();
$this->system = NULL;
}
/**
* Install an extension with a valid type name
*/
- function testInstallDisableUninstall() {
+ public function testInstallDisableUninstall() {
$manager = $this->system->getManager();
$this->assertDBQuery(0, 'SELECT count(*) FROM civicrm_option_value WHERE name = "test.extension.manager.searchtest"');
/**
* Install an extension with a valid type name
*/
- function testInstallDisableEnable() {
+ public function testInstallDisableEnable() {
$manager = $this->system->getManager();
$this->assertDBQuery(0, 'SELECT count(*) FROM civicrm_option_value WHERE name = "test.extension.manager.searchtest"');
const TESTING_TYPE = 'report';
const OTHER_TESTING_TYPE = 'module';
- function setUp() {
+ public function setUp() {
parent::setUp();
list ($this->basedir, $this->container) = $this->_createContainer();
$this->mapper = new CRM_Extension_Mapper($this->container);
}
- function tearDown() {
+ public function tearDown() {
parent::tearDown();
}
*
* @expectedException CRM_Extension_Exception
*/
- function testInstallInvalidType() {
+ public function testInstallInvalidType() {
$testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
$testingTypeManager->expects($this->never())
->method('onPreInstall');
* the second. This controls for bad SQL queries which hit either
* "the first row" or "all rows".
*/
- function testInstall_Disable_Uninstall() {
+ public function testInstall_Disable_Uninstall() {
$testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
$manager = $this->_createManager(array(
self::TESTING_TYPE => $testingTypeManager,
* Install an extension and then harshly remove the underlying source.
* Subseuently disable and uninstall.
*/
- function testInstall_DirtyRemove_Disable_Uninstall() {
+ public function testInstall_DirtyRemove_Disable_Uninstall() {
$testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
$manager = $this->_createManager(array(
self::TESTING_TYPE => $testingTypeManager,
/**
* Install an extension with a valid type name
*/
- function testInstall_Disable_Enable() {
+ public function testInstall_Disable_Enable() {
$testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
$manager = $this->_createManager(array(
self::TESTING_TYPE => $testingTypeManager,
/**
* Performing 'install' on a 'disabled' extension performs an 'enable'
*/
- function testInstall_Disable_Install() {
+ public function testInstall_Disable_Install() {
$testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
$manager = $this->_createManager(array(
self::TESTING_TYPE => $testingTypeManager,
/**
* Install an extension with a valid type name
*/
- function testEnableBare() {
+ public function testEnableBare() {
$testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
$manager = $this->_createManager(array(
self::TESTING_TYPE => $testingTypeManager,
/**
* Get the status of an unknown extension
*/
- function testStatusUnknownKey() {
+ public function testStatusUnknownKey() {
$testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
$testingTypeManager->expects($this->never())
->method('onPreInstall');
/**
* Replace code for an extension that doesn't exist in the container
*/
- function testReplace_Unknown() {
+ public function testReplace_Unknown() {
$testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
$manager = $this->_createManager(array(
self::TESTING_TYPE => $testingTypeManager,
/**
* Replace code for an extension that doesn't exist in the container
*/
- function testReplace_Uninstalled() {
+ public function testReplace_Uninstalled() {
$testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
$manager = $this->_createManager(array(
self::TESTING_TYPE => $testingTypeManager,
* Note that some metadata changes between versions -- the original has
* file="oddball", and the upgrade has file="newextension".
*/
- function testReplace_Installed() {
+ public function testReplace_Installed() {
$testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
$manager = $this->_createManager(array(
self::TESTING_TYPE => $testingTypeManager,
* Note that some metadata changes between versions -- the original has
* file="oddball", and the upgrade has file="newextension".
*/
- function testReplace_InstalledMissing() {
+ public function testReplace_InstalledMissing() {
$testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
$manager = $this->_createManager(array(
self::TESTING_TYPE => $testingTypeManager,
*
* @return CRM_Extension_Manager
*/
- function _createManager($typeManagers) {
+ public function _createManager($typeManagers) {
//list ($basedir, $c) = $this->_createContainer();
$mapper = new CRM_Extension_Mapper($this->container);
return new CRM_Extension_Manager($this->container, $this->container, $this->mapper, $typeManagers);
*
* @return array
*/
- function _createContainer(CRM_Utils_Cache_Interface $cache = NULL, $cacheKey = NULL) {
+ public function _createContainer(CRM_Utils_Cache_Interface $cache = NULL, $cacheKey = NULL) {
$basedir = $this->createTempDir('ext-');
mkdir("$basedir/weird");
mkdir("$basedir/weird/foobar");
*
* @return string
*/
- function _createDownload($key, $file) {
+ public function _createDownload($key, $file) {
$basedir = $this->createTempDir('ext-dl-');
file_put_contents("$basedir/info.xml", "<extension key='$key' type='".self::TESTING_TYPE."'><file>$file</file></extension>");
file_put_contents("$basedir/$file.php", "<?php\n");
* Class CRM_Extension_MapperTest
*/
class CRM_Extension_MapperTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
list ($this->basedir, $this->container) = $this->_createContainer();
$this->mapper = new CRM_Extension_Mapper($this->container);
$this->mapperWithSlash = new CRM_Extension_Mapper($this->containerWithSlash);
}
- function tearDown() {
+ public function tearDown() {
parent::tearDown();
}
- function testClassToKey() {
+ public function testClassToKey() {
$this->assertEquals("test.foo.bar", $this->mapper->classToKey('test_foo_bar'));
}
- function testClassToPath() {
+ public function testClassToPath() {
$this->assertEquals("{$this->basedir}/weird/foobar/oddball.php", $this->mapper->classToPath('test_foo_bar'));
}
- function testIsExtensionClass() {
+ public function testIsExtensionClass() {
$this->assertTrue($this->mapper->isExtensionClass('test_foo_bar'));
$this->assertFalse($this->mapper->isExtensionClass('test.foo.bar'));
$this->assertFalse($this->mapper->isExtensionClass('CRM_Core_DAO'));
}
- function testIsExtensionKey() {
+ public function testIsExtensionKey() {
$this->assertFalse($this->mapper->isExtensionKey('test_foo_bar'));
$this->assertTrue($this->mapper->isExtensionKey('test.foo.bar'));
$this->assertFalse($this->mapper->isExtensionKey('CRM_Core_DAO'));
}
- function testGetTemplateName() {
+ public function testGetTemplateName() {
$this->assertEquals("oddball.tpl", $this->mapper->getTemplateName('test_foo_bar'));
}
- function testGetTemplatePath() {
+ public function testGetTemplatePath() {
$this->assertEquals("{$this->basedir}/weird/foobar/templates", $this->mapper->getTemplatePath('test_foo_bar'));
}
- function testKeyToClass() {
+ public function testKeyToClass() {
$this->assertEquals("test_foo_bar", $this->mapper->keyToClass('test.foo.bar'));
}
- function testKeyToPath() {
+ public function testKeyToPath() {
$this->assertEquals("{$this->basedir}/weird/foobar/oddball.php", $this->mapper->classToPath('test.foo.bar'));
$this->assertEquals("{$this->basedir2}/weird/foobar/oddball.php", $this->mapperWithSlash->classToPath('test.foo.bar'));
}
- function testKeyToBasePath() {
+ public function testKeyToBasePath() {
$this->assertEquals("{$this->basedir}/weird/foobar", $this->mapper->keyToBasePath('test.foo.bar'));
$this->assertEquals("{$this->basedir2}/weird/foobar", $this->mapperWithSlash->keyToBasePath('test.foo.bar'));
$this->assertEquals(rtrim($civicrm_root, '/'), $this->mapper->keyToBasePath('civicrm'));
}
- function testKeyToUrl() {
+ public function testKeyToUrl() {
$this->assertEquals("http://example/basedir/weird/foobar", $this->mapper->keyToUrl('test.foo.bar'));
$this->assertEquals("http://example/basedir/weird/foobar", $this->mapperWithSlash->keyToUrl('test.foo.bar'));
*
* @return array
*/
- function _createContainer(CRM_Utils_Cache_Interface $cache = NULL, $cacheKey = NULL, $appendPathGarbage = '') {
+ public function _createContainer(CRM_Utils_Cache_Interface $cache = NULL, $cacheKey = NULL, $appendPathGarbage = '') {
/*
$container = new CRM_Extension_Container_Static(array(
'test.foo.bar' => array(
*/
class CRM_Financial_BAO_FinancialAccountTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->organizationCreate();
}
- function teardown() {
+ public function teardown() {
$this->financialAccountDelete('Donations');
}
/**
* Check method add()
*/
- function testAdd() {
+ public function testAdd() {
$params = array(
'name' => 'Donations',
'is_deductible' => 0,
/**
* Check method retrive()
*/
- function testRetrieve() {
+ public function testRetrieve() {
$params = array(
'name' => 'Donations',
'is_deductible' => 0,
/**
* Check method setIsActive()
*/
- function testSetIsActive() {
+ public function testSetIsActive() {
$params = array(
'name' => 'Donations',
'is_deductible' => 0,
/**
* Check method del()
*/
- function testdel() {
+ public function testdel() {
$params = array(
'name' => 'Donations',
'is_deductible' => 0,
/**
* Check method getAccountingCode()
*/
- function testGetAccountingCode() {
+ public function testGetAccountingCode() {
$params = array(
'name' => 'Donations',
'is_active' => 1,
*/
class CRM_Financial_BAO_FinancialItemTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
/**
* Check method add()
*/
- function testAdd() {
+ public function testAdd() {
$firstName = 'Shane';
$lastName = 'Whatson';
$params = array(
/**
* Check method retrive()
*/
- function testRetrieve() {
+ public function testRetrieve() {
$firstName = 'Shane';
$lastName = 'Whatson';
$params = array(
/**
* Check method create()
*/
- function testCreate() {
+ public function testCreate() {
$firstName = 'Shane';
$lastName = 'Whatson';
$params = array(
/**
* Check method del()
*/
- function testCreateEntityTrxn() {
+ public function testCreateEntityTrxn() {
$fParams = array(
'name' => 'Donations'.substr(sha1(rand()), 0, 7),
'is_deductible' => 0,
/**
* Check method retrieveEntityFinancialTrxn()
*/
- function testRetrieveEntityFinancialTrxn() {
+ public function testRetrieveEntityFinancialTrxn() {
$entityTrxn = self::testCreateEntityTrxn();
$params = array(
'entity_table' => 'civicrm_contribution',
*/
class CRM_Financial_BAO_FinancialTypeAccountTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->organizationCreate();
}
/**
* Check method add()
*/
- function testAdd() {
+ public function testAdd() {
$params = array(
'name' => 'TestFinancialAccount_1',
'accounting_code' => 4800,
/**
* Check method del()
*/
- function testDel() {
+ public function testDel() {
$params = array(
'name' => 'TestFinancialAccount_2',
'is_deductible' => 0,
/**
* Check method getFinancialAccount()
*/
- function testRetrieve() {
+ public function testRetrieve() {
$params = array(
'name' => 'TestFinancialAccount_3',
'is_deductible' => 0,
/**
* Check method getFinancialAccount()
*/
- function testGetFinancialAccount() {
+ public function testGetFinancialAccount() {
$params = array(
'name' => 'TestFinancialAccount',
'accounting_code' => 4800,
/**
* Check method getInstrumentFinancialAccount()
*/
- function testGetInstrumentFinancialAccount() {
+ public function testGetInstrumentFinancialAccount() {
$paymentInstrumentValue = 1;
$params = array(
'name' => 'Donations',
*/
class CRM_Financial_BAO_FinancialTypeTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function teardown() {
+ public function teardown() {
$this->financialAccountDelete('Donations');
}
/**
* Check method add()
*/
- function testAdd() {
+ public function testAdd() {
$params = array(
'name' => 'Donations',
'is_active' => 1,
/**
* Check method retrive()
*/
- function testRetrieve() {
+ public function testRetrieve() {
$params = array(
'name' => 'Donations',
'is_active' => 1,
/**
* Check method setIsActive()
*/
- function testSetIsActive() {
+ public function testSetIsActive() {
$params = array(
'name' => 'Donations',
'is_deductible' => 0,
/**
* Check method del()
*/
- function testDel() {
+ public function testDel() {
$params = array(
'name' => 'Donations',
'is_deductible' => 0,
*/
class CRM_Financial_BAO_PaymentProcessorTypeTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
/**
* Check method create()
*/
- function testCreate() {
+ public function testCreate() {
$params = array(
'name' => 'Test_Payment_Processor',
'title' => 'Test Payment Processor',
/**
* Check method retrieve()
*/
- function testRetrieve() {
+ public function testRetrieve() {
$params = array(
'name' => 'Test_Retrieve_Payment_Processor',
'title' => 'Test Retrieve Payment Processor',
/**
* Check method setIsActive()
*/
- function testSetIsActive() {
+ public function testSetIsActive() {
$params = array(
'name' => 'Test_Set_Payment_Processor',
'title' => 'Test Set Payment Processor',
/**
* Check method getDefault()
*/
- function testGetDefault() {
+ public function testGetDefault() {
$params = array('is_default' => 1);
$defaults = array();
$result = CRM_Financial_BAO_PaymentProcessorType::retrieve($params, $defaults);
/**
* Check method del()
*/
- function testDel() {
+ public function testDel() {
$params = array(
'name' => 'Test_Del_Payment_Processor',
'title' => 'Test Del Payment Processor',
protected $_params = array();
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->_params = array(
'sEcho' => '1',
$this->groupCreate(array('title' => 'not-me-active', 'is_active' => 1, 'name' => 'not-me-active'));
}
- function tearDown() {
+ public function tearDown() {
CRM_Utils_Hook::singleton()->reset();
$this->quickCleanup(array('civicrm_group'));
$config = CRM_Core_Config::singleton();
/**
* @param $permission
*/
- function setPermissionAndRequest($permission) {
+ public function setPermissionAndRequest($permission) {
CRM_Core_Config::singleton()->userPermissionClass->permissions = array($permission);
CRM_Contact_BAO_Group::getPermissionClause(TRUE);
global $_REQUEST;
* @param $permission
* @param $hook
*/
- function setHookAndRequest($permission, $hook) {
+ public function setHookAndRequest($permission, $hook) {
CRM_Core_Config::singleton()->userPermissionClass->permissions = array($permission);
$this->hookClass->setHook('civicrm_aclGroup', array($this, $hook));
CRM_Contact_BAO_Group::getPermissionClause(TRUE);
/**
* Retrieve groups as 'view all contacts'
*/
- function testGroupListViewAllContacts() {
+ public function testGroupListViewAllContacts() {
$this->setPermissionAndRequest('view all contacts');
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
$this->assertEquals(2, $total);
* Without setting params the default is both enabled & disabled
* (if you do set default it is enabled only)
*/
- function testGroupListViewAllContactsFoundTitle() {
+ public function testGroupListViewAllContactsFoundTitle() {
$this->_params['title'] = 'p';
$this->setPermissionAndRequest('view all contacts');
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
/**
* Retrieve groups as 'view all contacts'
*/
- function testGroupListViewAllContactsNotFoundTitle() {
+ public function testGroupListViewAllContactsNotFoundTitle() {
$this->_params['title'] = 'z';
$this->setPermissionAndRequest('view all contacts');
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
/**
* Retrieve groups as 'edit all contacts'
*/
- function testGroupListEditAllContacts() {
+ public function testGroupListEditAllContacts() {
$this->setPermissionAndRequest('edit all contacts');
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
$this->assertEquals(2, $total);
/**
* Retrieve groups as 'view all contacts'
*/
- function testGroupListViewAllContactsEnabled() {
+ public function testGroupListViewAllContactsEnabled() {
$this->_params['status'] = 1;
$this->setPermissionAndRequest('view all contacts');
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
/**
* Retrieve groups as 'view all contacts'
*/
- function testGroupListViewAllContactsDisabled() {
+ public function testGroupListViewAllContactsDisabled() {
$this->_params['status'] = 2;
$this->setPermissionAndRequest('view all contacts');
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
/**
* Retrieve groups as 'view all contacts'
*/
- function testGroupListViewAllContactsDisabledNotFoundTitle() {
+ public function testGroupListViewAllContactsDisabledNotFoundTitle() {
$this->_params['status'] = 2;
$this->_params['title'] = 'n';
$this->setPermissionAndRequest('view all contacts');
/**
* Retrieve groups as 'view all contacts'
*/
- function testGroupListViewAllContactsDisabledFoundTitle() {
+ public function testGroupListViewAllContactsDisabledFoundTitle() {
$this->_params['status'] = 2;
$this->_params['title'] = 'p';
$this->setPermissionAndRequest('view all contacts');
/**
* Retrieve groups as 'view all contacts'
*/
- function testGroupListViewAllContactsAll() {
+ public function testGroupListViewAllContactsAll() {
$this->_params['status'] = 3;
$this->setPermissionAndRequest('view all contacts');
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
/**
* Retrieve groups as 'view all contacts'
*/
- function testGroupListAccessCiviCRM() {
+ public function testGroupListAccessCiviCRM() {
$this->setPermissionAndRequest('access CiviCRM');
$permissionClause = CRM_Contact_BAO_Group::getPermissionClause(TRUE);
$this->assertEquals('1 = 0', $permissionClause);
/**
* Retrieve groups as 'view all contacts'
*/
- function testGroupListAccessCiviCRMEnabled() {
+ public function testGroupListAccessCiviCRMEnabled() {
$this->_params['status'] = 1;
$this->setPermissionAndRequest('access CiviCRM');
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
/**
* Retrieve groups as 'view all contacts'
*/
- function testGroupListAccessCiviCRMDisabled() {
+ public function testGroupListAccessCiviCRMDisabled() {
$this->_params['status'] = 2;
$this->setPermissionAndRequest('access CiviCRM');
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
/**
* Retrieve groups as 'view all contacts'
*/
- function testGroupListAccessCiviCRMAll() {
+ public function testGroupListAccessCiviCRMAll() {
$this->_params['status'] = 2;
$this->setPermissionAndRequest('access CiviCRM');
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
/**
* Retrieve groups as 'view all contacts'
*/
- function testGroupListAccessCiviCRMFound() {
+ public function testGroupListAccessCiviCRMFound() {
$this->_params['title'] = 'p';
$this->setPermissionAndRequest('access CiviCRM');
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
/**
* Retrieve groups as 'view all contacts'
*/
- function testGroupListAccessCiviCRMNotFound() {
+ public function testGroupListAccessCiviCRMNotFound() {
$this->_params['title'] = 'z';
$this->setPermissionAndRequest('access CiviCRM');
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
$this->assertEquals(0, $total, 'Total returned should be accurate based on permissions');
}
- function testTraditionalACL () {
+ public function testTraditionalACL () {
$this->setupACL();
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
$this->assertEquals(1, count($groups), 'Returned groups should exclude disabled by default');
$this->assertEquals('pick-me-active', $groups[2]['group_name']);
}
- function testTraditionalACLNotFoundTitle () {
+ public function testTraditionalACLNotFoundTitle () {
$this->_params['title'] = 'n';
$this->setupACL();
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
$this->assertEquals(0, $total, 'Total needs to be set correctly');
}
- function testTraditionalACLFoundTitle () {
+ public function testTraditionalACLFoundTitle () {
$this->_params['title'] = 'p';
$this->setupACL();
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
$this->assertEquals('pick-me-disabled', $groups[1]['group_name']);
}
- function testTraditionalACLDisabled () {
+ public function testTraditionalACLDisabled () {
$this->_params['status'] = 2;
$this->setupACL();
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
$this->assertEquals('pick-me-disabled', $groups[1]['group_name']);
}
- function testTraditionalACLDisabledFoundTitle () {
+ public function testTraditionalACLDisabledFoundTitle () {
$this->_params['status'] = 2;
$this->_params['title'] = 'p';
$this->setupACL();
$this->assertEquals('pick-me-disabled', $groups[1]['group_name']);
}
- function testTraditionalACLDisabledNotFoundTitle () {
+ public function testTraditionalACLDisabledNotFoundTitle () {
$this->_params['status'] = 2;
$this->_params['title'] = 'n';
$this->setupACL();
$this->assertEquals(0, $total, 'Total needs to be set correctly');
}
- function testTraditionalACLEnabled () {
+ public function testTraditionalACLEnabled () {
$this->_params['status'] = 1;
$this->setupACL();
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
$this->assertEquals('pick-me-active', $groups[2]['group_name']);
}
- function testTraditionalACLAll () {
+ public function testTraditionalACLAll () {
$this->_params['status'] = 3;
$this->setupACL();
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
/**
* ACL Group hook
*/
- function testGroupListAclGroupHookDisabled() {
+ public function testGroupListAclGroupHookDisabled() {
$this->_params['status'] = 2;
$this->setHookAndRequest('access CiviCRM', 'hook_civicrm_aclGroup');
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
/**
* ACL Group hook
*/
- function testGroupListAclGroupHookDisabledFound() {
+ public function testGroupListAclGroupHookDisabledFound() {
$this->_params['status'] = 2;
$this->_params['title'] = 'p';
$this->setHookAndRequest('access CiviCRM', 'hook_civicrm_aclGroup');
/**
* ACL Group hook
*/
- function testGroupListAclGroupHookDisabledNotFound() {
+ public function testGroupListAclGroupHookDisabledNotFound() {
$this->_params['status'] = 2;
$this->_params['title'] = 'n';
$this->setHookAndRequest('access CiviCRM', 'hook_civicrm_aclGroup');
/**
* ACL Group hook
*/
- function testGroupListAclGroupHook() {
+ public function testGroupListAclGroupHook() {
$this->setHookAndRequest('access CiviCRM', 'hook_civicrm_aclGroup');
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
$this->assertEquals(1, count($groups), 'Returned groups should exclude disabled by default');
/**
* ACL Group hook
*/
- function testGroupListAclGroupHookTitleNotFound() {
+ public function testGroupListAclGroupHookTitleNotFound() {
$this->_params['title'] = 'n';
$this->setHookAndRequest('access CiviCRM', 'hook_civicrm_aclGroup');
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
/**
* ACL Group hook
*/
- function testGroupListAclGroupHookTitleFound() {
+ public function testGroupListAclGroupHookTitleFound() {
$this->_params['title'] = 'p';
$this->setHookAndRequest('access CiviCRM', 'hook_civicrm_aclGroup');
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
/**
* ACL Group hook
*/
- function testGroupListAclGroupHookAll() {
+ public function testGroupListAclGroupHookAll() {
$this->_params['status'] = 3;
$this->setHookAndRequest('access CiviCRM', 'hook_civicrm_aclGroup');
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
/**
* ACL Group hook
*/
- function testGroupListAclGroupHookEnabled() {
+ public function testGroupListAclGroupHookEnabled() {
$this->_params['status'] = 1;
$this->setHookAndRequest('access CiviCRM', 'hook_civicrm_aclGroup');
list($groups, $total) = CRM_Group_Page_AJAX::getGroupList();
* @param array $allGroups
* @param array $currentGroups
*/
- function hook_civicrm_aclGroup($type, $contactID, $tableName, &$allGroups, &$currentGroups) {
+ public function hook_civicrm_aclGroup($type, $contactID, $tableName, &$allGroups, &$currentGroups) {
//don't use api - you will get a loop
$sql = " SELECT * FROM civicrm_group WHERE name LIKE '%pick%'";
$groups = array();
return new CRM_Mailing_BAO_QueryTestDataProvider;
}
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function tearDown() {
+ public function tearDown() {
$tablesToTruncate = array(
'civicrm_mailing_event_bounce',
'civicrm_mailing_event_delivered',
* Test CRM_Contact_BAO_Query::searchQuery()
* @dataProvider dataProvider
*/
- function testSearch($fv, $count, $ids, $full) {
+ public function testSearch($fv, $count, $ids, $full) {
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
$this->createFlatXMLDataSet(
protected static $bodytext = 'Unit tests keep children safe.';
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->_mut = new CiviMailUtils( $this, true );
}
- function tearDown() {
+ public function tearDown() {
$this->_mut->stop();
parent::tearDown();
}
/**
* Basic send
*/
- function testSend() {
+ public function testSend() {
$contact_params_1 = array(
'first_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Anderson',
*/
class CRM_Member_BAO_MembershipLogTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$params = array(
* This method is called after a test is executed.
*
*/
- function tearDown() {
+ public function tearDown() {
$this->relationshipTypeDelete($this->_relationshipTypeId);
$this->membershipTypeDelete(array('id' => $this->_membershipTypeID));
$this->membershipStatusDelete($this->_mebershipStatusID);
/**
* Test add()
*/
- function testadd() {
+ public function testadd() {
$contactId = Contact::createIndividual();
$params = array(
/**
* Test del()
*/
- function testdel() {
+ public function testdel() {
$contactId = Contact::createIndividual();
$params = array(
/**
* Test resetmodified()
*/
- function testresetmodifiedId() {
+ public function testresetmodifiedId() {
$contactId = Contact::createIndividual();
$params = array(
*/
class CRM_Member_BAO_MembershipStatusTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
/* check function add()
*
*/
- function testAdd() {
+ public function testAdd() {
$params = array(
'name' => 'pending',
'is_active' => 1,
$this->assertEquals($result, 'pending', 'Verify membership status is_active.');
}
- function testRetrieve() {
+ public function testRetrieve() {
$params = array(
'name' => 'testStatus',
CRM_Member_BAO_MembershipStatus::del($membershipStatus->id);
}
- function testSetIsActive() {
+ public function testSetIsActive() {
$params = array(
'name' => 'pending',
$this->assertEquals($isActive, 0, 'Verify membership status is_active.');
}
- function testGetMembershipStatus() {
+ public function testGetMembershipStatus() {
$params = array(
'name' => 'pending',
'is_active' => 1,
$this->assertEquals($result['name'], 'pending', 'Verify membership status name.');
}
- function testDel() {
+ public function testDel() {
$params = array(
'name' => 'testStatus',
'is_active' => 1,
$this->assertEquals(empty($result), TRUE, 'Verify membership status record deletion.');
}
- function testGetMembershipStatusByDate() {
+ public function testGetMembershipStatusByDate() {
$params = array(
'name' => 'Current',
'is_active' => 1,
$this->assertEquals($result['name'], 'Current', 'Verify membership status record.');
}
- function testgetMembershipStatusCurrent() {
+ public function testgetMembershipStatusCurrent() {
$params = array(
'name' => 'Current',
'is_active' => 1,
*/
class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
// FIXME: something NULLs $GLOBALS['_HTML_QuickForm_registered_rules'] when the tests are ran all together
$GLOBALS['_HTML_QuickForm_registered_rules'] = array(
* This method is called after a test is executed.
*
*/
- function tearDown() {
+ public function tearDown() {
$this->membershipTypeDelete( array( 'id' => $this->_membershipTypeID ) );
$this->membershipStatusDelete( $this->_membershipStatusID );
Contact::delete( $this->_contactID );
$this->_contactID = $this->_membershipStatusID = $this->_membershipTypeID = null;
}
- function testCreate() {
+ public function testCreate() {
$contactId = Contact::createIndividual();
Contact::delete($contactId);
}
- function testGetValues() {
+ public function testGetValues() {
// $this->markTestSkipped( 'causes mysterious exit, needs fixing!' );
// Calculate membership dates based on the current date
$now = time();
Contact::delete($contactId);
}
- function testRetrieve() {
+ public function testRetrieve() {
$contactId = Contact::createIndividual();
$params = array(
$this->contactDelete($contactId);
}
- function testActiveMembers() {
+ public function testActiveMembers() {
$contactId = Contact::createIndividual();
$params = array(
Contact::delete($contactId);
}
- function testDeleteMembership() {
+ public function testDeleteMembership() {
$contactId = Contact::createIndividual();
$params = array(
Contact::delete($contactId);
}
- function testGetContactMembership() {
+ public function testGetContactMembership() {
$contactId = Contact::createIndividual();
$params = array(
* Get the contribution
* page id from the membership record
*/
- function testgetContributionPageId() {
+ public function testgetContributionPageId() {
$contactId = Contact::createIndividual();
$params = array(
* type.
*
*/
- function testgetMembershipStarts() {
+ public function testgetMembershipStarts() {
$contactId = Contact::createIndividual();
$params = array(
* optionally for a specified date.
*
*/
- function testGetMembershipCount() {
+ public function testGetMembershipCount() {
$contactId = Contact::createIndividual();
$params = array(
* batch update member via profile
*
*/
- function testsortName() {
+ public function testsortName() {
$contactId = Contact::createIndividual();
$params = array(
* Delete related memberships
*
*/
- function testdeleteRelatedMemberships() {
+ public function testdeleteRelatedMemberships() {
$contactId = Contact::createIndividual();
$params = array(
* Renew membership with change in membership type
*
*/
- function testRenewMembership() {
+ public function testRenewMembership() {
$contactId = Contact::createIndividual();
$joinDate = $startDate = date("Ymd", strtotime(date("Ymd") . " -6 month"));
$endDate = date("Ymd", strtotime($joinDate . " +1 year -1 day"));
* Renew stale membership
*
*/
- function testStaleMembership() {
+ public function testStaleMembership() {
$statusId = 3;
$contactId = Contact::createIndividual();
$joinDate = $startDate = date("Ymd", strtotime(date("Ymd") . " -1 year -15 days"));
*/
class CRM_Member_BAO_MembershipTypeTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
//create relationship
* This method is called after a test is executed.
*
*/
- function tearDown() {
+ public function tearDown() {
$this->relationshipTypeDelete($this->_relationshipTypeId);
$this->membershipStatusDelete($this->_membershipStatusID);
$this->contactDelete($this->_orgContactID);
/* check function add()
*
*/
- function testAdd() {
+ public function testAdd() {
$ids = array();
$params = array(
'name' => 'test type',
/* check function retrive()
*
*/
- function testRetrieve() {
+ public function testRetrieve() {
$ids = array();
$params = array(
'name' => 'General',
/* check function isActive()
*
*/
- function testSetIsActive() {
+ public function testSetIsActive() {
$ids = array();
$params = array(
'name' => 'General',
/* check function del()
*
*/
- function testdel() {
+ public function testdel() {
$ids = array();
$params = array(
'name' => 'General',
/* check function convertDayFormat( )
*
*/
- function testConvertDayFormat() {
+ public function testConvertDayFormat() {
$ids = array();
$params = array(
'name' => 'General',
/* check function getMembershipTypes( )
*
*/
- function testGetMembershipTypes() {
+ public function testGetMembershipTypes() {
$ids = array();
$params = array(
'name' => 'General',
/* check function getMembershipTypeDetails( )
*
*/
- function testGetMembershipTypeDetails() {
+ public function testGetMembershipTypeDetails() {
$ids = array();
$params = array(
'name' => 'General',
/* check function getDatesForMembershipType( )
*
*/
- function testGetDatesForMembershipType() {
+ public function testGetDatesForMembershipType() {
$ids = array();
$params = array(
'name' => 'General',
/* check function getRenewalDatesForMembershipType( )
*
*/
- function testGetRenewalDatesForMembershipType() {
+ public function testGetRenewalDatesForMembershipType() {
$ids = array();
$params = array(
'name' => 'General',
/* check function getMembershipTypesByOrg( )
*
*/
- function testGetMembershipTypesByOrg() {
+ public function testGetMembershipTypesByOrg() {
$ids = array();
$params = array(
'name' => 'General',
* Test CRM_Member_Form_Membership::formRule() with a parameter
* that has an empty contact_select_id value
*/
- function testFormRuleEmptyContact() {
+ public function testFormRuleEmptyContact() {
$params = array(
'contact_select_id' => 0,
'membership_type_id' => array(),
* that has an start date before the join date and a rolling
* membership type
*/
- function testFormRuleRollingEarlyStart() {
+ public function testFormRuleRollingEarlyStart() {
$unixNow = time();
$ymdNow = date('m/d/Y', $unixNow);
$unixYesterday = $unixNow - (24 * 60 * 60);
* that has an end date before the start date and a rolling
* membership type
*/
- function testFormRuleRollingEarlyEnd() {
+ public function testFormRuleRollingEarlyEnd() {
$unixNow = time();
$ymdNow = date('m/d/Y', $unixNow);
$unixYesterday = $unixNow - (24 * 60 * 60);
* that has an end date but no start date and a rolling
* membership type
*/
- function testFormRuleRollingEndNoStart() {
+ public function testFormRuleRollingEndNoStart() {
$unixNow = time();
$ymdNow = date('m/d/Y', $unixNow);
$unixYearFromNow = $unixNow + (365 * 24 * 60 * 60);
* Test CRM_Member_Form_Membership::formRule() with a parameter
* that has an end date and a lifetime membership type
*/
- function testFormRuleRollingLifetimeEnd() {
+ public function testFormRuleRollingLifetimeEnd() {
$unixNow = time();
$unixYearFromNow = $unixNow + (365 * 24 * 60 * 60);
$params = array(
* Test CRM_Member_Form_Membership::formRule() with a parameter
* that has an override and no status
*/
- function testFormRuleOverrideNoStatus() {
+ public function testFormRuleOverrideNoStatus() {
$unixNow = time();
$unixYearFromNow = $unixNow + (365 * 24 * 60 * 60);
$params = array('join_date' => date('m/d/Y', $unixNow),
* Test CRM_Member_Form_Membership::formRule() with a join date
* of one month from now and a rolling membership type
*/
- function testFormRuleRollingJoin1MonthFromNow() {
+ public function testFormRuleRollingJoin1MonthFromNow() {
$unixNow = time();
$unix1MFmNow = $unixNow + (31 * 24 * 60 * 60);
$params = array('join_date' => date('m/d/Y', $unix1MFmNow),
* Test CRM_Member_Form_Membership::formRule() with a join date
* of today and a rolling membership type
*/
- function testFormRuleRollingJoinToday() {
+ public function testFormRuleRollingJoinToday() {
$unixNow = time();
$params = array('join_date' => date('m/d/Y', $unixNow),
'start_date' => '',
* Test CRM_Member_Form_Membership::formRule() with a join date
* of one month ago and a rolling membership type
*/
- function testFormRuleRollingJoin1MonthAgo() {
+ public function testFormRuleRollingJoin1MonthAgo() {
$unixNow = time();
$unix1MAgo = $unixNow - (31 * 24 * 60 * 60);
$params = array('join_date' => date('m/d/Y', $unix1MAgo),
* Test CRM_Member_Form_Membership::formRule() with a join date
* of six months ago and a rolling membership type
*/
- function testFormRuleRollingJoin6MonthsAgo() {
+ public function testFormRuleRollingJoin6MonthsAgo() {
$unixNow = time();
$unix6MAgo = $unixNow - (180 * 24 * 60 * 60);
$params = array('join_date' => date('m/d/Y', $unix6MAgo),
* Test CRM_Member_Form_Membership::formRule() with a join date
* of one year+ ago and a rolling membership type
*/
- function testFormRuleRollingJoin1YearAgo() {
+ public function testFormRuleRollingJoin1YearAgo() {
$unixNow = time();
$unix1YAgo = $unixNow - (370 * 24 * 60 * 60);
$params = array('join_date' => date('m/d/Y', $unix1YAgo),
* Test CRM_Member_Form_Membership::formRule() with a join date
* of two years ago and a rolling membership type
*/
- function testFormRuleRollingJoin2YearsAgo() {
+ public function testFormRuleRollingJoin2YearsAgo() {
$unixNow = time();
$unix2YAgo = $unixNow - (2 * 365 * 24 * 60 * 60);
$params = array('join_date' => date('m/d/Y', $unix2YAgo),
* Test CRM_Member_Form_Membership::formRule() with a join date
* of six months ago and a fixed membership type
*/
- function testFormRuleFixedJoin6MonthsAgo() {
+ public function testFormRuleFixedJoin6MonthsAgo() {
$unixNow = time();
$unix6MAgo = $unixNow - (180 * 24 * 60 * 60);
$params = array('join_date' => date('m/d/Y', $unix6MAgo),
*/
protected $_membershipTypeID = NULL;
- function setUp() {
+ public function setUp() {
parent::setUp();
$params = array(
* This method is called after a test is executed.
*
*/
- function tearDown() {
+ public function tearDown() {
$tablesToTruncate = array('civicrm_membership', 'civicrm_membership_log', 'civicrm_contribution', 'civicrm_membership_payment');
$this->quickCleanup($tablesToTruncate);
$this->relationshipTypeDelete($this->_relationshipTypeId);
/**
* Test Import
*/
- function testImport() {
+ public function testImport() {
$contactId = $this->individualCreate();
$contact2Params = array(
'first_name' => 'Anthonita',
parent::setUp();
}
- function testAddPCPBlock() {
+ public function testAddPCPBlock() {
$params = $this->pcpBlockParams();
$pcpBlock = CRM_PCP_BAO_PCP::add($params, TRUE);
// CRM_Core_DAO::deleteTestObjects( 'CRM_PCP_DAO_PCPBlock', $delParams );
}
- function testAddPCP() {
+ public function testAddPCP() {
$blockParams = $this->pcpBlockParams();
$pcpBlock = CRM_PCP_BAO_PCP::add($blockParams, TRUE);
// CRM_Core_DAO::deleteTestObjects( 'CRM_PCP_DAO_PCP', $delParams );
}
- function testAddPCPNoStatus() {
+ public function testAddPCPNoStatus() {
$blockParams = $this->pcpBlockParams();
$pcpBlock = CRM_PCP_BAO_PCP::add($blockParams, TRUE);
// CRM_Core_DAO::deleteTestObjects( 'CRM_PCP_DAO_PCP', $delParams );
}
- function testDeletePCP() {
+ public function testDeletePCP() {
$pcp = CRM_Core_DAO::createTestObject('CRM_PCP_DAO_PCP');
$pcpId = $pcp->id;
/**
* create() and deletepledgeblock() method
*/
- function testCreateAndDeletePledgeBlock() {
+ public function testCreateAndDeletePledgeBlock() {
$pledgeFrequencyUnit = array(
'week' => 1,
/**
* Add() method (add and edit modes of pledge block)
*/
- function testAddPledgeBlock() {
+ public function testAddPledgeBlock() {
$pledgeFrequencyUnit = array(
'week' => 1,
/**
* Retrieve() and getPledgeBlock() method of pledge block
*/
- function testRetrieveAndGetPledgeBlock() {
+ public function testRetrieveAndGetPledgeBlock() {
$pledgeFrequencyUnit = array(
'week' => 1,
/**
* Test for Add/Update Pledge Payment.
*/
- function testAdd() {
+ public function testAdd() {
$pledge = CRM_Core_DAO::createTestObject('CRM_Pledge_BAO_Pledge');
$params = array(
'pledge_id' => $pledge->id,
/**
* Retrieve a payment based on a pledge id = 0
*/
- function testRetrieveZeroPledeID() {
+ public function testRetrieveZeroPledeID() {
$payment = CRM_Core_DAO::createTestObject('CRM_Pledge_BAO_PledgePayment');
$params = array('pledge_id' => 0);
$defaults = array();
/**
* Retrieve a payment based on a Null pledge id
*/
- function testRetrieveStringPledgeID() {
+ public function testRetrieveStringPledgeID() {
$payment = CRM_Core_DAO::createTestObject('CRM_Pledge_BAO_PledgePayment');
$params = array('pledge_id' => 'Test');
$defaults = array();
/**
* Test that payment retrieve wrks based on known pledge id
*/
- function testRetrieveKnownPledgeID() {
+ public function testRetrieveKnownPledgeID() {
$payment = CRM_Core_DAO::createTestObject('CRM_Pledge_BAO_PledgePayment');
$pledgeId = $payment->pledge_id;
$params = array('pledge_id' => $pledgeId);
/**
* Delete Payments payments for one pledge
*/
- function testDeletePledgePaymentsNormal() {
+ public function testDeletePledgePaymentsNormal() {
$payment = CRM_Core_DAO::createTestObject('CRM_Pledge_BAO_PledgePayment');
$paymentid = CRM_Pledge_BAO_PledgePayment::deletePayments($payment->pledge_id);
$this->assertEquals(count($paymentid), 1, "Deleted one payment");
/**
* Pass Null Id for a payment deletion for one pledge
*/
- function testDeletePledgePaymentsNullId() {
+ public function testDeletePledgePaymentsNullId() {
$payment = CRM_Core_DAO::createTestObject('CRM_Pledge_BAO_PledgePayment');
$paymentid = CRM_Pledge_BAO_PledgePayment::deletePayments(Null);
$this->assertEquals(count($paymentid), 1, "No payments deleted");
/**
* Pass Zero Id for a payment deletion for one pledge
*/
- function testDeletePaymentsZeroId() {
+ public function testDeletePaymentsZeroId() {
$payment = CRM_Core_DAO::createTestObject('CRM_Pledge_BAO_PledgePayment');
$paymentid = CRM_Pledge_BAO_PledgePayment::deletePayments(0);
$result = CRM_Pledge_BAO_Pledge::deletePledge($payment->pledge_id);
/**
* Test calculateBaseScheduleDate - should give 15th day of month
*/
- function testcalculateBaseScheduleDateMonth() {
+ public function testcalculateBaseScheduleDateMonth() {
$params = array(
'scheduled_date' => '20110510',
'frequency_unit' => 'month',
/**
* Test calculateBaseScheduleDate - should give original date
*/
- function testcalculateBaseScheduleDateDay() {
+ public function testcalculateBaseScheduleDateDay() {
$params = array(
'scheduled_date' => '20110510',
'frequency_unit' => 'day',
* Test calculateBaseScheduleDateWeek - should give the day in the week as indicated
* testing each day as this is really the only unit that does anything
*/
- function testcalculateBaseScheduleDateWeek() {
+ public function testcalculateBaseScheduleDateWeek() {
$params = array(
'scheduled_date' => '20110510',
'frequency_unit' => 'week',
/**
* Test calculateBaseScheduleDate - should give original date
*/
- function testcalculateBaseScheduleDateYear() {
+ public function testcalculateBaseScheduleDateYear() {
$params = array(
'scheduled_date' => '20110510',
'frequency_unit' => 'year',
/**
* Test calculateNextScheduledDate - no date provided
*/
- function testcalculateNextScheduledDateYear() {
+ public function testcalculateNextScheduledDateYear() {
$params = array(
'scheduled_date' => '20110510',
'frequency_unit' => 'year',
/**
* Test calculateNextScheduledDate - no date provided
*/
- function testcalculateNextScheduledDateYearDateProvided() {
+ public function testcalculateNextScheduledDateYearDateProvided() {
$params = array(
'scheduled_date' => '20110510',
'frequency_unit' => 'year',
/**
* Test for Add/Update Pledge.
*/
- function testAdd() {
+ public function testAdd() {
$params = array(
'contact_id' => $this->_contactId,
'frequency_unit' => 'month',
/**
* Retrieve a pledge based on a pledge id = 0
*/
- function testRetrieveZeroPledeID() {
+ public function testRetrieveZeroPledeID() {
$defaults = array();
$params = array('pledge_id' => 0);
$pledgeId = CRM_Pledge_BAO_Pledge::retrieve($params, $defaults);
/**
* Retrieve a payment based on a Null pledge id random string
*/
- function testRetrieveStringPledgeID() {
+ public function testRetrieveStringPledgeID() {
$defaults = array();
$params = array('pledge_id' => 'random text');
$pledgeId = CRM_Pledge_BAO_Pledge::retrieve($params, $defaults);
/**
* Test that payment retrieve wrks based on known pledge id
*/
- function testRetrieveKnownPledgeID() {
+ public function testRetrieveKnownPledgeID() {
$params = array(
'contact_id' => $this->_contactId,
'frequency_unit' => 'month',
/**
* Return a list of persistent and transient queue providers
*/
- function getQueueSpecs() {
+ public function getQueueSpecs() {
$queueSpecs = array();
$queueSpecs[] = array(
array(
}
/* ----------------------- Per-provider tests ----------------------- */
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->queueService = CRM_Queue_Service::singleton(TRUE);
}
- function tearDown() {
+ public function tearDown() {
CRM_Utils_Time::resetTime();
$tablesToTruncate = array('civicrm_queue_item');
*
* @dataProvider getQueueSpecs
*/
- function testPriorities($queueSpec) {
+ public function testPriorities($queueSpec) {
$this->queue = $this->queueService->create($queueSpec);
$this->assertTrue($this->queue instanceof CRM_Queue_Queue);
/**
* Return a list of persistent and transient queue providers
*/
- function getQueueSpecs() {
+ public function getQueueSpecs() {
$queueSpecs = array();
$queueSpecs[] = array(
array(
}
/* ----------------------- Per-provider tests ----------------------- */
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->queueService = CRM_Queue_Service::singleton(TRUE);
}
- function tearDown() {
+ public function tearDown() {
CRM_Utils_Time::resetTime();
$tablesToTruncate = array('civicrm_queue_item');
*
* @dataProvider getQueueSpecs
*/
- function testBasicUsage($queueSpec) {
+ public function testBasicUsage($queueSpec) {
$this->queue = $this->queueService->create($queueSpec);
$this->assertTrue($this->queue instanceof CRM_Queue_Queue);
*
* @dataProvider getQueueSpecs
*/
- function testManualRelease($queueSpec) {
+ public function testManualRelease($queueSpec) {
$this->queue = $this->queueService->create($queueSpec);
$this->assertTrue($this->queue instanceof CRM_Queue_Queue);
*
* @dataProvider getQueueSpecs
*/
- function testTimeoutRelease($queueSpec) {
+ public function testTimeoutRelease($queueSpec) {
$this->queue = $this->queueService->create($queueSpec);
$this->assertTrue($this->queue instanceof CRM_Queue_Queue);
*
* @dataProvider getQueueSpecs
*/
- function testStealItem($queueSpec) {
+ public function testStealItem($queueSpec) {
$this->queue = $this->queueService->create($queueSpec);
$this->assertTrue($this->queue instanceof CRM_Queue_Queue);
*
* @dataProvider getQueueSpecs
*/
- function testCreateResetTrue($queueSpec) {
+ public function testCreateResetTrue($queueSpec) {
$this->queue = $this->queueService->create($queueSpec);
$this->queue->createItem(array(
'test-key' => 'a',
*
* @dataProvider getQueueSpecs
*/
- function testCreateResetFalse($queueSpec) {
+ public function testCreateResetFalse($queueSpec) {
$this->queue = $this->queueService->create($queueSpec);
$this->queue->createItem(array(
'test-key' => 'a',
*
* @dataProvider getQueueSpecs
*/
- function testLoad($queueSpec) {
+ public function testLoad($queueSpec) {
$this->queue = $this->queueService->create($queueSpec);
$this->queue->createItem(array(
'test-key' => 'a',
*/
class CRM_Queue_RunnerTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
require_once 'CRM/Queue/Service.php';
$this->queueService = CRM_Queue_Service::singleton(TRUE);
self::$_recordedValues = array();
}
- function tearDown() {
+ public function tearDown() {
unset($this->queue);
unset($this->queueService);
$this->quickCleanup($tablesToTruncate);
}
- function testRunAllNormal() {
+ public function testRunAllNormal() {
// prepare a list of tasks with an error in the middle
$this->queue->createItem(new CRM_Queue_Task(
array('CRM_Queue_RunnerTest', '_recordValue'),
* Run a series of tasks; one of the tasks will insert more
* TODOs at the start of the list
*/
- function testRunAll_AddMore() {
+ public function testRunAll_AddMore() {
// prepare a list of tasks with an error in the middle
$this->queue->createItem(new CRM_Queue_Task(
array('CRM_Queue_RunnerTest', '_recordValue'),
* Run a series of tasks; when one throws an
* exception, ignore it and continue
*/
- function testRunAll_Continue_Exception() {
+ public function testRunAll_Continue_Exception() {
// prepare a list of tasks with an error in the middle
$this->queue->createItem(new CRM_Queue_Task(
array('CRM_Queue_RunnerTest', '_recordValue'),
* Run a series of tasks; when one throws an exception,
* abort processing and return it to the queue.
*/
- function testRunAll_Abort_Exception() {
+ public function testRunAll_Abort_Exception() {
// prepare a list of tasks with an error in the middle
$this->queue->createItem(new CRM_Queue_Task(
array('CRM_Queue_RunnerTest', '_recordValue'),
* Run a series of tasks; when one returns false,
* abort processing and return it to the queue.
*/
- function testRunAll_Abort_False() {
+ public function testRunAll_Abort_False() {
// prepare a list of tasks with an error in the middle
$this->queue->createItem(new CRM_Queue_Task(
array('CRM_Queue_RunnerTest', '_recordValue'),
* @return bool
*/
static
- function _recordValue($taskCtx, $value) {
+ public function _recordValue($taskCtx, $value) {
self::$_recordedValues[] = $value;
return TRUE;
}
* @return bool
*/
static
- function _returnFalse($taskCtx) {
+ public function _returnFalse($taskCtx) {
return FALSE;
}
* @throws Exception
*/
static
- function _throwException($taskCtx, $value) {
+ public function _throwException($taskCtx, $value) {
throw new Exception("Manufactured error: $value");
}
* @return bool
*/
static
- function _enqueueNumbers($taskCtx, $low, $high) {
+ public function _enqueueNumbers($taskCtx, $low, $high) {
for ($i = $low; $i <= $high; $i++) {
$taskCtx->queue->createItem(new CRM_Queue_Task(
array('CRM_Queue_RunnerTest', '_recordValue'),
);
}
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->foreignKeyChecksOff();
$this->quickCleanup($this->_tablesToTruncate);
}
- function tearDown() {
+ public function tearDown() {
parent::tearDown();
CRM_Core_DAO::executeQuery('DROP TEMPORARY TABLE IF EXISTS civireport_contribution_detail_temp1');
CRM_Core_DAO::executeQuery('DROP TEMPORARY TABLE IF EXISTS civireport_contribution_detail_temp2');
);
}
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->foreignKeyChecksOff();
$this->quickCleanup($this->_tablesToTruncate);
}
- function tearDown() {
+ public function tearDown() {
parent::tearDown();
CRM_Core_DAO::executeQuery('DROP TEMPORARY TABLE IF EXISTS civireport_contribution_detail_temp1');
CRM_Core_DAO::executeQuery('DROP TEMPORARY TABLE IF EXISTS civireport_contribution_detail_temp2');
* Class CRM_UF_Page_ProfileEditorTest
*/
class CRM_UF_Page_ProfileEditorTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
/**
* Spot check a few fields that should appear in schema
*/
- function testGetSchema() {
+ public function testGetSchema() {
$schema = CRM_UF_Page_ProfileEditor::getSchema(array('IndividualModel', 'ActivityModel'));
foreach ($schema as $entityName => $entityDef) {
foreach ($entityDef['schema'] as $fieldName => $fieldDef) {
*/
var $noise;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->assertDBQuery(0, "SELECT count(*) FROM civicrm_contact WHERE first_name='Jeffrey' and last_name='Lebowski'");
));
}
- function tearDown() {
+ public function tearDown() {
$noise = $this->callAPISuccess('Contact', 'get', array(
'id' => $this->noise['individual'],
'return' => array('email'),
/**
* If there's no pre-existing record, then insert a new one.
*/
- function testCreateMatch_none() {
+ public function testCreateMatch_none() {
$result = $this->callAPISuccess('contact', 'create', array(
'options' => array(
'match' => array('first_name', 'last_name'),
/**
* If there's no pre-existing record, then throw an error.
*/
- function testCreateMatchMandatory_none() {
+ public function testCreateMatchMandatory_none() {
$this->callAPIFailure('contact', 'create', array(
'options' => array(
'match-mandatory' => array('first_name', 'last_name'),
/**
* @return array
*/
- function apiOptionNames() {
+ public function apiOptionNames() {
return array(
array('match'),
array('match-mandatory'),
* @dataProvider apiOptionNames
* @param string $apiOptionName e.g. "match" or "match-mandatory"
*/
- function testCreateMatch_one($apiOptionName) {
+ public function testCreateMatch_one($apiOptionName) {
// create basic record
$result1 = $this->callAPISuccess('contact', 'create', array(
'contact_type' => 'Individual',
* @dataProvider apiOptionNames
* @param string $apiOptionName e.g. "match" or "match-mandatory"
*/
- function testCreateMatch_many($apiOptionName) {
+ public function testCreateMatch_many($apiOptionName) {
// create the first Lebowski
$result1 = $this->callAPISuccess('contact', 'create', array(
'contact_type' => 'Individual',
* When replacing one set with another set, match items within
* the set using a key.
*/
- function testReplaceMatch_Email() {
+ public function testReplaceMatch_Email() {
// Create contact with two emails (j1,j2)
$createResult = $this->callAPISuccess('contact', 'create', array(
'contact_type' => 'Individual',
* When replacing one set with another set, match items within
* the set using a key.
*/
- function testReplaceMatch_Address() {
+ public function testReplaceMatch_Address() {
// Create contact with two addresses (j1,j2)
$createResult = $this->callAPISuccess('contact', 'create', array(
'contact_type' => 'Individual',
*/
class CRM_Utils_API_ReloadOptionTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
CRM_Utils_Hook_UnitTests::singleton()->setHook('civicrm_post', array($this, 'onPost'));
}
* If reload option is missing, then 'create' returns the inputted nick_name -- despite the
* fact that the hook manipulated the actual DB content.
*/
- function testNoReload() {
+ public function testNoReload() {
$result = $this->callAPISuccess('contact', 'create', array(
'contact_type' => 'Individual',
'first_name' => 'First',
/**
* When the reload option is unrecognized, generate an error
*/
- function testReloadInvalid() {
+ public function testReloadInvalid() {
$this->callAPIFailure('contact', 'create', array(
'contact_type' => 'Individual',
'first_name' => 'First',
* If reload option is set, then 'create' returns the final nick_name -- even if it
* differs from the inputted nick_name.
*/
- function testReloadDefault() {
+ public function testReloadDefault() {
$result = $this->callAPISuccess('contact', 'create', array(
'contact_type' => 'Individual',
'first_name' => 'First',
* When the reload option is combined with chaining, the reload should munge
* the chain results.
*/
- function testReloadNoChainInterference() {
+ public function testReloadNoChainInterference() {
$result = $this->callAPISuccess('contact', 'create', array(
'contact_type' => 'Individual',
'first_name' => 'First',
* @param int $objectId
* @param $objectRef
*/
- function onPost($op, $objectName, $objectId, &$objectRef) {
+ public function onPost($op, $objectName, $objectId, &$objectRef) {
if ($op == 'create' && $objectName == 'Individual') {
CRM_Core_DAO::executeQuery(
"UPDATE civicrm_contact SET nick_name = 'munged' WHERE id = %1",
*/
class CRM_Utils_ArrayTest extends CiviUnitTestCase {
- function testIndexArray() {
+ public function testIndexArray() {
$inputs = array();
$inputs[] = array(
'lang' => 'en',
$this->assertEquals($inputs[5], $byLangMsgid[NULL]['greeting']);
}
- function testCollect() {
+ public function testCollect() {
$arr = array(
array('catWord' => 'cat', 'dogWord' => 'dog'),
array('catWord' => 'chat', 'dogWord' => 'chien'),
$this->assertEquals($expected, CRM_Utils_Array::collect('catWord', $arr));
}
- function testProduct0() {
+ public function testProduct0() {
$actual = CRM_Utils_Array::product(
array(),
array('base data' => 1)
), $actual);
}
- function testProduct1() {
+ public function testProduct1() {
$actual = CRM_Utils_Array::product(
array('dim1' => array('a', 'b')),
array('base data' => 1)
), $actual);
}
- function testProduct3() {
+ public function testProduct3() {
$actual = CRM_Utils_Array::product(
array('dim1' => array('a', 'b'), 'dim2' => array('alpha', 'beta'), 'dim3' => array('one', 'two')),
array('base data' => 1)
), $actual);
}
- function testIsSubset() {
+ public function testIsSubset() {
$this->assertTrue(CRM_Utils_Array::isSubset(array(), array()));
$this->assertTrue(CRM_Utils_Array::isSubset(array('a'), array('a')));
$this->assertTrue(CRM_Utils_Array::isSubset(array('a'), array('b','a','c')));
$this->assertFalse(CRM_Utils_Array::isSubset(array('a'), array('b','c','d')));
}
- function testRemove() {
+ public function testRemove() {
$data = array(
'one' => 1,
'two' => 2,
* Class CRM_Utils_Cache_SqlGroupTest
*/
class CRM_Utils_Cache_SqlGroupTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function tearDown() {
+ public function tearDown() {
parent::tearDown();
}
/**
* Add and remove two items from the same cache instance
*/
- function testSameInstance() {
+ public function testSameInstance() {
$a = new CRM_Utils_Cache_SqlGroup(array(
'group' => 'testSameInstance',
));
/**
* Add item to one cache instance then read with another
*/
- function testTwoInstance() {
+ public function testTwoInstance() {
$a = new CRM_Utils_Cache_SqlGroup(array(
'group' => 'testTwoInstance',
));
/**
* Add item to one cache instance then read (with or without prefetch) from another
*/
- function testPrefetch() {
+ public function testPrefetch() {
// 1. put data in cache
$a = new CRM_Utils_Cache_SqlGroup(array(
'group' => 'testPrefetch',
*/
class CRM_Utils_DeprecatedUtilsTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function tearDown() {
+ public function tearDown() {
// truncate a few tables
$tablesToTruncate = array(
'civicrm_contact',
/**
* Test civicrm_contact_check_params with no contact type
*/
- function testCheckParamsWithNoContactType() {
+ public function testCheckParamsWithNoContactType() {
$params = array('foo' => 'bar');
$contact = _civicrm_api3_deprecated_contact_check_params($params, FALSE);
$this->assertEquals(1, $contact['is_error'], "In line " . __LINE__);
/**
* Test civicrm_contact_check_params with a duplicate
*/
- function testCheckParamsWithDuplicateContact() {
+ public function testCheckParamsWithDuplicateContact() {
// Insert a row in civicrm_contact creating individual contact
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
* Test civicrm_contact_check_params with a duplicate
* and request the error in array format
*/
- function testCheckParamsWithDuplicateContact2() {
+ public function testCheckParamsWithDuplicateContact2() {
// Insert a row in civicrm_contact creating individual contact
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
* Test civicrm_contact_check_params with check for required
* params and no params
*/
- function testCheckParamsWithNoParams() {
+ public function testCheckParamsWithNoParams() {
$params = array();
$contact = _civicrm_api3_deprecated_contact_check_params($params, FALSE);
$this->assertEquals(1, $contact['is_error'], "In line " . __LINE__);
* Class CRM_Utils_FileTest
*/
class CRM_Utils_FileTest extends CiviUnitTestCase {
- function testIsChildPath() {
+ public function testIsChildPath() {
$testCases = array();
$testCases[] = array('/ab/cd/ef', '/ab/cd', FALSE);
$testCases[] = array('/ab/cd', '/ab/cd/ef', TRUE);
var $log;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->fakeModules = array(
'hooktesta',
self::$activeTest = $this;
}
- function tearDown() {
+ public function tearDown() {
self::$activeTest = $this;
parent::tearDown();
}
/**
* Verify that runHooks() is reentrant by invoking one hook which calls another hooks
*/
- function testRunHooks_reentrancy() {
+ public function testRunHooks_reentrancy() {
$arg1 = 'whatever';
$this->hook->runHooks($this->fakeModules, 'civicrm_testRunHooks_outer', 1, $arg1, CRM_Utils_Hook::$_nullObject, CRM_Utils_Hook::$_nullObject, CRM_Utils_Hook::$_nullObject, CRM_Utils_Hook::$_nullObject, CRM_Utils_Hook::$_nullObject);
$this->assertEquals(
/**
* Verify that the results of runHooks() are correctly merged
*/
- function testRunHooks_merge() {
+ public function testRunHooks_merge() {
$result = $this->hook->runHooks($this->fakeModules, 'civicrm_testRunHooks_merge', 0, CRM_Utils_Hook::$_nullObject, CRM_Utils_Hook::$_nullObject, CRM_Utils_Hook::$_nullObject, CRM_Utils_Hook::$_nullObject, CRM_Utils_Hook::$_nullObject, CRM_Utils_Hook::$_nullObject);
$this->assertEquals(
array(
',
);
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function testHtmlToText() {
+ public function testHtmlToText() {
foreach ($this->_testInput as $html => $text) {
$output = CRM_Utils_String::htmlToText($html);
$this->assertEquals(
parent::tearDown();
}
- function testFetchHttp() {
+ public function testFetchHttp() {
$result = $this->client->fetch(self::VALID_HTTP_URL, $this->tmpFile);
$this->assertEquals(CRM_Utils_HttpClient::STATUS_OK, $result);
$this->assertRegExp(self::VALID_HTTP_REGEX, file_get_contents($this->tmpFile));
}
- function testFetchHttps_valid() {
+ public function testFetchHttps_valid() {
$result = $this->client->fetch(self::VALID_HTTPS_URL, $this->tmpFile);
$this->assertEquals(CRM_Utils_HttpClient::STATUS_OK, $result);
$this->assertRegExp(self::VALID_HTTPS_REGEX, file_get_contents($this->tmpFile));
}
- function testFetchHttps_invalid_verify() {
+ public function testFetchHttps_invalid_verify() {
$result = $this->client->fetch(self::SELF_SIGNED_HTTPS_URL, $this->tmpFile);
$this->assertEquals(CRM_Utils_HttpClient::STATUS_DL_ERROR, $result);
$this->assertEquals('', file_get_contents($this->tmpFile));
}
- function testFetchHttps_invalid_noVerify() {
+ public function testFetchHttps_invalid_noVerify() {
$result = civicrm_api('Setting', 'create', array(
'version' => 3,
'verifySSL' => FALSE,
$this->assertRegExp(self::SELF_SIGNED_HTTPS_REGEX, file_get_contents($this->tmpFile));
}
- function testFetchHttp_badOutFile() {
+ public function testFetchHttp_badOutFile() {
$result = $this->client->fetch(self::VALID_HTTP_URL, '/ba/d/path/too/utput');
$this->assertEquals(CRM_Utils_HttpClient::STATUS_WRITE_ERROR, $result);
}
- function testGetHttp() {
+ public function testGetHttp() {
list($status, $data) = $this->client->get(self::VALID_HTTP_URL);
$this->assertEquals(CRM_Utils_HttpClient::STATUS_OK, $status);
$this->assertRegExp(self::VALID_HTTP_REGEX, $data);
}
- function testGetHttps_valid() {
+ public function testGetHttps_valid() {
list($status, $data) = $this->client->get(self::VALID_HTTPS_URL);
$this->assertEquals(CRM_Utils_HttpClient::STATUS_OK, $status);
$this->assertRegExp(self::VALID_HTTPS_REGEX, $data);
}
- function testGetHttps_invalid_verify() {
+ public function testGetHttps_invalid_verify() {
list($status, $data) = $this->client->get(self::SELF_SIGNED_HTTPS_URL);
$this->assertEquals(CRM_Utils_HttpClient::STATUS_DL_ERROR, $status);
$this->assertEquals('', $data);
}
- function testGetHttps_invalid_noVerify() {
+ public function testGetHttps_invalid_noVerify() {
$result = civicrm_api('Setting', 'create', array(
'version' => 3,
'verifySSL' => FALSE,
/**
* @return array
*/
- function translateExamples() {
+ public function translateExamples() {
$cases = array();
$cases[] = array(
'',
);
$cases[] = array( // with arg
'
- function whits() {
+ public function whits() {
for (a in b) {
mitts("wallaby", function(zoo){
alert(zoo + ts("Hello"))
* @param array $expectedStrings
* @dataProvider translateExamples
*/
- function testParseStrings($jsCode, $expectedStrings) {
+ public function testParseStrings($jsCode, $expectedStrings) {
$actualStrings = CRM_Utils_JS::parseStrings($jsCode);
sort($expectedStrings);
sort($actualStrings);
*/
class CRM_Utils_MailTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
* Test case for add( )
* test with empty params.
*/
- function testFormatRFC822() {
+ public function testFormatRFC822() {
$values = array(
array('name' => "Test User",
class CRM_Utils_Migrate_ImportExportTest extends CiviUnitTestCase {
protected $_apiversion;
- function setUp() {
+ public function setUp() {
$this->_apiversion = 3;
parent::setUp();
}
- function tearDown() {
+ public function tearDown() {
$tablesToTruncate = array(
'civicrm_custom_group',
'civicrm_custom_field',
* load the XML into a clean DB and see if it creates matching custom-group
* and custom-field.
*/
- function basicXmlTestCases() {
+ public function basicXmlTestCases() {
// a small library which we use to describe test cases
$fixtures = array();
$fixtures['textField'] = array(
* @param $expectedXmlFilePath
* @dataProvider basicXmlTestCases
*/
- function testBasicXMLExports($customGroupParams, $fieldParams, $expectedXmlFilePath) {
+ public function testBasicXMLExports($customGroupParams, $fieldParams, $expectedXmlFilePath) {
$this->assertDBQuery(0, 'SELECT count(*) FROM civicrm_custom_group WHERE title = %1', array(
1 => array($customGroupParams['title'], 'String')
));
* @throws CRM_Core_Exception
* @dataProvider basicXmlTestCases
*/
- function testBasicXMLImports($expectCustomGroup, $expectCustomField, $inputXmlFilePath) {
+ public function testBasicXMLImports($expectCustomGroup, $expectCustomField, $inputXmlFilePath) {
$this->assertDBQuery(0, 'SELECT count(*) FROM civicrm_custom_group WHERE title = %1', array(
1 => array($expectCustomGroup['title'], 'String')
));
/**
* @return array
*/
- function randomDecimalCases() {
+ public function randomDecimalCases() {
$cases = array();
// array(array $precision, int $expectedMinInclusive, int $expectedMaxExclusive)
$cases[] = array(array(1, 0), 0, 10);
* @param int $expectedMaxExclusive
* @dataProvider randomDecimalCases
*/
- function testCreateRandomDecimal($precision, $expectedMinInclusive, $expectedMaxExclusive) {
+ public function testCreateRandomDecimal($precision, $expectedMinInclusive, $expectedMaxExclusive) {
list ($sigFigs, $decFigs) = $precision;
for ($i = 0; $i < 10; $i++) {
$decimal = CRM_Utils_Number::createRandomDecimal($precision);
/**
* @return array
*/
- function truncDecimalCases() {
+ public function truncDecimalCases() {
$cases = array();
// array($value, $precision, $expectedValue)
$cases[] = array(523, array(1,0), 5);
* @param $expectedValue
* @dataProvider truncDecimalCases
*/
- function testCreateTruncatedDecimal($value, $precision, $expectedValue) {
+ public function testCreateTruncatedDecimal($value, $precision, $expectedValue) {
list ($sigFigs, $decFigs) = $precision;
$this->assertEquals($expectedValue, CRM_Utils_Number::createTruncatedDecimal($value, $precision),
"assert createTruncatedValue($value, ($sigFigs,$decFigs)) == $expectedValue"
*/
class CRM_Utils_QueryFormatterTest extends CiviUnitTestCase {
- function dataProvider() {
+ public function dataProvider() {
$cases = array(); // array(0=>$inputText, 1=>$language, 2=>$options, 3=>$expectedText)
$cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_NONE, '%first second%');
* @param $expectedText
* @dataProvider dataProvider
*/
- function testFormat($text, $language, $mode, $expectedText) {
+ public function testFormat($text, $language, $mode, $expectedText) {
$formatter = new CRM_Utils_QueryFormatter($mode);
$actualText = $formatter->format($text, $language);
$this->assertEquals($expectedText, $actualText);
*/
class CRM_Utils_RestTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function testProcessMultiple() {
+ public function testProcessMultiple() {
$_SERVER['REQUEST_METHOD'] = 'POST';
$input = array(
'cow' => array(
*/
class CRM_Utils_RuleTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
/**
* @dataProvider integerDataProvider
*/
- function testInteger($inputData, $expectedResult) {
+ public function testInteger($inputData, $expectedResult) {
$this->assertEquals($expectedResult, CRM_Utils_Rule::integer($inputData));
}
/**
* @return array
*/
- function integerDataProvider() {
+ public function integerDataProvider() {
return array(
array(10, TRUE),
array('145E+3', FALSE),
/**
* @dataProvider positiveDataProvider
*/
- function testPositive($inputData, $expectedResult) {
+ public function testPositive($inputData, $expectedResult) {
$this->assertEquals($expectedResult, CRM_Utils_Rule::positiveInteger($inputData));
}
/**
* @return array
*/
- function positiveDataProvider() {
+ public function positiveDataProvider() {
return array(
array(10, TRUE),
array('145.0E+3', FALSE),
/**
* @dataProvider numericDataProvider
*/
- function testNumeric($inputData, $expectedResult) {
+ public function testNumeric($inputData, $expectedResult) {
$this->assertEquals($expectedResult, CRM_Utils_Rule::numeric($inputData));
}
/**
* @return array
*/
- function numericDataProvider() {
+ public function numericDataProvider() {
return array(
array(10, TRUE),
array('145.0E+3', FALSE),
* Class CRM_Utils_SQL_SelectTest
*/
class CRM_Utils_SQL_InsertTest extends CiviUnitTestCase {
- function testRow_twice() {
+ public function testRow_twice() {
$insert = CRM_Utils_SQL_Insert::into('foo')
->row(array('first' => '1', 'second' => '2' ))
->row(array('second' => '2b', 'first' => '1b'))
$this->assertLike($expected, $insert->toSQL());
}
- function testRows() {
+ public function testRows() {
$insert = CRM_Utils_SQL_Insert::into('foo')
->row(array('first' => '1', 'second' => '2' ))
->rows(array(
* @param $actual
* @param string $message
*/
- function assertLike($expected, $actual, $message = '') {
+ public function assertLike($expected, $actual, $message = '') {
$expected = trim((preg_replace('/[ \r\n\t]+/', ' ', $expected)));
$actual = trim((preg_replace('/[ \r\n\t]+/', ' ', $actual)));
$this->assertEquals($expected, $actual, $message);
* Class CRM_Utils_SQL_SelectTest
*/
class CRM_Utils_SQL_SelectTest extends CiviUnitTestCase {
- function testGetDefault() {
+ public function testGetDefault() {
$select = CRM_Utils_SQL_Select::from('foo bar');
$this->assertLike('SELECT * FROM foo bar', $select->toSQL());
}
- function testGetFields() {
+ public function testGetFields() {
$select = CRM_Utils_SQL_Select::from('foo')
->select('bar')
->select(array('whiz', 'bang'));
$this->assertLike('SELECT bar, whiz, bang FROM foo', $select->toSQL());
}
- function testWherePlain() {
+ public function testWherePlain() {
$select = CRM_Utils_SQL_Select::from('foo')
->where('foo = bar')
->where(array('whiz = bang', 'frob > nicate'));
$this->assertLike('SELECT * FROM foo WHERE (foo = bar) AND (whiz = bang) AND (frob > nicate)', $select->toSQL());
}
- function testWhereArg() {
+ public function testWhereArg() {
$select = CRM_Utils_SQL_Select::from('foo')
->where('foo = @value', array('@value' => 'not"valid'))
->where(array('whiz > @base', 'frob != @base'), array('@base' => 'in"valid'));
$this->assertLike('SELECT * FROM foo WHERE (foo = "not\\"valid") AND (whiz > "in\\"valid") AND (frob != "in\\"valid")', $select->toSQL());
}
- function testGroupByPlain() {
+ public function testGroupByPlain() {
$select = CRM_Utils_SQL_Select::from('foo')
->groupBy("bar_id")
->groupBy(array('whiz_id*2', 'lower(bang)'));
$this->assertLike('SELECT * FROM foo GROUP BY bar_id, whiz_id*2, lower(bang)', $select->toSQL());
}
- function testHavingPlain() {
+ public function testHavingPlain() {
$select = CRM_Utils_SQL_Select::from('foo')
->groupBy("bar_id")
->having('count(id) > 2')
$this->assertLike('SELECT * FROM foo GROUP BY bar_id HAVING (count(id) > 2) AND (sum(id) > 10) AND (avg(id) < 200)', $select->toSQL());
}
- function testHavingArg() {
+ public function testHavingArg() {
$select = CRM_Utils_SQL_Select::from('foo')
->groupBy("bar_id")
->having('count(id) > #mincnt', array('#mincnt' => 2))
$this->assertLike('SELECT * FROM foo GROUP BY bar_id HAVING (count(id) > 2) AND (sum(id) > 10) AND (avg(id) < 10)', $select->toSQL());
}
- function testOrderByPlain() {
+ public function testOrderByPlain() {
$select = CRM_Utils_SQL_Select::from('foo bar')
->orderBy('first asc')
->orderBy(array('second desc', 'third'));
$this->assertLike('SELECT * FROM foo bar ORDER BY first asc, second desc, third', $select->toSQL());
}
- function testLimit_defaultOffset() {
+ public function testLimit_defaultOffset() {
$select = CRM_Utils_SQL_Select::from('foo bar')
->limit(20);
$this->assertLike('SELECT * FROM foo bar LIMIT 20 OFFSET 0', $select->toSQL());
}
- function testLimit_withOffset() {
+ public function testLimit_withOffset() {
$select = CRM_Utils_SQL_Select::from('foo bar')
->limit(20, 60);
$this->assertLike('SELECT * FROM foo bar LIMIT 20 OFFSET 60', $select->toSQL());
}
- function testLimit_disable() {
+ public function testLimit_disable() {
$select = CRM_Utils_SQL_Select::from('foo bar')
->limit(20, 60)
->limit(NULL, NULL);
$this->assertLike('SELECT * FROM foo bar', $select->toSQL());
}
- function testBig() {
+ public function testBig() {
$select = CRM_Utils_SQL_Select::from('foo')
->select('foo.id')
->join('rel1', 'INNER JOIN rel1_table rel1 ON foo.id = rel1.foo_id')
);
}
- function testInterpolate() {
+ public function testInterpolate() {
$actual = CRM_Utils_SQL_Select::from('ignore')->interpolate(
'@escaped !unescaped #validated',
array(
$this->assertLike('"foo\"bar" concat(foo,bar) 15.2', $actual);
}
- function testInterpolateArray() {
+ public function testInterpolateArray() {
$actual = CRM_Utils_SQL_Select::from('ignore')->interpolate(
'(@escaped) (!unescaped) (#validated)',
array(
$this->assertLike('("foo\\"bar", "whiz", "null", NULL, "bang") (foo"bar, bar) (1, 10, NULL, 100.1)', $actual);
}
- function testInterpolateBadNumber() {
+ public function testInterpolateBadNumber() {
try {
$result = CRM_Utils_SQL_Select::from('ignore')->interpolate('#num', array(
'#num' => '5not-a-number5'
}
}
- function testInterpolateBadKey() {
+ public function testInterpolateBadKey() {
try {
$result = CRM_Utils_SQL_Select::from('ignore')->interpolate('this is a {var}', array(
'{var}' => 'not a well-formed variable name'
* @param $actual
* @param string $message
*/
- function assertLike($expected, $actual, $message = '') {
+ public function assertLike($expected, $actual, $message = '') {
$expected = trim((preg_replace('/[ \r\n\t]+/', ' ', $expected)));
$actual = trim((preg_replace('/[ \r\n\t]+/', ' ', $actual)));
$this->assertEquals($expected, $actual, $message);
*/
class CRM_Utils_SignerTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function testSignValidate() {
+ public function testSignValidate() {
$cases = array();
$cases[] = array(
'signParams' => array(
*/
class CRM_Utils_StringTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function testStripPathChars() {
+ public function testStripPathChars() {
$testSet = array(
'' => '',
NULL => NULL,
}
}
- function testExtractName() {
+ public function testExtractName() {
$cases = array(
array(
'full_name' => 'Alan',
}
}
- function testEllipsify() {
+ public function testEllipsify() {
$maxLen = 5;
$cases = array(
'1' => '1',
}
}
- function testRandom() {
+ public function testRandom() {
for ($i = 0; $i < 4; $i++) {
$actual = CRM_Utils_String::createRandom(4, 'abc');
$this->assertEquals(4, strlen($actual));
$this->assertEquals($expected, $actual);
}
- function booleanDataProvider() {
+ public function booleanDataProvider() {
$cases = array(); // array(0 => $input, 1 => $expectedOutput)
$cases[] = array(TRUE, TRUE);
$cases[] = array(FALSE, FALSE);
* @param $expected bool
* @dataProvider booleanDataProvider
*/
- function testStrToBool($input, $expected) {
+ public function testStrToBool($input, $expected) {
$actual = CRM_Utils_String::strtobool($input);
$this->assertTrue($expected === $actual);
}
*/
class CRM_Utils_SystemTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
- function testUrlQueryString() {
+ public function testUrlQueryString() {
$config = CRM_Core_Config::singleton();
$this->assertTrue($config->userSystem instanceof CRM_Utils_System_UnitTests);
$expected = '/index.php?q=civicrm/foo/bar&foo=ab&bar=cd%26ef';
$this->assertEquals($expected, $actual);
}
- function testUrlQueryArray() {
+ public function testUrlQueryArray() {
$config = CRM_Core_Config::singleton();
$this->assertTrue($config->userSystem instanceof CRM_Utils_System_UnitTests);
$expected = '/index.php?q=civicrm/foo/bar&foo=ab&bar=cd%26ef';
* @param bool $expectedResult
* @dataProvider equalCases
*/
- function testEquals($timeA, $timeB, $threshold, $expectedResult) {
+ public function testEquals($timeA, $timeB, $threshold, $expectedResult) {
$actual = CRM_Utils_Time::isEqual($timeA, $timeB, $threshold);
$this->assertEquals($expectedResult, $actual);
*/
class CRM_Utils_TypeTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
}
/**
* @dataProvider validateDataProvider
*/
- function testValidate($inputData, $inputType, $expectedResult) {
+ public function testValidate($inputData, $inputType, $expectedResult) {
$this->assertEquals($expectedResult, CRM_Utils_Type::validate($inputData, $inputType, FALSE));
}
/**
* @return array
*/
- function validateDataProvider() {
+ public function validateDataProvider() {
return array(
array(10, 'Int', 10),
array('145E+3', 'Int', NULL),
*/
class CRM_Utils_ZipTest extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->file = FALSE;
}
- function tearDown() {
+ public function tearDown() {
parent::tearDown();
if ($this->file) {
unlink($this->file);
}
}
- function testFindBaseDirName_normal() {
+ public function testFindBaseDirName_normal() {
$this->_doFindBaseDirName('author-com.example.foo-random/',
array('author-com.example.foo-random'),
array('author-com.example.foo-random/README.txt' => 'hello')
);
}
- function testFindBaseDirName_0() {
+ public function testFindBaseDirName_0() {
$this->_doFindBaseDirName('0/',
array('0'),
array()
);
}
- function testFindBaseDirName_plainfile() {
+ public function testFindBaseDirName_plainfile() {
$this->_doFindBaseDirName(FALSE,
array(),
array('README.txt' => 'hello')
);
}
- function testFindBaseDirName_twodir() {
+ public function testFindBaseDirName_twodir() {
$this->_doFindBaseDirName(FALSE,
array('dir-1', 'dir-2'),
array('dir-1/README.txt' => 'hello')
);
}
- function testFindBaseDirName_dirfile() {
+ public function testFindBaseDirName_dirfile() {
$this->_doFindBaseDirName(FALSE,
array('dir-1'),
array('dir-1/README.txt' => 'hello', 'MANIFEST.MF' => 'extra')
);
}
- function testFindBaseDirName_dot() {
+ public function testFindBaseDirName_dot() {
$this->_doFindBaseDirName(FALSE,
array('.'),
array('./README.txt' => 'hello')
);
}
- function testFindBaseDirName_dots() {
+ public function testFindBaseDirName_dots() {
$this->_doFindBaseDirName(FALSE,
array('..'),
array('../README.txt' => 'hello')
);
}
- function testFindBaseDirName_weird() {
+ public function testFindBaseDirName_weird() {
$this->_doFindBaseDirName(FALSE,
array('foo/../'),
array('foo/../README.txt' => 'hello')
);
}
- function testGuessBaseDir_normal() {
+ public function testGuessBaseDir_normal() {
$this->_doGuessBaseDir('author-com.example.foo-random',
array('author-com.example.foo-random'),
array('author-com.example.foo-random/README.txt' => 'hello'),
);
}
- function testGuessBaseDir_MACOSX() {
+ public function testGuessBaseDir_MACOSX() {
$this->_doGuessBaseDir('com.example.foo',
array('com.example.foo', '__MACOSX'),
array('author-com.example.foo-random/README.txt' => 'hello', '__MACOSX/foo' => 'bar'),
);
}
- function testGuessBaseDir_0() {
+ public function testGuessBaseDir_0() {
$this->_doGuessBaseDir('0',
array('0'),
array(),
);
}
- function testGuessBaseDir_plainfile() {
+ public function testGuessBaseDir_plainfile() {
$this->_doGuessBaseDir(FALSE,
array(),
array('README.txt' => 'hello'),
);
}
- function testGuessBaseDir_twodir() {
+ public function testGuessBaseDir_twodir() {
$this->_doGuessBaseDir(FALSE,
array('dir-1', 'dir-2'),
array('dir-1/README.txt' => 'hello'),
);
}
- function testGuessBaseDir_weird() {
+ public function testGuessBaseDir_weird() {
$this->_doGuessBaseDir(FALSE,
array('foo/../'),
array('foo/../README.txt' => 'hello'),
* @param $dirs
* @param $files
*/
- function _doFindBaseDirName($expectedBaseDirName, $dirs, $files) {
+ public function _doFindBaseDirName($expectedBaseDirName, $dirs, $files) {
$this->file = tempnam(sys_get_temp_dir(), 'testzip-');
$this->assertTrue(CRM_Utils_Zip::createTestZip($this->file, $dirs, $files));
* @param $files
* @param $expectedKey
*/
- function _doGuessBaseDir($expectedResult, $dirs, $files, $expectedKey) {
+ public function _doGuessBaseDir($expectedResult, $dirs, $files, $expectedKey) {
$this->file = tempnam(sys_get_temp_dir(), 'testzip-');
$this->assertTrue(CRM_Utils_Zip::createTestZip($this->file, $dirs, $files));
/**
* @return array
*/
- function get_info() {
+ public function get_info() {
return array(
'name' => 'VersionCheck Test',
'description' => 'Test versionCheck functionality',
);
}
- function setUp() {
+ public function setUp() {
parent::setUp();
}
* @param array $versionInfo
* @param mixed $expectedResult
*/
- function testNewerVersion($localVersion, $versionInfo, $expectedResult) {
+ public function testNewerVersion($localVersion, $versionInfo, $expectedResult) {
$vc = CRM_Utils_VersionCheck::singleton();
// These values are set by the constructor but for testing we override them
$vc->localVersion = $localVersion;
/**
* @return array (localVersion, versionInfo, expectedResult)
*/
- function newerVersionDataProvider() {
+ public function newerVersionDataProvider() {
$data = array();
// Make sure we do not get unstable release updates for a stable localVersion
* @param array $versionInfo
* @param bool $expectedResult
*/
- function testSecurityUpdate($localVersion, $versionInfo, $expectedResult) {
+ public function testSecurityUpdate($localVersion, $versionInfo, $expectedResult) {
$vc = CRM_Utils_VersionCheck::singleton();
// These values are set by the constructor but for testing we override them
$vc->localVersion = $localVersion;
/**
* @return array (localVersion, versionInfo, expectedResult)
*/
- function securityUpdateDataProvider() {
+ public function securityUpdateDataProvider() {
$data = array();
// Make sure we get alerted if a security release is available
$this->kernel = new Kernel($this->dispatcher);
}
- function testNormalEvents() {
+ public function testNormalEvents() {
$this->kernel->registerApiProvider($this->createWidgetFrobnicateProvider());
$result = $this->kernel->run('Widget', 'frobnicate', array(
'version' => self::MOCK_VERSION,
$this->assertEquals('frob', $result['values'][98]);
}
- function testResolveException() {
+ public function testResolveException() {
$test = $this;
$this->dispatcher->addListener(Events::RESOLVE, function () {
throw new \API_Exception('Oh My God', 'omg', array('the' => 'badzes'));
/**
* @return array
*/
- function v4options() {
+ public function v4options() {
$cases = array(); // array(0 => $requestParams, 1 => $expectedOptions, 2 => $expectedData, 3 => $expectedChains)
$cases[] = array(
array('version' => 4), // requestParams
* @param $expectedChains
* @dataProvider v4options
*/
- function testCreateRequest_v4Options($inputParams, $expectedOptions, $expectedData, $expectedChains) {
+ public function testCreateRequest_v4Options($inputParams, $expectedOptions, $expectedData, $expectedChains) {
$apiRequest = Request::create('MyEntity', 'MyAction', $inputParams, NULL);
$this->assertEquals($expectedOptions, $apiRequest['options']->getArray());
$this->assertEquals($expectedData, $apiRequest['data']->getArray());
/**
* @expectedException \API_Exception
*/
- function testCreateRequest_v4BadEntity() {
+ public function testCreateRequest_v4BadEntity() {
Request::create('Not!Valid', 'create', array('version' => 4), NULL);
}
/**
* @expectedException \API_Exception
*/
- function testCreateRequest_v4BadAction() {
+ public function testCreateRequest_v4BadAction() {
Request::create('MyEntity', 'bad!action', array('version' => 4), NULL);
}
/**
* @return array
*/
- function validEntityActionPairs() {
+ public function validEntityActionPairs() {
$cases = array();
$cases[] = array(
array('MyEntity', 'MyAction', 3),
/**
* @dataProvider validEntityActionPairs
*/
- function testCreateRequest_EntityActionMunging($input, $expected) {
+ public function testCreateRequest_EntityActionMunging($input, $expected) {
list ($inEntity, $inAction, $inVersion) = $input;
$apiRequest = Request::create($inEntity, $inAction, array('version' => $inVersion), NULL);
$this->assertEquals($expected, array($apiRequest['entity'], $apiRequest['action'], $apiRequest['version']));
/**
* @return array
*/
- function invalidEntityActionPairs() {
+ public function invalidEntityActionPairs() {
$cases = array();
$cases[] = array('My+Entity', 'MyAction', 4);
$cases[] = array('My Entity', 'MyAction', 4);
* @dataProvider invalidEntityActionPairs
* @expectedException \API_Exception
*/
- function testCreateRequest_InvalidEntityAction($inEntity, $inAction, $inVersion) {
+ public function testCreateRequest_InvalidEntityAction($inEntity, $inAction, $inVersion) {
Request::create($inEntity, $inAction, array('version' => $inVersion), NULL);
}
\CRM_Core_DAO_AllCoreTables::init(TRUE);
}
- function okDataProvider() {
+ public function okDataProvider() {
$cases = array();
$cases[] = array('Widget', 'create', array('id' => self::WIDGET_ID));
return $cases;
}
- function badDataProvider() {
+ public function badDataProvider() {
$cases = array();
$cases[] = array('Forbidden', 'create', array('id' => self::FORBIDDEN_ID), '/Authorization failed/');
* @param $params
* @dataProvider okDataProvider
*/
- function testOk($entity, $action, $params) {
+ public function testOk($entity, $action, $params) {
$params['version'] = 3;
$params['debug'] = 1;
$params['check_permissions'] = 1;
* @param $params
* @dataProvider badDataProvider
*/
- function testBad($entity, $action, $params, $expectedError) {
+ public function testBad($entity, $action, $params, $expectedError) {
$params['version'] = 3;
$params['debug'] = 1;
$params['check_permissions'] = 1;
*/
class TransactionSubscriberTest extends \CiviUnitTestCase {
- function transactionOptions() {
+ public function transactionOptions() {
$r = array();
// $r[] = array(string $entity, string $action, array $params, bool $isTransactional, bool $isForceRollback, bool $isNested);
* Ensure that API parameters "is_transactional" and "force_rollback" are parsed correctly
* @dataProvider transactionOptions
*/
- function testTransactionOptions($version, $entity, $action, $params, $isTransactional, $isForceRollback, $isNested) {
+ public function testTransactionOptions($version, $entity, $action, $params, $isTransactional, $isForceRollback, $isNested) {
$txs = new TransactionSubscriber();
$apiProvider = NULL;
$this->assertEquals($isNested, $txs->isNested($apiProvider, $apiRequest), 'check isNested');
}
- function testForceRollback() {
+ public function testForceRollback() {
$result = $this->callAPISuccess('contact', 'create', array(
'contact_type' => 'Individual',
'first_name' => 'Me',
* @param $caseTypes
* @see \CRM_Utils_Hook::caseTypes
*/
- function hook_caseTypes(&$caseTypes) {
+ public function hook_caseTypes(&$caseTypes) {
$caseTypes[$this->caseType] = array(
'module' => 'org.civicrm.hrcase',
'name' => $this->caseType,
);
}
- function assertApproxTime($expected, $actual, $tolerance = 1) {
+ public function assertApproxTime($expected, $actual, $tolerance = 1) {
$diff = abs(strtotime($expected) - strtotime($actual));
$this->assertTrue($diff <= $tolerance, sprintf("Check approx time equality. expected=[%s] actual=[%s] tolerance=[%s]",
$expected, $actual, $tolerance
* @param $key
* @return mixed
*/
- static function ag($array, $key) {
+ public static function ag($array, $key) {
return $array[$key];
}
}
\ No newline at end of file
* a payment processor of type Authorize.net
* @return CRM_Financial_DAO_PaymentProcessor
*/
- function create() {
+ public function create() {
$paymentProcessor = new CRM_Financial_DAO_PaymentProcessor();
$paymentParams = array(
* @return boolean true if payment processor deleted, false otherwise
*
*/
- function delete($id) {
+ public function delete($id) {
$paymentProcessor = new CRM_Financial_DAO_PaymentProcessor();
$paymentProcessor->id = $id;
if ($paymentProcessor->find(TRUE)) {
*
* @access protected
*/
- function tearDown() {
+ public function tearDown() {
$this->quickCleanup($this->tablesToTruncate, TRUE);
$this->customDirectories(array('template_path' => FALSE));
CRM_Case_XMLRepository::singleton(TRUE);
* @param $caseTypes
* @see CRM_Utils_Hook::caseTypes
*/
- function hook_caseTypes(&$caseTypes) {
+ public function hook_caseTypes(&$caseTypes) {
}
}
\ No newline at end of file
* that a DELETE occurred
* @delete boolean True if we're checking that a DELETE action occurred.
*/
- function assertDBState(&$testCase, $daoName, $id, $match, $delete = FALSE) {
+ public function assertDBState(&$testCase, $daoName, $id, $match, $delete = FALSE) {
if (empty($id)) {
// adding this here since developers forget to check for an id
// and hence we get the first value in the db
/**
* Request a record from the DB by seachColumn+searchValue. Success if a record is found.
*/
- function assertDBNotNull(&$testCase, $daoName, $searchValue, $returnColumn, $searchColumn, $message) {
+ public function assertDBNotNull(&$testCase, $daoName, $searchValue, $returnColumn, $searchColumn, $message) {
if (empty($searchValue)) {
$testCase->fail("empty value passed to assertDBNotNull");
}
/**
* Request a record from the DB by seachColumn+searchValue. Success if returnColumn value is NULL.
*/
- function assertDBNull(&$testCase, $daoName, $searchValue, $returnColumn, $searchColumn, $message) {
+ public function assertDBNull(&$testCase, $daoName, $searchValue, $returnColumn, $searchColumn, $message) {
$value = CRM_Core_DAO::getFieldValue($daoName, $searchValue, $returnColumn, $searchColumn);
$testCase->assertNull($value, $message);
}
/**
* Request a record from the DB by id. Success if row not found.
*/
- function assertDBRowNotExist(&$testCase, $daoName, $id, $message) {
+ public function assertDBRowNotExist(&$testCase, $daoName, $id, $message) {
$value = CRM_Core_DAO::getFieldValue($daoName, $id, 'id', 'id');
$testCase->assertNull($value, $message);
}
/**
* Compare all values in a single retrieved DB record to an array of expected values
*/
- function assertDBCompareValues(&$testCase, $daoName, $searchParams, $expectedValues) {
+ public function assertDBCompareValues(&$testCase, $daoName, $searchParams, $expectedValues) {
//get the values from db
$dbValues = array();
CRM_Core_DAO::commonRetrieve($daoName, $searchParams, $dbValues);
* @param $expectedValues
* @param $actualValues
*/
- function assertAttributesEquals(&$testCase, &$expectedValues, &$actualValues) {
+ public function assertAttributesEquals(&$testCase, &$expectedValues, &$actualValues) {
foreach ($expectedValues as $paramName => $paramValue) {
if (isset($actualValues[$paramName])) {
$testCase->assertEquals($paramValue, $actualValues[$paramName]);
* @param CiviSeleniumTestCase|CiviUnitTestCase $unit_test The currently running test
* @param bool $startImmediately Start writing to db now or wait until start() is called
*/
- function __construct(&$unit_test, $startImmediately = TRUE) {
+ public function __construct(&$unit_test, $startImmediately = TRUE) {
$this->_ut = $unit_test;
// Check if running under webtests or not
/**
* Start writing emails to db instead of current option
*/
- function start() {
+ public function start() {
if ($this->_webtest) {
// Change outbound mail setting
$this->_ut->openCiviPage('admin/setting/smtp', "reset=1", "_qf_Smtp_next");
}
}
- function stop() {
+ public function stop() {
if ($this->_webtest) {
if ($this->_outBound_option != CRM_Mailing_Config::OUTBOUND_OPTION_REDIRECT_TO_DB) {
// Change outbound mail setting
*
* @return ezcMail|string
*/
- function getMostRecentEmail($type = 'raw') {
+ public function getMostRecentEmail($type = 'raw') {
$msg = '';
if ($this->_webtest) {
* @throws Exception
* @return array(ezcMail)|array(string)
*/
- function getAllMessages($type = 'raw') {
+ public function getAllMessages($type = 'raw') {
$msgs = array();
if ($this->_webtest) {
/**
* @return int
*/
- function getSelectedOutboundOption() {
+ public function getSelectedOutboundOption() {
$selectedOption = CRM_Mailing_Config::OUTBOUND_OPTION_MAIL;
// Is there a better way to do this? How do you get the currently selected value of a radio button in selenium?
for ($i = 0; $i <= 5; $i++) {
*
* @return \ezcMail|string
*/
- function checkMailLog($strings, $absentStrings = array(), $prefix = '') {
+ public function checkMailLog($strings, $absentStrings = array(), $prefix = '') {
$mail = $this->getMostRecentEmail('raw');
foreach ($strings as $string) {
$this->_ut->assertContains($string, $mail, "$string . not found in $mail $prefix");
/**
* Check that mail log is empty
*/
- function assertMailLogEmpty($prefix = '') {
+ public function assertMailLogEmpty($prefix = '') {
$mail = $this->getMostRecentEmail('raw');
$this->_ut->assertEmpty($mail, 'mail sent when it should not have been ' . $prefix);
}
*
* @param array $expectedRecipients array($msgPos => array($recipPos => $emailAddr))
*/
- function assertRecipients($expectedRecipients) {
+ public function assertRecipients($expectedRecipients) {
$recipients = array();
foreach ($this->getAllMessages('ezc') as $message) {
$recipients[] = CRM_Utils_Array::collect('email', $message->to);
/**
* Remove any sent messages from the log
*/
- function clearMessages() {
+ public function clearMessages() {
if ($this->_webtest) {
throw new Exception("Not implementated: clearMessages for WebTest");
}
* Class CiviReportTestCase
*/
class CiviReportTestCase extends CiviUnitTestCase {
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->_sethtmlGlobals();
}
- function tearDown() {
+ public function tearDown() {
// TODO Figure out how to automatically drop all temporary tables.
// Note that MySQL doesn't provide a way to list them, so we would need
// to keep track ourselves (eg CRM_Core_TemporaryTableManager) or reset
* @return string
* @throws Exception
*/
- function getReportOutputAsCsv($reportClass, $inputParams) {
+ public function getReportOutputAsCsv($reportClass, $inputParams) {
$config = CRM_Core_Config::singleton();
$config->keyDisable = TRUE;
$controller = new CRM_Core_Controller_Simple($reportClass, ts('some title'));
*
* @return array
*/
- function getArrayFromCsv($csvFile) {
+ public function getArrayFromCsv($csvFile) {
$arrFile = array();
if (($handle = fopen($csvFile, "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
* @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);
$this->loggedInAs = NULL;
* @param $user: (str) the key 'user' or 'admin', or a literal username
* @param $pass: (str) if $user is a literal username and not 'user' or 'admin', supply the password
*/
- function webtestLogin($user = 'user', $pass = NULL) {
+ public function webtestLogin($user = 'user', $pass = NULL) {
// If already logged in as correct user, do nothing
if ($this->loggedInAs === $user) {
return;
$this->loggedInAs = $user;
}
- function webtestLogout() {
+ public function webtestLogout() {
if ($this->loggedInAs) {
$this->open($this->sboxPath . "user/logout");
$this->waitForPageToLoad($this->getTimeoutMsec());
* opening all civi pages, and using the $args param is also strongly encouraged
* This will make it much easier to run webtests in other CMSs in the future
*/
- function openCiviPage($url, $args = NULL, $waitFor = 'civicrm-footer') {
+ public function openCiviPage($url, $args = NULL, $waitFor = 'civicrm-footer') {
// Construct full url with args
// This could be extended in future to work with other CMS style urls
if ($args) {
* Wait for the page to load
* Wait for an element to be present
*/
- function clickLink($element, $waitFor = 'civicrm-footer', $waitForPageLoad = TRUE) {
+ public function clickLink($element, $waitFor = 'civicrm-footer', $waitForPageLoad = TRUE) {
$this->click($element);
// conditional wait for page load e.g for ajax form save
if ($waitForPageLoad) {
* @param string $element
* @param string $waitFor
*/
- function clickPopupLink($element, $waitFor=NULL) {
+ public function clickPopupLink($element, $waitFor=NULL) {
$this->clickAjaxLink($element, 'css=.ui-dialog');
if ($waitFor) {
$this->waitForElementPresent($waitFor);
* @param string $element
* @param string $waitFor
*/
- function clickAjaxLink($element, $waitFor=NULL) {
+ public function clickAjaxLink($element, $waitFor=NULL) {
$this->click($element);
if ($waitFor) {
$this->waitForElementPresent($waitFor);
* @param string $element
* @param string $waitFor
*/
- function clickLinkSuppressPopup($element, $waitFor = 'civicrm-footer') {
+ public function clickLinkSuppressPopup($element, $waitFor = 'civicrm-footer') {
$link = $this->getAttribute($element . '@href');
$this->open($link);
$this->waitForPageToLoad($this->getTimeoutMsec());
/**
* Wait for all ajax snippets to finish loading
*/
- function waitForAjaxContent() {
+ public function waitForAjaxContent() {
$this->waitForElementNotPresent('css=.blockOverlay');
// Some ajax calls happen in pairs (e.g. submit a popup form then refresh the underlying content)
// So we'll wait a sec and recheck to see if any more stuff is loading
* Call the API on the local server
* (kind of defeats the point of a webtest - see CRM-11889)
*/
- function webtest_civicrm_api($entity, $action, $params) {
+ public function webtest_civicrm_api($entity, $action, $params) {
if (!isset($params['version'])) {
$params['version'] = 3;
}
* Experimental - currently only works if permissions on remote site allow anon user to access ajax api
* @see CRM-11889
*/
- function rest_civicrm_api($entity, $action, $params = array()) {
+ public function rest_civicrm_api($entity, $action, $params = array()) {
$params += array(
'version' => 3,
);
*
* @return array|int
*/
- function webtestGetFirstValueForOptionGroup($option_group_name) {
+ public function webtestGetFirstValueForOptionGroup($option_group_name) {
$result = $this->webtest_civicrm_api("OptionValue", "getvalue", array(
'option_group_name' => $option_group_name,
'option.limit' => 1,
/**
* @return mixed
*/
- function webtestGetValidCountryID() {
+ public function webtestGetValidCountryID() {
static $_country_id;
if (is_null($_country_id)) {
$config_backend = $this->webtestGetConfig('countryLimit');
*
* @return mixed|null
*/
- function webtestGetValidEntityID($entity) {
+ public function webtestGetValidEntityID($entity) {
// michaelmcandrew: would like to use getvalue but there is a bug
// for e.g. group where option.limit not working at the moment CRM-9110
$result = $this->webtest_civicrm_api($entity, "get", array('option.limit' => 1, 'return' => 'id'));
*
* @return mixed
*/
- function webtestGetConfig($field) {
+ public function webtestGetConfig($field) {
static $_config_backend;
if (is_null($_config_backend)) {
$result = $this->webtest_civicrm_api("Domain", "getvalue", array(
/**
* Ensures the required CiviCRM components are enabled
*/
- function enableComponents($components) {
+ public function enableComponents($components) {
$this->openCiviPage("admin/setting/component", "reset=1", "_qf_Component_next-bottom");
$enabledComponents = $this->getSelectOptions("enableComponents-t");
$added = FALSE;
*
* @return mixed either a string with the (either generated or provided) email or null (if no email)
*/
- function webtestAddContact($fname = 'Anthony', $lname = 'Anderson', $email = NULL, $contactSubtype = NULL) {
+ public function webtestAddContact($fname = 'Anthony', $lname = 'Anderson', $email = NULL, $contactSubtype = NULL) {
$args = 'reset=1&ct=Individual';
if ($contactSubtype) {
$args .= "&cst={$contactSubtype}";
*
* @return null|string
*/
- function webtestAddHousehold($householdName = "Smith's Home", $email = NULL) {
+ public function webtestAddHousehold($householdName = "Smith's Home", $email = NULL) {
$this->openCiviPage("contact/add", "reset=1&ct=Household");
$this->click('household_name');
$this->type('household_name', $householdName);
*
* @return null|string
*/
- function webtestAddOrganization($organizationName = "Organization XYZ", $email = NULL, $contactSubtype = NULL) {
+ public function webtestAddOrganization($organizationName = "Organization XYZ", $email = NULL, $contactSubtype = NULL) {
$args = 'reset=1&ct=Organization';
if ($contactSubtype) {
$args .= "&cst={$contactSubtype}";
/**
*/
- function webtestFillAutocomplete($sortName, $fieldName = 'contact_id') {
+ public function webtestFillAutocomplete($sortName, $fieldName = 'contact_id') {
$this->select2($fieldName,$sortName);
//$this->assertContains($sortName, $this->getValue($fieldName), "autocomplete expected $sortName but didn’t find it in " . $this->getValue($fieldName));
}
/**
*/
- function webtestOrganisationAutocomplete($sortName) {
+ public function webtestOrganisationAutocomplete($sortName) {
$this->clickAt("//*[@id='contact_id']/../div/a");
$this->waitForElementPresent("//*[@id='select2-drop']/div/input");
$this->keyDown("//*[@id='select2-drop']/div/input", " ");
* @param $dateElement
* @param null $strToTimeArgs
*/
- function webtestFillDate($dateElement, $strToTimeArgs = NULL) {
+ public function webtestFillDate($dateElement, $strToTimeArgs = NULL) {
$timeStamp = strtotime($strToTimeArgs ? $strToTimeArgs : '+1 month');
$year = date('Y', $timeStamp);
* @param $dateElement
* @param null $strToTimeArgs
*/
- function webtestFillDateTime($dateElement, $strToTimeArgs = NULL) {
+ public function webtestFillDateTime($dateElement, $strToTimeArgs = NULL) {
$this->webtestFillDate($dateElement, $strToTimeArgs);
$timeStamp = strtotime($strToTimeArgs ? $strToTimeArgs : '+1 month');
* @param string $tableId Pass in the id attribute of a table to be verified if you want to only check a specific table
* on the web page.
*/
- function webtestVerifyTabularData($expected, $xpathPrefix = NULL, $tableId = NULL) {
+ public function webtestVerifyTabularData($expected, $xpathPrefix = NULL, $tableId = NULL) {
$tableLocator = "";
if ($tableId) {
$tableLocator = "[@id='$tableId']";
*
* @return void
*/
- function fillRichTextField($fieldName, $text = 'Typing this text into editor.', $editor = 'CKEditor', $compressed = FALSE) {
+ public function fillRichTextField($fieldName, $text = 'Typing this text into editor.', $editor = 'CKEditor', $compressed = FALSE) {
// make sure cursor focuses on the field
$this->fireEvent($fieldName, 'focus');
if ($editor == 'CKEditor') {
*
* @return void
*/
- function addMultipleChoiceOptions($options, &$validateStrings) {
+ public function addMultipleChoiceOptions($options, &$validateStrings) {
foreach ($options as $oIndex => $oValue) {
$validateStrings[] = $oValue['label'];
$validateStrings[] = $oValue['amount'];
* @param string $contactType
* @return array of contact attributes (id, names, email)
*/
- function createDialogContact($field = 'contact_id', $contactType = 'Individual') {
+ public function createDialogContact($field = 'contact_id', $contactType = 'Individual') {
$selectId = 's2id_' . $this->getAttribute($field . '@id');
$this->clickAt("xpath=//div[@id='$selectId']/a");
$this->clickAjaxLink("xpath=//li[@class='select2-no-results']//a[contains(text(), 'New $contactType')]", '_qf_Edit_next');
* @param $strings
* @return void
*/
- function assertStringsPresent($strings) {
+ public function assertStringsPresent($strings) {
foreach ((array) $strings as $string) {
$this->assertTrue($this->isTextPresent($string), "Could not find $string on page");
}
* of the URL that are present. Querystring elements are returned in sub-array (elements.queryString)
* http://php.net/manual/en/function.parse-url.php
*/
- function parseURL($url = NULL) {
+ public function parseURL($url = NULL) {
if (!$url) {
$url = $this->getLocation();
}
/**
* Returns a single argument from the url query
*/
- function urlArg($arg, $url = NULL) {
+ public function urlArg($arg, $url = NULL) {
$elements = $this->parseURL($url);
return isset($elements['queryString'][$arg]) ? $elements['queryString'][$arg] : NULL;
}
* @return int
*/
- function webtestAddPaymentProcessor($processorName = 'Test Processor', $processorType = 'Dummy', $processorSettings = NULL, $financialAccount = 'Deposit Bank Account') {
+ public function webtestAddPaymentProcessor($processorName = 'Test Processor', $processorType = 'Dummy', $processorSettings = NULL, $financialAccount = 'Deposit Bank Account') {
if (!$processorName) {
$this->fail("webTestAddPaymentProcessor requires $processorName.");
}
return $this->urlArg('id', $paymentProcessorLink);
}
- function webtestAddCreditCardDetails() {
+ public function webtestAddCreditCardDetails() {
$this->waitForElementPresent('credit_card_type');
$this->select('credit_card_type', 'label=Visa');
$this->type('credit_card_number', '4807731747657838');
*
* @return array
*/
- function webtestAddBillingDetails($firstName = NULL, $middleName = NULL, $lastName = NULL) {
+ public function webtestAddBillingDetails($firstName = NULL, $middleName = NULL, $lastName = NULL) {
if (!$firstName) {
$firstName = 'John';
}
*
* @return null|string
*/
- function webtestAttachFile($fieldLocator, $filePath = NULL) {
+ public function webtestAttachFile($fieldLocator, $filePath = NULL) {
if (!$filePath) {
$filePath = '/tmp/testfile_' . substr(sha1(rand()), 0, 7) . '.txt';
$fp = @fopen($filePath, 'w');
*
* @return null|string
*/
- function webtestCreateCSV($headers, $rows, $filePath = NULL) {
+ public function webtestCreateCSV($headers, $rows, $filePath = NULL) {
if (!$filePath) {
$filePath = '/tmp/testcsv_' . substr(sha1(rand()), 0, 7) . '.csv';
}
*
* @return an array of saved params values.
*/
- function webtestAddRelationshipType($params = array()) {
+ public function webtestAddRelationshipType($params = array()) {
$this->openCiviPage("admin/reltype", "reset=1&action=add");
//build the params if not passed.
* @param array $fields Fields to be set for strict rule
* @param int $threshold Rule's threshold value
*/
- function webtestStrictDedupeRuleDefault($contactType = 'Individual', $fields = array(), $threshold = 10) {
+ public function webtestStrictDedupeRuleDefault($contactType = 'Individual', $fields = array(), $threshold = 10) {
// set default strict rule.
$strictRuleId = 4;
if ($contactType == 'Organization') {
*
* @return array
*/
- function webtestAddMembershipType($period_type = 'rolling', $duration_interval = 1, $duration_unit = 'year', $auto_renew = 'no') {
+ public function webtestAddMembershipType($period_type = 'rolling', $duration_interval = 1, $duration_unit = 'year', $auto_renew = 'no') {
$membershipTitle = substr(sha1(rand()), 0, 7);
$membershipOrg = $membershipTitle . ' memorg';
$this->webtestAddOrganization($membershipOrg, TRUE);
*
* @return null|string
*/
- function WebtestAddGroup($groupName = NULL, $parentGroupName = NULL) {
+ public function WebtestAddGroup($groupName = NULL, $parentGroupName = NULL) {
$this->openCiviPage('group/add', 'reset=1', '_qf_Edit_upload-bottom');
// fill group name
*
* @return null
*/
- function WebtestAddActivity($activityType = "Meeting") {
+ public function WebtestAddActivity($activityType = "Meeting") {
// Adding Adding contact with randomized first name for test testContactContextActivityAdd
// We're using Quick Add block on the main page for this.
$firstName1 = substr(sha1(rand()), 0, 7);
* @return bool
*/
static
- function checkDoLocalDBTest() {
+ public function checkDoLocalDBTest() {
if (defined('CIVICRM_WEBTEST_LOCAL_DB') &&
CIVICRM_WEBTEST_LOCAL_DB
) {
* that a DELETE occurred
* @delete boolean True if we're checking that a DELETE action occurred.
*/
- function assertDBState($daoName, $id, $match, $delete = FALSE) {
+ public function assertDBState($daoName, $id, $match, $delete = FALSE) {
if (!self::checkDoLocalDBTest()) {
return;
}
*
* @return null|string
*/
- function assertDBNotNull($daoName, $searchValue, $returnColumn, $searchColumn, $message) {
+ public function assertDBNotNull($daoName, $searchValue, $returnColumn, $searchColumn, $message) {
if (!self::checkDoLocalDBTest()) {
return;
}
* @param $searchColumn
* @param $message
*/
- function assertDBNull($daoName, $searchValue, $returnColumn, $searchColumn, $message) {
+ public function assertDBNull($daoName, $searchValue, $returnColumn, $searchColumn, $message) {
if (!self::checkDoLocalDBTest()) {
return;
}
* @param int $id
* @param $message
*/
- function assertDBRowNotExist($daoName, $id, $message) {
+ public function assertDBRowNotExist($daoName, $id, $message) {
if (!self::checkDoLocalDBTest()) {
return;
}
* @param array $searchParams
* @param $expectedValues
*/
- function assertDBCompareValues($daoName, $searchParams, $expectedValues) {
+ public function assertDBCompareValues($daoName, $searchParams, $expectedValues) {
if (!self::checkDoLocalDBTest()) {
return;
}
* @param $expectedValues
* @param $actualValues
*/
- function assertAttributesEquals(&$expectedValues, &$actualValues) {
+ public function assertAttributesEquals(&$expectedValues, &$actualValues) {
if (!self::checkDoLocalDBTest()) {
return;
}
* @param $actual
* @param string $message
*/
- function assertType($expected, $actual, $message = '') {
+ public function assertType($expected, $actual, $message = '') {
return $this->assertInternalType($expected, $actual, $message);
}
/**
* Delete Financial Account
*/
- function _testDeleteFinancialAccount($financialAccountTitle) {
+ public function _testDeleteFinancialAccount($financialAccountTitle) {
$this->click("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Delete']");
$this->waitForElementPresent('_qf_FinancialAccount_next-botttom');
$this->click('_qf_FinancialAccount_next-botttom');
/**
* Verify data after ADD and EDIT
*/
- function _assertFinancialAccount($verifyData) {
+ public function _assertFinancialAccount($verifyData) {
foreach ($verifyData as $key => $expectedValue) {
$actualValue = $this->getValue($key);
if ($key == 'parent_financial_account') {
/**
* @param $verifySelectFieldData
*/
- function _assertSelectVerify($verifySelectFieldData) {
+ public function _assertSelectVerify($verifySelectFieldData) {
foreach ($verifySelectFieldData as $key => $expectedvalue) {
$actualvalue = $this->getSelectedLabel($key);
$this->assertEquals($expectedvalue, $actualvalue);
* @param $financialType
* @param string $option
*/
- function addeditFinancialType($financialType, $option = 'new') {
+ public function addeditFinancialType($financialType, $option = 'new') {
$this->openCiviPage("admin/financial/financialType", "reset=1");
if ($option == 'Delete') {
* Give the specified permissions
* Note: this function logs in as 'admin' (logging out if necessary)
*/
- function changePermissions($permission) {
+ public function changePermissions($permission) {
$this->webtestLogin('admin');
$this->open("{$this->sboxPath}admin/people/permissions");
$this->waitForElementPresent('edit-submit');
* @param $profileTitle
* @param $profileFields
*/
- function addProfile($profileTitle, $profileFields) {
+ public function addProfile($profileTitle, $profileFields) {
$this->openCiviPage('admin/uf/group', "reset=1");
$this->clickLink('link=Add Profile', '_qf_Group_cancel-bottom');
* @param $cost
* @param $financialType
*/
- function addPremium($name, $sku, $amount, $price, $cost, $financialType) {
+ public function addPremium($name, $sku, $amount, $price, $cost, $financialType) {
$this->waitForElementPresent("_qf_ManagePremiums_upload-bottom");
$this->type("name", $name);
$this->type("sku", $sku);
* @param $label
* @param $financialAccount
*/
- function addPaymentInstrument($label, $financialAccount) {
+ public function addPaymentInstrument($label, $financialAccount) {
$this->openCiviPage('admin/options/payment_instrument', 'action=add&reset=1', "_qf_Options_next-bottom");
$this->type("label", $label);
$this->select("financial_account_id", "value=$financialAccount");
/**
* Ensure we have a default mailbox set up for CiviMail
*/
- function setupDefaultMailbox() {
+ public function setupDefaultMailbox() {
$this->openCiviPage('admin/mailSettings', 'action=update&id=1&reset=1');
// Check if it hasn't already been set up
if (!$this->getSelectedValue('protocol')) {
*
* @return string, timeout expressed in milliseconds
*/
- function getTimeoutMsec() {
+ public function getTimeoutMsec() {
// note: existing local versions of CiviSeleniumSettings may not declare $timeout, so use @
$timeout = ($this->settings && @$this->settings->timeout) ? ($this->settings->timeout * 1000) : 30000;
return (string) $timeout; // don't know why, but all our old code used a string
* @param callable|boolean $beforeTriggering fn to execute before actual element triggering
* @return void
*/
- function customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl, $beforeTriggering = NULL) {
+ public function customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl, $beforeTriggering = NULL) {
// FIXME: Testing a theory that these failures have something to do with permissions
$this->webtestLogin('admin');
*
* @return array
*/
- function addCustomGroupField($customSets) {
+ public function addCustomGroupField($customSets) {
$return = array();
foreach ($customSets as $customSet) {
$this->openCiviPage("admin/custom/group", "action=add&reset=1");
/**
* Type and select first occurance of autocomplete
*/
- function select2($fieldName,$label, $multiple = FALSE, $xpath=FALSE) {
+ public function select2($fieldName,$label, $multiple = FALSE, $xpath=FALSE) {
// In the case of chainSelect, wait for options to load
$this->waitForElementNotPresent('css=select.loading');
if ($multiple) {
/**
* Select multiple options
*/
- function multiselect2($fieldid, $params) {
+ public function multiselect2($fieldid, $params) {
// In the case of chainSelect, wait for options to load
$this->waitForElementNotPresent('css=select.loading');
foreach($params as $value) {
/**
* Check for unobtrusive status message as set by CRM.status
*/
- function checkCRMStatus($text=NULL) {
+ public function checkCRMStatus($text=NULL) {
$this->waitForElementPresent("css=.crm-status-box-outer.status-success");
if ($text) {
$this->assertElementContainsText("css=.crm-status-box-outer.status-success", $text);
/**
* Check for obtrusive status message as set by CRM.alert
*/
- function checkCRMAlert($text, $type='success') {
+ public function checkCRMAlert($text, $type='success') {
$this->waitForElementPresent("css=div.ui-notify-message.$type");
$this->waitForText("css=div.ui-notify-message.$type", $text);
// We got the message, now let's close it so the webtest doesn't get confused by lots of open alerts
/**
* Enable or disable Pop-ups via Display Preferences
*/
- function enableDisablePopups($enabled = TRUE) {
+ public function enableDisablePopups($enabled = TRUE) {
$this->openCiviPage('admin/setting/preferences/display', 'reset=1');
$isChecked = $this->isChecked('ajaxPopupsEnabled');
if (($isChecked && !$enabled) || (!$isChecked && $enabled)) {
/**
* Attempt to get information about what went wrong if we encounter an error when loading a page
*/
- function checkForErrorsOnPage() {
+ public function checkForErrorsOnPage() {
foreach (array('Access denied', 'Page not found') as $err) {
if ($this->isElementPresent("xpath=//h1[contains(., '$err')]")) {
$this->fail("'$err' encountered at " . $this->getLocation() . "\nwhile logged in as '{$this->loggedInAs}'");
/**
* Simple name based constructor
*/
- function __construct($theClass = '', $name = '') {
+ public function __construct($theClass = '', $name = '') {
if (empty($name)) {
$name = str_replace('_',
' ',
* suppress failed test error issued by phpunit when it finds
* a test suite with no tests
*/
- function testNothing() {
+ public function testNothing() {
}
/**
* @param array $data
* @param string $dataName
*/
- function __construct($name = NULL, array$data = array(), $dataName = '') {
+ public function __construct($name = NULL, array$data = array(), $dataName = '') {
parent::__construct($name, $data, $dataName);
// we need full error reporting
/**
* @return bool
*/
- function requireDBReset() {
+ public function requireDBReset() {
return $this->DBResetRequired;
}
/**
* @return string
*/
- static function getDBName() {
+ public static function getDBName() {
$dbName = !empty($GLOBALS['mysql_db']) ? $GLOBALS['mysql_db'] : 'civicrm_tests_dev';
return $dbName;
}
/**
* FIXME: Maybe a better way to do it
*/
- function foreignKeyChecksOff() {
+ public function foreignKeyChecksOff() {
self::$utils = new Utils($GLOBALS['mysql_host'],
$GLOBALS['mysql_port'],
$GLOBALS['mysql_user'],
return TRUE;
}
- function foreignKeyChecksOn() {
+ public function foreignKeyChecksOn() {
// FIXME: might not be needed if previous fixme implemented
}
* that a DELETE occurred
* @delete boolean True if we're checking that a DELETE action occurred.
*/
- function assertDBState($daoName, $id, $match, $delete = FALSE) {
+ public function assertDBState($daoName, $id, $match, $delete = FALSE) {
if (empty($id)) {
// adding this here since developers forget to check for an id
// and hence we get the first value in the db
* @return null|string
* @throws PHPUnit_Framework_AssertionFailedError
*/
- function assertDBNotNull($daoName, $searchValue, $returnColumn, $searchColumn, $message) {
+ public function assertDBNotNull($daoName, $searchValue, $returnColumn, $searchColumn, $message) {
if (empty($searchValue)) {
$this->fail("empty value passed to assertDBNotNull");
}
* @param $searchColumn
* @param $message
*/
- function assertDBNull($daoName, $searchValue, $returnColumn, $searchColumn, $message) {
+ public function assertDBNull($daoName, $searchValue, $returnColumn, $searchColumn, $message) {
$value = CRM_Core_DAO::getFieldValue($daoName, $searchValue, $returnColumn, $searchColumn, TRUE);
$this->assertNull($value, $message);
}
* @param int $id
* @param null $message
*/
- function assertDBRowNotExist($daoName, $id, $message = NULL) {
+ public function assertDBRowNotExist($daoName, $id, $message = NULL) {
$message = $message ? $message : "$daoName (#$id) should not exist";
$value = CRM_Core_DAO::getFieldValue($daoName, $id, 'id', 'id', TRUE);
$this->assertNull($value, $message);
* @param int $id
* @param null $message
*/
- function assertDBRowExist($daoName, $id, $message = NULL) {
+ public function assertDBRowExist($daoName, $id, $message = NULL) {
$message = $message ? $message : "$daoName (#$id) should exist";
$value = CRM_Core_DAO::getFieldValue($daoName, $id, 'id', 'id', TRUE);
$this->assertEquals($id, $value, $message);
* @param array $searchParams
* @param $expectedValues
*/
- function assertDBCompareValues($daoName, $searchParams, $expectedValues) {
+ public function assertDBCompareValues($daoName, $searchParams, $expectedValues) {
//get the values from db
$dbValues = array();
CRM_Core_DAO::commonRetrieve($daoName, $searchParams, $dbValues);
* Example: $this->assertSql(2, 'select count(*) from foo where foo.bar like "%1"',
* array(1 => array("Whiz", "String")));
*/
- function assertDBQuery($expected, $query, $params = array(), $message = '') {
+ public function assertDBQuery($expected, $query, $params = array(), $message = '') {
if ($message) $message .= ': ';
$actual = CRM_Core_DAO::singleValueQuery($query, $params);
$this->assertEquals($expected, $actual,
* @param array $expected
* @param array $actual
*/
- function assertTreeEquals($expected, $actual) {
+ public function assertTreeEquals($expected, $actual) {
$e = array();
$a = array();
CRM_Utils_Array::flatten($expected, $e, '', ':::');
* @param int|float $tolerance
* @param string $message
*/
- function assertApproxEquals($expected, $actual, $tolerance, $message = NULL) {
+ public function assertApproxEquals($expected, $actual, $tolerance, $message = NULL) {
if ($message === NULL) {
$message = sprintf("approx-equals: expected=[%.3f] actual=[%.3f] tolerance=[%.3f]", $expected, $actual, $tolerance);
}
*
* @throws PHPUnit_Framework_AssertionFailedError
*/
- function assertAttributesEquals($expectedValues, $actualValues, $message = NULL) {
+ public function assertAttributesEquals($expectedValues, $actualValues, $message = NULL) {
foreach ($expectedValues as $paramName => $paramValue) {
if (isset($actualValues[$paramName])) {
$this->assertEquals($paramValue, $actualValues[$paramName], "Value Mismatch On $paramName - value 1 is " . print_r($paramValue, TRUE) . " value 2 is " . print_r($actualValues[$paramName], TRUE) );
* @param $key
* @param $list
*/
- function assertArrayKeyExists($key, &$list) {
+ public function assertArrayKeyExists($key, &$list) {
$result = isset($list[$key]) ? TRUE : FALSE;
$this->assertTrue($result, ts("%1 element exists?",
array(1 => $key)
* @param $key
* @param $list
*/
- function assertArrayValueNotNull($key, &$list) {
+ public function assertArrayValueNotNull($key, &$list) {
$this->assertArrayKeyExists($key, $list);
$value = isset($list[$key]) ? $list[$key] : NULL;
* @param array $apiResult api result
* @param string $prefix extra test to add to message
*/
- function assertAPISuccess($apiResult, $prefix = '') {
+ public function assertAPISuccess($apiResult, $prefix = '') {
if (!empty($prefix)) {
$prefix .= ': ';
}
* @param string $prefix extra test to add to message
* @param null $expectedError
*/
- function assertAPIFailure($apiResult, $prefix = '', $expectedError = NULL) {
+ public function assertAPIFailure($apiResult, $prefix = '', $expectedError = NULL) {
if (!empty($prefix)) {
$prefix .= ': ';
}
* @param $actual
* @param string $message
*/
- function assertType($expected, $actual, $message = '') {
+ public function assertType($expected, $actual, $message = '') {
return $this->assertInternalType($expected, $actual, $message);
}
/**
* Check that a deleted item has been deleted
*/
- function assertAPIDeleted($entity, $id) {
+ public function assertAPIDeleted($entity, $id) {
$this->callAPISuccess($entity, 'getcount', array('id' => $id), 0);
}
* @param array $valuesToExclude
* @param string $prefix extra test to add to message
*/
- function assertAPIArrayComparison($result, $expected, $valuesToExclude = array(), $prefix = '') {
+ public function assertAPIArrayComparison($result, $expected, $valuesToExclude = array(), $prefix = '') {
$valuesToExclude = array_merge($valuesToExclude, array('debug', 'xdebug', 'sequential'));
foreach ($valuesToExclude as $value) {
if(isset($result[$value])) {
* @param array $params
* @return array|int
*/
- function civicrm_api($entity, $action, $params) {
+ public function civicrm_api($entity, $action, $params) {
return civicrm_api($entity, $action, $params);
}
*
* @return array|int
*/
- function callAPISuccess($entity, $action, $params, $checkAgainst = NULL) {
+ public function callAPISuccess($entity, $action, $params, $checkAgainst = NULL) {
$params = array_merge(array(
'version' => $this->_apiversion,
'debug' => 1,
*
* @return array|int
*/
- function callAPISuccessGetValue($entity, $params, $type = NULL) {
+ public function callAPISuccessGetValue($entity, $params, $type = NULL) {
$params += array(
'version' => $this->_apiversion,
'debug' => 1,
* @throws Exception
* @return array|int
*/
- function callAPISuccessGetSingle($entity, $params, $checkAgainst = NULL) {
+ public function callAPISuccessGetSingle($entity, $params, $checkAgainst = NULL) {
$params += array(
'version' => $this->_apiversion,
'debug' => 1,
* - array
* - object
*/
- function callAPISuccessGetCount($entity, $params, $count = NULL) {
+ public function callAPISuccessGetCount($entity, $params, $count = NULL) {
$params += array(
'version' => $this->_apiversion,
'debug' => 1,
* @param string|null $actionName
* @return array|int
*/
- function callAPIAndDocument($entity, $action, $params, $function, $file, $description = "", $subfile = NULL, $actionName = NULL){
+ public function callAPIAndDocument($entity, $action, $params, $function, $file, $description = "", $subfile = NULL, $actionName = NULL){
$params['version'] = $this->_apiversion;
$result = $this->callAPISuccess($entity, $action, $params);
$this->documentMe($params, $result, $function, $file, $description, $subfile, $actionName);
* @param null $extraOutput
* @return array|int
*/
- function callAPIFailure($entity, $action, $params, $expectedErrorMessage = NULL, $extraOutput = NULL) {
+ public function callAPIFailure($entity, $action, $params, $expectedErrorMessage = NULL, $extraOutput = NULL) {
if (is_array($params)) {
$params += array(
'version' => $this->_apiversion,
*
* @return int id of Organisation created
*/
- function organizationCreate($params = array(), $seq = 0) {
+ public function organizationCreate($params = array(), $seq = 0) {
if (!$params) {
$params = array();
}
*
* @return int id of Individual created
*/
- function individualCreate($params = array(), $seq = 0) {
+ public function individualCreate($params = array(), $seq = 0) {
$params = array_merge($this->sampleContact('Individual', $seq), $params);
return $this->_contactCreate($params);
}
*
* @return int id of Household created
*/
- function householdCreate($params = array(), $seq = 0) {
+ public function householdCreate($params = array(), $seq = 0) {
$params = array_merge($this->sampleContact('Household', $seq), $params);
return $this->_contactCreate($params);
}
*
* @return array properties of sample contact (ie. $params for API call)
*/
- function sampleContact($contact_type, $seq = 0) {
+ public function sampleContact($contact_type, $seq = 0) {
$samples = array(
'Individual' => array(
// The number of values in each list need to be coprime numbers to not have duplicates
*
* @return array|int
*/
- function contactDelete($contactID) {
+ public function contactDelete($contactID) {
$params = array(
'id' => $contactID,
'skip_undelete' => 1,
*
* @throws Exception
*/
- function contactTypeDelete($contactTypeId) {
+ public function contactTypeDelete($contactTypeId) {
require_once 'CRM/Contact/BAO/ContactType.php';
$result = CRM_Contact_BAO_ContactType::del($contactTypeId);
if (!$result) {
*
* @return mixed
*/
- function membershipTypeCreate($params = array()) {
+ public function membershipTypeCreate($params = array()) {
CRM_Member_PseudoConstant::flush('membershipType');
CRM_Core_Config::clearDBCache();
$memberOfOrganization = $this->organizationCreate();
*
* @return mixed
*/
- function contactMembershipCreate($params) {
+ public function contactMembershipCreate($params) {
$pre = array(
'join_date' => '2007-01-21',
'start_date' => '2007-01-21',
*
* @param array $params
*/
- function membershipTypeDelete($params) {
+ public function membershipTypeDelete($params) {
$this->callAPISuccess('MembershipType', 'Delete', $params);
}
/**
* @param int $membershipID
*/
- function membershipDelete($membershipID) {
+ public function membershipDelete($membershipID) {
$deleteParams = array('id' => $membershipID);
$result = $this->callAPISuccess('Membership', 'Delete', $deleteParams);
return;
*
* @return mixed
*/
- function membershipStatusCreate($name = 'test member status') {
+ public function membershipStatusCreate($name = 'test member status') {
$params['name'] = $name;
$params['start_event'] = 'start_date';
$params['end_event'] = 'end_date';
/**
* @param int $membershipStatusID
*/
- function membershipStatusDelete($membershipStatusID) {
+ public function membershipStatusDelete($membershipStatusID) {
if (!$membershipStatusID) {
return;
}
*
* @return mixed
*/
- function relationshipTypeCreate($params = array()) {
+ public function relationshipTypeCreate($params = array()) {
$params = array_merge(array(
'name_a_b' => 'Relation 1 for relationship type create',
'name_b_a' => 'Relation 2 for relationship type create',
*
* @param int $relationshipTypeID
*/
- function relationshipTypeDelete($relationshipTypeID) {
+ public function relationshipTypeDelete($relationshipTypeID) {
$params['id'] = $relationshipTypeID;
$this->callAPISuccess('relationship_type', 'delete', $params);
}
*
* @return mixed
*/
- function paymentProcessorTypeCreate($params = NULL) {
+ public function paymentProcessorTypeCreate($params = NULL) {
if (is_null($params)) {
$params = array(
'name' => 'API_Test_PP',
*
* @return int $id of participant created
*/
- function participantCreate($params) {
+ public function participantCreate($params) {
if(empty($params['contact_id'])){
$params['contact_id'] = $this->individualCreate();
}
*
* @return object of Payment Processsor
*/
- function processorCreate() {
+ public function processorCreate() {
$processorParams = array(
'domain_id' => 1,
'name' => 'Dummy',
* @param array $params
* @return object of contribution page
*/
- function contributionPageCreate($params) {
+ public function contributionPageCreate($params) {
$this->_pageParams = array(
'title' => 'Test Contribution Page',
'financial_type_id' => 1,
* @param array $params
* @return array result of created tag
*/
- function tagCreate($params = array()) {
+ public function tagCreate($params = array()) {
$defaults = array(
'name' => 'New Tag3',
'description' => 'This is description for Our New Tag ',
*
* @param int $tagId id of the tag to be deleted
*/
- function tagDelete($tagId) {
+ public function tagDelete($tagId) {
require_once 'api/api.php';
$params = array(
'tag_id' => $tagId,
*
* @return bool
*/
- function entityTagAdd($params) {
+ public function entityTagAdd($params) {
$result = $this->callAPISuccess('entity_tag', 'create', $params);
return TRUE;
}
*
* @return int id of created contribution
*/
- function pledgeCreate($cID) {
+ public function pledgeCreate($cID) {
$params = array(
'contact_id' => $cID,
'pledge_create_date' => date('Ymd'),
*
* @param int $pledgeId
*/
- function pledgeDelete($pledgeId) {
+ public function pledgeDelete($pledgeId) {
$params = array(
'pledge_id' => $pledgeId,
);
* @param bool $isFee
* @return int id of created contribution
*/
- function contributionCreate($cID, $cTypeID = 1, $invoiceID = 67890, $trxnID = 12345, $paymentInstrumentID = 1, $isFee = TRUE) {
+ public function contributionCreate($cID, $cTypeID = 1, $invoiceID = 67890, $trxnID = 12345, $paymentInstrumentID = 1, $isFee = TRUE) {
$params = array(
'domain_id' => 1,
'contact_id' => $cID,
* @param int $trxnID
* @return int id of created contribution
*/
- function onlineContributionCreate($params, $financialType, $invoiceID = 67890, $trxnID = 12345) {
+ public function onlineContributionCreate($params, $financialType, $invoiceID = 67890, $trxnID = 12345) {
$contribParams = array(
'contact_id' => $params['contact_id'],
'receive_date' => date('Ymd'),
*
* @return array|int
*/
- function contributionDelete($contributionId) {
+ public function contributionDelete($contributionId) {
$params = array(
'contribution_id' => $contributionId,
);
*
* @return array $event
*/
- function eventCreate($params = array()) {
+ public function eventCreate($params = array()) {
// if no contact was passed, make up a dummy event creator
if (!isset($params['contact_id'])) {
$params['contact_id'] = $this->_contactCreate(array(
*
* @return array|int
*/
- function eventDelete($id) {
+ public function eventDelete($id) {
$params = array(
'event_id' => $id,
);
*
* @return array|int
*/
- function participantDelete($participantID) {
+ public function participantDelete($participantID) {
$params = array(
'id' => $participantID,
);
* @param int $contributionID
* @return int $id of created payment
*/
- function participantPaymentCreate($participantID, $contributionID = NULL) {
+ public function participantPaymentCreate($participantID, $contributionID = NULL) {
//Create Participant Payment record With Values
$params = array(
'participant_id' => $participantID,
*
* @param int $paymentID
*/
- function participantPaymentDelete($paymentID) {
+ public function participantPaymentDelete($paymentID) {
$params = array(
'id' => $paymentID,
);
* @param int $contactID
* @return int location id of created location
*/
- function locationAdd($contactID) {
+ public function locationAdd($contactID) {
$address = array(
1 => array(
'location_type' => 'New Location Type',
*
* @param array $params parameters
*/
- function locationDelete($params) {
+ public function locationDelete($params) {
$this->callAPISuccess('Location', 'delete', $params);
}
* @param array $params
* @return int location id of created location
*/
- function locationTypeCreate($params = NULL) {
+ public function locationTypeCreate($params = NULL) {
if ($params === NULL) {
$params = array(
'name' => 'New Location Type',
*
* @param int location type id
*/
- function locationTypeDelete($locationTypeId) {
+ public function locationTypeDelete($locationTypeId) {
$locationType = new CRM_Core_DAO_LocationType();
$locationType->id = $locationTypeId;
$locationType->delete();
* @param array $params
* @return int groupId of created group
*/
- function groupCreate($params = array()) {
+ public function groupCreate($params = array()) {
$params = array_merge(array(
'name' => 'Test Group 1',
'domain_id' => 1,
* @param array $params
* @return int groupId of created group
*/
- function groupContactCreate($groupID, $totalCount = 10) {
+ public function groupContactCreate($groupID, $totalCount = 10) {
$params = array('group_id' => $groupID);
for ($i=1; $i <= $totalCount; $i++) {
$contactID = $this->individualCreate();
*
* @param int $gid
*/
- function groupDelete($gid) {
+ public function groupDelete($gid) {
$params = array(
'id' => $gid,
* Create a UFField
* @param array $params
*/
- function uFFieldCreate($params = array()) {
+ public function uFFieldCreate($params = array()) {
$params = array_merge(array(
'uf_group_id' => 1,
'field_name' => 'first_name',
* @param array $params
* @return int $id of created UF Join
*/
- function ufjoinCreate($params = NULL) {
+ public function ufjoinCreate($params = NULL) {
if ($params === NULL) {
$params = array(
'is_active' => 1,
*
* @param array with missing uf_group_id
*/
- function ufjoinDelete($params = NULL) {
+ public function ufjoinDelete($params = NULL) {
if ($params === NULL) {
$params = array(
'is_active' => 1,
*
* @param int $contactId
*/
- function contactGroupCreate($contactId) {
+ public function contactGroupCreate($contactId) {
$params = array(
'contact_id.1' => $contactId,
'group_id' => 1,
*
* @param int $contactId
*/
- function contactGroupDelete($contactId) {
+ public function contactGroupDelete($contactId) {
$params = array(
'contact_id.1' => $contactId,
'group_id' => 1,
* @param array $params
* @return array|int
*/
- function activityCreate($params = NULL) {
+ public function activityCreate($params = NULL) {
if ($params === NULL) {
$individualSourceID = $this->individualCreate();
*
* @param array $params parameters
*/
- function activityTypeCreate($params) {
+ public function activityTypeCreate($params) {
$result = $this->callAPISuccess('ActivityType', 'create', $params);
return $result;
}
*
* @param int $activityTypeId id of the activity type
*/
- function activityTypeDelete($activityTypeId) {
+ public function activityTypeDelete($activityTypeId) {
$params['activity_type_id'] = $activityTypeId;
$result = $this->callAPISuccess('ActivityType', 'delete', $params);
return $result;
* @param array $params
* @return array|int
*/
- function customGroupCreate($params = array()) {
+ public function customGroupCreate($params = array()) {
$defaults = array(
'title' => 'new custom group',
'extends' => 'Contact',
* Existing function doesn't allow params to be over-ridden so need a new one
* this one allows you to only pass in the params you want to change
*/
- function CustomGroupCreateByParams($params = array()) {
+ public function CustomGroupCreateByParams($params = array()) {
$defaults = array(
'title' => "API Custom Group",
'extends' => 'Contact',
/**
* Create custom group with multi fields
*/
- function CustomGroupMultipleCreateByParams($params = array()) {
+ public function CustomGroupMultipleCreateByParams($params = array()) {
$defaults = array(
'style' => 'Tab',
'is_multiple' => 1,
/**
* Create custom group with multi fields
*/
- function CustomGroupMultipleCreateWithFields($params = array()) {
+ public function CustomGroupMultipleCreateWithFields($params = array()) {
// also need to pass on $params['custom_field'] if not set but not in place yet
$ids = array();
$customGroup = $this->CustomGroupMultipleCreateByParams($params);
*
* @return array $ids ids of created objects
*/
- function entityCustomGroupWithSingleFieldCreate($function, $filename) {
+ public function entityCustomGroupWithSingleFieldCreate($function, $filename) {
$params = array('title' => $function);
$entity = substr(basename($filename), 0, strlen(basename($filename)) - 8);
$params['extends'] = $entity ? $entity : 'Contact';
*
* @return array|int
*/
- function customGroupDelete($customGroupID) {
+ public function customGroupDelete($customGroupID) {
$params['id'] = $customGroupID;
return $this->callAPISuccess('custom_group', 'delete', $params);
}
* @param array $params (custom_group_id) is required
* @return array|int
*/
- function customFieldCreate($params) {
+ public function customFieldCreate($params) {
$params = array_merge(array(
'label' => 'Custom Field',
'data_type' => 'String',
*
* @return array|int
*/
- function customFieldDelete($customFieldID) {
+ public function customFieldDelete($customFieldID) {
$params['id'] = $customFieldID;
return $this->callAPISuccess('custom_field', 'delete', $params);
* @param int $cId
* @return array $note
*/
- function noteCreate($cId) {
+ public function noteCreate($cId) {
$params = array(
'entity_table' => 'civicrm_contact',
'entity_id' => $cId,
/**
* Enable CiviCampaign Component
*/
- function enableCiviCampaign() {
+ public function enableCiviCampaign() {
CRM_Core_BAO_ConfigSetting::enableComponent('CiviCampaign');
// force reload of config object
$config = CRM_Core_Config::singleton(TRUE, TRUE);
* @param string $subfile name for subfile - if this is completed the example will be put in a subfolder (named by the entity)
* @param string $action - optional action - otherwise taken from function name
*/
- function documentMe($params, $result, $function, $filename, $description = "", $subfile = NULL, $action = NULL) {
+ public function documentMe($params, $result, $function, $filename, $description = "", $subfile = NULL, $action = NULL) {
if (defined('DONT_DOCUMENT_TEST_CONFIG') && DONT_DOCUMENT_TEST_CONFIG) {
return;
}
* @param array $result
*
*/
- function tidyExampleResult(&$result){
+ public function tidyExampleResult(&$result){
if(!is_array($result)) {
return;
}
*
* @return array|int
*/
- function noteDelete($params) {
+ public function noteDelete($params) {
return $this->callAPISuccess('Note', 'delete', $params);
}
*
* @return array|int
*/
- function customFieldOptionValueCreate($customGroup, $name) {
+ public function customFieldOptionValueCreate($customGroup, $name) {
$fieldParams = array(
'custom_group_id' => $customGroup['id'],
'name' => 'test_custom_group',
*
* @return bool
*/
- function confirmEntitiesDeleted($entities) {
+ public function confirmEntitiesDeleted($entities) {
foreach ($entities as $entity) {
$result = $this->callAPISuccess($entity, 'Get', array());
* @param $tablesToTruncate
* @param bool $dropCustomValueTables
*/
- function quickCleanup($tablesToTruncate, $dropCustomValueTables = FALSE) {
+ public function quickCleanup($tablesToTruncate, $dropCustomValueTables = FALSE) {
if ($this->tx) {
throw new Exception("CiviUnitTestCase: quickCleanup() is not compatible with useTransaction()");
}
/**
* Clean up financial entities after financial tests (so we remember to get all the tables :-))
*/
- function quickCleanUpFinancialEntities() {
+ public function quickCleanUpFinancialEntities() {
$tablesToTruncate = array(
'civicrm_contribution',
'civicrm_contribution_soft',
CRM_Member_BAO_Membership::createRelatedMemberships($var, $var, TRUE);
}
- function restoreDefaultPriceSetConfig() {
+ public function restoreDefaultPriceSetConfig() {
CRM_Core_DAO::executeQuery("INSERT INTO `civicrm_price_field` (`id`, `price_set_id`, `name`, `label`, `html_type`, `is_enter_qty`, `help_pre`, `help_post`, `weight`, `is_display_amounts`, `options_per_line`, `is_active`, `is_required`, `active_on`, `expire_on`, `javascript`, `visibility_id`) VALUES (1, 1, 'contribution_amount', 'Contribution Amount', 'Text', 0, NULL, NULL, 1, 1, 1, 1, 1, NULL, NULL, NULL, 1)");
CRM_Core_DAO::executeQuery("INSERT INTO `civicrm_price_field_value` (`id`, `price_field_id`, `name`, `label`, `description`, `amount`, `count`, `max_value`, `weight`, `membership_type_id`, `membership_num_terms`, `is_default`, `is_active`, `financial_type_id`, `deductible_amount`) VALUES (1, 1, 'contribution_amount', 'Contribution Amount', NULL, '1', NULL, NULL, 1, NULL, NULL, 0, 1, 1, 0.00)");
}
*
* @throws Exception
*/
- function getAndCheck($params, $id, $entity, $delete = 1, $errorText = '') {
+ public function getAndCheck($params, $id, $entity, $delete = 1, $errorText = '') {
$result = $this->callAPISuccessGetSingle($entity, array(
'id' => $id,
* @param array $expected expected values
*
*/
- function checkArrayEquals(&$actual, &$expected) {
+ public function checkArrayEquals(&$actual, &$expected) {
self::unsetId($actual);
self::unsetId($expected);
$this->assertEquals($actual, $expected);
* @param array $unformattedArray The array from which the 'id' has to be unset
*
*/
- static function unsetId(&$unformattedArray) {
+ public static function unsetId(&$unformattedArray) {
$formattedArray = array();
if (array_key_exists('id', $unformattedArray)) {
unset($unformattedArray['id']);
* 'php_path' Set to TRUE to use the default, FALSE or "" to disable support, or a string path to use another path
* 'template_path' Set to TRUE to use the default, FALSE or "" to disable support, or a string path to use another path
*/
- function customDirectories($customDirs) {
+ public function customDirectories($customDirs) {
require_once 'CRM/Core/Config.php';
$config = CRM_Core_Config::singleton();
* @param string $prefix
* @return string $string
*/
- function createTempDir($prefix = 'test-') {
+ public function createTempDir($prefix = 'test-') {
$tempDir = CRM_Utils_File::tempdir($prefix);
$this->tempDirs[] = $tempDir;
return $tempDir;
}
- function cleanTempDirs() {
+ public function cleanTempDirs() {
if (!is_array($this->tempDirs)) {
// fix test errors where this is not set
return;
/**
* Temporarily replace the singleton extension with a different one
*/
- function setExtensionSystem(CRM_Extension_System $system) {
+ public function setExtensionSystem(CRM_Extension_System $system) {
if ($this->origExtensionSystem == NULL) {
$this->origExtensionSystem = CRM_Extension_System::singleton();
}
CRM_Extension_System::setSingleton($this->origExtensionSystem);
}
- function unsetExtensionSystem() {
+ public function unsetExtensionSystem() {
if ($this->origExtensionSystem !== NULL) {
CRM_Extension_System::setSingleton($this->origExtensionSystem);
$this->origExtensionSystem = NULL;
* @param $extras
* @return void
*/
- function setMockSettingsMetaData($extras) {
+ public function setMockSettingsMetaData($extras) {
CRM_Core_BAO_Setting::$_cache = array();
$this->callAPISuccess('system','flush', array());
CRM_Core_BAO_Setting::$_cache = array();
/**
* @param string $name
*/
- function financialAccountDelete($name) {
+ public function financialAccountDelete($name) {
$financialAccount = new CRM_Financial_DAO_FinancialAccount();
$financialAccount->name = $name;
if($financialAccount->find(TRUE)) {
* FIXME: something NULLs $GLOBALS['_HTML_QuickForm_registered_rules'] when the tests are ran all together
* (NB unclear if this is still required)
*/
- function _sethtmlGlobals() {
+ public function _sethtmlGlobals() {
$GLOBALS['_HTML_QuickForm_registered_rules'] = array(
'required' => array(
'html_quickform_rule_required',
* $this->_permissionedGroup = $this->groupCreate(array('title' => 'pick-me-active', 'is_active' => 1, 'name' => 'pick-me-active'));
*
*/
- function setupACL() {
+ public function setupACL() {
global $_REQUEST;
$_REQUEST = $this->_params;
/**
* Alter default price set so that the field numbers are not all 1 (hiding errors)
*/
- function offsetDefaultPriceSet() {
+ public function offsetDefaultPriceSet() {
$contributionPriceSet = $this->callAPISuccess('price_set', 'getsingle', array('name' => 'default_contribution_amount'));
$firstID = $contributionPriceSet['id'];
$this->callAPISuccess('price_set', 'create', array('id' => $contributionPriceSet['id'], 'is_active' => 0, 'name' => 'old'));
* There is another function to this effect on the PaypalPro test but it appears to be silently failing
* & the best protection agains that is the functions this class affords
*/
- function paymentProcessorCreate($params = array()) {
+ public function paymentProcessorCreate($params = array()) {
$params = array_merge(array(
'name' => 'demo',
'domain_id' => CRM_Core_Config::domainID(),
/**
* Set up initial recurring payment allowing subsequent IPN payments
*/
- function setupRecurringPaymentProcessorTransaction() {
+ public function setupRecurringPaymentProcessorTransaction() {
$contributionRecur = $this->callAPISuccess('contribution_recur', 'create', array(
'contact_id' => $this->_contactID,
'amount' => 1000,
/**
* We don't have a good way to set up a recurring contribution with a membership so let's just do one then alter it
*/
- function setupMembershipRecurringPaymentProcessorTransaction() {
+ public function setupMembershipRecurringPaymentProcessorTransaction() {
$this->ids['membership_type'] = $this->membershipTypeCreate();
//create a contribution so our membership & contribution don't both have id = 1
$this->contributionCreate($this->_contactID, 1, 'abcd', '345j');
*
* @throws Exception
*/
- function CiviUnitTestCase_fatalErrorHandler($message) {
+ public function CiviUnitTestCase_fatalErrorHandler($message) {
throw new Exception("{$message['message']}: {$message['code']}");
}
* Helper function to create new mailing
* @return mixed
*/
- function createMailing() {
+ public function createMailing() {
$params = array(
'subject' => 'maild' . rand(),
'body_text' => 'bdkfhdskfhduew',
* Helper function to delete mailing
* @param $id
*/
- function deleteMailing($id) {
+ public function deleteMailing($id) {
$params = array(
'id' => $id,
);
*
* @param bool $nest whether to use nesting or reference-counting
*/
- function useTransaction($nest = TRUE) {
+ public function useTransaction($nest = TRUE) {
if (!$this->tx) {
$this->tx = new CRM_Core_Transaction($nest);
$this->tx->rollback();
}
}
- function clearOutputBuffer() {
+ public function clearOutputBuffer() {
while (ob_get_level() > 0) {
ob_end_clean();
}
*
* @return int $contactID id of created contact
*/
- static function create($params) {
+ public static function create($params) {
require_once "CRM/Contact/BAO/Contact.php";
$contactID = CRM_Contact_BAO_Contact::createProfileContact($params, CRM_Core_DAO::$_nullArray);
return $contactID;
* @param array $params
* @return int $contactID id of created Individual
*/
- static function createIndividual($params = NULL) {
+ public static function createIndividual($params = NULL) {
//compose the params, when not passed
if (!$params) {
$first_name = 'John';
* @param array $params
* @return mixed $contactID id of created Household
*/
- static function createHousehold($params = NULL) {
+ public static function createHousehold($params = NULL) {
//compose the params, when not passed
if (!$params) {
$household_name = "John Doe's home";
* @param array $params
* @return mixed $contactID id of created Organisation
*/
- static function createOrganisation($params = NULL) {
+ public static function createOrganisation($params = NULL) {
//compose the params, when not passed
if (!$params) {
$organization_name = "My Organization";
* @param int $contactID id of the contact to delete
* @return boolean true if contact deleted, false otherwise
*/
- static function delete($contactID) {
+ public static function delete($contactID) {
require_once 'CRM/Contact/BAO/Contact.php';
return CRM_Contact_BAO_Contact::deleteContact($contactID);
}
*
* @return mixed $contributionPage id of created Contribution Page
*/
- static function create($id = NULL) {
+ public static function create($id = NULL) {
require_once "CRM/Contribute/BAO/ContributionPage.php";
$params = array(
'title' => 'Help Test CiviCRM!',
* to be deleted
* @return boolean true if Contribution Page deleted, false otherwise
*/
- static function delete($contributionPageId) {
+ public static function delete($contributionPageId) {
require_once "CRM/Contribute/DAO/ContributionPage.php";
$cp = new CRM_Contribute_DAO_ContributionPage();
$cp->id = $contributionPageId;
*
* @return object of created group
*/
- static function createGroup($group, $extends = NULL, $isMultiple = FALSE) {
+ public static function createGroup($group, $extends = NULL, $isMultiple = FALSE) {
if (empty($group)) {
if (isset($extends) &&
!is_array($extends)
* @param null $fields
* @return object of created field
*/
- static function createField($params, $fields = NULL) {
+ public static function createField($params, $fields = NULL) {
if (empty($params)) {
$params = array(
'custom_group_id' => $fields['groupId'],
* @deprecated use function on parent class
* @param object of Custom Field to delete
*/
- static function deleteField($params) {
+ public static function deleteField($params) {
require_once 'CRM/Core/BAO/CustomField.php';
CRM_Core_BAO_CustomField::deleteField($params);
}
* @param object Custom Group to delete
* @return boolean true if Group deleted, false otherwise
*/
- static function deleteGroup($params) {
+ public static function deleteGroup($params) {
require_once 'CRM/Core/BAO/CustomGroup.php';
$deleteCustomGroup = CRM_Core_BAO_CustomGroup::deleteGroup($params, TRUE);
return $deleteCustomGroup;
*
* @return mixed $event id of created Event
*/
- static function create($contactId) {
+ public static function create($contactId) {
require_once "CRM/Event/BAO/Event.php";
$params = array(
'title' => 'Test Event',
* @param int $eventId
* @return boolean true if event deleted, false otherwise
*/
- static function delete($eventId) {
+ public static function delete($eventId) {
return CRM_Event_BAO_Event::del($eventId);
}
}
/**
* Helper function to create membership type
*/
- function createMembershipType() {
+ public function createMembershipType() {
$orgId = Contact::createOrganisation();
$ids = array('memberOfContact' => $orgId);
/**
* Helper function to create membership block for contribution page
*/
- function createMembershipBlock($membershipType, $contributionPageId) {
+ public function createMembershipBlock($membershipType, $contributionPageId) {
$param = array(
'is_active' => 1,
'new_title' => 'Membership Fees',
/**
* Helper function to delete the membership block
*/
- function deleteMembershipBlock($blcokId) {
+ public function deleteMembershipBlock($blcokId) {
$dao = new CRM_Member_DAO_MembershipBlock();
$dao->id = $blcokId;
if ($dao->find(TRUE)) {
* @return array of created pcp block
*
*/
- function create($contributionPageId) {
+ public function create($contributionPageId) {
$profileParams = array(
'group_type' => 'Individual,Contact',
'title' => 'Test Supprorter Profile',
* @return boolean true if success, false otherwise
*
*/
- function delete($params) {
+ public function delete($params) {
$delete_params = array('id' => $params['profileId']);
$resulProfile = civicrm_api('uf_group', 'delete', $delete_params);
*
* @return mixed $participant id of created Participant
*/
- static function create($contactId, $eventId) {
+ public static function create($contactId, $eventId) {
$params = array(
'send_receipt' => 1,
'is_test' => 0,
* @param int $participantId
* @return boolean true if participant deleted, false otherwise
*/
- static function delete($participantId) {
+ public static function delete($participantId) {
require_once 'CRM/Event/BAO/Participant.php';
return CRM_Event_BAO_Participant::deleteParticipant($participantId);
}
* callAPISuccess won't work
* I have duplicated this on the main test class as a work around
*/
- static function create() {
+ public static function create() {
$paymentProcessor = new CRM_Financial_DAO_PaymentProcessor();
$paymentParams = array(
* to be deleted
* @return boolean true if payment processor deleted, false otherwise
*/
- static function delete($id) {
+ public static function delete($id) {
$pp = new CRM_Financial_DAO_PaymentProcessor();
$pp->id = $id;
if ($pp->find(TRUE)) {
/**
* @param null $name
*/
- function __construct($name = NULL) {
+ 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
- function setUp() {
+ 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
- function tearDown() {
+ public function tearDown() {
// delete your instance
unset($this->abc);
}
// test the toString function
- function testHello() {
+ public function testHello() {
$result = $this->abc;
$expected = 'hello';
$this->assertEquals($result, $expected);
* @return mixed PDOStatement => Results of the query
* false => Query failed
*/
- function do_query($query) {
+ public function do_query($query) {
// echo "do_query($query)\n";
// $stmt = $this->pdo->query( $query, PDO::FETCH_ASSOC );
// echo "PDO returned";
parent::setUp();
}
- function testAssignUsersToRoles() {
+ public function testAssignUsersToRoles() {
$this->webtestLogin();
$this->clickLink("_qf_ACL_next-bottom");
}
- function testACLforSmartGroups() {
+ public function testACLforSmartGroups() {
$this->webtestLogin();
//Create role
parent::setUp();
}
- function testRecurringActivity() {
+ public function testRecurringActivity() {
$this->webtestLogin();
//Adding new contact
parent::setUp();
}
- function testContactContextActivityAdd() {
+ public function testContactContextActivityAdd() {
$this->webtestLogin();
// Adding Adding contact with randomized first name for test testContactContextActivityAdd
);
}
- function testSeparateActivityForMultiTargetContacts() {
+ public function testSeparateActivityForMultiTargetContacts() {
$this->webtestLogin();
//creating contacts
parent::setUp();
}
- function testStandaloneActivityAdd() {
+ public function testStandaloneActivityAdd() {
$this->webtestLogin();
$this->openCiviPage("admin/setting/preferences/display", "reset=1", "name=activity_assignee_notification_ics");
parent::setUp();
}
- function testStandaloneActivityAdd() {
+ public function testStandaloneActivityAdd() {
$this->webtestLogin();
// Adding Anderson, Anthony and Summerson, Samuel for testStandaloneActivityAdd test
);
}
- function testAjaxCustomGroupLoad() {
+ public function testAjaxCustomGroupLoad() {
$this->webtestLogin();
$triggerElement = array('name' => 'activity_type_id', 'type' => 'select');
$customSets = array(
* @param $expected
* @param null $xpathPrefix
*/
- function VerifyTabularData($expected, $xpathPrefix = NULL) {
+ public function VerifyTabularData($expected, $xpathPrefix = NULL) {
foreach ($expected as $label => $value) {
$this->waitForElementPresent("xpath=//table/tbody/tr/td{$xpathPrefix}[text()='{$label}']/../following-sibling::td/span");
$this->verifyText("xpath=//table/tbody/tr/td{$xpathPrefix}[text()='{$label}']/../following-sibling::td/span", preg_quote($value), 'In line ' . __LINE__);
parent::setUp();
}
- function testCustomAdd() {
+ public function testCustomAdd() {
$this->webtestLogin();
$this->openCiviPage("admin/custom/group", "action=add&reset=1");
parent::setUp();
}
- function testCustomSameFieldAdd() {
+ public function testCustomSameFieldAdd() {
$this->open($this->sboxPath);
$this->webtestLogin();
$this->_testCustomAdd();
}
- function _testCustomAdd() {
+ public function _testCustomAdd() {
//CRM-7564 : Different gropus can contain same custom fields
$this->open($this->sboxPath . "civicrm/admin/custom/group?action=add&reset=1");
$this->waitForPageToLoad($this->getTimeoutMsec());
parent::setUp();
}
- function testScheduleReminder() {
+ public function testScheduleReminder() {
$this->webtestLogin();
// Add new Schedule Reminder
parent::setUp();
}
- function testDefaultCountryIsEnabled() {
+ public function testDefaultCountryIsEnabled() {
$this->webtestLogin();
$this->openCiviPage("admin/setting/localization", "reset=1");
$this->addSelection("countryLimit-t", "label=United States");
parent::setUp();
}
- function testCreateCustomFields() {
+ public function testCreateCustomFields() {
$this->webtestLogin();
$cid_all = $this->_createContact("all_data", "move_custom_data");
* @param int $from_group_id
* @param int $to_group_id
*/
- function _moveCustomField($field_to_move, $from_group_id, $to_group_id) {
+ public function _moveCustomField($field_to_move, $from_group_id, $to_group_id) {
//go to the move field page
$this->openCiviPage('admin/custom/group/field/move', "reset=1&fid={$field_to_move}");
*
* @return mixed
*/
- function _createContact($firstName = "John", $lastName = "Doe") {
+ public function _createContact($firstName = "John", $lastName = "Doe") {
$firstName .= "_" . substr(sha1(rand()), 0, 5);
$lastName .= "_" . substr(sha1(rand()), 0, 5);
$this->webtestAddContact($firstName, $lastName);
*
* @return array
*/
- function _loadDataFromApi($contact_id, $group_id, $reset_cache = FALSE) {
+ public function _loadDataFromApi($contact_id, $group_id, $reset_cache = FALSE) {
// cache the fields, just to speed things up a little
static $field_ids = array();
*
* @return null
*/
- function _buildCustomFieldset($prefix) {
+ public function _buildCustomFieldset($prefix) {
$group_id = $this->_createCustomGroup($prefix);
$field_ids[] = $this->_addCustomFieldToGroup($group_id, 'Alphanumeric', "CheckBox", $prefix);
$field_ids[] = $this->_addCustomFieldToGroup($group_id, 'Alphanumeric', "Radio", $prefix);
*
* @return null
*/
- function _createCustomGroup($prefix = "custom", $entity = "Contact") {
+ public function _createCustomGroup($prefix = "custom", $entity = "Contact") {
$this->openCiviPage('admin/custom/group', 'action=add&reset=1');
* @return mixed
* @throws PHPUnit_Framework_AssertionFailedError
*/
- function _addCustomFieldToGroup($group_id, $type = 'Alphanumeric', $widget = 'CheckBox', $prefix = '') {
+ public function _addCustomFieldToGroup($group_id, $type = 'Alphanumeric', $widget = 'CheckBox', $prefix = '') {
//A mapping of data type names to integer keys
$type_map = array(
'alphanumeric' => array(
* @param int $contact_id
* @param int $group_id
*/
- function _fillCustomDataForContact($contact_id, $group_id) {
+ public function _fillCustomDataForContact($contact_id, $group_id) {
//edit the given contact
$this->openCiviPage('contact/add', "reset=1&action=update&cid={$contact_id}");
parent::setUp();
}
- function testRelationshipTypeAdd() {
+ public function testRelationshipTypeAdd() {
$this->webtestLogin();
$this->waitForPageToLoad($this->getTimeoutMsec());
}
}
- function testRelationshipTypeAddValidateFormRules() {
+ public function testRelationshipTypeAddValidateFormRules() {
$this->webtestLogin();
$this->waitForPageToLoad($this->getTimeoutMsec());
parent::setUp();
}
- function testCreateCampaign() {
+ public function testCreateCampaign() {
$this->webtestLogin('admin');
// Enable CiviCampaign module if necessary
* @param $campaignTitle
* @param int $id
*/
- function activityAddTest($campaignTitle, $id) {
+ public function activityAddTest($campaignTitle, $id) {
// Adding Adding contact with randomized first name for test testContactContextActivityAdd
// We're using Quick Add block on the main page for this.
$firstName1 = substr(sha1(rand()), 0, 7);
parent::setUp();
}
- function testCreateCampaign() {
+ public function testCreateCampaign() {
// Fixme: testing a theory that this test was failing due to permissions
$this->webtestLogin('admin');
$this->assertEquals($campaignDescription, $fetchedVaue);
}
- function testAjaxCustomGroupLoad() {
+ public function testAjaxCustomGroupLoad() {
$this->webtestLogin();
$this->enableComponents(array('CiviCampaign'));
parent::setUp();
}
- function testCreateCampaign() {
+ public function testCreateCampaign() {
// Log in as admin first to verify permissions for CiviCampaign
$this->webtestLogin('admin');
* @param $campaignTitle
* @param int $id
*/
- function mailingAddTest($groupName, $campaignTitle, $id) {
+ public function mailingAddTest($groupName, $campaignTitle, $id) {
//---- create mailing contact and add to mailing Group
$firstName = substr(sha1(rand()), 0, 7);
$this->webtestAddContact($firstName, "Mailson", "mailino$firstName@mailson.co.in");
parent::setUp();
}
- function testCreateCampaign() {
+ public function testCreateCampaign() {
$this->webtestLogin('admin');
// Create new group
* @param $campaignTitle
* @param int $id
*/
- function memberAddTest($campaignTitle, $id) {
+ public function memberAddTest($campaignTitle, $id) {
//Add new memebershipType
$memTypeParams = $this->webtestAddMembershipType();
parent::setUp();
}
- function testCreateCampaign() {
+ public function testCreateCampaign() {
$this->webtestLogin('admin');
// Create new group
* @param int $id
* @param bool $past
*/
- function offlineContributionTest($campaignTitle, $id, $past = FALSE) {
+ public function offlineContributionTest($campaignTitle, $id, $past = FALSE) {
// Create a contact to be used as soft creditor
$softCreditFname = substr(sha1(rand()), 0, 7);
$softCreditLname = substr(sha1(rand()), 0, 7);
/**
* @param string $groupName
*/
- function pastCampaignsTest($groupName) {
+ public function pastCampaignsTest($groupName) {
$this->openCiviPage('campaign/add', 'reset=1', '_qf_Campaign_upload-bottom');
$pastTitle = substr(sha1(rand()), 0, 7);
parent::setUp();
}
- function testCreateCampaign() {
+ public function testCreateCampaign() {
$this->webtestLogin('admin');
// Create new group
* @param $campaignTitle
* @param int $id
*/
- function offlineParticipantAddTest($campaignTitle, $id) {
+ public function offlineParticipantAddTest($campaignTitle, $id) {
// connect campaign with event
$this->openCiviPage("event/manage", "reset=1");
$eventId = $this->registerUrl();
/**
* @return mixed
*/
- function registerUrl() {
+ public function registerUrl() {
$this->openCiviPage("event/manage", "reset=1");
$eventId = explode('-', $this->getAttribute("//div[@id='event_status_id']//div[2]/table/tbody/tr@id"));
return $eventId[1];
parent::setUp();
}
- function testCreateCampaign() {
+ public function testCreateCampaign() {
$this->webtestLogin('admin');
// Create new group
* @param $campaignTitle
* @param int $id
*/
- function onlineContributionAddTest($campaignTitle, $id) {
+ public function onlineContributionAddTest($campaignTitle, $id) {
// Use default payment processor
$processorName = 'Test Processor';
$paymentProcessorId = $this->webtestAddPaymentProcessor($processorName);
parent::setUp();
}
- function testCreateCampaign() {
+ public function testCreateCampaign() {
$this->webtestLogin('admin');
// Create new group
* @param $campaignTitle
* @param int $id
*/
- function onlineParticipantAddTest($campaignTitle, $id) {
+ public function onlineParticipantAddTest($campaignTitle, $id) {
// Use default payment processor
$processorName = 'Test Processor';
$paymentProcessorId = $this->webtestAddPaymentProcessor($processorName);
* @param $eventTitle
* @param $eventDescription
*/
- function _testAddEventInfo($id, $eventTitle, $eventDescription) {
+ public function _testAddEventInfo($id, $eventTitle, $eventDescription) {
$this->waitForElementPresent("_qf_EventInfo_upload-bottom");
$this->select("event_type_id", "value=1");
/**
* @param $streetAddress
*/
- function _testAddLocation($streetAddress) {
+ public function _testAddLocation($streetAddress) {
// Wait for Location tab form to load
$this->waitForElementPresent("_qf_Location_upload-bottom");
* @param bool $priceSet
* @param int $processorId
*/
- function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorId) {
+ public function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorId) {
// Go to Fees tab
$this->click("link=Fees");
$this->waitForElementPresent("_qf_Fee_upload-bottom");
* @param $registerIntro
* @param bool $multipleRegistrations
*/
- function _testAddOnlineRegistration($registerIntro, $multipleRegistrations = FALSE) {
+ public function _testAddOnlineRegistration($registerIntro, $multipleRegistrations = FALSE) {
// Go to Online Registration tab
$this->click("link=Online Registration");
$this->waitForElementPresent("_qf_Registration_upload-bottom");
* @param $eventTitle
* @param $eventInfoStrings
*/
- function _testVerifyEventInfo($eventTitle, $eventInfoStrings) {
+ public function _testVerifyEventInfo($eventTitle, $eventInfoStrings) {
// verify event input on info page
// start at Manage Events listing
$this->openCiviPage("event/manage", "reset=1");
*
* @return string
*/
- function _testVerifyRegisterPage($registerStrings) {
+ public function _testVerifyRegisterPage($registerStrings) {
// Go to Register page and check for intro text and fee levels
$this->click("link=Register Now");
$this->waitForElementPresent("_qf_Register_upload-bottom");
* @param int $numberRegistrations
* @param bool $anonymous
*/
- function _testOnlineRegistration($campaignTitle, $registerUrl, $numberRegistrations = 1, $anonymous = TRUE) {
+ public function _testOnlineRegistration($campaignTitle, $registerUrl, $numberRegistrations = 1, $anonymous = TRUE) {
if ($anonymous) {
$this->webtestLogout();
}
parent::setUp();
}
- function testPetitionUsageScenario() {
+ public function testPetitionUsageScenario() {
$this->webtestLogin('admin');
// Enable CiviCampaign module if necessary
parent::setUp();
}
- function testCreateCampaign() {
+ public function testCreateCampaign() {
// Log in as admin first to verify permissions for CiviGrant
$this->webtestLogin('admin');
* @param $campaignTitle
* @param int $id
*/
- function pledgeAddTest($campaignTitle, $id) {
+ public function pledgeAddTest($campaignTitle, $id) {
// create unique name
$name = substr(sha1(rand()), 0, 7);
$firstName = 'Adam' . $name;
parent::setUp();
}
- function testSurveyUsageScenario() {
+ public function testSurveyUsageScenario() {
$this->webtestLogin('admin');
// Create new group
$this->waitForText("xpath=//div[@id='search-status']/table/tbody/tr[1]/td[1]",'1 Result');
}
- function testSurveyReportTest() {
+ public function testSurveyReportTest() {
$this->webtestLogin('admin');
// Enable CiviCampaign module if necessary
parent::setUp();
}
- function testAddActivityToCase() {
+ public function testAddActivityToCase() {
// Log in as admin first to verify permissions for CiviCase
$this->webtestLogin('admin');
$this->_testAddNewActivity($contact['first_name'], $subject, $customGroupTitle, $contact['sort_name']);
}
- function testLinkCases() {
+ public function testLinkCases() {
// Log in as admin first to verify permissions for CiviCase
$this->webtestLogin('admin');
* @param $customGroupTitle
* @param $contactName
*/
- function _testAddNewActivity($firstName, $caseSubject, $customGroupTitle, $contactName) {
+ public function _testAddNewActivity($firstName, $caseSubject, $customGroupTitle, $contactName) {
$customDataParams = $this->_addCustomData($customGroupTitle);
//$customDataParams = array( 'optionLabel_47d58', 'custom_8_-1' );
*
* @return array
*/
- function _addCustomData($customGroupTitle) {
+ public function _addCustomData($customGroupTitle) {
$this->openCiviPage('admin/custom/group', 'reset=1');
parent::setUp();
}
- function testStandaloneCaseAdd() {
+ public function testStandaloneCaseAdd() {
// Log in as admin first to verify permissions for CiviCase
$this->webtestLogin('admin');
$this->_testAssignToClient($client['first_name'], $client['last_name'], $caseTypeLabel);
}
- function testAjaxCustomGroupLoad() {
+ public function testAjaxCustomGroupLoad() {
// Log in as admin first to verify permissions for CiviCase
$this->webtestLogin('admin');
* @param $validateStrings
* @param $activityTypes
*/
- function _testVerifyCaseSummary($validateStrings, $activityTypes) {
+ public function _testVerifyCaseSummary($validateStrings, $activityTypes) {
$this->assertStringsPresent($validateStrings);
foreach ($activityTypes as $aType) {
$this->assertElementPresent("xpath=//div[@class='case-control-panel']/div/p/select", $aType);
* @param $caseRoles
* @param string $creatorName
*/
- function _testVerifyCaseRoles($caseRoles, $creatorName) {
+ public function _testVerifyCaseRoles($caseRoles, $creatorName) {
$id = $this->urlArg('id');
$this->waitForElementPresent("xpath=//table[@id='caseRoles-selector-$id']/tbody/tr[4]/td[2]/a");
// check that expected roles are listed in the Case Roles pane
/**
* @param $activityTypes
*/
- function _testVerifyCaseActivities($activityTypes) {
+ public function _testVerifyCaseActivities($activityTypes) {
$id = $this->urlArg('id');
// check that expected auto-created activities are listed in the Case Activities table
foreach ($activityTypes as $aType) {
* @param $subject
* @param $openCaseData
*/
- function _testVerifyOpenCaseActivity($subject, $openCaseData) {
+ public function _testVerifyOpenCaseActivity($subject, $openCaseData) {
$id = $this->urlArg('id');
// check that open case subject is present
$this->assertText("case_id_$id", $subject);
* @param string $lastName
* @param $action
*/
- function _testSearchbyDate($firstName, $lastName, $action) {
+ public function _testSearchbyDate($firstName, $lastName, $action) {
// Find Cases
if ($action != "0") {
$this->openCiviPage('case/search', 'reset=1');
*
* test for assign case to another client
*/
- function _testAssignToClient($firstName, $lastName, $caseTypeLabel) {
+ public function _testAssignToClient($firstName, $lastName, $caseTypeLabel) {
$this->openCiviPage('case/search', 'reset=1', '_qf_Search_refresh-bottom');
$this->type('sort_name', $firstName);
$this->clickLink('_qf_Search_refresh-bottom');
parent::setUp();
}
- function testAddEditCaseType() {
+ public function testAddEditCaseType() {
$caseRoles = array(1 => 'Parent of', 2 => 'Spouse of', 3 => 'Partner of');
$activityTypes = array(1 => 'Meeting',2 => 'Contribution',3 => 'Event Registration');
$timelineActivityTypes = array(1 => 'Meeting',2 => 'Phone Call',3 => 'Email');
parent::setUp();
}
- function testAddCase() {
+ public function testAddCase() {
$this->webtestLogin('admin');
// Enable CiviCase module if necessary
*
* @return array
*/
- function _testGetCustomFieldId($customGrpId1, $noteRichEditor=FALSE) {
+ public function _testGetCustomFieldId($customGrpId1, $noteRichEditor=FALSE) {
$customId = array();
$this->openCiviPage('admin/custom/group/field/add', array('reset' => 1, 'action' => 'add', 'gid' => $customGrpId1));
* @param $customGrpId1
* @param int $customId
*/
- function _testDeleteCustomData($customGrpId1, $customId) {
+ public function _testDeleteCustomData($customGrpId1, $customId) {
// delete all custom data
foreach ($customId as $cKey => $cValue) {
$this->openCiviPage("admin/custom/group/field", array('action' => 'delete', 'reset' => '1', 'gid' => $customGrpId1, 'id' => $cValue));
/**
* CRM-12812
*/
- function testCaseCustomNoteRichEditor() {
+ public function testCaseCustomNoteRichEditor() {
$this->webtestLogin('admin');
//setting ckeditor as WYSIWYG
* @param string $custMname
* @param $custLname
*/
- function _testAdvansearchCaseData($customId, $custFname, $custMname, $custLname) {
+ public function _testAdvansearchCaseData($customId, $custFname, $custMname, $custLname) {
// search casecontact
$this->openCiviPage('contact/search/advanced', 'reset=1', '_qf_Advanced_refresh');
$this->click("CiviCase");
parent::setUp();
}
- function testAllOrMyCases() {
+ public function testAllOrMyCases() {
// Log in as admin first to verify permissions for CiviCase
$this->webtestLogin('admin');
parent::setUp();
}
- function testAuthenticAddUser() {
+ public function testAuthenticAddUser() {
$this->webtestLogin('admin');
$this->waitForPageToLoad($this->getTimeoutMsec());
}
- function testAnonymousAddUser() {
+ public function testAnonymousAddUser() {
// Make sure Drupal account settings allow visitors to register for account w/o admin approval
// login as admin
$this->webtestLogin('admin');
parent::setUp();
}
- function testAddContactsToEventAdvanceSearch() {
+ public function testAddContactsToEventAdvanceSearch() {
$this->webtestLogin();
$this->waitForPageToLoad($this->getTimeoutMsec());
parent::setUp();
}
- function testIndividualAdd() {
+ public function testIndividualAdd() {
$this->webtestLogin();
$groupName = $this->WebtestAddGroup();
$this->waitForText('crm-notification-container', "Contact Saved");
}
- function testHouseholdAdd() {
+ public function testHouseholdAdd() {
$this->webtestLogin();
$groupName = $this->WebtestAddGroup();
$this->waitForText('crm-notification-container', "Contact Saved");
}
- function testOrganizationAdd() {
+ public function testOrganizationAdd() {
$this->webtestLogin();
$groupName = $this->WebtestAddGroup();
$this->waitForText('crm-notification-container', "Contact Saved");
}
- function testIndividualAddWithSharedAddress() {
+ public function testIndividualAddWithSharedAddress() {
$this->webtestLogin();
$this->openCiviPage('contact/add', "reset=1&ct=Individual");
parent::setUp();
}
- function testAddViaCreateProfile() {
+ public function testAddViaCreateProfile() {
$this->webtestLogin();
$this->openCiviPage('profile/create', 'reset=1&gid=1', '_qf_Edit_next');
parent::setUp();
}
- function teststreetAddressParsing() {
+ public function teststreetAddressParsing() {
// Logging in.
$this->webtestLogin();
/*
* test individual pane seperatly.
*/
- function testIndividualPanes() {
+ public function testIndividualPanes() {
$this->webtestLogin();
// Get all default advance search panes.
/*
* test by selecting all panes at a time.
*/
- function testAllPanes() {
+ public function testAllPanes() {
$this->webtestLogin();
// Get all default advance search panes.
*
* @return array
*/
- function _advanceSearchPanes($paneRef = NULL) {
+ public function _advanceSearchPanes($paneRef = NULL) {
static $_advance_search_panes;
if (!isset($_advance_search_panes) || empty($_advance_search_panes)) {
parent::setUp();
}
- function testSearchForPrivacyOptions() {
+ public function testSearchForPrivacyOptions() {
$this->webtestLogin();
$privacyOptions = array(
* @param $privacyOperator
* @param $allPrivacyOptions
*/
- function _addPrivacyCriteria($inEx, $privacyOptions, $privacyOperator, $allPrivacyOptions) {
+ public function _addPrivacyCriteria($inEx, $privacyOptions, $privacyOperator, $allPrivacyOptions) {
$inExId = ($inEx == 'include') ? 'CIVICRM_QFID_2_privacy_toggle' : 'CIVICRM_QFID_1_privacy_toggle';
$this->click($inExId);
$this->select('privacy_operator', "{$privacyOperator}");
*
* @return bool
*/
- function _searchSortNameCriteria($firstName, $lastName) {
+ public function _searchSortNameCriteria($firstName, $lastName) {
//type in the criteria
$this->type("sort_name", "{$lastName}, {$firstName}");
*
* @return string
*/
- function getOptionVal($privacyOption) {
+ public function getOptionVal($privacyOption) {
if ($privacyOption == 'do_not_phone') {
$privacyOptionVal = 'Do not phone';
}
* @param string $lastName
* @param $options
*/
- function _addIndividual($firstName, $lastName, $options) {
+ public function _addIndividual($firstName, $lastName, $options) {
$this->openCiviPage('contact/add', 'reset=1&ct=Individual');
parent::setUp();
}
- function testAdvanceSearch() {
+ public function testAdvanceSearch() {
$this->webtestLogin();
$this->waitForPageToLoad($this->getTimeoutMsec());
/*
* Check for CRM-9873
*/
- function testActivitySearchByTypeTest() {
+ public function testActivitySearchByTypeTest() {
$this->webtestLogin();
$this->openCiviPage('contact/search/advanced', 'reset=1');
$this->clickAjaxLink("activity", 'activity_subject');
/**
* @param string $firstName
*/
- function submitSearch($firstName) {
+ public function submitSearch($firstName) {
$this->clickLink("_qf_Advanced_refresh");
// verify unique name
$this->waitForText("xpath=//div[@class='crm-search-results']/table/tbody", preg_quote("adv$firstName, $firstName"));
/*
* Check for CRM-14952
*/
- function testStateSorting() {
+ public function testStateSorting() {
$this->webtestLogin();
$this->openCiviPage('contact/search/advanced', 'reset=1', 'group');
$this->select2("group", "Newsletter", TRUE);
* @param string $groupName
* @param $tagName
*/
- function addBasicSearchDetail($firstName, $groupName, $tagName) {
+ public function addBasicSearchDetail($firstName, $groupName, $tagName) {
// fill partial sort name
$this->type("sort_name", "$firstName");
// select subtype
/**
* @param $firstName
*/
- function addAddressSearchDetail($firstName) {
+ public function addAddressSearchDetail($firstName) {
// select location type (home and main)
$this->multiselect2('location_type', array('Home', 'Main'));
// fill street address
/**
* @param $firstName
*/
- function addActivitySearchDetail($firstName) {
+ public function addActivitySearchDetail($firstName) {
// check activity types
$checkActivityTypes = array("Contribution", "Event Registration", "Membership Signup");
foreach ($checkActivityTypes as $labels) {
}
// function to fill demographic search details
- function addDemographicSearchDetail() {
+ public function addDemographicSearchDetail() {
// fill birth date range
$this->select("birth_date_relative","value=0");
$this->webtestFillDate("birth_date_low", "-3 year");
/**
* @param $firstName
*/
- function addContributionSearchDetail($firstName) {
+ public function addContributionSearchDetail($firstName) {
// fill contribution date range
$this->select("contribution_date_relative","value=0");
$this->webtestFillDate("contribution_date_low", "-1 day");
}
// function to fill participant search details
- function addParticipantSearchDetail() {
+ public function addParticipantSearchDetail() {
// fill event name
$this->select2("event_id", "Fall Fundraiser Dinner");
// fill event type
/**
* @param $firstName
*/
- function addMemberSearchDetail($firstName) {
+ public function addMemberSearchDetail($firstName) {
// check membership type (Student)
$this->click("xpath=//div[@id='memberForm']/table/tbody/tr[1]/td[1]/div[1]//div/label[text()='Student']");
// check membership status (completed)
/**
* @param $firstName
*/
- function addPledgeSearchDetail($firstName) {
+ public function addPledgeSearchDetail($firstName) {
// fill pledge schedule date range
$this->select("pledge_payment_date_relative","value=0");
$this->webtestFillDate("pledge_payment_date_low", "-1 day");
/**
* @param null $firstName
*/
- function createDetailContact($firstName = NULL) {
+ public function createDetailContact($firstName = NULL) {
if (!$firstName) {
$firstName = substr(sha1(rand()), 0, 7);
}
parent::setUp();
}
- function testSearchRelatedContact() {
+ public function testSearchRelatedContact() {
// Log in using webtestLogin() method
$this->webtestLogin();
* @param $eventTitle
* @param $eventDescription
*/
- function _testAddEventInfo($eventTitle, $eventDescription) {
+ public function _testAddEventInfo($eventTitle, $eventDescription) {
$this->waitForElementPresent("_qf_EventInfo_upload-bottom");
$this->select("event_type_id", "value=1");
/**
* @param $streetAddress
*/
- function _testAddLocation($streetAddress) {
+ public function _testAddLocation($streetAddress) {
// Wait for Location tab form to load
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->waitForElementPresent("_qf_Location_upload-bottom");
* @param bool $priceSet
* @param int $processorId
*/
- function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorId) {
+ public function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorId) {
// Go to Fees tab
$this->click("link=Fees");
$this->waitForElementPresent("_qf_Fee_upload-bottom");
* @param string $relatedName
* @param $relType
*/
- function _testAddRelationship($ContactName, $relatedName, $relType) {
+ public function _testAddRelationship($ContactName, $relatedName, $relType) {
$this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh');
$this->type("sort_name", $ContactName);
/**
* @param $relType
*/
- function _testSearchResult($relType) {
+ public function _testSearchResult($relType) {
//search related contact using Advanced Search
$this->openCiviPage('contact/search/advanced', 'reset=1', '_qf_Advanced_refresh');
$this->assertElementContainsText('search-status', '2 Contacts');
}
- function testAdvanceSearchForLog() {
+ public function testAdvanceSearchForLog() {
$this->webtestLogin();
$Pdate = date('F jS, Y h:i:s A', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) - 1, date( 'Y' )) );
parent::setUp();
}
- function testContactReferenceField() {
+ public function testContactReferenceField() {
$this->webtestLogin();
/* add new group */
parent::setUp();
}
- function testTagAContact() {
+ public function testTagAContact() {
$this->webtestLogin();
$this->openCiviPage("admin/tag", "action=add&reset=1", "_qf_Tag_next");
$this->checkCRMStatus();
}
- function testTagSetContact() {
+ public function testTagSetContact() {
$this->webtestLogin();
$this->openCiviPage("admin/tag", "action=add&reset=1&tagset=1");
//Test that option to create a cms user is present on a contact who does not
//have a cms account already( in this case, a new contact )
- function testCreateContactLinkPresent() {
+ public function testCreateContactLinkPresent() {
//login
$this->webtestLogin('admin');
//Test that the action link is missing for users who already have a contact
//record. The contact record for drupal user 1 is used
- function testCreateContactLinkMissing() {
+ public function testCreateContactLinkMissing() {
//login
$this->webtestLogin('admin');
}
//Test the ajax "check username availibity" link when adding cms user
- function testCheckUsernameAvailability() {
+ public function testCheckUsernameAvailability() {
$this->webtestLogin('admin');
$email = $this->_createUserAndGotoForm();
}
//Test form submission when the username is taken
- function testTakenUsernameSubmission() {
+ public function testTakenUsernameSubmission() {
//login
$this->webtestLogin('admin');
}
//Test form sumbission when user passwords dont match
- function testMismatchPasswordSubmission() {
+ public function testMismatchPasswordSubmission() {
//login
$this->webtestLogin('admin');
$this->assertTrue($results['count'] == 0);
}
- function testMissingDataSubmission() {
+ public function testMissingDataSubmission() {
//login
$this->webtestLogin('admin');
}
//Test a valid (username unique and passwords match) submission
- function testValidSubmission() {
+ public function testValidSubmission() {
//login
$this->webtestLogin('admin');
* @param $password
* @param $confirm_password
*/
- function _fillCMSUserForm($username, $password, $confirm_password) {
+ public function _fillCMSUserForm($username, $password, $confirm_password) {
$this->type("cms_name", $username);
$this->type("cms_pass", $password);
$this->type("cms_confirm_pass", $confirm_password);
/**
* @return array
*/
- function _createUserAndGoToForm() {
+ public function _createUserAndGoToForm() {
$firstName = substr(sha1(rand()), 0, 7) . "John";
$lastName = substr(sha1(rand()), 0, 7) . "Smith";
$email = $this->webtestAddContact($firstName, $lastName, TRUE);
parent::setUp();
}
- function testCustomDataAdd() {
+ public function testCustomDataAdd() {
$this->webtestLogin();
$this->openCiviPage('admin/custom/group', 'action=add&reset=1');
$this->waitForPageToLoad($this->getTimeoutMsec());
}
- function testCustomDataMoneyAdd() {
+ public function testCustomDataMoneyAdd() {
$this->webtestLogin();
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->verifyText("xpath=//div[@id='custom-set-content-{$customFieldsetId}']/div/div[2]/div[2]", '12,345,678.98');
}
- function testCustomDataChangeLog(){
+ public function testCustomDataChangeLog(){
$this->webtestLogin();
//enable logging
parent::setUp();
}
- function testDeceasedContactsAdvanceSearch() {
+ public function testDeceasedContactsAdvanceSearch() {
$this->webtestLogin();
$this->waitForPageToLoad($this->getTimeoutMsec());
* @param string $groupName
* @param bool $deceased
*/
- function _testAddContact($firstName, $lastName, $email, $groupName, $deceased = FALSE) {
+ public function _testAddContact($firstName, $lastName, $email, $groupName, $deceased = FALSE) {
$this->webtestAddContact($firstName, $lastName, $email);
if ($deceased) {
$this->click('link=Edit');
parent::setUp();
}
- function testDuplicateContactAdd() {
+ public function testDuplicateContactAdd() {
$this->webtestLogin();
$this->openCiviPage('contact/add', 'reset=1&ct=Individual');
parent::setUp();
}
- function testEditContact() {
+ public function testEditContact() {
// Log in using webtestLogin() method
$this->webtestLogin();
parent::setUp();
}
- function testGroupAdd() {
+ public function testGroupAdd() {
$this->webtestLogin();
$this->openCiviPage('group/add', 'reset=1', '_qf_Edit_upload-bottom');
$this->assertElementContainsText("css=div.crm-summary-display_name", $displayName);
}
- function testGroupReserved() {
+ public function testGroupReserved() {
$this->webtestLogin('admin');
$this->openCiviPage('group/add', 'reset=1', '_qf_Edit_upload-bottom');
*
* @return string
*/
- function _testCreateUser($roleid) {
+ public function _testCreateUser($roleid) {
$this->open($this->sboxPath . "admin/people/create");
$this->waitForElementPresent("edit-submit");
/**
* @param $role
*/
- function _roleDelete($role) {
+ public function _roleDelete($role) {
$this->waitForElementPresent("xpath=//table[@id='user-roles']/tbody//tr/td[text()='{$role}']/..//td/a[text()='edit role']");
$this->click("xpath=//table[@id='user-roles']/tbody//tr/td[text()='{$role}']/..//td/a[text()='edit role']");
$this->waitForElementPresent('edit-delete');
/**
* Webtest for add contact to group (CRM-15108)
*/
- function testAddContactToGroup() {
+ public function testAddContactToGroup() {
$this->webtestLogin();
$this->openCiviPage("contact/add", "reset=1&ct=Individual");
$this->waitForElementPresent('_qf_Contact_upload_view-bottom');
parent::setUp();
}
- function testAddAndEditField() {
+ public function testAddAndEditField() {
$this->webtestLogin();
// Add a contact
parent::setUp();
}
- function testIndividualAdd() {
+ public function testIndividualAdd() {
$this->webtestLogin();
$this->openCiviPage("contact/add", "reset=1&ct=Individual");
$this->assertChecked("check_3");
}
- function testMergeContactSubType() {
+ public function testMergeContactSubType() {
$this->webtestLogin();
$this->openCiviPage("contact/add", "reset=1&ct=Individual");
$this->waitForElementPresent('_qf_Contact_cancel-bottom');
* @param string $lastName
* @param $subject
*/
- function addActivity($firstName, $lastName, $subject) {
+ public function addActivity($firstName, $lastName, $subject) {
$withContact = substr(sha1(rand()), 0, 7);
$this->webtestAddContact($withContact, "Anderson", $withContact . "@anderson.name");
$this->waitForText('crm-notification-container', "Activity '$subject' has been saved.", "Status message didn't show up after saving!");
}
- function testMergeTest() {
+ public function testMergeTest() {
$this->webtestLogin();
$this->openCiviPage("contact/add", "reset=1&ct=Individual");
$this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[3]/div[2][contains(text(), '9876543210')]"));
}
- function testBatchMerge(){
+ public function testBatchMerge(){
$this->webtestLogin();
// add contact1 and its duplicate
/**
* Helper FN
*/
- function _createContacts($firstName = NULL, $lastName = NULL, $organizationName = NULL, $contactType = 'Individual') {
+ public function _createContacts($firstName = NULL, $lastName = NULL, $organizationName = NULL, $contactType = 'Individual') {
if ($contactType == 'Individual') {
// add contact
$this->openCiviPage("contact/add", "reset=1&ct=Individual");
* Helper FN
* to create new membership type
*/
- function addMembershipType($membershipOrganization) {
+ public function addMembershipType($membershipOrganization) {
$this->openCiviPage("admin/member/membershipType", "reset=1&action=browse");
$this->click("link=Add Membership Type");
$this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
/**
* Test for CRM-12695 fix
*/
- function testMergeOrganizations() {
+ public function testMergeOrganizations() {
$this->webtestLogin();
// build organisation name
/**
* Test for CRM-15658 fix
*/
- function testMergeEmailAndAddress() {
+ public function testMergeEmailAndAddress() {
$this->webtestLogin();
$this->openCiviPage("contact/add", "reset=1&ct=Individual");
$firstName = substr(sha1(rand()), 0, 7);
parent::setUp();
}
- function testIndividualAdd() {
+ public function testIndividualAdd() {
$this->webtestLogin();
$selection1 = 'Student';
/**
* Add custom fields for a contact sub-type
*/
- function _addCustomData($contactSubType) {
+ public function _addCustomData($contactSubType) {
$this->openCiviPage("admin/custom/group", "action=add&reset=1");
//fill custom group title
parent::setUp();
}
- function testPrevNext() {
+ public function testPrevNext() {
$this->webtestLogin();
/* add new group */
parent::setUp();
}
- function testPrivacyOptionSearch() {
+ public function testPrivacyOptionSearch() {
$this->webtestLogin();
$this->waitForPageToLoad($this->getTimeoutMsec());
parent::setUp();
}
- function testProfileChecksum() {
+ public function testProfileChecksum() {
$this->webtestLogin('admin');
// Profile fields.
*
* @return null
*/
- function _testCreateContactProfile($fields, $profileName) {
+ public function _testCreateContactProfile($fields, $profileName) {
// Add new profile.
$this->openCiviPage("admin/uf/group", "reset=1");
$this->click('newCiviCRMProfile-top');
parent::setUp();
}
- function testRelationshipAddTest() {
+ public function testRelationshipAddTest() {
$this->webtestLogin();
//create a relationship type between different contact types
$this->assertTrue($this->isTextPresent($params['label_b_a']));
}
- function testRelationshipAddNewIndividualTest() {
+ public function testRelationshipAddNewIndividualTest() {
$this->webtestLogin();
//create a relationship type between different contact types
$this->assertTrue($this->isTextPresent($params['label_a_b']));
}
- function testAjaxCustomGroupLoad() {
+ public function testAjaxCustomGroupLoad() {
$this->webtestLogin();
//create a New Individual
$this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl);
}
- function testRelationshipAddCurrentEmployerTest() {
+ public function testRelationshipAddCurrentEmployerTest() {
$this->webtestLogin();
//create a New Individual
parent::setUp();
}
- function testSearchBuilderOptions() {
+ public function testSearchBuilderOptions() {
$this->webtestLogin();
$groupName = $this->WebtestAddGroup();
}
}
- function testSearchBuilderRLIKE() {
+ public function testSearchBuilderRLIKE() {
$this->webtestLogin();
// Adding contact
/**
* @param null $firstName
*/
- function createDetailContact($firstName = NULL) {
+ public function createDetailContact($firstName = NULL) {
if (!$firstName) {
$firstName = substr(sha1(rand()), 0, 7);
$this->assertTrue($this->isTextPresent("$firstName adv$firstName"));
}
- function testSearchBuilderContacts() {
+ public function testSearchBuilderContacts() {
$this->webtestLogin();
//Individual
* @param string $op
* @param null $count
*/
- function _searchBuilder($field, $fieldValue = NULL, $name = NULL, $op = '=', $count = NULL) {
+ public function _searchBuilder($field, $fieldValue = NULL, $name = NULL, $op = '=', $count = NULL) {
// search builder using contacts(not using contactType)
$this->openCiviPage("contact/search/builder", "reset=1");
$this->enterValues(1, 1, 'Contacts', $field, NULL, $op, "$fieldValue");
/**
* Enter form values in a Search Builder row
*/
- function enterValues($set, $row, $entity, $field, $loc, $op, $value = '') {
+ public function enterValues($set, $row, $entity, $field, $loc, $op, $value = '') {
if ($set > 1 && $row == 1) {
$this->click('addBlock');
}
* @param null $count
* @param $field
*/
- function _advancedSearch($fieldValue = NULL, $name = NULL, $contactType = NULL, $count = NULL, $field) {
+ public function _advancedSearch($fieldValue = NULL, $name = NULL, $contactType = NULL, $count = NULL, $field) {
//advanced search by selecting the contactType
$this->openCiviPage("contact/search/advanced", "reset=1");
if (isset($contactType)) {
* @param null $streetName
* @param null $postalCode
*/
- function _createContact($contactType, $name, $email, $streetName = NULL, $postalCode = NULL) {
+ public function _createContact($contactType, $name, $email, $streetName = NULL, $postalCode = NULL) {
$this->openCiviPage('contact/add', array('reset' => 1, 'ct' => $contactType), '_qf_Contact_cancel');
if ($contactType == 'Individual') {
* Webtest for CRM-12148
*
*/
- function testSearchBuilderfinancialType() {
+ public function testSearchBuilderfinancialType() {
$this->webtestLogin();
// add financial type
* Webtest for CRM-12588
*
*/
- function testSearchBuilderMembershipType() {
+ public function testSearchBuilderMembershipType() {
$this->webtestLogin();
// create first contact
parent::setUp();
}
- function testQuickSearch() {
+ public function testQuickSearch() {
$this->webtestLogin();
// Adding contact
$this->assertTrue($this->isTextPresent("$displayName"), "Contact did not find!");
}
- function testQuickSearchPartial() {
+ public function testQuickSearchPartial() {
$this->webtestLogin();
// Adding contact
$this->assertElementContainsText('css=.crm-search-results > table.row-highlight', $sortName);
}
- function testContactSearch() {
+ public function testContactSearch() {
$this->webtestLogin();
// Create new tag.
*
* @static
*/
- static function addTag($tagName = 'New Tag', $self) {
+ public static function addTag($tagName = 'New Tag', $self) {
$self->openCiviPage('admin/tag', array('reset' => 1, 'action' => 'add'), '_qf_Tag_next');
// fill tag name
}
// CRM-6586
- function testContactSearchExport() {
+ public function testContactSearchExport() {
$this->webtestLogin();
// Create new group
/*
* test individual pane seperatly.
*/
- function testAdvancedSearch() {
+ public function testAdvancedSearch() {
$this->webtestLogin();
// Get all default advance search panes.
}
- function testIndividualSearchPage(){
+ public function testIndividualSearchPage(){
$this->webtestLogin();
$this->openCiviPage("contribute/search", "reset=1");
*
* @return array
*/
- function _advanceSearchPanesDateFilter($paneRef = NULL) {
+ public function _advanceSearchPanesDateFilter($paneRef = NULL) {
static $_advance_search_panes;
if (!isset($_advance_search_panes) || empty($_advance_search_panes)) {
/**
* Test Signature in TinyMC.
*/
- function testTinyMCE() {
+ public function testTinyMCE() {
$this->webtestLogin();
$this->openCiviPage('dashboard', 'reset=1', 'crm-recently-viewed');
/**
* Test Signature in CKEditor.
*/
- function testCKEditor() {
+ public function testCKEditor() {
$this->webtestLogin();
$this->openCiviPage('dashboard', 'reset=1', 'crm-recently-viewed');
/**
* Helper function to select Editor.
*/
- function _selectEditor($editor) {
+ public function _selectEditor($editor) {
$this->openCiviPage('admin/setting/preferences/display', 'reset=1');
// Change editor if not already selected
/**
* Helper function for Check Signature in Editor.
*/
- function _checkSignature($fieldName, $signature, $editor) {
+ public function _checkSignature($fieldName, $signature, $editor) {
if ($editor == 'CKEditor') {
$this->waitForElementPresent("xpath=//div[@id='cke_{$fieldName}']//iframe");
$this->selectFrame("xpath=//div[@id='cke_{$fieldName}']//iframe");
/**
* Helper function for Check Signature in Activity.
*/
- function _checkActivity($subject, $signature) {
+ public function _checkActivity($subject, $signature) {
$this->openCiviPage('activity/search', 'reset=1', '_qf_Search_refresh');
$this->type('activity_subject', $subject);
parent::setUp();
}
- function testAddTag() {
+ public function testAddTag() {
$this->webtestLogin();
$this->openCiviPage("admin/tag", "action=add&reset=1", "_qf_Tag_next");
$this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagName']/following-sibling::td[7]/span/a[text()= 'Edit']");
}
- function testAddTagSet() {
+ public function testAddTagSet() {
$this->webtestLogin();
$this->openCiviPage("admin/tag", "action=add&reset=1&tagset=1");
parent::setUp();
}
- function testTagSetSearch() {
+ public function testTagSetSearch() {
$this->webtestLogin();
$tagSet1 = $this->_testAddTagSet();
/**
* @return array
*/
- function _testAddTagSet() {
+ public function _testAddTagSet() {
// Go to add tag set url.
$this->openCiviPage('admin/tag', 'action=add&reset=1&tagset=1');
parent::setUp();
}
- function testAddContactsToGroup() {
+ public function testAddContactsToGroup() {
$this->webtestLogin();
$newGroupName = 'Group_' . substr(sha1(rand()), 0, 7);
}
- function testMultiplePageContactSearchAddContactsToGroup() {
+ public function testMultiplePageContactSearchAddContactsToGroup() {
$this->webtestLogin();
$newGroupName = 'Group_' . substr(sha1(rand()), 0, 7);
$this->WebtestAddGroup($newGroupName);
parent::setUp();
}
- function testSelectedContacts() {
+ public function testSelectedContacts() {
$this->webtestLogin();
// make group
parent::setUp();
}
- function testSMSToContacts() {
+ public function testSMSToContacts() {
$this->webtestLogin();
// ADD a New Group
parent::setUp();
}
- function testUpdateProfile() {
+ public function testUpdateProfile() {
// Create new via profile
include_once ('WebTest/Contact/AddViaProfileTest.php');
WebTest_Contact_AddViaProfileTest::testAddViaCreateProfile();
parent::setUp();
}
- function testBatchAddContribution() {
+ public function testBatchAddContribution() {
$this->webtestLogin();
$itemCount = 5;
// create contact
$this->_verifyData($data, "Contribution");
}
- function testBatchAddMembership() {
+ public function testBatchAddMembership() {
$this->webtestLogin();
$itemCount = 5;
$softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE);
}
- function testBatchAddPledge() {
+ public function testBatchAddPledge() {
$this->webtestLogin();
// create a new pledge for contact
* @param $row
* @param $type
*/
- function _fillData($data, $row, $type) {
+ public function _fillData($data, $row, $type) {
if (!empty($data['contact'])) {
$this->select2("s2id_primary_contact_id_{$row}", $data['contact']['email']);
}
* @param $data
* @param $type
*/
- function _checkResult($data, $type) {
+ public function _checkResult($data, $type) {
if ($type == "Contribution") {
$this->openCiviPage("contribute/search", "reset=1", "contribution_date_low");
$this->type("sort_name", "{$data['last_name']} {$data['first_name']}");
* @param $data
* @param $type
*/
- function _verifyData($data, $type) {
+ public function _verifyData($data, $type) {
$this->waitForElementPresent("xpath=//table[@id='DataTables_Table_0']/tbody//tr/td[7]/span/a[1][text()='Enter records']");
$this->click("xpath=//table[@id='DataTables_Table_0']/tbody//tr/td[7]/span/a[1][text()='Enter records']");
$this->waitForElementPresent('_qf_Entry_upload');
parent::setUp();
}
- function testAddPriceSet() {
+ public function testAddPriceSet() {
// Log in using webtestLogin() method
$this->webtestLogin();
* @param $setHelp
* @param null $financialType
*/
- function _testAddSet($setTitle, $usedFor, $setHelp, $financialType = NULL) {
+ public function _testAddSet($setTitle, $usedFor, $setHelp, $financialType = NULL) {
$this->openCiviPage("admin/price", "reset=1&action=add", '_qf_Set_next-bottom');
// Enter Priceset fields (Title, Used For ...)
* @param $financialType
* @param bool $dateSpecificFields
*/
- function _testAddPriceFields(&$fields, &$validateString, $financialType, $dateSpecificFields = FALSE) {
+ public function _testAddPriceFields(&$fields, &$validateString, $financialType, $dateSpecificFields = FALSE) {
$validateStrings[] = $financialType;
$sid = $this->urlArg('sid');
$this->openCiviPage('admin/price/field', "reset=1&action=add&sid=$sid", 'label');
/**
* @return string
*/
- function _testAddFinancialType() {
+ public function _testAddFinancialType() {
//Add new Financial Type
$financialType['name'] = 'FinancialType ' . substr(sha1(rand()), 0, 4);
$financialType['is_deductible'] = TRUE;
* @param $validateStrings
* @param int $sid
*/
- function _testVerifyPriceSet($validateStrings, $sid) {
+ public function _testVerifyPriceSet($validateStrings, $sid) {
// verify Price Set at Preview page
// start at Manage Price Sets listing
$this->openCiviPage("admin/price", "reset=1");
$this->assertStringsPresent($validateStrings);
}
- function testContributeOfflineWithPriceSet() {
+ public function testContributeOfflineWithPriceSet() {
// Log in using webtestLogin() method
$this->webtestLogin();
}
}
- function testContributeOnlineWithPriceSet() {
+ public function testContributeOnlineWithPriceSet() {
$this->webtestLogin();
//add financial type of account type expense
}
- function testContributeWithDateSpecificPriceSet() {
+ public function testContributeWithDateSpecificPriceSet() {
$this->webtestLogin();
//add financial type of account type expense
$this->webtestVerifyTabularData($expected);
}
- function testContributeOfflineforSoftcreditwithApi() {
+ public function testContributeOfflineforSoftcreditwithApi() {
// Log in using webtestLogin() method
$this->webtestLogin();
parent::setUp();
}
- function testWithConfirm() {
+ public function testWithConfirm() {
$this->_addContributionPage(TRUE);
$this->_fillOutContributionPage();
$this->assertTrue($this->isTextPresent("Your transaction has been processed successfully"), "Should load thank you page");
}
- function testWithoutConfirm() {
+ public function testWithoutConfirm() {
$this->_addContributionPage(FALSE);
$this->_fillOutContributionPage();
parent::setUp();
}
- function testContactContextAdd() {
+ public function testContactContextAdd() {
// Log in using webtestLogin() method
$this->webtestLogin();
* Class WebTest_Contribute_ContributionPageAddTest
*/
class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase {
- function testContributionPageAdd() {
+ public function testContributionPageAdd() {
// open browser, login
$this->webtestLogin();
}
// CRM-12510 Test copy contribution page
- function testContributionPageCopy() {
+ public function testContributionPageCopy() {
// open browser, login
$this->webtestLogin();
/**
* Check CRM-7943
*/
- function testContributionPageSeparatePayment() {
+ public function testContributionPageSeparatePayment() {
// open browser, login
$this->webtestLogin();
/**
* Check CRM-7949
*/
- function testContributionPageSeparatePaymentPayLater() {
+ public function testContributionPageSeparatePaymentPayLater() {
// open browser, login
$this->webtestLogin();
/**
* CRM-12994
*/
- function testContributionPageAddPremiumRequiredField() {
+ public function testContributionPageAddPremiumRequiredField() {
// open browser, login
$this->webtestLogin();
parent::setUp();
}
- function testStandaloneContributeAdd() {
+ public function testStandaloneContributeAdd() {
$this->webtestLogin();
// Create a contact to be used as soft creditor
}
}
- function testDeductibleAmount() {
+ public function testDeductibleAmount() {
$this->webtestLogin();
//add authorize .net payment processor
* @param string $lastName
* @param $processorName
*/
- function _doOfflineContribution($params, $firstName, $lastName, $processorName) {
+ public function _doOfflineContribution($params, $firstName, $lastName, $processorName) {
$this->waitForElementPresent("css=li#tab_contribute a");
$this->click("css=li#tab_contribute a");
/**
* @param $verifyData
*/
- function _verifyAmounts($verifyData) {
+ public function _verifyAmounts($verifyData) {
// since we are doing test contributions we need to search for test contribution and select first contribution
// record for the contact
$this->openCiviPage("contribute/search", "reset=1", "contribution_date_low");
'crm-contact-actions-link', FALSE);
}
- function testOnlineContributionWithZeroAmount() {
+ public function testOnlineContributionWithZeroAmount() {
$this->webtestLogin();
// Create a contact to be used as soft creditor
parent::setUp();
}
- function testOfflineRecurContribution() {
+ public function testOfflineRecurContribution() {
$this->webtestLogin();
// We need a payment processor
parent::setUp();
}
- function testOnBehalfOfOrganization() {
+ public function testOnBehalfOfOrganization() {
$this->webtestLogin();
// create new individual
$this->_testUserWithMoreThanOneRelationship($pageId, $cid, $pageTitle);
}
- function testOnBehalfOfOrganizationWithMembershipData() {
+ public function testOnBehalfOfOrganizationWithMembershipData() {
$this->webtestLogin();
// create new individual
$this->webtestLogout();
}
- function testOnBehalfOfOrganizationWithOrgData() {
+ public function testOnBehalfOfOrganizationWithOrgData() {
$this->webtestLogin();
$this->openCiviPage("profile/edit", "reset=1&gid=4");
$this->_testOrganization($pageId, $cid, $pageTitle);
}
- function testWithContactSubtypeDupe() {
+ public function testWithContactSubtypeDupe() {
$this->webtestLogin();
//create organisation
* @param int $cid
* @param $pageTitle
*/
- function _testOrganization($pageId, $cid, $pageTitle) {
+ public function _testOrganization($pageId, $cid, $pageTitle) {
//Open Live Contribution Page
$this->openCiviPage("contribute/transact", "reset=1&id=$pageId", "_qf_Main_upload-bottom");
* @param int $cid
* @param $pageTitle
*/
- function _testAnomoyousOganization($pageId, $cid, $pageTitle) {
+ public function _testAnomoyousOganization($pageId, $cid, $pageTitle) {
//Open Live Contribution Page
$this->openCiviPage("contribute/transact", "reset=1&id=$pageId", "_qf_Main_upload-bottom");
* @param int $cid
* @param $pageTitle
*/
- function _testUserWithOneRelationship($pageId, $cid, $pageTitle) {
+ public function _testUserWithOneRelationship($pageId, $cid, $pageTitle) {
$this->webtestLogin('admin');
// Create new group
* @param int $cid
* @param $pageTitle
*/
- function _testUserWithMoreThanOneRelationship($pageId, $cid, $pageTitle) {
+ public function _testUserWithMoreThanOneRelationship($pageId, $cid, $pageTitle) {
$this->webtestLogin('admin');
$this->waitForPageToLoad($this->getTimeoutMsec());
);
}
- function testOnBehalfOfOrganizationWithImage() {
+ public function testOnBehalfOfOrganizationWithImage() {
$this->webtestLogin();
$this->openCiviPage("profile/edit", "reset=1&gid=4");
* @param int $cid
* @param $pageTitle
*/
- function _testOrganizationWithImageUpload($pageId, $cid, $pageTitle) {
+ public function _testOrganizationWithImageUpload($pageId, $cid, $pageTitle) {
//Open Live Contribution Page
$this->openCiviPage("contribute/transact", "reset=1&id=$pageId", '_qf_Main_upload-bottom');
parent::setUp();
}
- function testOnlineContributionAdd() {
+ public function testOnlineContributionAdd() {
$this->webtestLogin();
// Use default payment processor
}
- function testOnlineContributionWithZeroAmount () {
+ public function testOnlineContributionWithZeroAmount () {
$this->webtestLogin();
// Use default payment processor
* @param int $pageId
* @param bool $priceSet
*/
- function _doContributionAndVerifyData($pageId, $priceSet = FALSE) {
+ public function _doContributionAndVerifyData($pageId, $priceSet = FALSE) {
//logout
$this->webtestLogout();
$amountLabel = 'Total Amount';
parent::setUp();
}
- function testOnlineMultpiplePaymentProcessor() {
+ public function testOnlineMultpiplePaymentProcessor() {
// Log in using webtestLogin() method
$this->webtestLogin();
}
- function testOnlineMultiplePaymentProcessorWithPayLater() {
+ public function testOnlineMultiplePaymentProcessorWithPayLater() {
// Log in using webtestLogin() method
$this->webtestLogin();
parent::setUp();
}
- function testOnlineRecurContribution() {
+ public function testOnlineRecurContribution() {
require_once 'ContributionPageAddTest.php';
// a random 7-char string and an even number to make this pass unique
parent::setUp();
}
- function testPCPAdd() {
+ public function testPCPAdd() {
// open browser, login
$this->webtestLogin();
parent::setUp();
}
- function testStandaloneContributeAdd() {
+ public function testStandaloneContributeAdd() {
$this->webtestLogin();
// Create a contact to be used as soft creditor
}
}
- function testfinancialTypeSearch() {
+ public function testfinancialTypeSearch() {
$this->webtestLogin();
$financialType = array(
/**
* @param $financialType
*/
- function addStandaloneContribution($financialType) {
+ public function addStandaloneContribution($financialType) {
$this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload");
}
}
- function testAjaxCustomGroupLoad() {
+ public function testAjaxCustomGroupLoad() {
$this->webtestLogin();
$triggerElement = array('name' => 'financial_type_id', 'type' => 'select');
$customSets = array(
parent::setUp();
}
- function testBatchUpdatePendingContribution() {
+ public function testBatchUpdatePendingContribution() {
$this->webtestLogin();
$this->_testOfflineContribution();
$this->_testOfflineContribution();
$this->webtestVerifyTabularData($expected);
}
- function testParticipationAdd() {
+ public function testParticipationAdd() {
// Log in using webtestLogin() method
$this->webtestLogin();
/**
* @param string $firstName
*/
- function _addParticipant($firstName) {
+ public function _addParticipant($firstName) {
$this->openCiviPage("participant/add", "reset=1&action=add&context=standalone", '_qf_Participant_upload-bottom');
);
}
- function _testOfflineContribution() {
+ public function _testOfflineContribution() {
$this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload");
// create new contact using dialog
parent::setUp();
}
- function testChangeContributionAmount() {
+ public function testChangeContributionAmount() {
$this->webtestLogin();
$amount = 100;
//Offline Pay Later Contribution
$this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare);
}
- function testPayLater() {
+ public function testPayLater() {
$this->webtestLogin();
$amount = 100.00;
//Offline Pay Later Contribution
$this->assertEquals($status, '1', "Verify Completed Status");
}
- function testChangePremium() {
+ public function testChangePremium() {
$this->webtestLogin();
$from = 'Premiums';
$to = 'Premiums inventory';
$this->assertEquals($deletedAmount, $cost, "Verify actual cost for deleted premium");
}
- function testDeletePremium() {
+ public function testDeletePremium() {
$this->webtestLogin();
$from = 'Premiums';
$to = 'Premiums inventory';
$this->assertEquals($actualAmount, $cost, "Verify actual cost for deleted premium");
}
- function testChangePaymentInstrument() {
+ public function testChangePaymentInstrument() {
$this->webtestLogin();
$label = 'TEST'.substr(sha1(rand()), 0, 7);
$amount = 100.00;
$this->assertEquals($totalAmount, $amount, "Verify amount for newly inserted values");
}
- function testRefundContribution() {
+ public function testRefundContribution() {
$this->webtestLogin();
$amount = 100.00;
$this->_testOfflineContribution($amount);
$this->assertEquals($amount, '-100.00', 'Verify Financial Trxn Amount.');
}
- function testCancelPayLater() {
+ public function testCancelPayLater() {
$this->webtestLogin();
$amount = 100.00;
$this->_testOfflineContribution($amount, "Pending");
$this->assertEquals($totalAmount, "-$amount", 'Verify Amount for Financial Trxn');
}
- function testChangeFinancialType() {
+ public function testChangeFinancialType() {
$this->webtestLogin();
$amount = 100.00;
$this->_testOfflineContribution($amount);
* @param string $status
* @return array
*/
- function _testOfflineContribution($amount, $status="Completed") {
+ public function _testOfflineContribution($amount, $status="Completed") {
$this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload");
parent::setUp();
}
- function testUpdatePendingContribution() {
+ public function testUpdatePendingContribution() {
$this->webtestLogin();
//Offline Pay Later Contribution
/**
* @return array of contact details
*/
- function _testOfflineContribution() {
+ public function _testOfflineContribution() {
// Create a contact to be used as soft creditor
$softCreditFname = substr(sha1(rand()), 0, 7);
$softCreditLname = substr(sha1(rand()), 0, 7);
/**
* @param array $contact
*/
- function _testOnlineContribution($contact) {
+ public function _testOnlineContribution($contact) {
// Use default payment processor
$processorName = 'Test Processor';
parent::setUp();
}
- function testPaymentProcessorsSSL() {
+ public function testPaymentProcessorsSSL() {
$this->_initialize();
$this->_tryPaymentProcessor($this->names['AuthNet']);
$this->_tryPaymentProcessor($this->names['PayPal_Standard']);*/
}
- function _initialize() {
+ public function _initialize() {
if (!$this->initialized) {
// log in
$this->webtestLogin();
/**
* @param string $name
*/
- function _tryPaymentProcessor($name) {
+ public function _tryPaymentProcessor($name) {
// load contribution page
$this->openCiviPage("contribute/transact", "reset=1&action=preview&id={$this->pageId}", "_qf_Main_upload-bottom");
parent::setUp();
}
- function testAddPaidEventNoTemplate() {
+ public function testAddPaidEventNoTemplate() {
// Log in using webtestLogin() method
$this->webtestLogin();
$this->_testVerifyRegisterPage($registerStrings);
}
- function testAddPaidEventDiscount() {
+ public function testAddPaidEventDiscount() {
// Log in using webtestLogin() method
$this->webtestLogin();
$this->_testOnlineRegistration($registerUrl, $numberRegistrations, $anonymous);
}
- function testDeletePriceSetDiscount() {
+ public function testDeletePriceSetDiscount() {
// Log in using webtestLogin() method
$this->webtestLogin();
}
}
- function testAddDeleteEventDiscount() {
+ public function testAddDeleteEventDiscount() {
// Log in using webtestLogin() method
$this->webtestLogin();
* @param $eventTitle
* @param $discount
*/
- function _deleteDiscount($id, $eventTitle, $discount) {
+ public function _deleteDiscount($id, $eventTitle, $discount) {
$this->openCiviPage("event/manage/fee", "reset=1&action=update&id=$id", "_qf_Fee_upload-bottom");
$this->type("discount_name_2", "");
$this->click("xpath=//tr[@id='discount_2']/td[3]/a");
$this->assertStringsPresent($discount[1]);
}
- function testAddPaidEventWithTemplate() {
+ public function testAddPaidEventWithTemplate() {
// Log in using webtestLogin() method
$this->webtestLogin();
$this->_testVerifyRegisterPage($registerStrings);
}
- function testAddFreeEventWithTemplate() {
+ public function testAddFreeEventWithTemplate() {
// Log in using webtestLogin() method
$this->webtestLogin();
$this->verifyElementNotPresent("css=div.paid_event-section");
}
- function testUnpaidPaid() {
+ public function testUnpaidPaid() {
// Log in using webtestLogin() method
$this->webtestLogin();
$this->assertNotChecked('is_pay_later');
}
- function testAjaxCustomGroupLoad() {
+ public function testAjaxCustomGroupLoad() {
$this->webtestLogin();
$triggerElement = array('name' => 'event_type_id', 'type' => 'select');
* @param $eventTitle
* @param $eventDescription
*/
- function _testAddEventInfo($eventTitle, $eventDescription) {
+ public function _testAddEventInfo($eventTitle, $eventDescription) {
$this->waitForElementPresent("_qf_EventInfo_upload-bottom");
$this->select("event_type_id", "value=1");
* @param int $templateID
* @param int $eventTypeID
*/
- function _testAddEventInfoFromTemplate($eventTitle, $eventDescription, $templateID, $eventTypeID) {
+ public function _testAddEventInfoFromTemplate($eventTitle, $eventDescription, $templateID, $eventTypeID) {
$this->waitForElementPresent("_qf_EventInfo_upload-bottom");
// Select event template. Use option value, not label - since labels can be translated and test would fail
/**
* @param $streetAddress
*/
- function _testAddLocation($streetAddress) {
+ public function _testAddLocation($streetAddress) {
// Wait for Location tab form to load
$this->waitForAjaxContent();
$this->waitForElementPresent("_qf_Location_upload-bottom");
*
* @return array
*/
- function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorName = "PP Pro", $double = FALSE, $payLater = FALSE) {
+ public function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorName = "PP Pro", $double = FALSE, $payLater = FALSE) {
$discount1 = "Early-bird" . substr(sha1(rand()), 0, 7);
$discount2 = "";
// Go to Fees tab
* @param $registerIntro
* @param bool $multipleRegistrations
*/
- function _testAddOnlineRegistration($registerIntro, $multipleRegistrations = FALSE) {
+ public function _testAddOnlineRegistration($registerIntro, $multipleRegistrations = FALSE) {
// Go to Online Registration tab
$this->click("link=Online Registration");
$this->waitForElementPresent("_qf_Registration_upload-bottom");
*
* @return null
*/
- function _testVerifyEventInfo($eventTitle, $eventInfoStrings, $eventFees = NULL) {
+ public function _testVerifyEventInfo($eventTitle, $eventInfoStrings, $eventFees = NULL) {
// verify event input on info page
// start at Manage Events listing
$this->openCiviPage("event/manage", "reset=1");
*
* @return string
*/
- function _testVerifyRegisterPage($registerStrings) {
+ public function _testVerifyRegisterPage($registerStrings) {
// Go to Register page and check for intro text and fee levels
$this->click("link=Register Now");
$this->waitForElementPresent("_qf_Register_upload-bottom");
*
* @return array
*/
- function _testOnlineRegistration($registerUrl, $numberRegistrations = 1, $anonymous = TRUE, $isPayLater = FALSE, $participantEmailInfo = array(), $paymentProcessor = NULL) {
+ public function _testOnlineRegistration($registerUrl, $numberRegistrations = 1, $anonymous = TRUE, $isPayLater = FALSE, $participantEmailInfo = array(), $paymentProcessor = NULL) {
$infoPassed = FALSE;
if (!empty($participantEmailInfo)) {
$infoPassed = TRUE;
/**
* @param $eventTitle
*/
- function _testAddReminder($eventTitle) {
+ public function _testAddReminder($eventTitle) {
// Go to Schedule Reminders tab
$this->click('css=li#tab_reminder a');
$this->waitForElementPresent("newScheduleReminder");
}
}
- function testEventAddMultipleParticipant() {
+ public function testEventAddMultipleParticipant() {
// Log in using webtestLogin() method
$this->webtestLogin();
$this->openCiviPage("event/add", "reset=1&action=add");
/**
* @param int $contributionID
*/
- function verifyFinancialRecords($contributionID) {
+ public function verifyFinancialRecords($contributionID) {
// check count for civicrm_contribution and civicrm_financial_item in civicrm_entity_financial_trxn
$query = "SELECT COUNT(DISTINCT(c1.id)) civicrm_contribution, COUNT(c2.id) civicrm_financial_item FROM civicrm_entity_financial_trxn c1
LEFT JOIN civicrm_entity_financial_trxn c2 ON c1.financial_trxn_id = c2.financial_trxn_id AND c2.entity_table ='civicrm_financial_item'
$this->assertEquals('2', $dao->civicrm_financial_trxn, 'civicrm_financial_trxn count does not match');
}
- function testEventApprovalRegistration() {
+ public function testEventApprovalRegistration() {
$this->webtestLogin();
//Participant Status
/**
* @param $status
*/
- function _testEnableParticipantStatuses($status) {
+ public function _testEnableParticipantStatuses($status) {
// enable participant status
if ($this->isElementPresent("xpath=//td[@class='crm-participant-label crm-editable crm-editable-enabled'][contains(text(), '{$status}')]/../td[9]/span/a[2][text()='Enable']")) {
$this->click("xpath=//td[@class='crm-participant-label crm-editable crm-editable-enabled'][contains(text(), '{$status}')]/../td[9]/span/a[2][text()='Enable']");
parent::setUp();
}
- function testEventParticipationAdd() {
+ public function testEventParticipationAdd() {
$this->webtestLogin();
// Adding contact with randomized first name (so we can then select that contact when creating event registration)
);
}
- function testEventParticipationAddWithMultipleRoles() {
+ public function testEventParticipationAddWithMultipleRoles() {
$this->webtestLogin();
// Adding contact with randomized first name (so we can then select that contact when creating event registration)
$this->verifyText("xpath=//table/tbody/tr/td[text()='Total Amount']/following-sibling::td/strong", preg_quote('$ 800.00'), 'In line ' . __LINE__);
}
- function testEventAddMultipleParticipants() {
+ public function testEventAddMultipleParticipants() {
$this->webtestLogin();
$processorId = $this->webtestAddPaymentProcessor();
}
}
- function testAjaxCustomGroupLoad() {
+ public function testAjaxCustomGroupLoad() {
$this->webtestLogin();
$customSets = array(
* Webtest for CRM-10983
*
*/
- function testCheckDuplicateCustomDataLoad() {
+ public function testCheckDuplicateCustomDataLoad() {
$this->webtestLogin();
$customSets = array(
* @param string $lastName
* @param int $processorId
*/
- function _fillParticipantDetails($processorId) {
+ public function _fillParticipantDetails($processorId) {
$contact = $this->createDialogContact();
$this->select('payment_processor_id', "value={$processorId}");
parent::setUp();
}
- function testAddPriceSet() {
+ public function testAddPriceSet() {
// Log in using webtestLogin() method
$this->webtestLogin();
* @param $setHelp
* @param string $financialType
*/
- function _testAddSet($setTitle, $usedFor, $setHelp, $financialType = 'Event Fee') {
+ public function _testAddSet($setTitle, $usedFor, $setHelp, $financialType = 'Event Fee') {
$this->openCiviPage('admin/price', 'reset=1&action=add', '_qf_Set_next-bottom');
// Enter Priceset fields (Title, Used For ...)
* @param $validateStrings
* @param bool $dateSpecificFields
*/
- function _testAddPriceFields(&$fields, &$validateStrings, $dateSpecificFields = FALSE) {
+ public function _testAddPriceFields(&$fields, &$validateStrings, $dateSpecificFields = FALSE) {
$this->clickLinkSuppressPopup('newPriceField');
foreach ($fields as $label => $type) {
$validateStrings[] = $label;
* @param $validateStrings
* @param int $sid
*/
- function _testVerifyPriceSet($validateStrings, $sid) {
+ public function _testVerifyPriceSet($validateStrings, $sid) {
// verify Price Set at Preview page
// start at Manage Price Sets listing
$this->openCiviPage('admin/price', 'reset=1');
$this->assertStringsPresent($validateStrings);
}
- function testRegisterWithPriceSet() {
+ public function testRegisterWithPriceSet() {
// Log in using webtestLogin() method
$this->webtestLogin();
$this->click('_qf_ParticipantView_cancel-bottom');
}
- function testParticipantWithDateSpecificPriceSet() {
+ public function testParticipantWithDateSpecificPriceSet() {
// Log in using webtestLogin() method
$this->webtestLogin();
*
*/
- function testEventWithPriceSet() {
+ public function testEventWithPriceSet() {
// Log in using webtestLogin() method
$this->webtestLogin();
}
- function testDeletePriceSetforEventTemplate() {
+ public function testDeletePriceSetforEventTemplate() {
// Log in using webtestLogin() method
$this->webtestLogin();
/**
* @param array $expectedLineItems
*/
- function _checkLineItems($expectedLineItems) {
+ public function _checkLineItems($expectedLineItems) {
foreach ($expectedLineItems as $lineKey => $lineValue) {
foreach ($lineValue as $key => $value) {
$this->verifyText("xpath=//table/tbody//tr/td[text()='Selections']/following-sibling::td/table/tbody//tr[$lineKey]/td[$key]", preg_quote($value));
parent::setUp();
}
- function testRecurringEvent() {
+ public function testRecurringEvent() {
$this->webtestLogin();
//Add repeat configuration for an event
}
// CRM-13964 and CRM-13965
- function testParticipantParitalPaymentInitiation() {
+ public function testParticipantParitalPaymentInitiation() {
// Log in using webtestLogin() method
$this->webtestLogin();
* @param $feeAmt
* @param int $amtPaid
*/
- function _checkPaymentInfoTable($feeAmt, $amtPaid) {
+ public function _checkPaymentInfoTable($feeAmt, $amtPaid) {
$this->assertElementContainsText("xpath=//td[@id='payment-info']/table[@id='info']/tbody/tr[2]/td", "$ {$feeAmt}", 'Missing text: appropriate fee amount');
$this->assertElementContainsText("xpath=//td[@id='payment-info']/table[@id='info']/tbody/tr[2]/td[2]", "$ {$amtPaid}", 'Missing text: appropriate fee amount');
}
parent::setUp();
}
- function testParticipationAdd() {
+ public function testParticipationAdd() {
// Log in using webtestLogin() method
$this->webtestLogin();
/**
* @param string $firstName
*/
- function addParticipant($firstName) {
+ public function addParticipant($firstName) {
$this->openCiviPage("participant/add", "reset=1&action=add&context=standalone", '_qf_Participant_upload-bottom');
// Type contact last name in contact auto-complete, wait for dropdown and click first result
parent::setUp();
}
- function testEventListing() {
+ public function testEventListing() {
// Log in using webtestLogin() method
$this->webtestLogin('admin');
* @param $startdate
* @param $enddate
*/
- function _testCreateEvent($eventTitle, $startdate, $enddate) {
+ public function _testCreateEvent($eventTitle, $startdate, $enddate) {
$this->openCiviPage("event/add", "reset=1&action=add");
parent::setUp();
}
- function testEventWaitList() {
+ public function testEventWaitList() {
// Log in using webtestLogin() method
$this->webtestLogin();
* @param $eventTitle
* @param $eventInfoStrings
*/
- function _testVerifyEventInfo($eventTitle, $eventInfoStrings) {
+ public function _testVerifyEventInfo($eventTitle, $eventInfoStrings) {
// verify event input on info page
// start at Manage Events listing
$this->openCiviPage("event/manage", "reset=1");
*
* @return string
*/
- function _testVerifyRegisterPage($registerStrings) {
+ public function _testVerifyRegisterPage($registerStrings) {
// Go to Register page and check for intro text and fee levels
$this->click("link=Register Now");
$this->waitForElementPresent("_qf_Register_upload-bottom");
* @param int $numberRegistrations
* @param bool $anonymous
*/
- function _testOnlineRegistration($registerUrl, $numberRegistrations = 1, $anonymous = TRUE) {
+ public function _testOnlineRegistration($registerUrl, $numberRegistrations = 1, $anonymous = TRUE) {
if ($anonymous) {
$this->webtestLogout();
}
}
// this functionality is broken hence skipping the test
- function skiptestAuthenticatedMultipleEvent() {
+ public function skiptestAuthenticatedMultipleEvent() {
// Log in using webtestLogin() method
$this->webtestLogin();
}
// this functionality is broken hence skipping the test
- function skiptestAnonymousMultipleEvent() {
+ public function skiptestAnonymousMultipleEvent() {
// This is the path where our testing install resides.
// The rest of URL is defined in CiviSeleniumTestCase base class, in
// class attributes.
* @param $eventTitle
* @param $eventDescription
*/
- function _testAddEventInfo($eventTitle, $eventDescription) {
+ public function _testAddEventInfo($eventTitle, $eventDescription) {
$this->waitForElementPresent("_qf_EventInfo_upload-bottom");
$this->select("event_type_id", "value=1");
/**
* @param $streetAddress
*/
- function _testAddLocation($streetAddress) {
+ public function _testAddLocation($streetAddress) {
// Wait for Location tab form to load
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->waitForElementPresent("_qf_Location_upload-bottom");
* @param bool $priceSet
* @param string $processorName
*/
- function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorName = "PP Pro") {
+ public function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorName = "PP Pro") {
// Go to Fees tab
$this->click("link=Fees");
$this->waitForElementPresent("_qf_Fee_upload-bottom");
* @param $registerIntro
* @param bool $multipleRegistrations
*/
- function _testAddOnlineRegistration($registerIntro, $multipleRegistrations = FALSE) {
+ public function _testAddOnlineRegistration($registerIntro, $multipleRegistrations = FALSE) {
// Go to Online Registration tab
$this->click("link=Online Registration");
$this->waitForElementPresent("_qf_Registration_upload-bottom");
* @param $eventInfoStrings
* @param null $eventFees
*/
- function _AddEventToCart($eventTitle, $eventInfoStrings, $eventFees = NULL) {
+ public function _AddEventToCart($eventTitle, $eventInfoStrings, $eventFees = NULL) {
// verify event input on info page
// start at Manage Events listing
$this->openCiviPage("event/manage", "reset=1");
*
* @return string
*/
- function _testVerifyEventInfo($eventTitle, $eventInfoStrings, $eventFees = NULL) {
+ public function _testVerifyEventInfo($eventTitle, $eventInfoStrings, $eventFees = NULL) {
// verify event input on info page
// start at Manage Events listing
$this->openCiviPage("event/manage", "reset=1");
* @param int $numberRegistrations
* @param bool $anonymous
*/
- function _testOnlineRegistration($registerUrl, $numberRegistrations = 1, $anonymous = TRUE) {
+ public function _testOnlineRegistration($registerUrl, $numberRegistrations = 1, $anonymous = TRUE) {
if ($anonymous) {
$this->webtestLogout();
}
/**
* @return array
*/
- function _testCheckOut() {
+ public function _testCheckOut() {
//View the Cart
$this->click("xpath=//div[@id='messages']/div/div/a[text()='View your cart.']");
* @param string $lastName
* @param $events
*/
- function _checkContributionsandEventRegistration($firstName, $lastName, $events) {
+ public function _checkContributionsandEventRegistration($firstName, $lastName, $events) {
//Type the registered participant's email in autocomplete.
$this->click('sort_name_navigation');
$this->type('css=input#sort_name_navigation', "{$firstName}.{$lastName}@home.com");
parent::setUp();
}
- function testCreateEventRegisterPage() {
+ public function testCreateEventRegisterPage() {
// Log in using webtestLogin() method
$this->webtestLogin();
$this->waitForPageToLoad($this->getTimeoutMsec());
}
- function testAnoumyousRegisterPage() {
+ public function testAnoumyousRegisterPage() {
// add the required Drupal permission
$permission = array('edit-1-access-all-custom-data');
$this->changePermissions($permission);
*
* @return array
*/
- function _testGetCustomFieldId($customGrpId1) {
+ public function _testGetCustomFieldId($customGrpId1) {
$customId = array();
// Create a custom data to add in profile
/**
* @param int $eventPageId
*/
- function _testRemoveProfile($eventPageId) {
+ public function _testRemoveProfile($eventPageId) {
$this->openCiviPage("event/manage/settings", "reset=1&action=update&id=$eventPageId");
// Go to Online Contribution tab
*
* @return array
*/
- function _testGetProfileId($customId) {
+ public function _testGetProfileId($customId) {
// create profiles
$profileId = array();
$profilefield = array(
*
* @return null
*/
- function _testCreateProfile($profilefield, $location = 0, $type) {
+ public function _testCreateProfile($profilefield, $location = 0, $type) {
$locationfields = array(
'supplemental_address_1',
'supplemental_address_2',
* @param $eventTitle
* @param $eventDescription
*/
- function _testAddEventInfo($eventTitle, $eventDescription) {
+ public function _testAddEventInfo($eventTitle, $eventDescription) {
$this->waitForElementPresent("_qf_EventInfo_upload-bottom");
$this->select("event_type_id", "value=1");
/**
* @param $streetAddress
*/
- function _testAddLocation($streetAddress) {
+ public function _testAddLocation($streetAddress) {
// Wait for Location tab form to load
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->waitForElementPresent("_qf_Location_upload-bottom");
* @param bool $priceSet
* @param string $processorName
*/
- function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorName = "PP Pro") {
+ public function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorName = "PP Pro") {
// Go to Fees tab
$this->click("link=Fees");
$this->waitForElementPresent("_qf_Fee_upload-bottom");
*
* @return null
*/
- function _testAddMultipleProfile($profileId) {
+ public function _testAddMultipleProfile($profileId) {
// Go to Online Contribution tab
$this->click("link=Online Registration");
$this->waitForElementPresent("_qf_Registration_upload-bottom");
* @param $email3
* @param $email4
*/
- function _testEventRegistrationAfterRemoving($eventPageId, $customId, $firstName2, $lastName2, $participantfname2, $participantlname2, $email3, $email4) {
+ public function _testEventRegistrationAfterRemoving($eventPageId, $customId, $firstName2, $lastName2, $participantfname2, $participantlname2, $email3, $email4) {
$this->openCiviPage("event/register", "id={$eventPageId}&reset=1", "_qf_Register_upload-bottom");
$this->select("additional_participants", "value=1");
/**
* @return array|string
*/
- function _addEmailField() {
+ public function _addEmailField() {
//add email field in name and address profile
$this->openCiviPage('admin/uf/group/field/add', 'reset=1&action=add&gid=1', "_qf_Field_next-bottom");
$this->select("field_name[0]", "value=Contact");
/**
* @param int $cfId
*/
- function _removeEmailField($cfId) {
+ public function _removeEmailField($cfId) {
$this->openCiviPage("admin/uf/group/field", "action=delete&id={$cfId}");
$this->click("_qf_Field_next-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
parent::setUp();
}
- function testPCPAdd() {
+ public function testPCPAdd() {
//give permissions to anonymous user
$permission = array('edit-1-profile-listings-and-forms', 'edit-1-access-all-custom-data', 'edit-1-register-for-events', 'edit-1-make-online-contributions');
$this->changePermissions($permission);
* @param string $middleName
* @param $email
*/
- function _testAddEventForPCP($processorName, $campaignType, $contributionPageId = NULL, $firstName, $lastName, $middleName, $email) {
+ public function _testAddEventForPCP($processorName, $campaignType, $contributionPageId = NULL, $firstName, $lastName, $middleName, $email) {
$this->openCiviPage("event/add", "reset=1&action=add");
* @param $eventTitle
* @param $eventDescription
*/
- function _testAddEventInfo($eventTitle, $eventDescription) {
+ public function _testAddEventInfo($eventTitle, $eventDescription) {
$this->waitForElementPresent("_qf_EventInfo_upload-bottom");
$this->select("event_type_id", "value=1");
/**
* @param $streetAddress
*/
- function _testAddLocation($streetAddress) {
+ public function _testAddLocation($streetAddress) {
// Wait for Location tab form to load
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->waitForElementPresent("_qf_Location_upload-bottom");
* @param bool $priceSet
* @param string $processorName
*/
- function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorName = "PP Pro") {
+ public function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorName = "PP Pro") {
// Go to Fees tab
$this->click("link=Fees");
$this->waitForElementPresent("_qf_Fee_upload-bottom");
* @param $registerIntro
* @param bool $multipleRegistrations
*/
- function _testAddOnlineRegistration($registerIntro, $multipleRegistrations = FALSE) {
+ public function _testAddOnlineRegistration($registerIntro, $multipleRegistrations = FALSE) {
// Go to Online Registration tab
$this->click("link=Online Registration");
$this->waitForElementPresent("_qf_Registration_upload-bottom");
* @param $campaignType
* @param bool $anonymous
*/
- function _testOnlineRegistration($eventTitle, $pageId, $firstName, $lastName, $middleName, $email, $numberRegistrations = 1, $campaignType, $anonymous = TRUE) {
+ public function _testOnlineRegistration($eventTitle, $pageId, $firstName, $lastName, $middleName, $email, $numberRegistrations = 1, $campaignType, $anonymous = TRUE) {
$hash = substr(sha1(rand()), 0, 7);
$contributionAmount = 600;
*
* @return null
*/
- function _testEventPcpAdd($campaignType, $contributionPageId) {
+ public function _testEventPcpAdd($campaignType, $contributionPageId) {
$hash = substr(sha1(rand()), 0, 7);
$isPcpApprovalNeeded = TRUE;
* @param string $lastNameCreator
* @param $amount
*/
- function _testParticipantSearchEventName($eventName, $lastNameDonar, $firstNameDonar, $firstNameCreator, $lastNameCreator, $amount) {
+ public function _testParticipantSearchEventName($eventName, $lastNameDonar, $firstNameDonar, $firstNameCreator, $lastNameCreator, $amount) {
$sortName = $lastNameDonar . ', ' . $firstNameDonar;
$this->openCiviPage("event/search", "reset=1");
* @param $pcpCreatorLastName
* @param $amount
*/
- function _testSearchTest($firstName, $lastName, $pcpCreatorFirstName, $pcpCreatorLastName, $amount) {
+ public function _testSearchTest($firstName, $lastName, $pcpCreatorFirstName, $pcpCreatorLastName, $amount) {
$sortName = "$pcpCreatorLastName, $pcpCreatorFirstName";
$displayName = "$firstName $lastName";
parent::setUp();
}
- function testParticipantCountWithFeelevel() {
+ public function testParticipantCountWithFeelevel() {
// Log in using webtestLogin() method
$this->webtestLogin();
$this->assertElementContainsText("xpath=//div[@id='search-status']/table/tbody/tr[1]/td", '2 Results');
}
- function testParticipantCountWithPriceset() {
+ public function testParticipantCountWithPriceset() {
// Log in using webtestLogin() method
$this->webtestLogin();
* @param $setTitle
* @param string $financialType
*/
- function _testAddSet($setTitle, $financialType = 'Event Fee') {
+ public function _testAddSet($setTitle, $financialType = 'Event Fee') {
$this->openCiviPage('admin/price', 'reset=1&action=add', '_qf_Set_next-bottom');
// Enter Priceset fields (Title, Used For ...)
/**
* @param $options
*/
- function _testAddMultipleChoiceOptions($options) {
+ public function _testAddMultipleChoiceOptions($options) {
foreach ($options as $oIndex => $oValue) {
$this->type("option_label_{$oIndex}", $oValue['label']);
$this->type("option_amount_{$oIndex}", $oValue['amount']);
*
* @return string
*/
- function _testAddEvent($params) {
+ public function _testAddEvent($params) {
$this->openCiviPage('event/add', 'reset=1&action=add', '_qf_EventInfo_upload-bottom');
$this->select('event_type_id', "value={$params['event_type_id']}");
/**
* @param array $participant
*/
- function _testRegisterWithBillingInfo($participant = array()) {
+ public function _testRegisterWithBillingInfo($participant = array()) {
$this->waitForElementPresent("credit_card_type");
$this->select('credit_card_type', 'value=Visa');
$this->type('credit_card_number', '4111111111111111');
* @param $participants
* @param $priceFieldOptionCounts
*/
- function _testPricesetDetailsCustomSearch($eventParams, $participants, $priceFieldOptionCounts) {
+ public function _testPricesetDetailsCustomSearch($eventParams, $participants, $priceFieldOptionCounts) {
$this->openCiviPage('contact/search/custom', 'csid=9&reset=1');
$this->select('event_id', 'label=' . $eventParams['title']);
/**
* @param $strings
*/
- function _checkStrings(&$strings) {
+ public function _checkStrings(&$strings) {
// search for elements
foreach ($strings as $string) {
$this->assertTrue($this->isTextPresent($string), "Could not find $string on page");
}
}
- function testParticipantSearchForm() {
+ public function testParticipantSearchForm() {
$this->webtestLogin();
// visit event search page
$this->_checkStrings($stringsToCheck);
}
- function testParticipantSearchForce() {
+ public function testParticipantSearchForce() {
$this->webtestLogin();
// visit event search page
$this->assertTrue($this->isTextPresent("Select Records"), "A forced event search did not return any results");
}
- function testParticipantSearchEmpty() {
+ public function testParticipantSearchEmpty() {
$this->webtestLogin();
// visit event search page
$this->_checkStrings($stringsToCheck);
}
- function testParticipantSearchEventName() {
+ public function testParticipantSearchEventName() {
$this->webtestLogin();
// visit event search page
$this->_checkStrings($stringsToCheck);
}
- function testParticipantSearchEventDate() {
+ public function testParticipantSearchEventDate() {
$this->webtestLogin();
$this->_checkStrings($stringsToCheck);
}
- function testParticipantSearchEventDateAndType() {
+ public function testParticipantSearchEventDateAndType() {
$this->webtestLogin();
$this->_checkStrings($stringsToCheck);
}
- function testParticipantSearchCustomField() {
+ public function testParticipantSearchCustomField() {
$this->webtestLogin();
$this->_checkStrings($stringsToCheck);
}
- function testParticipantSearchForceAndView() {
+ public function testParticipantSearchForceAndView() {
$this->webtestLogin();
$this->_checkStrings($stringsToCheck);
}
- function testParticipantSearchForceAndEdit() {
+ public function testParticipantSearchForceAndEdit() {
$this->webtestLogin();
parent::setUp();
}
- function testWithoutFieldCount() {
+ public function testWithoutFieldCount() {
// Log in using webtestLogin() method
$this->webtestLogin();
$this->_checkConfirmationAndRegister();
}
- function testWithFieldCount() {
+ public function testWithFieldCount() {
// Log in using webtestLogin() method
$this->webtestLogin();
$this->_checkConfirmationAndRegister();
}
- function testAdditionalParticipantWithoutFieldCount() {
+ public function testAdditionalParticipantWithoutFieldCount() {
// Log in using webtestLogin() method
$this->webtestLogin();
$this->_checkConfirmationAndRegister();
}
- function testAdditionalParticipantWithFieldCount() {
+ public function testAdditionalParticipantWithFieldCount() {
// Log in using webtestLogin() method
$this->webtestLogin();
* @param $setTitle
* @param null $financialType
*/
- function _testAddSet($setTitle, $financialType = NULL) {
+ public function _testAddSet($setTitle, $financialType = NULL) {
$this->openCiviPage('admin/price', 'reset=1&action=add', '_qf_Set_next-bottom');
// Enter Priceset fields (Title, Used For ...)
/**
* @param $fields
*/
- function _testAddPriceFields($fields) {
+ public function _testAddPriceFields($fields) {
$fieldCount = count($fields);
$count = 1;
$this->waitForElementPresent('label');
* @param $options
* @param $fieldType
*/
- function _testAddMultipleChoiceOptions($options, $fieldType) {
+ public function _testAddMultipleChoiceOptions($options, $fieldType) {
foreach ($options as $oIndex => $oValue) {
$this->type("option_label_{$oIndex}", $oValue['label']);
$this->type("option_amount_{$oIndex}", $oValue['amount']);
*
* @return string
*/
- function _testAddEvent($params) {
+ public function _testAddEvent($params) {
$this->openCiviPage('event/add', 'reset=1&action=add', '_qf_EventInfo_upload-bottom');
$this->select('event_type_id', "value={$params['event_type_id']}");
return $this->getLocation();
}
- function _fillRegisterWithBillingInfo() {
+ public function _fillRegisterWithBillingInfo() {
$this->waitForElementPresent('credit_card_type');
$this->select('credit_card_type', 'value=Visa');
$this->type('credit_card_number', '4111111111111111');
$this->waitForPageToLoad($this->getTimeoutMsec());
}
- function _checkConfirmationAndRegister() {
+ public function _checkConfirmationAndRegister() {
$confirmStrings = array('Event Fee(s)', 'Billing Name and Address', 'Credit Card Information');
$this->assertStringsPresent($confirmStrings);
$this->click('_qf_Confirm_next-bottom');
parent::setUp();
}
- function testAddEvent() {
+ public function testAddEvent() {
// Log in using webtestLogin() method
$this->webtestLogin('admin');
* @param $eventTitle
* @param $eventDescription
*/
- function _testAddEventInfo($eventTitle, $eventDescription) {
+ public function _testAddEventInfo($eventTitle, $eventDescription) {
$this->waitForElementPresent("_qf_EventInfo_upload-bottom");
$this->select("event_type_id", "value=1");
/**
* @param $streetAddress
*/
- function _testAddLocation($streetAddress) {
+ public function _testAddLocation($streetAddress) {
// Wait for Location tab form to load
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->waitForElementPresent("_qf_Location_upload-bottom");
* @param $registerIntro
* @param bool $multipleRegistrations
*/
- function _testAddOnlineRegistration($registerIntro, $multipleRegistrations = FALSE) {
+ public function _testAddOnlineRegistration($registerIntro, $multipleRegistrations = FALSE) {
// Go to Online Registration tab
$this->click("link=Online Registration");
$this->waitForElementPresent("_qf_Registration_upload-bottom");
* @param $thankYouMsg
* @param $eventTitle
*/
- function _testAddTellAFriend($subject, $thankYouMsg, $eventTitle) {
+ public function _testAddTellAFriend($subject, $thankYouMsg, $eventTitle) {
// Go to Tell A Friend Tab
$this->click('link=Tell a Friend');
$this->waitForElementPresent('_qf_Event_cancel-bottom');
parent::setUp();
}
- function testPrefixGenderSuffix(){
+ public function testPrefixGenderSuffix(){
$this->webtestLogin();
// Create new group
/**
* Test Contact Export.
*/
- function testContactExport() {
+ public function testContactExport() {
$this->webtestLogin();
// Create new group
$this->reviewCSV($csvFile, $checkHeaders, $checkRows, 2);
}
- function testMergeHousehold() {
+ public function testMergeHousehold() {
$this->webtestLogin();
// Create new group
*
* @return array
*/
- function webtestAddContactWithGenderPrefixSuffix($fname = 'Anthony', $lname = 'Anderson', $email = NULL, $contactSubtype = NULL) {
+ public function webtestAddContactWithGenderPrefixSuffix($fname = 'Anthony', $lname = 'Anderson', $email = NULL, $contactSubtype = NULL) {
$url = $this->sboxPath . 'civicrm/contact/add?reset=1&ct=Individual';
if ($contactSubtype) {
$url = $url . "&cst={$contactSubtype}";
*
* @return array|int
*/
- function getOptionLabel($optionGroupName,$optionValue){
+ public function getOptionLabel($optionGroupName,$optionValue){
$params = array(
'version' => 3,
'sequential' => 1,
*
* @return string downloaded file path.
*/
- function downloadCSV($selector, $fileName = 'CiviCRM_Contact_Search.csv', $downloadDir = '/tmp') {
+ public function downloadCSV($selector, $fileName = 'CiviCRM_Contact_Search.csv', $downloadDir = '/tmp') {
// File download path.
$file = "{$downloadDir}/{$fileName}";
* @param int $rowCount count rows (excluding header row).
* @param array $settings used for override settings.
*/
- function reviewCSV($file, $checkColumns = array(), $checkRows = array(), $rowCount = 0, $settings = array()) {
+ public function reviewCSV($file, $checkColumns = array(), $checkRows = array(), $rowCount = 0, $settings = array()) {
// Check file exists before proceed.
$this->assertTrue(($file && file_exists($file)), "Not able to locate {$file}.");
/**
* Test To Add Financial Account class attributes.
*/
- function testFinancialAccount() {
+ public function testFinancialAccount() {
$this->webtestLogin();
// Add new Financial Account
*/
class WebTest_Financial_FinancialAccountTypeTest extends CiviSeleniumTestCase {
- function testFinancialAccount() {
+ public function testFinancialAccount() {
// To Add Financial Account
// class attributes.
parent::setUp();
}
- function testAddFinancialBatch() {
+ public function testAddFinancialBatch() {
// Log in using webtestLogin() method
$this->webtestLogin('admin');
$this->openCiviPage("financial/batch", "reset=1&action=add", '_qf_FinancialBatch_next-botttom');
*
* @return null
*/
- function _testAddBatch($setTitle, $setDescription, $setPaymentInstrument, $numberOfTrxn, $totalAmt) {
+ public function _testAddBatch($setTitle, $setDescription, $setPaymentInstrument, $numberOfTrxn, $totalAmt) {
// Enter Optional Constraints
$this->type('title', $setTitle);
$this->type('description', $setDescription);
/**
* @param $numberOfTrxn
*/
- function _testAssignBatch($numberOfTrxn) {
+ public function _testAssignBatch($numberOfTrxn) {
$this->select( "xpath=//div[@id='crm-transaction-selector-assign_length']/label/select[@name='crm-transaction-selector-assign_length']", "value=$numberOfTrxn" );
// Because it tends to cause problems, all uses of sleep() must be justified in comments
// Sleep should never be used for wait for anything to load from the server
* @param int $batchId
* @param $exportFormat
*/
- function _testExportBatch($setTitle, $batchId, $exportFormat) {
+ public function _testExportBatch($setTitle, $batchId, $exportFormat) {
$this->openCiviPage("financial/batch", "reset=1&action=export&id=$batchId");
if ($exportFormat == 'CSV') {
$this->click("xpath=//form[@id='FinancialBatch']/div[2]/table[@class='form-layout']/tbody/tr/td/input[2]");
parent::setUp();
}
- function testCheckDashboardElements() {
+ public function testCheckDashboardElements() {
// Log in using webtestLogin() method
$this->webtestLogin();
parent::setUp();
}
- function testCheckDashboardElements() {
+ public function testCheckDashboardElements() {
$this->webtestLogin();
* @param $widgetEnabledSelector
* @param $widgetTitle
*/
- function _testAddDashboardElement($widgetConfigureID, $widgetEnabledSelector, $widgetTitle) {
+ public function _testAddDashboardElement($widgetConfigureID, $widgetEnabledSelector, $widgetTitle) {
// Check if desired widget is already loaded on dashboard and remove it if it is so we can test adding it.
// Because it tends to cause problems, all uses of sleep() must be justified in comments
// Sleep should never be used for wait for anything to load from the server
* @param int $widgetConfigureID
* @param $widgetEnabledSelector
*/
- function _testRemoveDashboardElement($widgetConfigureID, $widgetEnabledSelector) {
+ public function _testRemoveDashboardElement($widgetConfigureID, $widgetEnabledSelector) {
$this->click("link=Configure Your Dashboard");
$this->waitForElementPresent("dashlets-header-col-0");
$this->mouseDownAt("{$widgetConfigureID}", "");
$this->assertFalse($this->isElementPresent($widgetEnabledSelector));
}
- function _testActivityDashlet() {
+ public function _testActivityDashlet() {
// Add an activity that will show up in the widget
$this->WebtestAddActivity();
$widgetTitle = "Activities";
parent::setUp();
}
- function testCheckDashboardElements() {
+ public function testCheckDashboardElements() {
$this->webtestLogin();
$this->openCiviPage("contact/search", "reset=1", "_qf_Basic_refresh");
parent::setUp();
}
- function login() {
+ public function login() {
$this->webtestLogin();
$this->openCiviPage('');
}
- function testSearchMenu() {
+ public function testSearchMenu() {
$this->login();
// click Search -> Find Contacts
// Use class names for menu items since li array can change based on which components are enabled
$this->assertText('search-status', 'Tagged IN Major Donor');
}
- function testNewIndividual() {
+ public function testNewIndividual() {
$this->login();
// Create New → Individual
$this->assertTextPresent("Do not phone");
}
- function testManageGroups() {
+ public function testManageGroups() {
$this->login();
// Contacts → Manage Groups
$this->assertTextPresent("Add Group");
}
- function testContributionDashboard() {
+ public function testContributionDashboard() {
$this->webtestLogin();
// Enable CiviContribute module if necessary
$this->enableComponents("CiviContribute");
$this->assertTextPresent("Recent Contributions");
}
- function testEventDashboard() {
+ public function testEventDashboard() {
$this->webtestLogin();
// Enable CiviEvent module if necessary
$this->assertTextPresent("Configure");
}
- function testMembershipsDashboard() {
+ public function testMembershipsDashboard() {
$this->webtestLogin();
// Enable CiviMember module if necessary
$this->assertTextPresent("Find more members...");
}
- function testFindContributions() {
+ public function testFindContributions() {
$this->webtestLogin();
// Enable CiviContribute module if necessary
$this->assertTextPresent("Currency");
}
- function testNewMailing() {
+ public function testNewMailing() {
$this->webtestLogin();
// Enable CiviMail module if necessary
$this->assertElementPresent("excludeGroups");
}
- function testConstituentReportSummary() {
+ public function testConstituentReportSummary() {
$this->login();
// Constituent Report Summary
$this->assertTextPresent("Total Row(s)");
}
- function testCustomData() {
+ public function testCustomData() {
$this->login();
// Use class names for menu items since li array can change based on which components are enabled
$this->assertTextPresent("Post-form Help");
}
- function testProfile() {
+ public function testProfile() {
$this->login();
// Use class names for menu items since li array can change based on which components are enabled
$this->assertTextPresent("Proximity Search");
}
- function testTags() {
+ public function testTags() {
$this->login();
// Use class names for menu items since li array can change based on which components are enabled
$this->assertTextPresent("Volunteer");
}
- function testActivityTypes() {
+ public function testActivityTypes() {
$this->login();
// Use class names for menu items since li array can change based on which components are enabled
$this->assertTextPresent("Membership Signup");
}
- function testRelationshipTypes() {
+ public function testRelationshipTypes() {
$this->login();
// Use class names for menu items since li array can change based on which components are enabled
$this->assertTextPresent("Volunteer for");
}
- function testMessageTemplates() {
+ public function testMessageTemplates() {
$this->login();
// Use class names for menu items since li array can change based on which components are enabled
parent::setUp();
}
- function testContactContextAddTest() {
+ public function testContactContextAddTest() {
// Log in as admin first to verify permissions for CiviGrant
$this->webtestLogin('admin');
parent::setUp();
}
- function testCustomFieldsetTest() {
+ public function testCustomFieldsetTest() {
// Log in as admin first to verify permissions for CiviGrant
$this->webtestLogin('admin');
);
}
- function testAjaxCustomGroupLoad() {
+ public function testAjaxCustomGroupLoad() {
$this->webtestLogin();
// Enable CiviGrant module if necessary
parent::setUp();
}
- function testStandaloneGrantAdd() {
+ public function testStandaloneGrantAdd() {
// Log in as admin first to verify permissions for CiviGrant
$this->webtestLogin('admin');
parent::setUp();
}
- function testActivityImport() {
+ public function testActivityImport() {
$this->webtestLogin();
/**
* @return array
*/
- function _activityCSVData() {
+ public function _activityCSVData() {
$firstName1 = substr(sha1(rand()), 0, 7);
$email1 = 'mail_' . substr(sha1(rand()), 0, 7) . '@example.com';
parent::setUp();
}
- function testCustomAddressDataImport() {
+ public function testCustomAddressDataImport() {
$this->webtestLogin();
$firstName1 = 'Ma_' . substr(sha1(rand()), 0, 7);
*
* @return array
*/
- function _individualCustomCSVData($customDataParams, $firstName1) {
+ public function _individualCustomCSVData($customDataParams, $firstName1) {
$headers = array(
'first_name' => 'First Name',
/**
* @return array
*/
- function _addCustomData() {
+ public function _addCustomData() {
$this->openCiviPage('admin/custom/group', 'reset=1');
*
* @return array
*/
- function _createMultipleValueCustomField( $customFieldName, $type ){
+ public function _createMultipleValueCustomField( $customFieldName, $type ){
$this->type('label', $customFieldName);
$this->select("data_type[0]","value=0");
$this->select("data_type[1]","value=".$type);
/**
* Check for Valid Street Address
*/
- function testValidStreetAddressParsing() {
+ public function testValidStreetAddressParsing() {
$this->webtestLogin();
//Go to the URL of Address Setting to enable street address parsing option
/**
* Check for Invalid Street Address
*/
- function testInvalidStreetAddressParsing() {
+ public function testInvalidStreetAddressParsing() {
$this->webtestLogin();
//Go to the URL of Address Setting to enable street address parsing option
/**
* Check Street Address when Address Parsing is Disabled
*/
- function testStreetAddress() {
+ public function testStreetAddress() {
$this->webtestLogin();
//Go to the URL of Address Setting to enable street address parsing option
*
* @return array
*/
- function _validStreetAddressCSVData() {
+ public function _validStreetAddressCSVData() {
$headers = array(
'first_name' => 'First Name',
'middle_name' => 'Middle Name',
*
* @return array
*/
- function _invalidStreetAddressCSVData() {
+ public function _invalidStreetAddressCSVData() {
$headers = array(
'first_name' => 'First Name',
'middle_name' => 'Middle Name',
parent::setUp();
}
- function testCustomDataImport() {
+ public function testCustomDataImport() {
$this->webtestLogin();
$firstName1 = 'Ma_' . substr(sha1(rand()), 0, 7);
*
* @return array
*/
- function _individualCustomCSVData($customDataParams, $firstName1) {
+ public function _individualCustomCSVData($customDataParams, $firstName1) {
$headers = array(
'first_name' => 'First Name',
'last_name' => 'Last Name',
* @param $originalRows
* @param $checkSummary
*/
- function checkDuplicateContacts($originalHeaders, $originalRows, $checkSummary) {
+ public function checkDuplicateContacts($originalHeaders, $originalRows, $checkSummary) {
$this->assertTrue($this->isTextPresent('CiviCRM has detected one record which is a duplicate of existing CiviCRM contact record. These records have not been imported.'));
}
/**
* @return array
*/
- function _addCustomData() {
+ public function _addCustomData() {
$this->openCiviPage("admin/custom/group", "reset=1");
/*
* Test contact import for Individuals Subtype.
*/
- function testIndividualSubtypeImport() {
+ public function testIndividualSubtypeImport() {
$this->webtestLogin();
// Get sample import data.
/*
* Test contact import for Organization Subtype.
*/
- function testOrganizationSubtypeImport() {
+ public function testOrganizationSubtypeImport() {
$this->webtestLogin();
// Get sample import data.
/*
* Test contact import for Household Subtype.
*/
- function testHouseholdSubtypeImport() {
+ public function testHouseholdSubtypeImport() {
$this->webtestLogin();
// Create Household Subtype
/**
* @return string
*/
- function _createHouseholdSubtype() {
+ public function _createHouseholdSubtype() {
// Visit to create contact subtype
$this->openCiviPage("admin/options/subtype", "action=add&reset=1");
/**
* @return array
*/
- function _individualSubtypeCSVData() {
+ public function _individualSubtypeCSVData() {
$headers = array(
'first_name' => 'First Name',
'middle_name' => 'Middle Name',
/**
* @return array
*/
- function _organizationSubtypeCSVData() {
+ public function _organizationSubtypeCSVData() {
$headers = array(
'organization_name' => 'Organization Name',
'email' => 'Email',
/**
* @return array
*/
- function _householdSubtypeCSVData() {
+ public function _householdSubtypeCSVData() {
$headers = array(
'household_name' => 'Household Name',
'email' => 'Email',
/*
* Test contact import for Individuals.
*/
- function testIndividualImport() {
+ public function testIndividualImport() {
$this->webtestLogin();
// Get sample import data.
/*
* Test contact import for Organization.
*/
- function testOrganizationImport() {
+ public function testOrganizationImport() {
$this->webtestLogin();
/*
* Test contact import for Household.
*/
- function testHouseholdImport() {
+ public function testHouseholdImport() {
$this->webtestLogin();
/**
* @return array
*/
- function _individualCSVData() {
+ public function _individualCSVData() {
$headers = array(
'first_name' => 'First Name',
'middle_name' => 'Middle Name',
/**
* @return array
*/
- function _organizationCSVData() {
+ public function _organizationCSVData() {
$headers = array(
'organization_name' => 'Organization Name',
'email' => 'Email',
/**
* @return array
*/
- function _householdCSVData() {
+ public function _householdCSVData() {
$headers = array(
'household_name' => 'Household Name',
'email' => 'Email',
parent::setUp();
}
- function testContributionImportIndividual() {
+ public function testContributionImportIndividual() {
$this->webtestLogin();
$this->importCSVComponent('Contribution', $headers, $rows, 'Individual', 'Insert new contributions', $fieldMapper);
}
- function testContributionImportOrganization() {
+ public function testContributionImportOrganization() {
$this->webtestLogin();
$this->importCSVComponent('Contribution', $headers, $rows, 'Organization', 'Insert new contributions', $fieldMapper);
}
- function testContributionImportHousehold() {
+ public function testContributionImportHousehold() {
$this->webtestLogin();
/**
* @return array
*/
- function _contributionIndividualCSVData() {
+ public function _contributionIndividualCSVData() {
$firstName1 = substr(sha1(rand()), 0, 7);
$email1 = 'mail_' . substr(sha1(rand()), 0, 7) . '@example.com';
$this->webtestAddContact($firstName1, 'Anderson', $email1);
/**
* @return array
*/
- function _contributionHouseholdCSVData() {
+ public function _contributionHouseholdCSVData() {
$household1 = substr(sha1(rand()), 0, 7) . ' home';
$this->webtestAddHousehold($household1, TRUE);
/**
* @return array
*/
- function _contributionOrganizationCSVData() {
+ public function _contributionOrganizationCSVData() {
$organization1 = substr(sha1(rand()), 0, 7) . ' org';
$this->webtestAddOrganization($organization1, TRUE);
parent::setUp();
}
- function testCustomDataImport() {
+ public function testCustomDataImport() {
$this->webtestLogin();
$firstName1 = 'Ma_' . substr(sha1(rand()), 0, 7);
*
* @return array
*/
- function _individualCustomCSVData($customGroupTitle, $firstName1, $firstName2, $id1, $id2) {
+ public function _individualCustomCSVData($customGroupTitle, $firstName1, $firstName2, $id1, $id2) {
list($customDataParams, $customDataVerify) = $this->_addCustomData($customGroupTitle, $id1, $id2);
$headers = array(
*
* @return array
*/
- function _addCustomData($customGroupTitle, $id1, $id2) {
+ public function _addCustomData($customGroupTitle, $id1, $id2) {
$this->openCiviPage("admin/custom/group", "reset=1");
/*
* Test contact import for yyyy_mm_dd date format.
*/
- function testDateFormat_yyyy_mm_dd() {
+ public function testDateFormat_yyyy_mm_dd() {
$this->webtestLogin();
// Get sample import data.
/*
* Test contact import for mm_dd_yy date format.
*/
- function testDateFormat_mm_dd_yy() {
+ public function testDateFormat_mm_dd_yy() {
$this->webtestLogin();
// Get sample import data.
/*
* Test contact import for mm_dd_yyyy date format.
*/
- function testDateFormat_mm_dd_yyyy() {
+ public function testDateFormat_mm_dd_yyyy() {
// Logging in. Remember to wait for page to load. In most cases,
// you can rely on 30000 as the value that allows your test to pass, however,
// sometimes your test might fail because of this. In such cases, it's better to pick one element
/*
* Test contact import for Month_dd_yyyy date format.
*/
- function testDateFormat_Month_dd_yyyy() {
+ public function testDateFormat_Month_dd_yyyy() {
// Logging in. Remember to wait for page to load. In most cases,
// you can rely on 30000 as the value that allows your test to pass, however,
// sometimes your test might fail because of this. In such cases, it's better to pick one element
/*
* Test contact import for dd_mon_yy date format.
*/
- function testDateFormat_dd_mon_yy() {
+ public function testDateFormat_dd_mon_yy() {
// Logging in. Remember to wait for page to load. In most cases,
// you can rely on 30000 as the value that allows your test to pass, however,
// sometimes your test might fail because of this. In such cases, it's better to pick one element
/*
* Test contact import for dd_mm_yyyy date format.
*/
- function testDateFormat_dd_mm_yyyy() {
+ public function testDateFormat_dd_mm_yyyy() {
// Logging in. Remember to wait for page to load. In most cases,
// you can rely on 30000 as the value that allows your test to pass, however,
// sometimes your test might fail because of this. In such cases, it's better to pick one element
/**
* @return array
*/
- function _individualCSVData_yyyy_mm_dd() {
+ public function _individualCSVData_yyyy_mm_dd() {
$headers = array(
'first_name' => 'First Name',
'middle_name' => 'Middle Name',
/**
* @return array
*/
- function _individualCSVData_mm_dd_yy() {
+ public function _individualCSVData_mm_dd_yy() {
$headers = array(
'first_name' => 'First Name',
'middle_name' => 'Middle Name',
/**
* @return array
*/
- function _individualCSVData_mm_dd_yyyy() {
+ public function _individualCSVData_mm_dd_yyyy() {
$headers = array(
'first_name' => 'First Name',
'middle_name' => 'Middle Name',
/**
* @return array
*/
- function _individualCSVData_Month_dd_yyyy() {
+ public function _individualCSVData_Month_dd_yyyy() {
$headers = array(
'first_name' => 'First Name',
'middle_name' => 'Middle Name',
/**
* @return array
*/
- function _individualCSVData_dd_mon_yy() {
+ public function _individualCSVData_dd_mon_yy() {
$headers = array(
'first_name' => 'First Name',
'middle_name' => 'Middle Name',
/**
* @return array
*/
- function _individualCSVData_dd_mm_yyyy() {
+ public function _individualCSVData_dd_mm_yyyy() {
$headers = array(
'first_name' => 'First Name',
'middle_name' => 'Middle Name',
/*
* Test contact import for Individuals Duplicate Matching.
*/
- function testIndividualDuplicateMatchingImport() {
+ public function testIndividualDuplicateMatchingImport() {
$this->webtestLogin();
$this->openCiviPage("contact/add", "reset=1&ct=Individual", 'first_name');
/*
* Test contact import for Organization Duplicate Matching.
*/
- function testOrganizationDuplicateMatchingImport() {
+ public function testOrganizationDuplicateMatchingImport() {
$this->webtestLogin();
//create oranization
/*
* Test contact import for Household Duplicate Matching.
*/
- function testHouseholdDuplicateMatchingImport() {
+ public function testHouseholdDuplicateMatchingImport() {
$this->webtestLogin();
// create household
* @param $originalRows
* @param $checkSummary
*/
- function checkDuplicateContacts($originalHeaders, $originalRows, $checkSummary) {
+ public function checkDuplicateContacts($originalHeaders, $originalRows, $checkSummary) {
$this->assertTrue($this->isTextPresent('CiviCRM has detected one record which is a duplicate of existing CiviCRM contact record. These records have not been imported.'));
$checkSummary = array(
*
* @return array
*/
- function _individualDuplicateMatchingCSVData($individualFields) {
+ public function _individualDuplicateMatchingCSVData($individualFields) {
$headers = array(
'first_name' => 'First Name',
'middle_name' => 'Middle Name',
*
* @return array
*/
- function _organizationDuplicateMatchingCSVData($organizationFields) {
+ public function _organizationDuplicateMatchingCSVData($organizationFields) {
$headers = array(
'organization_name' => 'Organization Name',
'email' => 'Email',
*
* @return array
*/
- function _householdDuplicateMatchingCSVData($householdFields) {
+ public function _householdDuplicateMatchingCSVData($householdFields) {
$headers = array(
'household_name' => 'Household Name',
'email' => 'Email',
/**
* Test contact import for Individuals.
*/
- function testIndividualImportWithGroup() {
+ public function testIndividualImportWithGroup() {
$this->webtestLogin();
// Get sample import data.
*
* @return array
*/
- function _individualGroupCSVData() {
+ public function _individualGroupCSVData() {
$headers = array(
'first_name' => 'First Name',
'middle_name' => 'Middle Name',
* @param string $type import type (csv/sql)
* @todo:currently only supports csv, need to work on sql import
*/
- function importContacts($headers, $rows, $contactType = 'Individual', $mode = 'Skip', $fieldMapper = array(), $other = array(), $type = 'csv') {
+ public function importContacts($headers, $rows, $contactType = 'Individual', $mode = 'Skip', $fieldMapper = array(), $other = array(), $type = 'csv') {
// Go to contact import page.
$this->openCiviPage("import/contact", "reset=1", "uploadFile");
*
* @return string
*/
- function _getImportComponentContactType($component, $contactType) {
+ public function _getImportComponentContactType($component, $contactType) {
$importComponentMode = array(
'Event' => array(
'Individual' => 'CIVICRM_QFID_1_8',
* @param array $checkMapperHeaders
* @param string $headerSelector
*/
- function _checkImportMapperData($headers, $rows, $existingMapping = NULL, $checkMapperHeaders = array(), $headerSelector = 'th') {
+ public function _checkImportMapperData($headers, $rows, $existingMapping = NULL, $checkMapperHeaders = array(), $headerSelector = 'th') {
if (empty($checkMapperHeaders)) {
$checkMapperHeaders = array(
*
* @return array $contactIds imported contact ids
*/
- function _getImportedContactIds($rows, $contactType = 'Individual') {
+ public function _getImportedContactIds($rows, $contactType = 'Individual') {
$contactIds = array();
foreach ($rows as $row) {
* @param array $headers
* @param array $rows
*/
- function _formatContactCSVdata(&$headers, &$rows) {
+ public function _formatContactCSVdata(&$headers, &$rows) {
if (!isset($headers['contact_relationships'])) {
return;
}
/**
* Test participant import for Individuals matching on external identifier.
*/
- function testContributionImport() {
+ public function testContributionImport() {
$this->webtestLogin();
// Get sample import data.
/**
* Test membership import for Individuals matching on external identifier.
*/
- function testMemberImportIndividual() {
+ public function testMemberImportIndividual() {
$this->webtestLogin();
// Get membership import data for Individuals.
/**
* Test participant import for Individuals matching on external identifier.
*/
- function testParticipantImportIndividual() {
+ public function testParticipantImportIndividual() {
// Log in using webtestLogin() method
$this->webtestLogin();
*
* @return array
*/
- function _contributionIndividualCSVData() {
+ public function _contributionIndividualCSVData() {
$firstName1 = substr(sha1(rand()), 0, 7);
$lastName1 = substr(sha1(rand()), 0, 7);
$externalId1 = substr(sha1(rand()), 0, 4);
*
* @return array
*/
- function _memberIndividualCSVData() {
+ public function _memberIndividualCSVData() {
$memTypeParams = $this->webtestAddMembershipType();
$firstName1 = substr(sha1(rand()), 0, 7);
*
* @return array
*/
- function _participantIndividualCSVData() {
+ public function _participantIndividualCSVData() {
$eventInfo = $this->_addNewEvent();
$firstName1 = substr(sha1(rand()), 0, 7);
*
* @return int external id
*/
- function _addContact($firstName, $lastName, $externalId) {
+ public function _addContact($firstName, $lastName, $externalId) {
$this->openCiviPage('contact/add', 'reset=1&ct=Individual');
//fill in first name
*
* @return array event details of newly created event
*/
- function _addNewEvent($params = array()) {
+ public function _addNewEvent($params = array()) {
if (empty($params)) {
// Use default payment processor
/**
* Test participant import for Individuals.
*/
- function testMemberImportIndividual() {
+ public function testMemberImportIndividual() {
$this->webtestLogin();
/**
* Test participant import for Households.
*/
- function testMemberImportHousehold() {
+ public function testMemberImportHousehold() {
$this->webtestLogin();
/**
* Test participant import for Organizations.
*/
- function testMemberImportOrganization() {
+ public function testMemberImportOrganization() {
$this->webtestLogin();
*
* @return array
*/
- function _memberIndividualCSVData() {
+ public function _memberIndividualCSVData() {
$memTypeParams = $this->webtestAddMembershipType();
$firstName1 = substr(sha1(rand()), 0, 7);
*
* @return array
*/
- function _memberHouseholdCSVData() {
+ public function _memberHouseholdCSVData() {
$memTypeParams = $this->webtestAddMembershipType();
$household1 = substr(sha1(rand()), 0, 7) . ' home';
*
* @return array
*/
- function _memberOrganizationCSVData() {
+ public function _memberOrganizationCSVData() {
$memTypeParams = $this->webtestAddMembershipType();
$organization1 = substr(sha1(rand()), 0, 7) . ' org';
/*
* Test Multiple Relationship import for Individuals.
*/
- function testMultipleRelationshipImport() {
+ public function testMultipleRelationshipImport() {
$this->webtestLogin();
// Get sample import data.
/**
* @return array
*/
- function _individualRelationshipCSVData() {
+ public function _individualRelationshipCSVData() {
$headers = array(
'first_name' => 'First Name',
/**
* Test participant import for Individuals.
*/
- function testParticipantImportIndividual() {
+ public function testParticipantImportIndividual() {
// Log in using webtestLogin() method
$this->webtestLogin();
/**
* Test participant import for Organizations.
*/
- function testParticipantImportOrganization() {
+ public function testParticipantImportOrganization() {
// Log in using webtestLogin() method
$this->webtestLogin();
/**
* Test participant import for Households.
*/
- function testParticipantImportHousehold() {
+ public function testParticipantImportHousehold() {
// Log in using webtestLogin() method
$this->webtestLogin();
*
* @return array
*/
- function _participantIndividualCSVData() {
+ public function _participantIndividualCSVData() {
$eventInfo = $this->_addNewEvent();
$firstName1 = substr(sha1(rand()), 0, 7);
*
* @return array
*/
- function _participantHouseholdCSVData() {
+ public function _participantHouseholdCSVData() {
$eventInfo = $this->_addNewEvent();
$household1 = substr(sha1(rand()), 0, 7) . ' home';
* Helper function to provide data for participant import for Organization.
* @return array
*/
- function _participantOrganizationCSVData() {
+ public function _participantOrganizationCSVData() {
$eventInfo = $this->_addNewEvent();
$organization1 = substr(sha1(rand()), 0, 7) . ' org';
*
* @return array $params event details of newly created event
*/
- function _addNewEvent($params = array()) {
+ public function _addNewEvent($params = array()) {
if (empty($params)) {
/**
* Test Saved Import Mapping for Individuals.
*/
- function testSaveIndividualMapping() {
+ public function testSaveIndividualMapping() {
// Logging in.
$this->webtestLogin();
*
* @return array
*/
- function _individualCSVData() {
+ public function _individualCSVData() {
$headers = array(
'individual_prefix' => 'Individual Prefix',
'first_name' => 'First Name',
/*
* Test contact import for Individuals.
*/
- function testContactImportWithTag() {
+ public function testContactImportWithTag() {
$this->webtestLogin();
// Get sample import data.
*
* @return array
*/
- function _contactTagCSVData() {
+ public function _contactTagCSVData() {
$headers = array(
'first_name' => 'First Name',
'middle_name' => 'Middle Name',
* @param bool $useTokens
* @param null $msgTitle
*/
- function testTemplateAdd($useTokens = FALSE, $msgTitle = NULL) {
+ public function testTemplateAdd($useTokens = FALSE, $msgTitle = NULL) {
$this->webtestLogin();
$this->openCiviPage("admin/messageTemplates/add", "action=add&reset=1");
}
}
- function testAddMailingWithMessageTemplate() {
+ public function testAddMailingWithMessageTemplate() {
// Call the above test to set up our environment
$msgTitle = 'msg_' . substr(sha1(rand()), 0, 7);
$this->testTemplateAdd(TRUE, $msgTitle);
parent::setUp();
}
- function testHeaderAdd() {
+ public function testHeaderAdd() {
$this->webtestLogin();
$this->openCiviPage("admin/component", "action=add&reset=1");
$this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[text()='{$componentName}']/../td[2][text()='Header']/../td[3][text()='{$subject}']/../td[4][text()='{$txtMsg}']/../td[5][text()='{$htmlMsg}']"), "The row doesn't consists of proper component details");
}
- function testFooterAdd() {
+ public function testFooterAdd() {
$this->webtestLogin();
$this->openCiviPage("admin/component", "action=add&reset=1");
$this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[text()='{$componentName}']/../td[2][text()='Footer']/../td[3][text()='{$subject}']/../td[4][text()='{$txtMsg}']/../td[5][text()='{$htmlMsg}']"), "The row doesn't consists of proper component details");
}
- function testAutomatedAdd() {
+ public function testAutomatedAdd() {
$this->webtestLogin();
$this->openCiviPage("admin/component", "action=add&reset=1");
parent::setUp();
}
- function testAddMailing() {
+ public function testAddMailing() {
$this->webtestLogin();
//----do create test mailing group
// //------ end unsubscribe -------
}
- function testAdvanceSearchAndReportCheck() {
+ public function testAdvanceSearchAndReportCheck() {
$this->webtestLogin();
* @param $criteriaCheck
* @param $mailingReportUrl
*/
- function criteriaCheck($criteriaCheck, $mailingReportUrl) {
+ public function criteriaCheck($criteriaCheck, $mailingReportUrl) {
foreach($criteriaCheck as $key => $infoFilter) {
foreach($infoFilter as $entity => $dataToCheck) {
$this->open($mailingReportUrl);
* @param $dataToCheck
* @param $entity
*/
- function _verifyCriteria($summaryInfo, $dataToCheck, $entity) {
+ public function _verifyCriteria($summaryInfo, $dataToCheck, $entity) {
foreach($dataToCheck as $key => $value) {
if ($entity == 'report') {
if ($key == 'report_name') {
parent::setUp();
}
- function testSpooledMailing() {
+ public function testSpooledMailing() {
$this->webtestLogin();
parent::setUp();
}
- function testMemberAdd() {
+ public function testMemberAdd() {
// Log in using webtestLogin() method
$this->webtestLogin();
/**
* @param array $memTypeParams
*/
- function _addMembership($memTypeParams) {
+ public function _addMembership($memTypeParams) {
// click through to the membership view screen
$this->click("css=li#tab_member a");
$this->waitForElementPresent("link=Add Membership");
* @param $profileTitle
* @param array $customDataParams
*/
- function _addProfile($profileTitle, $customDataParams) {
+ public function _addProfile($profileTitle, $customDataParams) {
$this->openCiviPage("admin/uf/group", "reset=1");
/**
* @return array
*/
- function _addCustomData() {
+ public function _addCustomData() {
$customGroupTitle = 'Custom_' . substr(sha1(rand()), 0, 4);
$this->openCiviPage('admin/custom/group', 'reset=1');
parent::setUp();
}
- function testContactMemberAdd() {
+ public function testContactMemberAdd() {
$this->webtestLogin();
// Create a membership type to use for this test (defaults for this helper function are rolling 1 year membership)
$this->webtestVerifyTabularData($verifyData);
}
- function testMemberAddWithLifeTimeMembershipType() {
+ public function testMemberAddWithLifeTimeMembershipType() {
$this->webtestLogin();
// Create a membership type to use for this test (defaults for this helper function are rolling 1 year membership)
parent::setUp();
}
- function testDefaultPricesetSelection() {
+ public function testDefaultPricesetSelection() {
// Log in using webtestLogin() method
$this->webtestLogin();
* @param array $contactParams
* @param $streetAddress
*/
- function contactInfoFill($firstName, $lastName, $email, $contactParams, $streetAddress) {
+ public function contactInfoFill($firstName, $lastName, $email, $contactParams, $streetAddress) {
//Credit Card Info
$this->select("credit_card_type", "value=Visa");
$this->type("credit_card_number", "4111111111111111");
* @param $priceSetSection
* @param $optionNumber
*/
- function checkOptions($priceSetSection, $optionNumber) {
+ public function checkOptions($priceSetSection, $optionNumber) {
$this->assertChecked("xpath=//div[@id='priceset']/div[@class='crm-section {$priceSetSection}']/div[2]/div[{$optionNumber}]/span/input");
}
* @param $priceSetSection
* @param $optionNumber
*/
- function _testDefaultSenarios($priceSetSection, $optionNumber) {
+ public function _testDefaultSenarios($priceSetSection, $optionNumber) {
$this->click("xpath=//div[@id='priceset']/div[@class='crm-section {$priceSetSection}']/div[2]/div[{$optionNumber}]/span/input");
}
* @param null $contributionType
* @param $setHelp
*/
- function _testAddSet($setTitle, $usedFor, $contributionType = NULL, $setHelp) {
+ public function _testAddSet($setTitle, $usedFor, $contributionType = NULL, $setHelp) {
$this->openCiviPage("admin/price", "reset=1&action=add", '_qf_Set_next-bottom');
// Enter Priceset fields (Title, Used For ...)
*
* @return array
*/
- function _testAddPriceFields(&$fields, &$validateString, $dateSpecificFields = FALSE, $title, $sid, $defaultPriceSet = FALSE, $contributionType) {
+ public function _testAddPriceFields(&$fields, &$validateString, $dateSpecificFields = FALSE, $title, $sid, $defaultPriceSet = FALSE, $contributionType) {
if ($defaultPriceSet) {
$memTypeTitle1 = 'General';
parent::setUp();
}
- function testEditMembershipActivityTypes() {
+ public function testEditMembershipActivityTypes() {
// Log in using webtestLogin() method
$this->webtestLogin();
// create contact
parent::setUp();
}
- function testMembershipTypeScenario1() {
+ public function testMembershipTypeScenario1() {
// Scenario 1
// Rollover Date < Start Date
// Join Date > Rollover Date and Join Date < Start Date
);
}
- function testMembershipTypeScenario2() {
+ public function testMembershipTypeScenario2() {
// Scenario 2
// Rollover Date < Join Date
);
}
- function testMembershipTypeScenario3() {
+ public function testMembershipTypeScenario3() {
// Scenario 3
// Standard Fixed scenario - Jan 1 Fixed Period Start and October 31 rollover
// Join Date is later than Rollover Date
);
}
- function testMembershipTypeScenario4() {
+ public function testMembershipTypeScenario4() {
// Scenario 4
// Standard Fixed scenario - Jan 1 Fixed Period Start and October 31 rollover
// Join Date is earlier than Rollover Date
parent::setUp();
}
- function testInheritedMembership() {
+ public function testInheritedMembership() {
// Log in using webtestLogin() method
$this->webtestLogin();
* Webtest for CRM-10146
*
*/
- function testInheritedMembershipActivity() {
+ public function testInheritedMembershipActivity() {
// Log in using webtestLogin() method
$this->webtestLogin();
parent::setUp();
}
- function testOfflineAutoRenewMembership() {
+ public function testOfflineAutoRenewMembership() {
$this->webtestLogin();
// We need a payment processor
parent::setUp();
}
- function testAddPriceSet() {
+ public function testAddPriceSet() {
// Log in using webtestLogin() method
$this->webtestLogin();
$this->_testSignUpOrRenewMembership($sid, $contactParams, $memTypeTitle1, $memTypeTitle2, $renew = TRUE);
}
- function testAddPriceSetWithMultipleTerms() {
+ public function testAddPriceSetWithMultipleTerms() {
// Log in using webtestLogin() method
$this->webtestLogin();
* @param null $contributionType
* @param $setHelp
*/
- function _testAddSet($setTitle, $usedFor, $contributionType = NULL, $setHelp) {
+ public function _testAddSet($setTitle, $usedFor, $contributionType = NULL, $setHelp) {
$this->openCiviPage('admin/price', 'reset=1&action=add', '_qf_Set_next-bottom');
// Enter Priceset fields (Title, Used For ...)
*
* @return array
*/
- function _testAddPriceFields(&$fields, &$validateString, $dateSpecificFields = FALSE, $title, $sid, $contributionType) {
+ public function _testAddPriceFields(&$fields, &$validateString, $dateSpecificFields = FALSE, $title, $sid, $contributionType) {
$memTypeParams1 = $this->webtestAddMembershipType();
$memTypeTitle1 = $memTypeParams1['membership_type'];
* @param $validateStrings
* @param int $sid
*/
- function _testVerifyPriceSet($validateStrings, $sid) {
+ public function _testVerifyPriceSet($validateStrings, $sid) {
// verify Price Set at Preview page
// start at Manage Price Sets listing
$this->openCiviPage('admin/price', 'reset=1');
* @param $memTypeTitle2
* @param bool $renew
*/
- function _testSignUpOrRenewMembership($sid, $contactParams, $memTypeTitle1, $memTypeTitle2, $renew = FALSE) {
+ public function _testSignUpOrRenewMembership($sid, $contactParams, $memTypeTitle1, $memTypeTitle2, $renew = FALSE) {
//build the membership dates.
require_once 'CRM/Core/Config.php';
require_once 'CRM/Utils/Array.php';
* @param $memTypeTitle1
* @param $term
*/
- function _testMultilpeTermsMembershipRegistration($sid, $contactParams, $memTypeTitle1, $term){
+ public function _testMultilpeTermsMembershipRegistration($sid, $contactParams, $memTypeTitle1, $term){
//build the membership dates.
require_once 'CRM/Core/Config.php';
require_once 'CRM/Utils/Array.php';
parent::setUp();
}
- function testOfflineMembershipRenew() {
+ public function testOfflineMembershipRenew() {
$this->webtestLogin();
// make sure period is correct for the membership type we testing for,
$this->webtestVerifyTabularData($verifyMembershipRenewData);
}
- function testOfflineMemberRenewOverride() {
+ public function testOfflineMemberRenewOverride() {
$this->webtestLogin();
// add membership type
$this->webtestVerifyTabularData($verifyMembershipRenewOverrideData);
}
- function testOfflineMembershipRenewChangeType() {
+ public function testOfflineMembershipRenewChangeType() {
$this->webtestLogin();
// make sure period is correct for the membership type we testing for,
$this->webtestVerifyTabularData($verifyMembershipData);
}
- function testOfflineMembershipRenewMultipleTerms() {
+ public function testOfflineMembershipRenewMultipleTerms() {
$this->webtestLogin();
// make sure period is correct for the membership type we testing for,
parent::setUp();
}
- function testOnlineAutoRenewMembershipAnonymous() {
+ public function testOnlineAutoRenewMembershipAnonymous() {
//configure membership signup page.
$pageId = $this->_configureMembershipPage();
// has changed a bit. No point in adding test for external page as we 'll test with fake transactions.
}
- function testOnlineAutoRenewMembershipAuthenticated() {
+ public function testOnlineAutoRenewMembershipAuthenticated() {
//configure membership signup page.
$pageId = $this->_configureMembershipPage();
/**
* @return null
*/
- function _configureMembershipPage() {
+ public function _configureMembershipPage() {
static $pageId = NULL;
if (!$pageId) {
parent::setUp();
}
- function testOnlineAutoRenewMembershipAnonymous() {
+ public function testOnlineAutoRenewMembershipAnonymous() {
//configure membership signup page.
$pageId = $this->_configureMembershipPage();
$this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]/strong[3]", $text, 'Missing text: ' . $text);
}
- function testOnlineAutoRenewMembershipAuthenticated() {
+ public function testOnlineAutoRenewMembershipAuthenticated() {
//configure membership signup page.
$pageId = $this->_configureMembershipPage();
$this->assertElementContainsText("xpath=//div[@class='crm-group amount_display-group']/div[2]/strong[3]", $text, 'Missing text: ' . $text);
}
- function testOnlinePendingAutoRenewMembershipAnonymous() {
+ public function testOnlinePendingAutoRenewMembershipAnonymous() {
//configure membership signup page.
$pageId = $this->_configureMembershipPage();
/**
* @return null
*/
- function _configureMembershipPage() {
+ public function _configureMembershipPage() {
static $pageId = NULL;
if (!$pageId) {
parent::setUp();
}
- function testAddPriceSet() {
+ public function testAddPriceSet() {
// add the required permission
$permissions = array('edit-1-make-online-contributions');
$this->changePermissions($permissions);
$this->_testSignUpOrRenewMembership($pageId, $contactParams, $memTypeTitle1, $memTypeTitle2, $renew = TRUE);
}
- function testAddPriceSetWithMultipleTerms() {
+ public function testAddPriceSetWithMultipleTerms() {
// add the required permission
$permissions = array('edit-1-make-online-contributions');
$this->changePermissions($permissions);
* @param null $contributionType
* @param $setHelp
*/
- function _testAddSet($setTitle, $usedFor, $contributionType = NULL, $setHelp) {
+ public function _testAddSet($setTitle, $usedFor, $contributionType = NULL, $setHelp) {
$this->openCiviPage('admin/price', 'reset=1&action=add', '_qf_Set_next-bottom');
// Enter Priceset fields (Title, Used For ...)
*
* @return array
*/
- function _testAddPriceFields(&$fields, &$validateString, $dateSpecificFields = FALSE, $title, $sid, $contributionType) {
+ public function _testAddPriceFields(&$fields, &$validateString, $dateSpecificFields = FALSE, $title, $sid, $contributionType) {
$memTypeParams1 = $this->webtestAddMembershipType();
$memTypeTitle1 = $memTypeParams1['membership_type'];
$memTypeId1 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/table/tbody//tr/td[1][text()='{$memTypeTitle1}']/../td[12]/span/a[3]@href"));
* @param $validateStrings
* @param int $sid
*/
- function _testVerifyPriceSet($validateStrings, $sid) {
+ public function _testVerifyPriceSet($validateStrings, $sid) {
// verify Price Set at Preview page
// start at Manage Price Sets listing
$this->openCiviPage('admin/price', 'reset=1');
* @param $memTypeTitle2
* @param bool $renew
*/
- function _testSignUpOrRenewMembership($pageId, $contactParams, $memTypeTitle1, $memTypeTitle2, $renew = FALSE) {
+ public function _testSignUpOrRenewMembership($pageId, $contactParams, $memTypeTitle1, $memTypeTitle2, $renew = FALSE) {
$this->webtestLogout();
$this->openCiviPage('contribute/transact', "reset=1&id=$pageId", '_qf_Main_upload-bottom');
* @param $term
* @param bool $renew
*/
- function _testMultilpeTermsMembershipRegistration($pageId, $contactParams, $memTypeTitle1, $term, $renew = FALSE){
+ public function _testMultilpeTermsMembershipRegistration($pageId, $contactParams, $memTypeTitle1, $term, $renew = FALSE){
if($renew){
$this->openCiviPage('member/search', 'reset=1', 'member_end_date_high');
$this->type("sort_name", "{$contactParams['first_name']} {$contactParams['last_name']}");
parent::setUp();
}
- function testOnlineMembershipCreate() {
+ public function testOnlineMembershipCreate() {
//check for online contribution and profile listings permissions
$permissions = array("edit-1-make-online-contributions", "edit-1-profile-listings-and-forms");
$this->changePermissions($permissions);
* @param $hash
* @param bool $otherAmount
*/
- function _testOnlineMembershipSignup($pageId, $memTypeId, $firstName, $lastName, $payLater, $hash, $otherAmount = FALSE) {
+ public function _testOnlineMembershipSignup($pageId, $memTypeId, $firstName, $lastName, $payLater, $hash, $otherAmount = FALSE) {
//Open Live Contribution Page
$this->openCiviPage("contribute/transact", "reset=1&id=$pageId", "_qf_Main_upload-bottom");
// Select membership type 1
$this->waitForPageToLoad($this->getTimeoutMsec());
}
- function testOnlineMembershipCreateWithContribution() {
+ public function testOnlineMembershipCreateWithContribution() {
//login with admin credentials & make sure we do have required permissions.
$permissions = array("edit-1-make-online-contributions", "edit-1-profile-listings-and-forms");
$this->changePermissions($permissions);
/**
* FIXME: This test tries to update a contribution page (id=2) that may not exist :(
*/
- function testOnlineMembershipRenew() {
+ public function testOnlineMembershipRenew() {
// a random 7-char string and an even number to make this pass unique
$hash = substr(sha1(rand()), 0, 7);
$rand = 2 * rand(2, 50);
/**
* FIXME: This test tries to update a contribution page (id=2) that may not exist :(
*/
- function testOnlineMembershipRenewChangeType() {
+ public function testOnlineMembershipRenewChangeType() {
// a random 7-char string and an even number to make this pass unique
$hash = substr(sha1(rand()), 0, 7);
$rand = 2 * rand(2, 50);
$this->assertEquals($membershipCreatedId, $membershipRenewedId);
}
- function testUpdateInheritedMembershipOnBehalfOfRenewal() {
+ public function testUpdateInheritedMembershipOnBehalfOfRenewal() {
// Log in as admin
$this->webtestLogin('admin');
parent::setUp();
}
- function testSeperateMembershipCreate() {
+ public function testSeperateMembershipCreate() {
// a random 7-char string and an even number to make this pass unique
$hash = substr(sha1(rand()), 0, 7);
$rand = 2 * rand(2, 50);
* @param int $memTypeId
* @param int $cid
*/
- function _testOnlineMembershipSignup($pageId, $memTypeId, $cid = NULL) {
+ public function _testOnlineMembershipSignup($pageId, $memTypeId, $cid = NULL) {
//Open Live Contribution Page
$args = array('reset' => 1, 'id' => $pageId);
if ($cid) {
parent::setUp();
}
- function testStandaloneMemberAdd() {
+ public function testStandaloneMemberAdd() {
$this->webtestLogin();
$this->webtestVerifyTabularData($expected);
}
- function testStandaloneGiftMembership() {
+ public function testStandaloneGiftMembership() {
$this->webtestLogin();
}
- function testStandaloneMemberOverrideAdd() {
+ public function testStandaloneMemberOverrideAdd() {
$this->webtestLogin();
$this->webtestVerifyTabularData($expected);
}
- function testAjaxCustomGroupLoad() {
+ public function testAjaxCustomGroupLoad() {
$this->webtestLogin();
$triggerElement = array('name' => 'membership_type_id_1', 'type' => 'select');
$customSets = array(
parent::setUp();
}
- function testAddMembership() {
+ public function testAddMembership() {
// Log in using webtestLogin() method
$this->webtestLogin();
/**
* @return array
*/
- function addMembershipType() {
+ public function addMembershipType() {
$membershipTitle = substr(sha1(rand()), 0, 7);
$membershipOrg = $membershipTitle . ' memorg';
$this->webtestAddOrganization($membershipOrg, TRUE);
parent::setUp();
}
- function testAddCancelPayment() {
+ public function testAddCancelPayment() {
$this->webtestLogin();
$this->openCiviPage('pledge/add', 'reset=1&context=standalone', '_qf_Pledge_upload');
parent::setUp();
}
- function testContactContextAddTest() {
+ public function testContactContextAddTest() {
$this->webtestLogin();
// Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg
$this->enableDisablePopups(FALSE);
parent::setUp();
}
- function testAddPledgePaymentWithAdjustPledgePaymentSchedule() {
+ public function testAddPledgePaymentWithAdjustPledgePaymentSchedule() {
$this->webtestLogin();
$this->openCiviPage('admin/setting/localization', 'reset=1');
$this->select("currencyLimit-f","value=FJD");
$this->enableDisablePopups(TRUE);
}
- function testAddPledgePaymentWithAdjustTotalPledgeAmount() {
+ public function testAddPledgePaymentWithAdjustTotalPledgeAmount() {
$this->webtestLogin();
// Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg
$this->enableDisablePopups(FALSE);
$this->enableDisablePopups(TRUE);
}
- function testAddPledgePayment() {
+ public function testAddPledgePayment() {
$this->webtestLogin();
// Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg
$this->enableDisablePopups(FALSE);
parent::setUp();
}
- function testStandalonePledgeAddDelete() {
+ public function testStandalonePledgeAddDelete() {
$this->webtestLogin();
$this->openCiviPage('pledge/add', 'reset=1&context=standalone', '_qf_Pledge_upload');
parent::setUp();
}
- function testStandalonePledgeAdd() {
+ public function testStandalonePledgeAdd() {
$this->webtestLogin();
$this->openCiviPage('pledge/add', 'reset=1&context=standalone', '_qf_Pledge_upload');
parent::setUp();
}
- function testBatchUpdateWithContactSubtypes() {
+ public function testBatchUpdateWithContactSubtypes() {
// Log in using webtestLogin() method
$this->webtestLogin();
$this->verifyText($xpath, preg_quote("Staff"));
}
- function testBatchUpdate() {
+ public function testBatchUpdate() {
// Log in using webtestLogin() method
$this->webtestLogin();
* @param $customDataArr
* @param $profileFor
*/
- function _addProfile($profileTitle, $customDataArr, $profileFor) {
+ public function _addProfile($profileTitle, $customDataArr, $profileFor) {
$this->openCiviPage('admin/uf/group', 'reset=1');
*
* @return array
*/
- function _addCustomData($profileFor) {
+ public function _addCustomData($profileFor) {
$returnArray = array();
$customGroupTitle = 'Custom_' . substr(sha1(rand()), 0, 4);
parent::setUp();
}
- function testProfileCreateDupeStrictDefault() {
+ public function testProfileCreateDupeStrictDefault() {
// lets give profile related permision to anonymous user.
$permission = array('edit-1-profile-create', 'edit-1-profile-edit', 'edit-1-profile-listings', 'edit-1-profile-view');
$this->changePermissions($permission);
protected function setUp() {
parent::setUp();
}
- function testAdminAddNewProfile() {
+ public function testAdminAddNewProfile() {
$this->webtestLogin();
list($id, $profileTitle) = $this->_addNewProfile();
$this->_deleteProfile($id, $profileTitle);
}
- function testUserAddNewProfile() {
+ public function testUserAddNewProfile() {
//add the required permission
$permissions = array(
'edit-2-profile-listings-and-forms',
$this->_deleteProfile($id, $profileTitle);
}
- function testAddNewNonMultiProfile() {
+ public function testAddNewNonMultiProfile() {
$this->webtestLogin();
list($id, $profileTitle) = $this->_addNewProfile(FALSE);
$this->_deleteProfile($id, $profileTitle);
}
- function testNonSearchableMultiProfile() {
+ public function testNonSearchableMultiProfile() {
$this->webtestLogin();
list($id, $profileTitle) = $this->_addNewProfile(TRUE, TRUE);
$this->_deleteProfile($id, $profileTitle);
*
* @return array
*/
- function _addNewProfile($checkMultiRecord = TRUE, $checkSearchable = FALSE, $userCheck = FALSE) {
+ public function _addNewProfile($checkMultiRecord = TRUE, $checkSearchable = FALSE, $userCheck = FALSE) {
$params = $this->_testCustomAdd($checkSearchable);
$this->openCiviPage('admin/uf/group', 'reset=1');
* @param int $gid
* @param $profileTitle
*/
- function _deleteProfile($gid, $profileTitle) {
+ public function _deleteProfile($gid, $profileTitle) {
$this->webtestLogin();
$this->openCiviPage("admin/uf/group", "action=delete&id={$gid}", '_qf_Group_next-bottom');
$this->click('_qf_Group_next-bottom');
*
* @return mixed
*/
- function _testCustomAdd($checkSearchable) {
+ public function _testCustomAdd($checkSearchable) {
$this->openCiviPage('admin/custom/group', 'action=add&reset=1');
*
* @return mixed
*/
- function _addRecords($context = 'Edit', $dialog = FALSE) {
+ public function _addRecords($context = 'Edit', $dialog = FALSE) {
$params['text'] = 'text' . substr(sha1(rand()), 0, 3);
$this->waitForElementPresent("//div[@id='crm-profile-block']/div/div[2]/input[@class='crm-form-text required']");
$this->type("//div[@id='crm-profile-block']/div/div[2]/input[@class='crm-form-text required']", $params['text']);
parent::setUp();
}
- function testAddNewProfile() {
+ public function testAddNewProfile() {
$this->webtestLogin();
// Add new profile.
$this->_testdeleteProfile($profileTitle);
}
- function testProfileAddContactstoGroup() {
+ public function testProfileAddContactstoGroup() {
$this->webtestLogin();
$permissions = array("edit-1-profile-listings-and-forms");
/**
* @param $profileTitle
*/
- function _testdeleteProfile($profileTitle) {
+ public function _testdeleteProfile($profileTitle) {
//$this->waitForPageToLoad($this->getTimeoutMsec());
$this->waitForElementPresent("xpath=//div[@id='user-profiles']/div/div/table/tbody//tr/td/span[text() = '$profileTitle']/../../td[7]/span[2][text()='more']/ul//li/a[text()='Delete']");
$this->click("xpath=//div[@id='user-profiles']/div/div/table/tbody//tr/td/span[text() = '$profileTitle']/../../td[7]/span[2][text()='more']/ul//li/a[text()='Delete']");
* Test to check profile description field
* which has a rich text editor (CKEditor)
*/
- function testCheckDescAndCreatedIdFields() {
+ public function testCheckDescAndCreatedIdFields() {
// Log in using webtestLogin() method
$this->webtestLogin();
parent::setUp();
}
- function testStateCountry() {
+ public function testStateCountry() {
$this->webtestLogin();
$config = CRM_Core_Config::singleton();
// Add new profile.
parent::setUp();
}
- function testProfileGroupSubscription() {
+ public function testProfileGroupSubscription() {
$this->webtestLogin();
// Add new profile.
/**
* @param $profileTitle
*/
- function _testdeleteProfile($profileTitle) {
+ public function _testdeleteProfile($profileTitle) {
$this->waitForElementPresent("xpath=//div[@id='user-profiles']/div/div[1]/table/tbody//tr/td[1]/span[text() = '$profileTitle']/../../td[7]/span[2][text()='more']/ul/li[5]/a[text()='Delete']");
$this->click("xpath=//div[@id='user-profiles']/div/div[1]/table/tbody//tr/td[1]/span[text() = '$profileTitle']/../../td[7]/span[2][text()='more']/ul/li[5]/a[text()='Delete']");
$this->waitForElementPresent('_qf_Group_next-bottom');
parent::setUp();
}
- function testSearchProfile() {
+ public function testSearchProfile() {
$this->webtestLogin();
// enable county field
parent::setUp();
}
- function testInstall() {
+ public function testInstall() {
$this->webtestLogin();
$this->open($this->settings->installURL);
parent::setUp();
}
- function testUpgrade() {
+ public function testUpgrade() {
$this->webtestLogin();
$this->open($this->settings->upgradeURL);
$this->waitForTextPresent("Upgrade CiviCRM to Version");
parent::setUp();
}
- function testAddReport() {
+ public function testAddReport() {
$this->webtestLogin();
// create contact
parent::setUp();
}
- function testDonarReportPager() {
+ public function testDonarReportPager() {
$this->webtestLogin();
// now create new donar detail report instance
parent::setUp();
}
- function testLoggingReport() {
+ public function testLoggingReport() {
$this->webtestLogin();
//enable the logging
/**
* @param $data
*/
- function verifyReportData($data) {
+ public function verifyReportData($data) {
foreach ($data as $value) {
// check for the row contains proper data
$actionPath = ($value['action'] == 'Update') ? "td[1]/a[2]" : "td[1][contains(text(), '{$value['action']}')]";
* @param $dataForReportDetail
* @param array $filters
*/
- function detailReportCheck($dataForReportDetail, $filters = array()) {
+ public function detailReportCheck($dataForReportDetail, $filters = array()) {
foreach ($dataForReportDetail as $value) {
$this->waitForElementPresent("xpath=//table/tbody//tr/td[2][contains(text(), '{$value['log_type']}')]/../td[4]/a[contains(text(), '{$value['altered_contact']}')]/../../td[1]/a[2]");
$this->click("xpath=//table/tbody//tr/td[2][contains(text(), '{$value['log_type']}')]/../td[4]/a[contains(text(), '{$value['altered_contact']}')]/../../td[1]/a[2]");
parent::setUp();
}
- function testRolePermissionReport() {
+ public function testRolePermissionReport() {
$this->webtestLogin('admin');
//create new roles
/*
*check for CRM-10148
*/
- function testReservedReportPermission() {
+ public function testReservedReportPermission() {
$this->webtestLogin('admin');
//create new role
/**
* @param $role
*/
- function _roleDelete($role) {
+ public function _roleDelete($role) {
$this->waitForElementPresent("xpath=//table[@id='user-roles']/tbody//tr/td[text()='{$role}']/..//td/a[text()='edit role']");
$this->click("xpath=//table[@id='user-roles']/tbody//tr/td[text()='{$role}']/..//td/a[text()='edit role']");
$this->waitForElementPresent('edit-delete');
*
* @return string
*/
- function _testCreateUser($roleid) {
+ public function _testCreateUser($roleid) {
$this->open($this->sboxPath . "admin/people/create");
*
* @return array; each item is a list of parameters for testAPICalls
*/
- function apiTestCases() {
+ public function apiTestCases() {
$cases = array();
// entity,action: omit apiKey, valid entity+action
/**
* @dataProvider apiTestCases
*/
- function testAPICalls($query, $is_error) {
+ public function testAPICalls($query, $is_error) {
$client = CRM_Utils_HttpClient::singleton();
list($status, $data) = $client->post($this->url, $query);
$this->assertEquals(CRM_Utils_HttpClient::STATUS_OK, $status);
* Submit a request with an API key that exists but does not correspond to
* a real user. Submit in "?entity=X&action=X" notation
*/
- function testNotCMSUser_entityAction() {
+ public function testNotCMSUser_entityAction() {
$client = CRM_Utils_HttpClient::singleton();
//Create contact with api_key
* Submit a request with an API key that exists but does not correspond to
* a real user. Submit in "?q=civicrm/$entity/$action" notation
*/
- function testNotCMSUser_q() {
+ public function testNotCMSUser_q() {
$client = CRM_Utils_HttpClient::singleton();
//Create contact with api_key
public $DBResetRequired = FALSE;
- function setUp() {
+ public function setUp() {
parent::setUp();
}
/**
* (non-PHPdoc)
* @see CiviUnitTestCase::tearDown()
*/
- function tearDown() {
+ public function tearDown() {
$tablesToTruncate = array(
'civicrm_activity',
);
$this->quickCleanup($tablesToTruncate, TRUE);
}
- function testActivityCreateCustomBefore() {
+ public function testActivityCreateCustomBefore() {
$values = $this->callAPISuccess('custom_field', 'getoptions', array('field' => 'custom_group_id',));
$this->assertTrue($values['count'] == 0);
$this->CustomGroupCreate(array('extends' => 'Activity'));
protected $_entity;
- function setUp() {
+ public function setUp() {
parent::setUp();
$baoObj = new CRM_Core_DAO();
$baoObj->createTestObject('CRM_Pledge_BAO_Pledge', array(), 1, 0);
* (non-PHPdoc)
* @see CiviUnitTestCase::tearDown()
*/
- function tearDown() {
+ public function tearDown() {
CRM_Utils_Hook::singleton()->reset();
$tablesToTruncate = array(
'civicrm_contact',
/**
* Function tests that an empty where hook returns no results
*/
- function testContactGetNoResultsHook() {
+ public function testContactGetNoResultsHook() {
$this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereHookNoResults'));
$result = $this->callAPISuccess('contact', 'get', array(
'check_permissions' => 1,
/**
* Function tests all results are returned
*/
- function testContactGetAllResultsHook() {
+ public function testContactGetAllResultsHook() {
$this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereHookAllResults'));
$result = $this->callAPISuccess('contact', 'get', array(
'check_permissions' => 1,
/**
* Function tests that deleted contacts are not returned
*/
- function testContactGetPermissionHookNoDeleted() {
+ public function testContactGetPermissionHookNoDeleted() {
$this->callAPISuccess('contact', 'create', array('id' => 2, 'is_deleted' => 1));
$this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereHookAllResults'));
$result = $this->callAPISuccess('contact', 'get', array(
/**
* Test permissions limited by hook
*/
- function testContactGetHookLimitingHook() {
+ public function testContactGetHookLimitingHook() {
$this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereOnlySecond'));
$result = $this->callAPISuccess('contact', 'get', array(
/**
* Confirm that without check permissions we still get 2 contacts returned
*/
- function testContactGetHookLimitingHookDontCheck() {
+ public function testContactGetHookLimitingHookDontCheck() {
//
$result = $this->callAPISuccess('contact', 'get', array(
'check_permissions' => 0,
/**
* Check that id works as a filter
*/
- function testContactGetIDFilter() {
+ public function testContactGetIDFilter() {
$this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereHookAllResults'));
$result = $this->callAPISuccess('contact', 'get', array(
'sequential' => 1,
/**
* Check that address IS returned
*/
- function testContactGetAddressReturned() {
+ public function testContactGetAddressReturned() {
$this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereOnlySecond'));
$fullresult = $this->callAPISuccess('contact', 'get', array(
'sequential' => 1,
/**
* Check that pledge IS not returned
*/
- function testContactGetPledgeIDNotReturned() {
+ public function testContactGetPledgeIDNotReturned() {
$this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereHookAllResults'));
$this->callAPISuccess('contact', 'get', array(
'sequential' => 1,
/**
* Check that pledge IS not an allowable filter
*/
- function testContactGetPledgeIDNotFiltered() {
+ public function testContactGetPledgeIDNotFiltered() {
$this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereHookAllResults'));
$this->callAPISuccess('contact', 'get', array(
'sequential' => 1,
/**
* Check that chaining doesn't bypass permissions
*/
- function testContactGetPledgeNotChainable() {
+ public function testContactGetPledgeNotChainable() {
$this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereOnlySecond'));
$this->callAPISuccess('contact', 'get', array(
'sequential' => 1,
);
}
- function setupCoreACL() {
+ public function setupCoreACL() {
$this->createLoggedInUser();
$this->_permissionedDisabledGroup = $this->groupCreate(array('title' => 'pick-me-disabled', 'is_active' => 0, 'name' => 'pick-me-disabled'));
$this->_permissionedGroup = $this->groupCreate(array('title' => 'pick-me-active', 'is_active' => 1, 'name' => 'pick-me-active'));
* @dataProvider entities
* confirm that without check permissions we still get 2 contacts returned
*/
- function testEntitiesGetHookLimitingHookNoCheck($entity) {
+ public function testEntitiesGetHookLimitingHookNoCheck($entity) {
CRM_Core_Config::singleton()->userPermissionClass->permissions = array();
$this->setUpEntities($entity);
$this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereHookNoResults'));
* @dataProvider entities
* confirm that without check permissions we still get 2 entities returned
*/
- function testEntitiesGetCoreACLLimitingHookNoCheck($entity) {
+ public function testEntitiesGetCoreACLLimitingHookNoCheck($entity) {
$this->setupCoreACL();
//CRM_Core_Config::singleton()->userPermissionClass->permissions = array();
$this->setUpEntities($entity);
* @dataProvider entities
* confirm that with check permissions we don't get entities
*/
- function testEntitiesGetCoreACLLimitingCheck($entity) {
+ public function testEntitiesGetCoreACLLimitingCheck($entity) {
$this->markTestIncomplete('this does not work in 4.4 but can be enabled in 4.5 or a security release of 4.4 including the important security fix CRM-14877');
$this->setupCoreACL();
$this->setUpEntities($entity);
* @dataProvider entities
* Function tests that an empty where hook returns no results
*/
- function testEntityGetNoResultsHook($entity) {
+ public function testEntityGetNoResultsHook($entity) {
$this->markTestIncomplete('hook acls only work with contacts so far');
CRM_Core_Config::singleton()->userPermissionClass->permissions = array();
$this->setUpEntities($entity);
/**
* No results returned
*/
- function aclWhereHookNoResults($type, &$tables, &$whereTables, &$contactID, &$where) {
+ public function aclWhereHookNoResults($type, &$tables, &$whereTables, &$contactID, &$where) {
}
/**
* All results returned
* @implements CRM_Utils_Hook::aclWhereClause
*/
- function aclWhereHookAllResults($type, &$tables, &$whereTables, &$contactID, &$where) {
+ public function aclWhereHookAllResults($type, &$tables, &$whereTables, &$contactID, &$where) {
$where = " (1) ";
}
* Full results returned
* @implements CRM_Utils_Hook::aclWhereClause
*/
- function aclWhereOnlySecond($type, &$tables, &$whereTables, &$contactID, &$where) {
+ public function aclWhereOnlySecond($type, &$tables, &$whereTables, &$contactID, &$where) {
$where = " contact_a.id > 1";
}
}
* Test checks that all v3 API return a standardised error message when
* the $params passed in is not an array.
*/
- function testParamsNotArray() {
+ public function testParamsNotArray() {
/*I have commented this out as the check for is_array has been moved to civicrm_api. But keeping in place as
* this test, in contrast to the standards test, tests all existing API rather than just CRUD ones
* so want to keep code for re-use
* Get all the files in the API directory for the relevant version which contain API functions
* @return array $files array of php files in the directory excluding helper files
*/
- function getAllFilesinAPIDir() {
+ public function getAllFilesinAPIDir() {
$files = array();
$handle = opendir($this->_apiDir);
* Require once Files
* @param $files array list of files to load
*/
- function requireOnceFilesArray($files) {
+ public function requireOnceFilesArray($files) {
foreach ($files as $key => $file) {
require_once $this->_apiDir . $file;
}
* Get all api exposed functions that are expected to conform to standards
* @return array $functionlist
*/
- function getAllAPIStdFunctions() {
+ public function getAllAPIStdFunctions() {
$functionlist = get_defined_functions();
$functions = preg_grep($this->_regexForGettingAPIStdFunctions, $functionlist['user']);
foreach ($functions as $key => $function) {
protected $_apiversion =3;
- function testAPIReplaceVariables() {
+ public function testAPIReplaceVariables() {
$result = array();
$result['testfield'] = 6;
$result['api.tag.get'] = 999;
/*
* test that error doesn't occur for non-existant file
*/
- function testAPIWrapperIncludeNoFile() {
+ public function testAPIWrapperIncludeNoFile() {
$result = $this->callAPIFailure('RandomFile', 'get', array(), 'API (RandomFile,get) does not exist (join the API team and implement it!)');
}
- function testAPIWrapperCamelCaseFunction() {
+ public function testAPIWrapperCamelCaseFunction() {
$result = $this->callAPISuccess('OptionGroup', 'Get', array());
}
- function testAPIWrapperLcaseFunction() {
+ public function testAPIWrapperLcaseFunction() {
$result = $this->callAPISuccess('OptionGroup', 'get', array());
}
- function testAPIResolver() {
+ public function testAPIResolver() {
$oldpath = get_include_path();
set_include_path($oldpath . PATH_SEPARATOR . dirname(__FILE__) . '/dataset/resolver');
set_include_path($oldpath);
}
- function testFromCamel() {
+ public function testFromCamel() {
$cases = array(
'Contribution' => 'contribution',
'contribution' => 'contribution',
}
}
- function testToCamel() {
+ public function testToCamel() {
$cases = array(
'Contribution' => 'Contribution',
'contribution' => 'Contribution',
/**
* Test that calling via wrapper works
*/
- function testv3Wrapper() {
+ public function testv3Wrapper() {
try{
$result = civicrm_api3('contact', 'get', array());
}
/**
* Test exception is thrown
*/
- function testv3WrapperException(){
+ public function testv3WrapperException(){
try{
$result = civicrm_api3('contact', 'create', array('debug' => 1));
}
* @param $apiWrappers
* @param $apiRequest
*/
- function onApiWrappers(&$apiWrappers, $apiRequest) {
+ public function onApiWrappers(&$apiWrappers, $apiRequest) {
$this->assertTrue(is_string($apiRequest['entity']) && !empty($apiRequest['entity']));
$this->assertTrue(is_string($apiRequest['action']) && !empty($apiRequest['action']));
$this->assertTrue(is_array($apiRequest['params']) && !empty($apiRequest['params']));
$apiWrappers[] = new api_v3_APIWrapperTest_Impl();
}
- function testWrapperHook() {
+ public function testWrapperHook() {
// Note: this API call would fail due to missing contact_type, but
// the wrapper intervenes (fromApiInput)
// Note: The output would define "display_name", but the wrapper
$this->useTransaction(TRUE);
}
- function testSimpleActionScheduleCreate() {
+ public function testSimpleActionScheduleCreate() {
$oldCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule');
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
/**
* Check if required fields are not passed
*/
- function testActionScheduleCreateWithoutRequired() {
+ public function testActionScheduleCreateWithoutRequired() {
$params = array(
'subject' => 'this case should fail',
'scheduled_date_time' => date('Ymd'),
$result = $this->callAPIFailure('activity', 'create', $params);
}
- function testActionScheduleWithScheduledDatesCreate() {
+ public function testActionScheduleWithScheduledDatesCreate() {
$oldCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule');
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
protected $_params;
- function setUp() {
+ public function setUp() {
$this->_apiversion = 3;
parent::setUp();
$this->useTransaction(TRUE);
*
* @access protected
*/
- function tearDown() {
+ public function tearDown() {
$tablesToTruncate = array(
'civicrm_contact',
'civicrm_activity',
/**
* Check with empty array
*/
- function testActivityCreateEmpty() {
+ public function testActivityCreateEmpty() {
$result = $this->callAPIFailure('activity', 'create', array());
}
/**
* Check if required fields are not passed
*/
- function testActivityCreateWithoutRequired() {
+ public function testActivityCreateWithoutRequired() {
$params = array(
'subject' => 'this case should fail',
'scheduled_date_time' => date('Ymd'),
* Test civicrm_activity_create() with mismatched activity_type_id
* and activity_name
*/
- function testActivityCreateMismatchNameType() {
+ public function testActivityCreateMismatchNameType() {
$params = array(
'source_contact_id' => $this->_contactID,
'subject' => 'Test activity',
/**
* Test civicrm_activity_id() with missing source_contact_id is put with the current user.
*/
- function testActivityCreateWithMissingContactId() {
+ public function testActivityCreateWithMissingContactId() {
$params = array(
'subject' => 'Make-it-Happen Meeting',
'activity_date_time' => date('Ymd'),
/**
* Test civicrm_activity_id() with non-numeric source_contact_id
*/
- function testActivityCreateWithNonNumericContactId() {
+ public function testActivityCreateWithNonNumericContactId() {
$params = array(
'source_contact_id' => 'fubar',
'subject' => 'Make-it-Happen Meeting',
* oddly enough this test was failing because the creation of the invalid type
* got added to the set up routine. Probably a mis-fix on a test
*/
- function testActivityCreateWithNonNumericActivityTypeId() {
+ public function testActivityCreateWithNonNumericActivityTypeId() {
$params = array(
'source_contact_id' => $this->_contactID,
'subject' => 'Make-it-Happen Meeting',
/**
* Check with incorrect required fields
*/
- function testActivityCreateWithUnknownActivityTypeId() {
+ public function testActivityCreateWithUnknownActivityTypeId() {
$params = array(
'source_contact_id' => $this->_contactID,
'subject' => 'Make-it-Happen Meeting',
$result = $this->callAPIFailure('activity', 'create', $params);
}
- function testActivityCreateWithInvalidPriority() {
+ public function testActivityCreateWithInvalidPriority() {
$params = array(
'source_contact_id' => $this->_contactID,
'subject' => 'Make-it-Happen Meeting',
- function testActivityCreateWithValidStringPriority() {
+ public function testActivityCreateWithValidStringPriority() {
$params = array(
'source_contact_id' => $this->_contactID,
'subject' => 'Make-it-Happen Meeting',
$this->assertEquals(1, $result['values'][$result['id']]['priority_id']);
}
- function testActivityCreateWithInValidStringPriority() {
+ public function testActivityCreateWithInValidStringPriority() {
$params = array(
'source_contact_id' => $this->_contactID,
'subject' => 'Make-it-Happen Meeting',
/**
* Test civicrm_activity_create() with valid parameters
*/
- function testActivityCreate() {
+ public function testActivityCreate() {
$result = $this->callAPISuccess('activity', 'create', $this->_params);
$result = $this->callAPISuccess('activity', 'get', $this->_params);
/**
* Test civicrm_activity_create() with valid parameters - use type_id
*/
- function testActivityCreateCampaignTypeID() {
+ public function testActivityCreateCampaignTypeID() {
$this->enableCiviCampaign();
$defaults = array();
$this->assertEquals($result['values'][$result['id']]['status_id'], 1, 'in line ' . __LINE__);
}
- function testActivityReturnTargetAssignee() {
+ public function testActivityReturnTargetAssignee() {
$description = "Example demonstrates setting & retrieving the target & source";
$subfile = "GetTargetandAssignee";
$this->assertEquals($this->_contactID, $result['values'][$result['id']]['target_contact_id'][0], 'in line ' . __LINE__);
}
- function testActivityCreateExample() {
+ public function testActivityCreateExample() {
/**
* Test civicrm_activity_create() using example code
*/
* Test civicrm_activity_create() with valid parameters
* and some custom data
*/
- function testActivityCreateCustom() {
+ public function testActivityCreateCustom() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params = $this->_params;
$params['custom_' . $ids['custom_field_id']] = "custom string";
* Test civicrm_activity_create() with valid parameters
* and some custom data
*/
- function testActivityCreateCustomContactRefField() {
+ public function testActivityCreateCustomContactRefField() {
$this->callAPISuccess('contact', 'create', array('id' => $this->_contactID, 'sort_name' => 'Contact, Test'));
$subfile = 'ContactRefCustomField';
/**
* Test civicrm_activity_create() with an invalid text status_id
*/
- function testActivityCreateBadTextStatus() {
+ public function testActivityCreateBadTextStatus() {
$params = array(
'source_contact_id' => $this->_contactID,
/**
* Test civicrm_activity_create() with an invalid text status_id
*/
- function testActivityCreateSupportActivityStatus() {
+ public function testActivityCreateSupportActivityStatus() {
$params = array(
'source_contact_id' => $this->_contactID,
* Test civicrm_activity_create() with valid parameters,
* using a text status_id
*/
- function testActivityCreateTextStatus() {
+ public function testActivityCreateTextStatus() {
$params = array(
/**
* Test civicrm_activity_get() with no params
*/
- function testActivityGetEmpty() {
+ public function testActivityGetEmpty() {
$result = $this->callAPISuccess('activity', 'get', array());
}
/**
* Test civicrm_activity_get() with a good activity ID
*/
- function testActivityGetGoodID1() {
+ public function testActivityGetGoodID1() {
// Insert rows in civicrm_activity creating activities 4 and
// 13
$description = "Function demonstrates getting asignee_contact_id & using it to get the contact";
/*
* test that get functioning does filtering
*/
- function testGetFilter() {
+ public function testGetFilter() {
$params = array(
'source_contact_id' => $this->_contactID,
'subject' => 'Make-it-Happen Meeting',
/**
* Test civicrm_activity_get() with filter target_contact_id
*/
- function testActivityGetTargetFilter() {
+ public function testActivityGetTargetFilter() {
$params = $this->_params;
$contact1Params = array(
'first_name' => 'John',
/*
* test that get functioning does filtering
*/
- function testGetStatusID() {
+ public function testGetStatusID() {
$params = array(
'source_contact_id' => $this->_contactID,
'subject' => 'Make-it-Happen Meeting',
/*
* test that get functioning does filtering
*/
- function testGetFilterMaxDate() {
+ public function testGetFilterMaxDate() {
$params = array(
'source_contact_id' => $this->_contactID,
'subject' => 'Make-it-Happen Meeting',
* Test civicrm_activity_get() with a good activity ID which
* has associated custom data
*/
- function testActivityGetGoodIDCustom() {
+ public function testActivityGetGoodIDCustom() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params = $this->_params;
* Test civicrm_activity_get() with a good activity ID which
* has associated custom data
*/
- function testActivityGetContact_idCustom() {
+ public function testActivityGetContact_idCustom() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params = $this->_params;
/**
* Check activity deletion with empty params
*/
- function testDeleteActivityForEmptyParams() {
+ public function testDeleteActivityForEmptyParams() {
$params = array('version' => $this->_apiversion);
$result = $this->callAPIFailure('activity', 'delete', $params);
}
/**
* Check activity deletion without activity id
*/
- function testDeleteActivityWithoutId() {
+ public function testDeleteActivityWithoutId() {
$params = array(
'activity_name' => 'Meeting',
'version' => $this->_apiversion,
/**
* Check activity deletion without activity type
*/
- function testDeleteActivityWithoutActivityType() {
+ public function testDeleteActivityWithoutActivityType() {
$params = array('id' => 1);
$result = $this->callAPIFailure('activity', 'delete', $params);
}
/**
* Check activity deletion with incorrect data
*/
- function testDeleteActivityWithIncorrectActivityType() {
+ public function testDeleteActivityWithIncorrectActivityType() {
$params = array(
'id' => 1,
'activity_name' => 'Test Activity',
/**
* Check activity deletion with correct data
*/
- function testDeleteActivity() {
+ public function testDeleteActivity() {
$result = $this->callAPISuccess('activity', 'create', $this->_params);
$params = array(
'id' => $result['id'],
/**
* Check if required fields are not passed
*/
- function testActivityUpdateWithoutRequired() {
+ public function testActivityUpdateWithoutRequired() {
$params = array(
'subject' => 'this case should fail',
'scheduled_date_time' => date('Ymd'),
/**
* Test civicrm_activity_update() with non-numeric id
*/
- function testActivityUpdateWithNonNumericId() {
+ public function testActivityUpdateWithNonNumericId() {
$params = array(
'id' => 'lets break it',
'activity_name' => 'Meeting',
/**
* Check with incorrect required fields
*/
- function testActivityUpdateWithIncorrectContactActivityType() {
+ public function testActivityUpdateWithIncorrectContactActivityType() {
$params = array(
'id' => 1,
'activity_name' => 'Test Activity',
/**
* Test civicrm_activity_update() to update an existing activity
*/
- function testActivityUpdate() {
+ public function testActivityUpdate() {
$result = $this->callAPISuccess('activity', 'create', $this->_params);
$params = array(
* Test civicrm_activity_update() with valid parameters
* and some custom data
*/
- function testActivityUpdateCustom() {
+ public function testActivityUpdateCustom() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params = $this->_params;
* Test civicrm_activity_update() for core activity fields
* and some custom data
*/
- function testActivityUpdateCheckCoreFields() {
+ public function testActivityUpdateCheckCoreFields() {
$params = $this->_params;
$contact1Params = array(
'first_name' => 'John',
* Test civicrm_activity_update() where the DB has a date_time
* value and there is none in the update params.
*/
- function testActivityUpdateNotDate() {
+ public function testActivityUpdateNotDate() {
$result = $this->callAPISuccess('activity', 'create', $this->_params);
$params = array(
/**
* Check activity update with status
*/
- function testActivityUpdateWithStatus() {
+ public function testActivityUpdateWithStatus() {
$activity = $this->callAPISuccess('activity', 'create', $this->_params);
$params = array(
'id' => $activity['id'],
* Test civicrm_activity_update() where the source_contact_id
* is not in the update params.
*/
- function testActivityUpdateKeepSource() {
+ public function testActivityUpdateKeepSource() {
$activity = $this->callAPISuccess('activity', 'create', $this->_params);
// Updating the activity but not providing anything for the source contact
// (It was set as $this->_contactID earlier.)
/**
* Test civicrm_activities_contact_get()
*/
- function testActivitiesContactGet() {
+ public function testActivitiesContactGet() {
$activity = $this->callAPISuccess('activity', 'create', $this->_params);
$activity2 = $this->callAPISuccess('activity', 'create', $this->_params2);
// Get activities associated with contact $this->_contactID
/*
* test chained Activity format
*/
- function testchainedActivityGet() {
+ public function testchainedActivityGet() {
$activity = $this->callAPISuccess('Contact', 'Create', array(
'display_name' => "bob brown",
/**
* Test civicrm_activity_contact_get() with invalid Contact Id
*/
- function testActivitiesContactGetWithInvalidContactId() {
+ public function testActivitiesContactGetWithInvalidContactId() {
$params = array('contact_id' => 'contact');
$result = $this->callAPIFailure('activity', 'get', $params);
}
/**
* Test civicrm_activity_contact_get() with contact having no Activity
*/
- function testActivitiesContactGetHavingNoActivity() {
+ public function testActivitiesContactGetHavingNoActivity() {
$params = array(
'first_name' => 'dan',
'last_name' => 'conberg',
$this->assertEquals($result['count'], 0, 'in line ' . __LINE__);
}
- function testGetFields() {
+ public function testGetFields() {
$params = array('action' => 'create');
$result = $this->callAPIAndDocument('activity', 'getfields', $params, __FUNCTION__, __FILE__, NULL, NULL, 'getfields');
$this->assertTrue(is_array($result['values']), 'get fields doesnt return values array in line ' . __LINE__);
class api_v3_ActivityTypeTest extends CiviUnitTestCase {
protected $_apiversion;
- function setUp() {
+ public function setUp() {
$this->_apiversion = 3;
CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name');
parent::setUp();
/**
* Test civicrm_activity_type_get()
*/
- function testActivityTypeGet() {
+ public function testActivityTypeGet() {
$params = array();
$result = $this->callAPIAndDocument('activity_type', 'get', $params, __FUNCTION__, __FILE__);
$this->assertEquals($result['values']['1'], 'Meeting', 'In line ' . __LINE__);
/**
* Test civicrm_activity_type_create()
*/
- function testActivityTypeCreate() {
+ public function testActivityTypeCreate() {
$params = array(
'weight' => '2',
'label' => 'send out letters',
/**
* Test civicrm_activity_type_create - check id
*/
- function testActivityTypecreatecheckId() {
+ public function testActivityTypecreatecheckId() {
$params = array(
'label' => 'type_create',
'weight' => '2',
/**
* Test civicrm_activity_type_delete()
*/
- function testActivityTypeDelete() {
+ public function testActivityTypeDelete() {
$params = array(
'label' => 'type_create_delete',
'weight' => '2',
protected $_entity;
- function setUp() {
+ public function setUp() {
$this->_entity = 'Address';
parent::setUp();
);
}
- function tearDown() {
+ public function tearDown() {
$this->locationTypeDelete($this->_locationType->id);
$this->contactDelete($this->_contactID);
}
$this->callAPISuccess('address', 'delete', array('id' => $create['id']));
}
- function testGetWithCustom() {
+ public function testGetWithCustom() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params = $this->_params;
/**
* Create a sample batch
*/
- function batchCreate() {
+ public function batchCreate() {
$params = $this->_params;
$params['name'] = $params['title'] = 'Batch_433397';
$params['status_id'] = 1;
/**
* Test civicrm_batch_create - success expected.
*/
- function testCreate() {
+ public function testCreate() {
$params = array(
'name' => 'New_Batch_03',
'title' => 'New Batch 03',
/**
* Test civicrm_batch_create with id.
*/
- function testUpdate() {
+ public function testUpdate() {
$params = array(
'name' => 'New_Batch_04',
'title' => 'New Batch 04',
/**
* Test civicrm_batch_delete using the old $params['batch_id'] syntax.
*/
- function testBatchDeleteOldSyntax() {
+ public function testBatchDeleteOldSyntax() {
$batchID = $this->batchCreate();
$params = array(
'batch_id' => $batchID,
/**
* Test civicrm_batch_delete using the new $params['id'] syntax
*/
- function testBatchDeleteCorrectSyntax() {
+ public function testBatchDeleteCorrectSyntax() {
$batchID = $this->batchCreate();
$params = array(
'id' => $batchID,
Contact::createOrganisation();
}
- function tearDown() {
+ public function tearDown() {
}
/**
* Verify that attempt to create individual contact with only
* first and last names succeeds
*/
- function testCRM11793Organization() {
+ public function testCRM11793Organization() {
$this->_testCRM11793ContactType('Organization');
}
- function testCRM11793Household() {
+ public function testCRM11793Household() {
$this->_testCRM11793ContactType('Household');
}
- function testCRM11793Individual() {
+ public function testCRM11793Individual() {
$this->_testCRM11793ContactType('Individual');
}
/**
* @param $contactType
*/
- function _testCRM11793ContactType($contactType) {
+ public function _testCRM11793ContactType($contactType) {
$result = $this->callAPISuccess(
'contact',
'get',
public $DBResetRequired = FALSE;
- function setUp() {
+ public function setUp() {
$this->_apiversion = 3;
$this->params = array(
'title' => "campaign title",
/**
* Check with empty array
*/
- function testCaseCreateEmpty() {
+ public function testCaseCreateEmpty() {
$result = $this->callAPIFailure('case', 'create', array());
}
/**
* Check if required fields are not passed
*/
- function testCaseCreateWithoutRequired() {
+ public function testCaseCreateWithoutRequired() {
$params = array(
'subject' => 'this case should fail',
'case_type_id' => 1,
/**
* Test create function with valid parameters
*/
- function testCaseCreate() {
+ public function testCaseCreate() {
// Create Case
$params = $this->_params;
// Test using label instead of value
/**
* Test update (create with id) function with valid parameters
*/
- function testCaseUpdate() {
+ public function testCaseUpdate() {
// Create Case
$params = $this->_params;
// Test using name instead of value
/**
* Test delete function with valid parameters
*/
- function testCaseDelete() {
+ public function testCaseDelete() {
// Create Case
$result = $this->callAPISuccess('case', 'create', $this->_params);
/**
* Test get function based on activity
*/
- function testCaseGetByActivity() {
+ public function testCaseGetByActivity() {
// Create Case
$result = $this->callAPISuccess('case', 'create', $this->_params);
$id = $result['id'];
/**
* Test get function based on contact id
*/
- function testCaseGetByContact() {
+ public function testCaseGetByContact() {
// Create Case
$result = $this->callAPISuccess('case', 'create', $this->_params);
$id = $result['id'];
/**
* Test get function based on subject
*/
- function testCaseGetBySubject() {
+ public function testCaseGetBySubject() {
// Create Case
$result = $this->callAPISuccess('case', 'create', $this->_params);
$id = $result['id'];
/**
* Test get function based on wrong subject
*/
- function testCaseGetByWrongSubject() {
+ public function testCaseGetByWrongSubject() {
// Create Case
$result = $this->callAPISuccess('case', 'create', $this->_params);
$id = $result['id'];
/**
* Test get function with no criteria
*/
- function testCaseGetNoCriteria() {
+ public function testCaseGetNoCriteria() {
// Create Case
$result = $this->callAPISuccess('case', 'create', $this->_params);
$id = $result['id'];
/**
* Test activity api create for case activities
*/
- function testCaseActivityCreate() {
+ public function testCaseActivityCreate() {
// Create a case first
$params = $this->_params;
$result = $this->callAPISuccess('case', 'create', $params);
/**
* Test activity api update for case activities
*/
- function testCaseActivityUpdate() {
+ public function testCaseActivityUpdate() {
// Need to create the case and activity before we can update it
$this->testCaseActivityCreate();
//TODO: check some more things
}
- function testCaseActivityUpdateCustom() {
+ public function testCaseActivityUpdateCustom() {
// Create a case first
$result = $this->callAPISuccess('case', 'create', $this->_params);
*/
class api_v3_CaseTypeTest extends CiviCaseTestCase {
- function setUp() {
+ public function setUp() {
$this->quickCleanup(array('civicrm_case_type'));
parent::setUp();
* This method is called after a test is executed.
*
*/
- function tearDown() {
+ public function tearDown() {
parent::tearDown();
$this->quickCleanup(array('civicrm_case_type'));
}
/**
* Check with empty array
*/
- function testCaseTypeCreateEmpty() {
+ public function testCaseTypeCreateEmpty() {
$this->callAPIFailure('CaseType', 'create', array());
}
/**
* Check if required fields are not passed
*/
- function testCaseTypeCreateWithoutRequired() {
+ public function testCaseTypeCreateWithoutRequired() {
$params = array(
'name' => 'this case should fail',
);
* Test create methods with valid data
* success expected
*/
- function testCaseTypeCreate() {
+ public function testCaseTypeCreate() {
// Create Case Type
$params = array(
'title' => 'Application',
/**
* Create a case with an invalid name
*/
- function testCaseTypeCreate_invalidName() {
+ public function testCaseTypeCreate_invalidName() {
// Create Case Type
$params = array(
'title' => 'Application',
/**
* Test update (create with id) function with valid parameters
*/
- function testCaseTypeUpdate() {
+ public function testCaseTypeUpdate() {
// Create Case Type
$params = array(
'title' => 'Application',
/**
* Test delete function with valid parameters
*/
- function testCaseTypeDelete_New() {
+ public function testCaseTypeDelete_New() {
// Create Case Type
$params = array(
'title' => 'Application',
* Test create methods with xml file
* success expected
*/
- function testCaseTypeCreateWithDefinition() {
+ public function testCaseTypeCreateWithDefinition() {
// Create Case Type
$params = $this->fixtures['Application_with_Definition'];
$result = $this->callAPISuccess('CaseType', 'create', $params);
/**
* Create a CaseType+case then delete the CaseType.
*/
- function testCaseTypeDelete_InUse() {
+ public function testCaseTypeDelete_InUse() {
// Create Case Type
$params = $this->fixtures['Application_with_Definition'];
$createCaseType = $this->callAPISuccess('CaseType', 'create', $params);
);
}
- function tearDown() {
+ public function tearDown() {
// truncate a few tables
$tablesToTruncate = array(
'civicrm_contact',
* Verify that attempt to create individual contact with only
* first and last names succeeds
*/
- function testAddCreateIndividual() {
+ public function testAddCreateIndividual() {
$oldCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_contact');
$params = array(
'first_name' => 'abc1',
*
* Verify that sub-types are created successfully and not deleted by subsequent updates
*/
- function testIndividualSubType() {
+ public function testIndividualSubType() {
$params = array(
'first_name' => 'test abc',
'contact_type' => 'Individual',
/**
* Verify that attempt to create contact with empty params fails
*/
- function testCreateEmptyContact() {
+ public function testCreateEmptyContact() {
$this->callAPIFailure('contact', 'create', array());
}
/**
* Verify that attempt to create contact with bad contact type fails
*/
- function testCreateBadTypeContact() {
+ public function testCreateBadTypeContact() {
$params = array(
'email' => 'man1@yahoo.com',
'contact_type' => 'Does not Exist',
* Verify that attempt to create individual contact with required
* fields missing fails
*/
- function testCreateBadRequiredFieldsIndividual() {
+ public function testCreateBadRequiredFieldsIndividual() {
$params = array(
'middle_name' => 'This field is not required',
'contact_type' => 'Individual',
* Verify that attempt to create household contact with required
* fields missing fails
*/
- function testCreateBadRequiredFieldsHousehold() {
+ public function testCreateBadRequiredFieldsHousehold() {
$params = array(
'middle_name' => 'This field is not required',
'contact_type' => 'Household',
* Verify that attempt to create organization contact with
* required fields missing fails
*/
- function testCreateBadRequiredFieldsOrganization() {
+ public function testCreateBadRequiredFieldsOrganization() {
$params = array(
'middle_name' => 'This field is not required',
'contact_type' => 'Organization',
* Verify that attempt to create individual contact with only an
* email succeeds
*/
- function testCreateEmailIndividual() {
+ public function testCreateEmailIndividual() {
$params = array(
'email' => 'man3@yahoo.com',
* Verify that attempt to create individual contact with only
* first and last names succeeds
*/
- function testCreateNameIndividual() {
+ public function testCreateNameIndividual() {
$params = array(
'first_name' => 'abc1',
'contact_type' => 'Individual',
* Verify that attempt to create individual contact with
* first and last names and old key values works
*/
- function testCreateNameIndividualOldKeys() {
+ public function testCreateNameIndividualOldKeys() {
$params = array(
'individual_prefix' => 'Dr.',
'first_name' => 'abc1',
* Verify that attempt to create individual contact with
* first and last names and old key values works
*/
- function testCreateNameIndividualrecommendedKeys2() {
+ public function testCreateNameIndividualrecommendedKeys2() {
$params = array(
'prefix_id' => 'Dr.',
'first_name' => 'abc1',
* Verify that attempt to create household contact with only
* household name succeeds
*/
- function testCreateNameHousehold() {
+ public function testCreateNameHousehold() {
$params = array(
'household_name' => 'The abc Household',
'contact_type' => 'Household',
* Verify that attempt to create organization contact with only
* organization name succeeds
*/
- function testCreateNameOrganization() {
+ public function testCreateNameOrganization() {
$params = array(
'organization_name' => 'The abc Organization',
'contact_type' => 'Organization',
/**
* Verify that attempt to create organization contact without organization name fails
*/
- function testCreateNoNameOrganization() {
+ public function testCreateNoNameOrganization() {
$params = array(
'first_name' => 'The abc Organization',
'contact_type' => 'Organization',
* variables specific to participant so it can be replicated into other entities
* and / or moved to the automated test suite
*/
- function testCreateWithCustom() {
+ public function testCreateWithCustom() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params = $this->_params;
* CRM-12773 - expectation is that civicrm quietly ignores
* fields without values
*/
- function testCreateWithNULLCustomCRM12773() {
+ public function testCreateWithNULLCustomCRM12773() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params = $this->_params;
$params['custom_' . $ids['custom_field_id']] = NULL;
/*
* Test creating a current employer through API
*/
- function testContactCreateCurrentEmployer(){
+ public function testContactCreateCurrentEmployer(){
//here we will just do the get for set-up purposes
$count = $this->callAPISuccess('contact', 'getcount', array(
'organization_name' => 'new employer org',
* Test creating a current employer through API
* - check it will re-activate a de-activated employer
*/
- function testContactCreateDuplicateCurrentEmployerEnables(){
+ public function testContactCreateDuplicateCurrentEmployerEnables(){
//set up - create employer relationship
$employerResult = $this->callAPISuccess('contact', 'create', array_merge($this->_params, array(
'current_employer' => 'new employer org',)
* Check deceased contacts are not retrieved
* Note at time of writing the default is to return default. This should possibly be changed & test added
*/
- function testGetDeceasedRetrieved() {
+ public function testGetDeceasedRetrieved() {
$this->callAPISuccess($this->_entity, 'create', $this->_params);
$c2 = $this->callAPISuccess($this->_entity, 'create', array('first_name' => 'bb', 'last_name' => 'ccc', 'contact_type' => 'Individual', 'is_deceased' => 1));
$result = $this->callAPISuccess($this->_entity, 'get', array('is_deceased' => 0));
/**
* Test that sort works - old syntax
*/
- function testGetSort() {
+ public function testGetSort() {
$c1 = $this->callAPISuccess($this->_entity, 'create', $this->_params);
$c2 = $this->callAPISuccess($this->_entity, 'create', array('first_name' => 'bb', 'last_name' => 'ccc', 'contact_type' => 'Individual'));
$result = $this->callAPISuccess($this->_entity, 'get', array(
* Test that we can retrieve contacts using
* 'id' => array('IN' => array('3,4')) syntax
*/
- function testGetINIDArray() {
+ public function testGetINIDArray() {
$c1 = $this->callAPISuccess($this->_entity, 'create', $this->_params);
$c2 = $this->callAPISuccess($this->_entity, 'create', array('first_name' => 'bb', 'last_name' => 'ccc', 'contact_type' => 'Individual'));
$c3 = $this->callAPISuccess($this->_entity, 'create', array('first_name' => 'hh', 'last_name' => 'll', 'contact_type' => 'Individual'));
/*
* Test variants on deleted behaviour
*/
- function testGetDeleted() {
+ public function testGetDeleted() {
$params = $this->_params;
$contact1 = $this->callAPISuccess('contact', 'create', $params);
$params['is_deleted'] = 1;
/**
* Test that sort works - new syntax
*/
- function testGetSortNewSYntax() {
+ public function testGetSortNewSYntax() {
$c1 = $this->callAPISuccess($this->_entity, 'create', $this->_params);
$c2 = $this->callAPISuccess($this->_entity, 'create', array('first_name' => 'bb', 'last_name' => 'ccc', 'contact_type' => 'Individual'));
$result = $this->callAPISuccess($this->_entity, 'getvalue', array(
/**
* Test apostrophe works in get & create
*/
- function testGetApostropheCRM10857() {
+ public function testGetApostropheCRM10857() {
$params = array_merge($this->_params, array('last_name' => "O'Connor"));
$this->callAPISuccess($this->_entity, 'create', $params);
$result = $this->callAPISuccess($this->_entity, 'getsingle', array(
* variables specific to participant so it can be replicated into other entities
* and / or moved to the automated test suite
*/
- function testGetWithCustom() {
+ public function testGetWithCustom() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params = $this->_params;
* variables specific to participant so it can be replicated into other entities
* and / or moved to the automated test suite
*/
- function testGetWithCustomReturnSyntax() {
+ public function testGetWithCustomReturnSyntax() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params = $this->_params;
/**
* Check that address name is returned if required
*/
- function testGetReturnAddressName () {
+ public function testGetReturnAddressName () {
$contactID = $this->individualCreate();
$this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'address_name' => 'My house', 'location_type_id' => 'Home', 'street_address' => '1 my road'));
$result = $this->callAPISuccessGetSingle('contact', array('return' => 'address_name, street_address', 'id' => $contactID));
}
- function testGetGroupIDFromContact() {
+ public function testGetGroupIDFromContact() {
$groupId = $this->groupCreate();
$description = "Get all from group and display contacts";
$subFile = "GroupFilterUsingContactAPI";
/**
* Verify that attempt to create individual contact with two chained websites succeeds
*/
- function testCreateIndividualWithContributionDottedSyntax() {
+ public function testCreateIndividualWithContributionDottedSyntax() {
$description = "test demonstrates the syntax to create 2 chained entities";
$subFile = "ChainTwoWebsites";
$params = array(
/**
* Verify that attempt to create individual contact with chained contribution and website succeeds
*/
- function testCreateIndividualWithContributionChainedArrays() {
+ public function testCreateIndividualWithContributionChainedArrays() {
$params = array(
'first_name' => 'abc3',
'last_name' => 'xyz3',
* Verify that attempt to create individual contact with first
* and last names and email succeeds
*/
- function testCreateIndividualWithNameEmail() {
+ public function testCreateIndividualWithNameEmail() {
$params = array(
'first_name' => 'abc3',
'last_name' => 'xyz3',
/**
* Verify that attempt to create individual contact with no data fails
*/
- function testCreateIndividualWithOutNameEmail() {
+ public function testCreateIndividualWithOutNameEmail() {
$params = array(
'contact_type' => 'Individual',
);
* Verify that attempt to create individual contact with first
* and last names, email and location type succeeds
*/
- function testCreateIndividualWithNameEmailLocationType() {
+ public function testCreateIndividualWithNameEmailLocationType() {
$params = array(
'first_name' => 'abc4',
'last_name' => 'xyz4',
* Verify that when changing employers
* the old employer relationship becomes inactive
*/
- function testCreateIndividualWithEmployer() {
+ public function testCreateIndividualWithEmployer() {
$employer = $this->organizationCreate();
$employer2 = $this->organizationCreate();
* Verify that attempt to create household contact with details
* succeeds
*/
- function testCreateHouseholdDetails() {
+ public function testCreateHouseholdDetails() {
$params = array(
'household_name' => 'abc8\'s House',
'nick_name' => 'x House',
* Verify that attempt to create household contact with inadequate details
* fails
*/
- function testCreateHouseholdInadequateDetails() {
+ public function testCreateHouseholdInadequateDetails() {
$params = array(
'nick_name' => 'x House',
'email' => 'man8@yahoo.com',
/**
* Verify successful update of individual contact
*/
- function testUpdateIndividualWithAll() {
+ public function testUpdateIndividualWithAll() {
// Insert a row in civicrm_contact creating individual contact
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
/**
* Verify successful update of organization contact
*/
- function testUpdateOrganizationWithAll() {
+ public function testUpdateOrganizationWithAll() {
// Insert a row in civicrm_contact creating organization contact
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
/**
* Verify successful update of household contact
*/
- function testUpdateHouseholdwithAll() {
+ public function testUpdateHouseholdwithAll() {
// Insert a row in civicrm_contact creating household contact
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
/**
* Test civicrm_contact_delete() with no contact ID
*/
- function testContactDeleteNoID() {
+ public function testContactDeleteNoID() {
$params = array(
'foo' => 'bar',
);
/**
* Test civicrm_contact_delete() with error
*/
- function testContactDeleteError() {
+ public function testContactDeleteError() {
$params = array('contact_id' => 999);
$this->callAPIFailure('contact', 'delete', $params);
}
/**
* Test civicrm_contact_delete()
*/
- function testContactDelete() {
+ public function testContactDelete() {
$contactID = $this->individualCreate();
$params = array(
'id' => $contactID ,
/**
* Test for Contact.get id=@user:username
*/
- function testContactGetByUsername() {
+ public function testContactGetByUsername() {
// setup - create contact with a uf-match
$cid = $this->individualCreate(array(
'contact_type' => 'Individual',
/**
* Test to check return works OK
*/
- function testContactGetReturnValues() {
+ public function testContactGetReturnValues() {
$extraParams = array('nick_name' => 'Bob', 'phone' => '456', 'email' => 'e@mail.com');
$contactID = $this->individualCreate($extraParams);
//actually it turns out the above doesn't create a phone
}
}
- function testCRM13252MultipleChainedPhones() {
+ public function testCRM13252MultipleChainedPhones() {
$contactID = $this->householdCreate();
$this->callAPISuccessGetCount('phone', array('contact_id' => $contactID), 0);
$params = array(
/**
* Test for Contact.get id=@user:username (with an invalid username)
*/
- function testContactGetByUnknownUsername() {
+ public function testContactGetByUnknownUsername() {
// setup - mock the calls to CRM_Utils_System_*::getUfId
$userSystem = $this->getMock('CRM_Utils_System_UnitTests', array('getUfId'));
$userSystem->expects($this->once())
/**
* Verify attempt to create individual with chained arrays
*/
- function testGetIndividualWithChainedArrays() {
+ public function testGetIndividualWithChainedArrays() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params['custom_' . $ids['custom_field_id']] = "custom string";
$this->assertEquals("http://civicrm.org", $result['values'][$result['id']]['api.website.get']['values'][0]['url']);
}
- function testGetIndividualWithChainedArraysFormats() {
+ public function testGetIndividualWithChainedArraysFormats() {
$description = "/*this demonstrates the usage of chained api functions. A variety of return formats are used. Note that no notes
*custom fields or memberships exist";
$subfile = "APIChainedArrayFormats";
$this->customGroupDelete($moreids['custom_group_id']);
}
- function testGetIndividualWithChainedArraysAndMultipleCustom() {
+ public function testGetIndividualWithChainedArraysAndMultipleCustom() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params['custom_' . $ids['custom_field_id']] = "custom string";
$moreids = $this->CustomGroupMultipleCreateWithFields();
/*
* Test checks siusage of $values to pick & choose inputs
*/
- function testChainingValuesCreate() {
+ public function testChainingValuesCreate() {
$description = "/*this demonstrates the usage of chained api functions. Specifically it has one 'parent function' &
2 child functions - one receives values from the parent (Contact) and the other child (Tag). ";
$subfile = "APIChainedArrayValuesFromSiblingFunction";
/*
* test TrueFalse format - I couldn't come up with an easy way to get an error on Get
*/
- function testContactGetFormatIsSuccessTrue() {
+ public function testContactGetFormatIsSuccessTrue() {
$this->createContactFromXML();
$description = "This demonstrates use of the 'format.is_success' param.
This param causes only the success or otherwise of the function to be returned as BOOLEAN";
/*
* test TrueFalse format
*/
- function testContactCreateFormatIsSuccessFalse() {
+ public function testContactCreateFormatIsSuccessFalse() {
$description = "This demonstrates use of the 'format.is_success' param.
This param causes only the success or otherwise of the function to be returned as BOOLEAN";
/*
* test Single Entity format
*/
- function testContactGetSingle_entity_array() {
+ public function testContactGetSingle_entity_array() {
$this->createContactFromXML();
$description = "This demonstrates use of the 'format.single_entity_array' param.
/* This param causes the only contact to be returned as an array without the other levels.
/*
* test Single Entity format
*/
- function testContactGetFormatcount_only() {
+ public function testContactGetFormatcount_only() {
$this->createContactFromXML();
$description = "/*This demonstrates use of the 'getCount' action
/* This param causes the count of the only function to be returned as an integer";
/*
* Test id only format
*/
- function testContactGetFormatID_only() {
+ public function testContactGetFormatID_only() {
$this->createContactFromXML();
$description = "This demonstrates use of the 'format.id_only' param.
/* This param causes the id of the only entity to be returned as an integer.
/*
* Test id only format
*/
- function testContactGetFormatSingleValue() {
+ public function testContactGetFormatSingleValue() {
$this->createContactFromXML();
$description = "This demonstrates use of the 'format.single_value' param.
/* This param causes only a single value of the only entity to be returned as an string.
/**
* Test that permissions are respected when creating contacts
*/
- function testContactCreationPermissions() {
+ public function testContactCreationPermissions() {
$params = array(
'contact_type' => 'Individual', 'first_name' => 'Foo',
'last_name' => 'Bear',
$this->callAPISuccess('contact', 'create', $params, NULL, 'overfluous permissions should be enough to create a contact');
}
- function testContactUpdatePermissions() {
+ public function testContactUpdatePermissions() {
$params = array('contact_type' => 'Individual', 'first_name' => 'Foo', 'last_name' => 'Bear', 'check_permissions' => TRUE,);
$result = $this->callAPISuccess('contact', 'create', $params);
$config = CRM_Core_Config::singleton();
$this->callAPISuccess('contact', 'update', $params, NULL, 'overfluous permissions should be enough to update a contact');
}
- function createContactFromXML() {
+ public function createContactFromXML() {
// Insert a row in civicrm_contact creating contact 17
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
);
}
- function testContactProximity() {
+ public function testContactProximity() {
// first create a contact with a SF location with a specific
// geocode
$contactID = $this->organizationCreate();
* Test that Ajax API permission is sufficient to access getquick api
* (note that getquick api is required for autocomplete & has ACL permissions applied)
*/
- function testGetquickPermission_CRM_13744() {
+ public function testGetquickPermission_CRM_13744() {
CRM_Core_Config::singleton()->userPermissionClass->permissions = array('access CiviEvent');
$this->callAPIFailure('contact', 'getquick', array('name' => 'b', 'check_permissions' => TRUE));
CRM_Core_Config::singleton()->userPermissionClass->permissions = array('access CiviCRM');
/**
* Test get ref api - gets a list of references to an entity
*/
- function testGetReferenceCounts() {
+ public function testGetReferenceCounts() {
$result = $this->callAPISuccess('Contact', 'create', array(
'first_name' => 'Testily',
'last_name' => 'McHaste',
$this->assertTrue(!isset($refCountsIdx['sql:civicrm_address:contact_id']));
}
- function testSQLOperatorsOnContactAPI() {
+ public function testSQLOperatorsOnContactAPI() {
$this->individualCreate();
$this->organizationCreate();
$this->householdCreate();
/**
* CRM-14743 - test api respects search operators
*/
- function testGetModifiedDateByOperators() {
+ public function testGetModifiedDateByOperators() {
$preExistingContactCount = CRM_Core_DAO::singleValueQuery('select count(*) FROM civicrm_contact');
$contact1 = $this->individualCreate();
$sql = "UPDATE civicrm_contact SET created_date = '2012-01-01', modified_date = '2013-01-01' WHERE id = " . $contact1;
/**
* CRM-14743 - test api respects search operators
*/
- function testGetCreatedDateByOperators() {
+ public function testGetCreatedDateByOperators() {
$preExistingContactCount = CRM_Core_DAO::singleValueQuery('select count(*) FROM civicrm_contact');
$contact1 = $this->individualCreate();
$sql = "UPDATE civicrm_contact SET created_date = '2012-01-01' WHERE id = " . $contact1;
/**
* CRM-14263 check that API is not affected by search profile related bug
*/
- function testReturnCityProfile () {
+ public function testReturnCityProfile () {
$contactID = $this->individualCreate();
CRM_Core_Config::singleton()->defaultSearchProfileID = 1;
$this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1,));
/**
* CRM-15443 - ensure getlist api does not return deleted contacts
*/
- function testGetlistExcludeConditions() {
+ public function testGetlistExcludeConditions() {
$name = md5(time());
$contact = $this->individualCreate(array('last_name' => $name));
$deceasedContact = $this->individualCreate(array('last_name' => $name, 'is_deceased' => 1));
/**
* Test contact.getactions
*/
- function testGetActions() {
+ public function testGetActions() {
$description = "Getting the available actions for an entity.";
$result = $this->callAPIAndDocument($this->_entity, 'getactions', array(), __FUNCTION__, __FILE__, $description);
$expected = array(
class api_v3_ContactTypeTest extends CiviUnitTestCase {
protected $_apiversion;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
$this->_apiversion = 3;
* Test add methods with valid data
* success expected
*/
- function testContactCreate() {
+ public function testContactCreate() {
// check for Type:Individual Subtype:sub_individual
$contactParams = array(
/**
* Test add with invalid data
*/
- function testContactAddInvalidData() {
+ public function testContactAddInvalidData() {
// check for Type:Individual Subtype:sub_household
$contactParams = array(
* Test update with no subtype to valid subtype
* success expected
*/
- function testContactUpdateNoSubtypeValid() {
+ public function testContactUpdateNoSubtypeValid() {
// check for Type:Individual
$contactParams = array(
/**
* Test update with no subtype to invalid subtype
*/
- function testContactUpdateNoSubtypeInvalid() {
+ public function testContactUpdateNoSubtypeInvalid() {
// check for Type:Individual
$contactParams = array(
* Test update with no subtype to valid subtype
* success expected
*/
- function testContactUpdateSubtypeValid() {
+ public function testContactUpdateSubtypeValid() {
$params = array(
'label' => 'sub2_individual',
/**
* Test update with no subtype to invalid subtype
*/
- function testContactUpdateSubtypeInvalid() {
+ public function testContactUpdateSubtypeInvalid() {
// check for Type:Individual subtype:sub_individual
$contactParams = array(
);
}
- function tearDown() {
+ public function tearDown() {
foreach ($this->contactIds as $id) {
$this->callAPISuccess('contact', 'delete', array('id' => $id));
}
* Set up membership contribution page
* @param bool $isSeparatePayment
*/
- function setUpMembershipContributionPage($isSeparatePayment = FALSE) {
+ public function setUpMembershipContributionPage($isSeparatePayment = FALSE) {
$this->setUpMembershipBlockPriceSet();
$this->params['payment_processor_id'] = $this->_ids['payment_processor'] = $this->paymentProcessorCreate(array(
'payment_processor_type_id' => 'Dummy',
* The default data set does not include a complete default membership price set - not quite sure why
* This function ensures it exists & populates $this->_ids with it's data
*/
- function setUpMembershipBlockPriceSet() {
+ public function setUpMembershipBlockPriceSet() {
$this->_ids['price_set'][] = $this->callAPISuccess('price_set', 'getvalue', array('name' => 'default_membership_type_amount', 'return' => 'id'));
if (empty($this->_ids['membership_type'])) {
$this->_ids['membership_type'] = array($this->membershipTypeCreate(array('minimum_fee' => 2)));
/**
* Help function to set up contribution page with some defaults
*/
- function setUpContributionPage() {
+ public function setUpContributionPage() {
$contributionPageResult = $this->callAPISuccess($this->_entity, 'create', $this->params);
if (empty($this->_ids['price_set'])) {
$priceSet = $this->callAPISuccess('price_set', 'create', $this->_priceSetParams);
public $DBResetRequired = FALSE;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
$this->ids['contact'][0] = $this->individualCreate();
protected $_params;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
* Test get methods
* @todo - this might be better broken down into more smaller tests
*/
- function testGetContributionSoft() {
+ public function testGetContributionSoft() {
//We don't test for PCP fields because there's no PCP API, so we can't create campaigns.
$p = array(
'contribution_id' => $this->_contributionId,
///////////////// civicrm_contribution_soft
- function testCreateEmptyParamsContributionSoft() {
+ public function testCreateEmptyParamsContributionSoft() {
$softcontribution = $this->callAPIFailure('contribution_soft', 'create', array(),
'Mandatory key(s) missing from params array: contribution_id, amount, contact_id'
);
}
- function testCreateParamsWithoutRequiredKeysContributionSoft() {
+ public function testCreateParamsWithoutRequiredKeysContributionSoft() {
$softcontribution = $this->callAPIFailure('contribution_soft', 'create', array(),
'Mandatory key(s) missing from params array: contribution_id, amount, contact_id'
);
}
- function testCreateContributionSoftInvalidContact() {
+ public function testCreateContributionSoftInvalidContact() {
$params = array(
'contact_id' => 999,
);
}
- function testCreateContributionSoftInvalidContributionId() {
+ public function testCreateContributionSoftInvalidContributionId() {
$params = array(
'contribution_id' => 999999,
/*
* Function tests that additional financial records are created when fee amount is recorded
*/
- function testCreateContributionSoft() {
+ public function testCreateContributionSoft() {
$params = array(
'contribution_id' => $this->_contributionId,
'contact_id' => $this->_softIndividual1Id,
}
//To Update Soft Contribution
- function testCreateUpdateContributionSoft() {
+ public function testCreateUpdateContributionSoft() {
//create a soft credit
$params = array(
'contribution_id' => $this->_contributionId,
}
///////////////// civicrm_contribution_soft_delete methods
- function testDeleteEmptyParamsContributionSoft() {
+ public function testDeleteEmptyParamsContributionSoft() {
$params = array();
$softcontribution = $this->callAPIFailure('contribution_soft', 'delete', $params);
}
- function testDeleteWrongParamContributionSoft() {
+ public function testDeleteWrongParamContributionSoft() {
$params = array(
'contribution_source' => 'SSF',
);
$softcontribution = $this->callAPIFailure('contribution_soft', 'delete', $params);
}
- function testDeleteContributionSoft() {
+ public function testDeleteContributionSoft() {
//create a soft credit
$params = array(
'contribution_id' => $this->_contributionId,
* Test civicrm_contribution_search with empty params.
* All available contributions expected.
*/
- function testSearchEmptyParams() {
+ public function testSearchEmptyParams() {
$p = array(
'contribution_id' => $this->_contributionId,
'contact_id' => $this->_softIndividual1Id,
/**
* Test civicrm_contribution_soft_search. Success expected.
*/
- function testSearch() {
+ public function testSearch() {
$p1 = array(
'contribution_id' => $this->_contributionId,
'contact_id' => $this->_softIndividual1Id,
protected $_ids = array();
protected $_pageParams = array();
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->_apiversion = 3;
);
}
- function tearDown() {
+ public function tearDown() {
$this->quickCleanUpFinancialEntities();
}
- function testGetContribution() {
+ public function testGetContribution() {
$p = array(
'contact_id' => $this->_individualId,
'receive_date' => '2010-01-20',
/**
* We need to ensure previous tested behaviour still works as part of the api contract
*/
- function testGetContributionLegacyBehaviour() {
+ public function testGetContributionLegacyBehaviour() {
$p = array(
'contact_id' => $this->_individualId,
'receive_date' => '2010-01-20',
));
}
///////////////// civicrm_contribution_
- function testCreateEmptyContributionIDUseDonation() {
+ public function testCreateEmptyContributionIDUseDonation() {
$params = array(
'contribution_id' => FALSE,
'contact_id' => 1,
* stability
*///////////////// civicrm_contribution_
- function testCreateLegacyBehaviour() {
+ public function testCreateLegacyBehaviour() {
$params = array(
'contribution_id' => FALSE,
'contact_id' => 1,
* variables specific to participant so it can be replicated into other entities
* and / or moved to the automated test suite
*/
- function testCreateWithCustom() {
+ public function testCreateWithCustom() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params = $this->_params;
* variables specific to participant so it can be replicated into other entities
* and / or moved to the automated test suite
*/
- function testCreateGetFieldsWithCustom() {
+ public function testCreateGetFieldsWithCustom() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$idsContact = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, 'ContactTest.php');
$result = $this->callAPISuccess('Contribution', 'getfields', array());
$this->customGroupDelete($idsContact['custom_group_id']);
}
- function testCreateContributionNoLineItems() {
+ public function testCreateContributionNoLineItems() {
$params = array(
'contact_id' => $this->_individualId,
/*
* Test checks that passing in line items suppresses the create mechanism
*/
- function testCreateContributionChainedLineItems() {
+ public function testCreateContributionChainedLineItems() {
$params = array(
'contact_id' => $this->_individualId,
$this->assertEquals(2, $lineItems['count']);
}
- function testCreateContributionOffline() {
+ public function testCreateContributionOffline() {
$params = array(
'contact_id' => $this->_individualId,
'receive_date' => '20120511',
/**
* Test create with valid payment instument
*/
- function testCreateContributionWithPaymentInstrument() {
+ public function testCreateContributionWithPaymentInstrument() {
$params = $this->_params + array('payment_instrument' => 'EFT');
$contribution = $this->callAPISuccess('contribution', 'create', $params);
$contribution = $this->callAPISuccess('contribution','get', array(
$this->assertEquals('Credit Card', $contribution['values'][0]['payment_instrument']);
}
- function testGetContributionByPaymentInstrument() {
+ public function testGetContributionByPaymentInstrument() {
$params = $this->_params + array('payment_instrument' => 'EFT');
$params2 = $this->_params + array('payment_instrument' => 'Cash');
$this->callAPISuccess('contribution','create',$params);
/**
* Create test with unique field name on source
*/
- function testCreateContributionSource() {
+ public function testCreateContributionSource() {
$params = array(
'contact_id' => $this->_individualId,
/*
* Create test with unique field name on source
*/
- function testCreateDefaultNow() {
+ public function testCreateDefaultNow() {
$params = $this->_params;
unset($params['receive_date']);
/**
* Create test with unique field name on source
*/
- function testCreateContributionSourceInvalidContac() {
+ public function testCreateContributionSourceInvalidContac() {
$params = array(
'contact_id' => 999,
$this->callAPIFailure('contribution', 'create', $params, 'contact_id is not valid : 999');
}
- function testCreateContributionSourceInvalidContContact() {
+ public function testCreateContributionSourceInvalidContContact() {
$params = array(
'contribution_contact_id' => 999,
/**
* Test note created correctly
*/
- function testCreateContributionWithNote() {
+ public function testCreateContributionWithNote() {
$description = "Demonstrates creating contribution with Note Entity";
$subfile = "ContributionCreateWithNote";
$params = array(
$this->callAPISuccess('contribution', 'delete', array('id' => $contribution['id']));
}
- function testCreateContributionWithNoteUniqueNameAliases() {
+ public function testCreateContributionWithNoteUniqueNameAliases() {
$params = array(
'contact_id' => $this->_individualId,
'receive_date' => '2012-01-01',
* 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)
*/
- function testCreateContributionWithSoftCredt() {
+ public function testCreateContributionWithSoftCredt() {
$description = "Demonstrates creating contribution with SoftCredit";
$subfile = "ContributionCreateWithSoftCredit";
$contact2 = $this->callAPISuccess('Contact', 'create', array('display_name' => 'superman', 'contact_type' => 'Individual'));
$this->callAPISuccess('contact', 'delete', array('id' => $contact2['id']));
}
- function testCreateContributionWithSoftCreditDefaults() {
+ public function testCreateContributionWithSoftCreditDefaults() {
$description = "Demonstrates creating contribution with Soft Credit defaults for amount and type";
$subfile = "ContributionCreateWithSoftCreditDefaults";
$contact2 = $this->callAPISuccess('Contact', 'create', array('display_name' => 'superman', 'contact_type' => 'Individual'));
$this->callAPISuccess('contact', 'delete', array('id' => $contact2['id']));
}
- function testCreateContributionWithHonoreeContact() {
+ public function testCreateContributionWithHonoreeContact() {
$description = "Demonstrates creating contribution with Soft Credit by passing in honor_contact_id";
$subfile = "ContributionCreateWithHonoreeContact";
$contact2 = $this->callAPISuccess('Contact', 'create', array('display_name' => 'superman', 'contact_type' => 'Individual'));
/**
* Test using example code
*/
- function testContributionCreateExample() {
+ public function testContributionCreateExample() {
//make sure at least on page exists since there is a truncate in tear down
$page = $this->callAPISuccess('contribution_page', 'create', $this->_pageParams);
$this->assertAPISuccess($page);
/*
* Function tests that additional financial records are created when fee amount is recorded
*/
- function testCreateContributionWithFee() {
+ public function testCreateContributionWithFee() {
$params = array(
'contact_id' => $this->_individualId,
'receive_date' => '20120511',
/**
* Function tests that additional financial records are created when online contribution is created
*/
- function testCreateContributionOnline() {
+ public function testCreateContributionOnline() {
CRM_Financial_BAO_PaymentProcessor::create($this->_processorParams);
$contributionPage = $this->callAPISuccess( 'contribution_page','create', $this->_pageParams );
$this->assertAPISuccess($contributionPage);
* 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 testCreateInvalidFinancialType() {
+ public function testCreateInvalidFinancialType() {
$params = $this->_params;
$params['financial_type_id'] = 99999;
$this->callAPIFailure($this->_entity, 'create', $params, "'99999' is not a valid option for field financial_type_id");
* 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 testValidNamedFinancialType() {
+ public function testValidNamedFinancialType() {
$params = $this->_params;
$params['financial_type_id'] = 'Donation';
$this->callAPISuccess($this->_entity, 'create', $params);
* Function tests that additional financial records are created when online contribution with pay later option
* is created
*/
- function testCreateContributionPayLaterOnline() {
+ public function testCreateContributionPayLaterOnline() {
CRM_Financial_BAO_PaymentProcessor::create($this->_processorParams);
$this->_pageParams['is_pay_later'] = 1;
$contributionPage = $this->callAPISuccess( 'contribution_page','create',$this->_pageParams );
* Function tests that additional financial records are created when online contribution with pending option
* is created
*/
- function testCreateContributionPendingOnline() {
+ public function testCreateContributionPendingOnline() {
$paymentProcessor = CRM_Financial_BAO_PaymentProcessor::create($this->_processorParams);
$contributionPage = $this->callAPISuccess( 'contribution_page', 'create', $this->_pageParams );
$this->assertAPISuccess($contributionPage);
/**
* Test that BAO defaults work
*/
- function testCreateBAODefaults() {
+ public function testCreateBAODefaults() {
unset($this->_params['contribution_source_id'], $this->_params['payment_instrument_id']);
$contribution = $this->callAPISuccess('contribution', 'create', $this->_params);
$contribution = $this->callAPISuccess('contribution', 'getsingle', array('id' => $contribution['id'], 'api.contribution.delete' => 1));
/*
* Function tests that line items, financial records are updated when contribution amount is changed
*/
- function testCreateUpdateContributionChangeTotal() {
+ public function testCreateUpdateContributionChangeTotal() {
$contribution = $this->callAPISuccess('contribution', 'create', $this->_params);
$lineItems = $this->callAPISuccess('line_item','getvalue', array(
/*
* Function tests that line items, financial records are updated when pay later contribution is received
*/
- function testCreateUpdateContributionPayLater() {
+ public function testCreateUpdateContributionPayLater() {
$contribParams = array(
'contact_id' => $this->_individualId,
'receive_date' => '2012-01-01',
/*
* Function tests that financial records are updated when Payment Instrument is changed
*/
- function testCreateUpdateContributionPaymentInstrument() {
+ public function testCreateUpdateContributionPaymentInstrument() {
$instrumentId = $this->_addPaymentInstrument();
$contribParams = array(
'contact_id' => $this->_individualId,
/*
* Function tests that financial records are added when Contribution is Refunded
*/
- function testCreateUpdateContributionRefund() {
+ public function testCreateUpdateContributionRefund() {
$contribParams = array(
'contact_id' => $this->_individualId,
'receive_date' => '2012-01-01',
/*
* Function tests invalid contribution status change
*/
- function testCreateUpdateContributionInValidStatusChange() {
+ public function testCreateUpdateContributionInValidStatusChange() {
$contribParams = array(
'contact_id' => 1,
'receive_date' => '2012-01-01',
/*
* Function tests that financial records are added when Pending Contribution is Canceled
*/
- function testCreateUpdateContributionCancelPending() {
+ public function testCreateUpdateContributionCancelPending() {
$contribParams = array(
'contact_id' => $this->_individualId,
'receive_date' => '2012-01-01',
/*
* Function tests that financial records are added when Financial Type is Changed
*/
- function testCreateUpdateContributionChangeFinancialType() {
+ public function testCreateUpdateContributionChangeFinancialType() {
$contribParams = array(
'contact_id' => $this->_individualId,
'receive_date' => '2012-01-01',
/**
* Test that update does not change status id CRM-15105
*/
- function testCreateUpdateWithoutChangingPendingStatus() {
+ public function testCreateUpdateWithoutChangingPendingStatus() {
$contribution = $this->callAPISuccess('contribution', 'create', array_merge($this->_params, array('contribution_status_id' => 2)));
$this->callAPISuccess('contribution', 'create', array('id' => $contribution['id'], 'source' => 'new source'));
$contribution = $this->callAPISuccess('contribution', 'getsingle', array('id' => $contribution['id'], 'api.contribution.delete' => 1));
}
//To Update Contribution
//CHANGE: we require the API to do an incremental update
- function testCreateUpdateContribution() {
+ public function testCreateUpdateContribution() {
$contributionID = $this->contributionCreate($this->_individualId, $this->_financialTypeId, 'idofsh', 212355);
$old_params = array(
}
///////////////// civicrm_contribution_delete methods
- function testDeleteEmptyParamsContribution() {
+ public function testDeleteEmptyParamsContribution() {
$params = array();
$this->callAPIFailure('contribution', 'delete', $params);
}
- function testDeleteParamsNotArrayContribution() {
+ public function testDeleteParamsNotArrayContribution() {
$params = 'contribution_id= 1';
$contribution = $this->callAPIFailure('contribution', 'delete', $params);
$this->assertEquals($contribution['error_message'], 'Input variable `params` is not an array');
}
- function testDeleteWrongParamContribution() {
+ public function testDeleteWrongParamContribution() {
$params = array(
'contribution_source' => 'SSF',
$this->callAPIFailure('contribution', 'delete', $params);
}
- function testDeleteContribution() {
+ public function testDeleteContribution() {
$contributionID = $this->contributionCreate($this->_individualId, $this->_financialTypeId, 'dfsdf', 12389);
$params = array(
* Test civicrm_contribution_search with empty params.
* All available contributions expected.
*/
- function testSearchEmptyParams() {
+ public function testSearchEmptyParams() {
$params = array();
$p = array(
/**
* Test civicrm_contribution_search. Success expected.
*/
- function testSearch() {
+ public function testSearch() {
$p1 = array(
'contact_id' => $this->_individualId,
'receive_date' => date('Ymd'),
* Note that we are creating a logged in user because email goes out from
* that person
*/
- function testCompleteTransaction() {
+ public function testCompleteTransaction() {
$mut = new CiviMailUtils( $this, true );
$this->createLoggedInUser();
$params = array_merge($this->_params, array('contribution_status_id' => 2,));
*
* tests.
*/
- function testCompleteTransactionWithReceiptDateSet() {
+ public function testCompleteTransactionWithReceiptDateSet() {
$mut = new CiviMailUtils( $this, true );
$this->createLoggedInUser();
$params = array_merge($this->_params, array('contribution_status_id' => 2,'receipt_date' => 'now'));
* Note that we are creating a logged in user because email goes out from
* that person
*/
- function testCompleteTransactionWithParticipantRecord() {
+ public function testCompleteTransactionWithParticipantRecord() {
$mut = new CiviMailUtils( $this, true );
$mut->clearMessages();
$this->createLoggedInUser();
/**
* Test membership is renewed when transaction completed
*/
- function testCompleteTransactionMembershipPriceSet() {
+ public function testCompleteTransactionMembershipPriceSet() {
$this->createPriceSetWithPage('membership');
$this->setUpPendingContribution($this->_ids['price_field_value'][0]);
$this->callAPISuccess('contribution', 'completetransaction', array('id' => $this->_ids['contribution']));
/**
* Test membership is renewed when transaction completed
*/
- function testCompleteTransactionMembershipPriceSetTwoTerms() {
+ public function testCompleteTransactionMembershipPriceSetTwoTerms() {
$this->createPriceSetWithPage('membership');
$this->setUpPendingContribution($this->_ids['price_field_value'][1]);
$this->callAPISuccess('contribution', 'completetransaction', array('id' => $this->_ids['contribution']));
$this->cleanUpAfterPriceSets();
}
- function cleanUpAfterPriceSets() {
+ public function cleanUpAfterPriceSets() {
$this->quickCleanUpFinancialEntities();
$this->contactDelete($this->_ids['contact']);
$this->callAPISuccess('price_set', 'delete', array('id' => $this->_ids['price_set']));
* @param $entity
* @param array $params
*/
- function createPriceSetWithPage($entity, $params = array()) {
+ public function createPriceSetWithPage($entity, $params = array()) {
$membershipTypeID = $this->membershipTypeCreate();
$contributionPageResult = $this->callAPISuccess('contribution_page', 'create', array(
'title' => "Test Contribution Page",
* Set up a pending transaction with a specific price field id
* @param int $priceFieldValueID
*/
- function setUpPendingContribution($priceFieldValueID){
+ public function setUpPendingContribution($priceFieldValueID){
$contactID = $this->individualCreate();
$membership = $this->callAPISuccess('membership', 'create', array(
'contact_id' => $contactID,
/**
* Test sending a mail via the API
*/
- function testSendMail() {
+ public function testSendMail() {
$mut = new CiviMailUtils( $this, true );
$contribution = $this->callAPISuccess('contribution','create',$this->_params);
$this->callAPISuccess('contribution', 'sendconfirmation', array(
/**
* Test sending a mail via the API
*/
- function testSendMailEvent() {
+ public function testSendMailEvent() {
$mut = new CiviMailUtils( $this, true );
$contribution = $this->callAPISuccess('contribution','create',$this->_params);
$event = $this->eventCreate(array(
* This function does a GET & compares the result against the $params
* Use as a double check on Creates
*/
- function contributionGetnCheck($params, $id, $delete = 1) {
+ public function contributionGetnCheck($params, $id, $delete = 1) {
$contribution = $this->callAPISuccess('Contribution', 'Get', array(
'id' => $id,
* Create a pending contribution & linked pending participant record
* (along with an event)
*/
- function createPendingParticipantContribution(){
+ public function createPendingParticipantContribution(){
$event = $this->eventCreate(array('is_email_confirm' => 1, 'confirm_from_email' => 'test@civicrm.org',));
$participantID = $this->participantCreate(array('event_id' => $event['id'], 'status_id' => 6));
$this->_ids['participant'] = $participantID;
* @param int $contId
* @param $context
*/
- function _checkFinancialItem($contId, $context) {
+ public function _checkFinancialItem($contId, $context) {
if ($context != 'paylater') {
$params = array (
'entity_id' => $contId,
* @param $context
* @param int $instrumentId
*/
- function _checkFinancialTrxn($contribution, $context, $instrumentId = NULL) {
+ public function _checkFinancialTrxn($contribution, $context, $instrumentId = NULL) {
$trxnParams = array(
'entity_id' => $contribution['id'],
'entity_table' => 'civicrm_contribution',
/**
* @return mixed
*/
- function _addPaymentInstrument () {
+ public function _addPaymentInstrument () {
$gId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'payment_instrument', 'id', 'name');
$optionParams = array(
'option_group_id' => $gId,
* @param array $params
* @param $context
*/
- function _checkFinancialRecords($params,$context) {
+ public function _checkFinancialRecords($params,$context) {
$entityParams = array(
'entity_id' => $params['id'],
'entity_table' => 'civicrm_contribution',
protected $_params;
- function setUp() {
+ public function setUp() {
$this->_apiversion = 3;
parent::setUp();
$this->useTransaction(TRUE);
class api_v3_CustomFieldTest extends CiviUnitTestCase {
protected $_apiversion;
- function setUp() {
+ public function setUp() {
$this->_apiversion = 3;
parent::setUp();
}
- function tearDown() {
+ public function tearDown() {
$tablesToTruncate = array(
'civicrm_custom_group', 'civicrm_custom_field',
);
/**
* Check with no array
*/
- function testCustomFieldCreateNoArray() {
+ public function testCustomFieldCreateNoArray() {
$fieldParams = NULL;
$customField = $this->callAPIFailure('custom_field', 'create', $fieldParams);
/**
* Check with no label
*/
- function testCustomFieldCreateWithoutLabel() {
+ public function testCustomFieldCreateWithoutLabel() {
$customGroup = $this->customGroupCreate(array('extends' => 'Individual', 'title' => 'text_test_group'));
$params = array(
'custom_group_id' => $customGroup['id'],
/**
* Check with edit
*/
- function testCustomFieldCreateWithEdit() {
+ public function testCustomFieldCreateWithEdit() {
$customGroup = $this->customGroupCreate(array('extends' => 'Individual', 'title' => 'text_test_group'));
$params = array(
'custom_group_id' => $customGroup['id'],
/**
* Check without groupId
*/
- function testCustomFieldCreateWithoutGroupID() {
+ public function testCustomFieldCreateWithoutGroupID() {
$fieldParams = array(
'name' => 'test_textfield1',
'label' => 'Name',
/**
* Check for Each data type: loop through available form input types
**/
- function testCustomFieldCreateAllAvailableFormInputs() {
+ public function testCustomFieldCreateAllAvailableFormInputs() {
$gid = $this->customGroupCreate(array('extends' => 'Individual', 'title' => 'testAllFormInputs'));
$dtype = CRM_Core_BAO_CustomField::dataType();
/**
* @param array $params
*/
- function _loopingCustomFieldCreateTest($params) {
+ public function _loopingCustomFieldCreateTest($params) {
$customField = $this->callAPISuccess('custom_field', 'create', $params);
$this->assertNotNull($customField['id']);
$this->getAndCheck($params, $customField['id'], 'CustomField');
*
* @return array
*/
- function _buildParams($gid, $htype, $dtype) {
+ public function _buildParams($gid, $htype, $dtype) {
$params = $this->_buildBasicParams($gid, $htype, $dtype);
/* //Not Working for any type. Maybe redundant with testCustomFieldCreateWithOptionValues()
if ($htype == 'Multi-Select')
*
* @return array
*/
- function _buildBasicParams($gid, $htype, $dtype) {
+ public function _buildBasicParams($gid, $htype, $dtype) {
return array(
'custom_group_id' => $gid,
'label' => $dtype . $htype,
/**
* Check with data type - Options with option_values
*/
- function testCustomFieldCreateWithEmptyOptionGroup() {
+ public function testCustomFieldCreateWithEmptyOptionGroup() {
$customGroup = $this->customGroupCreate(array('extends' => 'Contact', 'title' => 'select_test_group'));
$params = array(
'custom_group_id' => $customGroup['id'],
/**
* Test custom field with existing option group
*/
- function testCustomFieldExistingOptionGroup() {
+ public function testCustomFieldExistingOptionGroup() {
$customGroup = $this->customGroupCreate(array('extends' => 'Organization', 'title' => 'test_group'));
$params = array(
'custom_group_id' => $customGroup['id'],
/**
* Test custom field get works & return param works
*/
- function testCustomFieldGetReturnOptions(){
+ public function testCustomFieldGetReturnOptions(){
$customGroup = $this->customGroupCreate(array('extends' => 'Individual', 'title' => 'test_group'));
$customField = $this->customFieldCreate(array('custom_group_id' => $customGroup['id']));
/**
* Test custom field get works & return param works
*/
- function testCustomFieldGetReturnArray(){
+ public function testCustomFieldGetReturnArray(){
$customGroup = $this->customGroupCreate(array('extends' => 'Individual', 'title' => 'test_group'));
$customField = $this->customFieldCreate(array('custom_group_id' => $customGroup['id']));
/**
* Test custom field get works & return param works
*/
- function testCustomFieldGetReturnTwoOptions(){
+ public function testCustomFieldGetReturnTwoOptions(){
$customGroup = $this->customGroupCreate(array('extends' => 'Individual', 'test_group'));
$customField = $this->customFieldCreate(array('custom_group_id' => $customGroup['id']));
$this->assertFalse(array_key_exists('label', $result));
}
- function testCustomFieldCreateWithOptionValues() {
+ public function testCustomFieldCreateWithOptionValues() {
$customGroup = $this->customGroupCreate(array('extends' => 'Contact', 'title' => 'select_test_group'));
$option_values = array(
/**
* Check with no array
*/
- function testCustomFieldDeleteNoArray() {
+ public function testCustomFieldDeleteNoArray() {
$params = NULL;
$customField = $this->callAPIFailure('custom_field', 'delete', $params);
$this->assertEquals($customField['error_message'], 'Input variable `params` is not an array');
/**
* Check without Field ID
*/
- function testCustomFieldDeleteWithoutFieldID() {
+ public function testCustomFieldDeleteWithoutFieldID() {
$params = array();
$customField = $this->callAPIFailure('custom_field', 'delete', $params,
'Mandatory key(s) missing from params array: id');
/**
* Check without valid array
*/
- function testCustomFieldDelete() {
+ public function testCustomFieldDelete() {
$customGroup = $this->customGroupCreate(array('extends' => 'Individual', 'title' => 'test_group'));
$customField = $this->customFieldCreate(array('custom_group_id' => $customGroup['id']));
$this->assertNotNull($customField['id'], 'in line ' . __LINE__);
/**
* Check for Option Value
*/
- function testCustomFieldOptionValueDelete() {
+ public function testCustomFieldOptionValueDelete() {
$customGroup = $this->customGroupCreate(array('extends' => 'Contact', 'title' => 'ABC'));
$customOptionValueFields = $this->customFieldOptionValueCreate($customGroup, 'fieldABC');
$params = array(
* and "Activity.getfields" should return only their respective fields (not the other's fields),
* and unrelated entities should return no custom fields.
*/
- function testGetfields_CrossEntityPollution() {
+ public function testGetfields_CrossEntityPollution() {
$auxEntities = array('Email', 'Address', 'LocBlock', 'Membership', 'ContributionPage', 'ReportInstance');
$allEntities = array_merge(array('Contact', 'Activity'), $auxEntities);
*
* @return array
*/
- function getCustomFieldKeys($getFieldsResult) {
+ public function getCustomFieldKeys($getFieldsResult) {
$isCustom = function($key) {
return preg_match('/^custom_/', $key);
};
public $DBResetRequired = TRUE;
- function setUp() {
+ public function setUp() {
$this->_entity = 'CustomGroup';
$this->_params = array(
'title' => 'Test_Group_1',
parent::setUp();
}
- function tearDown() {
+ public function tearDown() {
$tablesToTruncate = array('civicrm_custom_group', 'civicrm_custom_field');
// true tells quickCleanup to drop any tables that might have been created in the test
$this->quickCleanup($tablesToTruncate, TRUE);
* code. The SyntaxConformance is capable of testing this for all entities on create
* & delete (& it would be easy to add if not there)
*/
- function testCustomGroupCreateNoParam() {
+ public function testCustomGroupCreateNoParam() {
$customGroup = $this->callAPIFailure('custom_group', 'create', array(),
'Mandatory key(s) missing from params array: title, extends'
);
/**
* Check with empty array
*/
- function testCustomGroupCreateNoExtends() {
+ public function testCustomGroupCreateNoExtends() {
$params = array(
'domain_id' => 1,
'title' => 'Test_Group_1',
/**
* Check with empty array
*/
- function testCustomGroupCreateInvalidExtends() {
+ public function testCustomGroupCreateInvalidExtends() {
$params = array(
'domain_id' => 1,
'title' => 'Test_Group_1',
/**
* Check with a string instead of array for extends
*/
- function testCustomGroupCreateExtendsString() {
+ public function testCustomGroupCreateExtendsString() {
$params = array(
'domain_id' => 1,
'title' => 'Test_Group_1',
/**
* Check with valid array
*/
- function testCustomGroupCreate() {
+ public function testCustomGroupCreate() {
$params = array(
'title' => 'Test_Group_1',
'name' => 'test_group_1',
/**
* Check with valid array
*/
- function testCustomGroupGetFields() {
+ public function testCustomGroupGetFields() {
$params = array(
'options' => array('get_options' => 'style'),
);
/**
* Check with extends array length greater than 1
*/
- function testCustomGroupExtendsMultipleCreate() {
+ public function testCustomGroupExtendsMultipleCreate() {
$params = array(
'title' => 'Test_Group_1',
'name' => 'test_group_1',
/**
* Check with style missing from params array
*/
- function testCustomGroupCreateNoStyle() {
+ public function testCustomGroupCreateNoStyle() {
$params = array(
'title' => 'Test_Group_1',
'name' => 'test_group_1',
/**
* Check with not array
*/
- function testCustomGroupCreateNotArray() {
+ public function testCustomGroupCreateNotArray() {
$params = NULL;
$customGroup = $this->callAPIFailure('custom_group', 'create', $params);
$this->assertEquals($customGroup['error_message'], 'Input variable `params` is not an array', 'In line ' . __LINE__);
/**
* Check without title
*/
- function testCustomGroupCreateNoTitle() {
+ public function testCustomGroupCreateNoTitle() {
$params = array('extends' => array('Contact'),
'weight' => 5,
'collapse_display' => 1,
/**
* Check for household without weight
*/
- function testCustomGroupCreateHouseholdNoWeight() {
+ public function testCustomGroupCreateHouseholdNoWeight() {
$params = array(
'title' => 'Test_Group_3',
'name' => 'test_group_3',
/**
* Check for Contribution Donation
*/
- function testCustomGroupCreateContributionDonation() {
+ public function testCustomGroupCreateContributionDonation() {
$params = array(
'title' => 'Test_Group_6',
'name' => 'test_group_6',
/**
* Check with valid array
*/
- function testCustomGroupCreateGroup() {
+ public function testCustomGroupCreateGroup() {
$params = array(
'domain_id' => 1,
'title' => 'Test_Group_8',
/**
* Check with Activity - Meeting Type
*/
- function testCustomGroupCreateActivityMeeting() {
+ public function testCustomGroupCreateActivityMeeting() {
$params = array(
'title' => 'Test_Group_10',
'name' => 'test_group_10',
/**
* Check without GroupID
*/
- function testCustomGroupDeleteWithoutGroupID() {
+ public function testCustomGroupDeleteWithoutGroupID() {
$customGroup = $this->callAPIFailure('custom_group', 'delete', array());
$this->assertEquals($customGroup['error_message'], 'Mandatory key(s) missing from params array: id', 'In line ' . __LINE__);
}
/**
* Check with no array
*/
- function testCustomGroupDeleteNoArray() {
+ public function testCustomGroupDeleteNoArray() {
$params = NULL;
$customGroup = $this->callAPIFailure('custom_group', 'delete', $params);
$this->assertEquals($customGroup['error_message'], 'Input variable `params` is not an array', 'In line ' . __LINE__);
/**
* Check with valid custom group id
*/
- function testCustomGroupDelete() {
+ public function testCustomGroupDelete() {
$customGroup = $this->customGroupCreate(array('extends' => 'Individual', 'title' => 'test_group'));
$params = array(
'id' => $customGroup['id'],
class api_v3_CustomSearchTest extends CiviUnitTestCase {
protected $_apiversion;
- function setUp() {
+ public function setUp() {
$this->_apiversion = 3;
parent::setUp();
$this->useTransaction(TRUE);
protected $CustomGroupIndividual;
protected $individualStudent;
- function setUp() {
+ public function setUp() {
parent::setUp();
// Create Group For Individual Contact Type
$groupIndividual = array(
CRM_Core_BAO_CustomField::getTableColumnGroup($this->IndiStudentField['id'], True);
}
- function tearDown() {
+ public function tearDown() {
$tablesToTruncate = array('civicrm_contact', 'civicrm_cache');
$this->quickCleanup($tablesToTruncate, TRUE);
}
/*
* Test that custom fields is returned for correct contact type only
*/
- function testGetFields() {
+ public function testGetFields() {
$result = $this->callAPISuccess('Contact', 'getfields', array());
$this->assertArrayHasKey("custom_{$this->IndividualField['id']}", $result['values'], 'If This fails there is probably a caching issue - failure in line' . __LINE__ . print_r(array_keys($result['values']), TRUE));
$result = $this->callAPISuccess('Contact', 'getfields', array('action' => 'create', 'contact_type' => 'Individual'), 'in line' . __LINE__);
/**
* Add Custom data of Contact Type : Individual to a Contact type: Organization
*/
- function testAddIndividualCustomDataToOrganization() {
+ public function testAddIndividualCustomDataToOrganization() {
$params = array(
'id' => $this->organization,
* Add valid Empty params to a Contact Type : Individual
* note - don't copy & paste this - is of marginal value
*/
- function testAddCustomDataEmptyToIndividual() {
+ public function testAddCustomDataEmptyToIndividual() {
$contact = $this->callAPIFailure('contact', 'create', array(),
'Mandatory key(s) missing from params array: contact_type'
);
/**
* Add valid custom data to a Contact Type : Individual
*/
- function testAddValidCustomDataToIndividual() {
+ public function testAddValidCustomDataToIndividual() {
$params = array(
'contact_id' => $this->individual,
/**
* Add Custom data of Contact Type : Individual , SubType : Student to a Contact type: Organization Subtype: Sponsor
*/
- function testAddIndividualStudentCustomDataToOrganizationSponsor() {
+ public function testAddIndividualStudentCustomDataToOrganizationSponsor() {
$params = array(
'contact_id' => $this->organizationSponsor,
/**
* Add valid custom data to a Contact Type : Individual Subtype: Student
*/
- function testCreateValidCustomDataToIndividualStudent() {
+ public function testCreateValidCustomDataToIndividualStudent() {
$params = array(
'contact_id' => $this->individualStudent,
/**
* Add custom data of Individual Student to a Contact Type : Individual - parent
*/
- function testAddIndividualStudentCustomDataToIndividualParent() {
+ public function testAddIndividualStudentCustomDataToIndividualParent() {
$params = array(
'contact_id' => $this->individualParent,
/**
* Retrieve Valid custom Data added to Individual Contact Type
*/
- function testRetrieveValidCustomDataToIndividual() {
+ public function testRetrieveValidCustomDataToIndividual() {
$params = array(
'contact_id' => $this->individual,
/**
* Retrieve Valid custom Data added to Individual Contact Type , Subtype : Student.
*/
- function testRetrieveValidCustomDataToIndividualStudent() {
+ public function testRetrieveValidCustomDataToIndividualStudent() {
$params = array(
'contact_id' => $this->individualStudent,
public $DBResetRequired = FALSE;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->individual = $this->individualCreate();
$this->params = array(
$this->ids['multi2'] = $this->CustomGroupMultipleCreateWithFields(array('title' => 'group2'));
}
- function tearDown() {
+ public function tearDown() {
$tablesToTruncate = array(
'civicrm_email',
'civicrm_custom_field',
$this->useTransaction(TRUE);
}
- function testDashboardContactCreate() {
+ public function testDashboardContactCreate() {
$dashParams = array(
'version' => 3,
'label' => 'New Dashlet element',
$this->useTransaction(TRUE);
}
- function testDashboardCreate() {
+ public function testDashboardCreate() {
$oldCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_dashboard');
$params = array(
'version' => 3,
* @param int $id
* @param $oldCount
*/
- function DashboardDelete($id, $oldCount) {
+ public function DashboardDelete($id, $oldCount) {
$params = array(
'version' => 3,
'id' => $id,
protected $_entity;
protected $_params;
- function setUp() {
+ public function setUp() {
$this->_apiversion = 3;
$this->_entity = 'Email';
parent::setUp();
protected $_entity = 'entity_tag';
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
$this->_organizationID = $this->organizationCreate();
}
- function testAddEmptyParams() {
+ public function testAddEmptyParams() {
$individualEntity = $this->callAPIFailure('entity_tag', 'create', $params = array(),
'contact_id is a required field'
);
}
- function testAddWithoutTagID() {
+ public function testAddWithoutTagID() {
$params = array(
'contact_id' => $this->_individualID,
);
);
}
- function testAddWithoutContactID() {
+ public function testAddWithoutContactID() {
$params = array(
'tag_id' => $this->_tagID,
);
'contact_id is a required field');
}
- function testContactEntityTagCreate() {
+ public function testContactEntityTagCreate() {
$params = array(
'contact_id' => $this->_individualID,
'tag_id' => $this->_tagID,
$this->assertEquals($result['added'], 1);
}
- function testAddDouble() {
+ public function testAddDouble() {
$individualId = $this->_individualID;
$organizationId = $this->_organizationID;
$tagID = $this->_tagID;
}
///////////////// civicrm_entity_tag_get methods
- function testGetNoEntityID() {
+ public function testGetNoEntityID() {
$ContactId = $this->_individualID;
$tagID = $this->_tagID;
$params = array(
$this->assertEquals($ContactId, $result['values'][0]['entity_id']);
}
- function testIndividualEntityTagGet() {
+ public function testIndividualEntityTagGet() {
$contactId = $this->_individualID;
$tagID = $this->_tagID;
$params = array(
$entity = $this->callAPISuccess('entity_tag', 'get', $paramsEntity);
}
- function testHouseholdEntityGet() {
+ public function testHouseholdEntityGet() {
$ContactId = $this->_householdID;
$tagID = $this->_tagID;
$params = array(
$this->assertEquals($householdEntity['added'], 1);
}
- function testOrganizationEntityGet() {
+ public function testOrganizationEntityGet() {
$ContactId = $this->_organizationID;
$tagID = $this->_tagID;
$params = array(
}
///////////////// civicrm_entity_tag_Delete methods
- function testEntityTagDeleteNoTagId() {
+ public function testEntityTagDeleteNoTagId() {
$entityTagParams = array(
'contact_id_i' => $this->_individualID,
'contact_id_h' => $this->_householdID,
);
}
- function testEntityTagDeleteINDHH() {
+ public function testEntityTagDeleteINDHH() {
$entityTagParams = array(
'contact_id_i' => $this->_individualID,
'contact_id_h' => $this->_householdID,
$this->assertEquals($result['removed'], 2);
}
- function testEntityTagDeleteHH() {
+ public function testEntityTagDeleteHH() {
$entityTagParams = array(
'contact_id_i' => $this->_individualID,
'contact_id_h' => $this->_householdID,
$this->assertEquals($result['removed'], 1);
}
- function testEntityTagDeleteHHORG() {
+ public function testEntityTagDeleteHHORG() {
$entityTagParams = array(
'contact_id_i' => $this->_individualID,
'contact_id_h' => $this->_householdID,
///////////////// civicrm_tag_entities_get methods
- function testCommonContactEntityTagAdd() {
+ public function testCommonContactEntityTagAdd() {
$params = array(
'contact_id' => $this->_individualID,
'tag_id' => $this->_tagID,
}
- function testEntityTagCommonDeleteINDHH() {
+ public function testEntityTagCommonDeleteINDHH() {
$entityTagParams = array(
'contact_id_i' => $this->_individualID,
'contact_id_h' => $this->_householdID,
$this->assertEquals($result['removed'], 2);
}
- function testEntityTagCommonDeleteHH() {
+ public function testEntityTagCommonDeleteHH() {
$entityTagParams = array(
'contact_id_i' => $this->_individualID,
'contact_id_h' => $this->_householdID,
$this->assertEquals($result['removed'], 1);
}
- function testEntityTagCommonDeleteHHORG() {
+ public function testEntityTagCommonDeleteHHORG() {
$entityTagParams = array(
'contact_id_i' => $this->_individualID,
'contact_id_h' => $this->_householdID,
protected $_apiversion;
protected $_entity;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->_apiversion = 3;
$this->_entity = 'event';
}
}
- function tearDown() {
+ public function tearDown() {
foreach ($this->eventIds as $eventId) {
$this->eventDelete($eventId);
}
///////////////// civicrm_event_get methods
- function testGetEventById() {
+ public function testGetEventById() {
$params = array(
'id' => $this->_events[1]['id'],);
$result = $this->callAPISuccess('event', 'get', $params);
$this->assertEquals($result['values'][$this->_eventIds[1]]['event_title'], 'Annual CiviCRM meet 2');
}
- function testGetEventByEventTitle() {
+ public function testGetEventByEventTitle() {
$params = array(
'event_title' => 'Annual CiviCRM meet',
$this->assertEquals($result['values'][0]['id'], $this->_eventIds[0]);
}
- function testGetEventByWrongTitle() {
+ public function testGetEventByWrongTitle() {
$params = array(
'title' => 'No event with that title',);
$result = $this->callAPISuccess('Event', 'Get', $params);
$this->assertEquals(0, $result['count']);
}
- function testGetEventByIdSort() {
+ public function testGetEventByIdSort() {
$params = array(
'return.sort' => 'id ASC',
'return.max_results' => 1, );
*/
/*
- function testGetIdOfEventByEventTitle() {
+ public function testGetIdOfEventByEventTitle() {
$params = array( 'title' => 'Annual CiviCRM meet',
'return' => 'id'
);
/**
* Test 'is.Current' option. Existing event is 'old' so only current should be returned
*/
- function testGetIsCurrent() {
+ public function testGetIsCurrent() {
$params = array(
'isCurrent' => 1,
);
/**
* There has been a schema change & the api needs to buffer developers from it
*/
- function testGetPaymentProcessorId() {
+ public function testGetPaymentProcessorId() {
$params = $this->_params[0];
$params['payment_processor_id'] = 1;
$params['sequential'] =1;
$this->assertEquals($result['values'][0]['payment_processor_id'], 1,"handing get payment processor compatibility");
}
- function testInvalidData() {
+ public function testInvalidData() {
$params = $this->_params[0];
$params['sequential'] =1;
$params['loc_block_id'] =100;
/**
* Test 'is.Current' option. Existing event is 'old' so only current should be returned
*/
- function testGetSingleReturnIsFull() {
+ public function testGetSingleReturnIsFull() {
$contactID = $this->individualCreate();
$params = array(
'id' => $this->_eventIds[0], 'max_participants' => 1,
* Legacy support for Contribution Type ID. We need to ensure this is supported
* as an alias for financial_type_id
*/
- function testCreateGetEventLegacyContributionTypeID() {
+ public function testCreateGetEventLegacyContributionTypeID() {
$contributionTypeArray = array('contribution_type_id' => 3);
if(isset($this->_params[0]['financial_type_id'])){
//in case someone edits $this->_params & invalidates this test :-)
* variables specific to participant so it can be replicated into other entities
* and / or moved to the automated test suite
*/
- function testCreateWithCustom() {
+ public function testCreateWithCustom() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params = $this->_params[0];
/**
* Test that an event with a price set can be created
*/
- function testCreatePaidEvent() {
+ public function testCreatePaidEvent() {
//@todo alter API so that an integer is converted to an array
$priceSetParams = array('price_set_id' => (array) 1, 'is_monetary' => 1);
$result = $this->callAPISuccess('Event', 'Create', array_merge($this->_params[0], $priceSetParams));
$this->assertArrayKeyExists('price_set_id', $event);
}
- function testCreateEventParamsNotArray() {
+ public function testCreateEventParamsNotArray() {
$params = NULL;
$result = $this->callAPIFailure('event', 'create', $params);
}
- function testCreateEventEmptyParams() {
+ public function testCreateEventEmptyParams() {
$params = array();
$result = $this->callAPIFailure('event', 'create', $params);
}
- function testCreateEventParamsWithoutTitle() {
+ public function testCreateEventParamsWithoutTitle() {
unset($this->_params['title']);
$result = $this->callAPIFailure('event', 'create', $this->_params);
$this->assertAPIFailure($result);
}
- function testCreateEventParamsWithoutEventTypeId() {
+ public function testCreateEventParamsWithoutEventTypeId() {
unset($this->_params['event_type_id']);
$result = $this->callAPIFailure('event', 'create', $this->_params);
}
- function testCreateEventParamsWithoutStartDate() {
+ public function testCreateEventParamsWithoutStartDate() {
unset($this->_params['start_date']);
$result = $this->callAPIFailure('event', 'create', $this->_params);
}
- function testCreateEventSuccess() {
+ public function testCreateEventSuccess() {
$result = $this->callAPIAndDocument('Event', 'Create', $this->_params[0], __FUNCTION__, __FILE__);
$this->assertArrayHasKey('id', $result['values'][$result['id']], 'In line ' . __LINE__);
$result = $this->callAPISuccess($this->_entity, 'Get', array('id' => $result['id']));
/**
* Test that passing in Unique field names works
*/
- function testCreateEventSuccessUniqueFieldNames() {
+ public function testCreateEventSuccessUniqueFieldNames() {
$this->_params[0]['event_start_date'] = $this->_params[0]['start_date'];
unset($this->_params[1]['start_date']);
$this->_params[0]['event_title'] = $this->_params[0]['title'];
$this->assertEquals($this->_params[0]['event_title'], $result['values'][$result['id']]['title'], 'end date is not set in line ' . __LINE__);
}
- function testUpdateEvent() {
+ public function testUpdateEvent() {
$result = $this->callAPISuccess('event', 'create', $this->_params[1]);
$params = array(
}
- function testDeleteEmptyParams() {
+ public function testDeleteEmptyParams() {
$result = $this->callAPIFailure('Event', 'Delete', array());
}
- function testDelete() {
+ public function testDelete() {
$params = array(
'id' => $this->_eventIds[0],
);
/**
* Check event_id still supported for delete
*/
- function testDeleteWithEventId() {
+ public function testDeleteWithEventId() {
$params = array(
'event_id' => $this->_eventIds[0], );
$result = $this->callAPISuccess('Event', 'Delete', $params);
/**
* Trying to delete an event with participants should return error
*/
- function testDeleteWithExistingParticipant() {
+ public function testDeleteWithExistingParticipant() {
$contactID = $this->individualCreate();
$participantID = $this->participantCreate(
array(
$result = $this->callAPISuccess('Event', 'Delete', array('id' => $this->_eventIds[0]));
}
- function testDeleteWithWrongEventId() {
+ public function testDeleteWithWrongEventId() {
$params = array('event_id' => $this->_eventIds[0]);
$result = $this->callAPISuccess('Event', 'Delete', $params);
// try to delete again - there's no such event anymore
/**
* Test civicrm_event_search with wrong params type
*/
- function testSearchWrongParamsType() {
+ public function testSearchWrongParamsType() {
$params = 'a string';
$result = $this->callAPIFailure('event', 'get', $params);
}
/**
* Test civicrm_event_search with empty params
*/
- function testSearchEmptyParams() {
+ public function testSearchEmptyParams() {
$event = $this->callAPISuccess('event', 'create', $this->_params[1]);
$getparams = array( 'sequential' => 1,
/**
* Test civicrm_event_search. Success expected.
*/
- function testSearch() {
+ public function testSearch() {
$params = array(
'event_type_id' => 1,
'return.title' => 1,
* Test civicrm_event_search. Success expected.
* return.offset and return.max_results test (CRM-5266)
*/
- function testSearchWithOffsetAndMaxResults() {
+ public function testSearchWithOffsetAndMaxResults() {
$maxEvents = 5;
$events = array();
while ($maxEvents > 0) {
$this->assertEquals(2, $result['count'], ' 2 results returned In line ' . __LINE__);
}
- function testEventCreationPermissions() {
+ public function testEventCreationPermissions() {
$params = array(
'event_type_id' => 1, 'start_date' => '2010-10-03', 'title' => 'le cake is a tie', 'check_permissions' => TRUE, );
$config = &CRM_Core_Config::singleton();
$result = $this->callAPISuccess('event', 'create', $params);
}
- function testgetfields() {
+ public function testgetfields() {
$description = "demonstrate use of getfields to interrogate api";
$params = array('action' => 'create');
$result = $this->callAPISuccess('event', 'getfields', $params);
/**
* Test api_action param also works
*/
- function testgetfieldsRest() {
+ public function testgetfieldsRest() {
$description = "demonstrate use of getfields to interrogate api";
$params = array('api_action' => 'create');
$result = $this->callAPISuccess('event', 'getfields', $params);
$this->assertEquals(1, $result['values']['title']['api.required'], 'in line ' . __LINE__);
}
- function testgetfieldsGet() {
+ public function testgetfieldsGet() {
$description = "demonstrate use of getfields to interrogate api";
$params = array('action' => 'get');
$result = $this->callAPISuccess('event', 'getfields', $params);
$this->assertEquals('title', $result['values']['event_title']['name'], 'in line ' . __LINE__);
}
- function testgetfieldsDelete() {
+ public function testgetfieldsDelete() {
$description = "demonstrate use of getfields to interrogate api";
$params = array('action' => 'delete');
$result = $this->callAPISuccess('event', 'getfields', $params);
public $DBResetRequired = FALSE;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->ids['contact'][0] = $this->individualCreate();
$this->params = array(
);
}
- function tearDown() {
+ public function tearDown() {
foreach ($this->ids as $entity => $entities) {
foreach ($entities as $id) {
$this->callAPISuccess($entity, 'delete', array( 'id' => $id));
*
* @todo set up calls function that doesn't work @ the moment
*/
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
}
///////////////// civicrm_group_contact_get methods
- function testGet() {
+ public function testGet() {
$params = array(
'contact_id' => $this->_contactId,
);
}
}
- function testGetGroupID() {
+ public function testGetGroupID() {
$description = "Get all from group and display contacts";
$subfile = "GetWithGroupID";
$params = array(
}
}
- function testCreateWithEmptyParams() {
+ public function testCreateWithEmptyParams() {
$params = array();
$groups = $this->callAPIFailure('group_contact', 'create', $params);
$this->assertEquals($groups['error_message'],
);
}
- function testCreateWithoutGroupIdParams() {
+ public function testCreateWithoutGroupIdParams() {
$params = array(
'contact_id' => $this->_contactId, );
$this->assertEquals($groups['error_message'], 'Mandatory key(s) missing from params array: group_id');
}
- function testCreateWithoutContactIdParams() {
+ public function testCreateWithoutContactIdParams() {
$params = array(
'group_id' => $this->_groupId1, );
$groups = $this->callAPIFailure('group_contact', 'create', $params);
$this->assertEquals($groups['error_message'], 'Mandatory key(s) missing from params array: contact_id');
}
- function testCreate() {
+ public function testCreate() {
$cont = array(
'first_name' => 'Amiteshwar',
'middle_name' => 'L.',
}
///////////////// civicrm_group_contact_remove methods
- function testDelete() {
+ public function testDelete() {
$params = array(
'contact_id' => $this->_contactId,
'group_id' => $this->_groupId1,
$this->assertEquals($result['total_count'], 1, "in line " . __LINE__);
}
- function testDeletePermanent() {
+ public function testDeletePermanent() {
$result = $this->callAPISuccess('group_contact', 'get', array('contact_id' => $this->_contactId));
$params = array(
'id' => $result['id'],
protected $_apiversion;
protected $_groupID;
- function setUp() {
+ public function setUp() {
$this->_apiversion = 3;
parent::setUp();
$this->_groupID = $this->groupCreate();
}
- function tearDown() {
+ public function tearDown() {
$this->groupDelete($this->_groupID);
}
- function testgroupCreateNoTitle() {
+ public function testgroupCreateNoTitle() {
$params = array(
'name' => 'Test Group No title ',
'domain_id' => 1,
}
- function testGetGroupWithEmptyParams() {
+ public function testGetGroupWithEmptyParams() {
$group = $this->callAPISuccess('group', 'get', $params = array());
$group = $group["values"];
$this->assertEquals($group[$this->_groupID]['visibility'], 'Public Pages');
}
- function testGetGroupParamsWithGroupId() {
+ public function testGetGroupParamsWithGroupId() {
$params = array('id' => $this->_groupID);
$group = $this->callAPISuccess('group', 'get', $params);
}
}
- function testGetGroupParamsWithGroupName() {
+ public function testGetGroupParamsWithGroupName() {
$params = array(
'name' => "Test Group 1",
);
}
}
- function testGetGroupParamsWithReturnName() {
+ public function testGetGroupParamsWithReturnName() {
$params = array();
$params['id'] = $this->_groupID;
$params['return.name'] = 1;
);
}
- function testGetGroupParamsWithGroupTitle() {
+ public function testGetGroupParamsWithGroupTitle() {
$params = array();
$params['title'] = 'New Test Group Created';
$group = $this->callAPISuccess('group', 'get', $params);
}
}
- function testGetNonExistingGroup() {
+ public function testGetNonExistingGroup() {
$params = array();
$params['title'] = 'No such group Exist';
$group = $this->callAPISuccess('group', 'get', $params);
$this->assertEquals(0, $group['count']);
}
- function testgroupdeleteParamsnoId() {
+ public function testgroupdeleteParamsnoId() {
$group = $this->callAPIFailure('group', 'delete', array(), 'Mandatory key(s) missing from params array: id');
}
- function testgetfields() {
+ public function testgetfields() {
$description = "demonstrate use of getfields to interrogate api";
$params = array('action' => 'create');
$result = $this->callAPIAndDocument('group', 'getfields', $params, __FUNCTION__, __FILE__, $description, 'getfields', 'getfields');
public $DBResetRequired = FALSE;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
*/
private $_mut;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction();
CRM_Mailing_BAO_MailingJob::$mailsProcessed = 0; // DGW
/**
*
*/
- function tearDown() {
+ public function tearDown() {
$this->_mut->stop();
// $this->quickCleanup(array('civicrm_mailing', 'civicrm_mailing_job', 'civicrm_contact'));
CRM_Utils_Hook::singleton()->reset();
/**
* Check mailing is sent
*/
- function testProcessMailing() {
+ public function testProcessMailing() {
$this->createContactsInGroup(10, $this->_groupID);
CRM_Core_Config::singleton()->mailerBatchLimit = 2;
$this->callAPISuccess('mailing', 'create', $this->_params);
* @param integer $count
* @param integer $groupID
*/
- function createContactsInGroup($count, $groupID) {
+ public function createContactsInGroup($count, $groupID) {
for($i = 1; $i <= $count; $i++ ) {
$contactID = $this->individualCreate(array('first_name' => $count, 'email' => 'mail' . $i . '@nul.com'));
$this->callAPISuccess('group_contact', 'create', array('contact_id' => $contactID, 'group_id' => $groupID, 'status' => 'Added'));
*
* @return array
*/
- function getRecipients($start, $count) {
+ public function getRecipients($start, $count) {
$recipients = array();
for($i = $start; $i < ($start + $count); $i++ ) {
$recipients[][0] = 'mail' . $i . '@nul.com';
public $_entity = 'Job';
public $_params = array();
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
$this->_params = array(
/**
* Check with no name
*/
- function testCreateWithoutName() {
+ public function testCreateWithoutName() {
$params = array(
'is_active' => 1, );
$result = $this->callAPIFailure('job', 'create', $params,
/**
* Create job with an invalid "run_frequency" value
*/
- function testCreateWithInvalidFrequency() {
+ public function testCreateWithInvalidFrequency() {
$params = array(
'sequential' => 1,
'name' => 'API_Test_Job',
/**
* Create job
*/
- function testCreate() {
+ public function testCreate() {
$result = $this->callAPIAndDocument('job', 'create', $this->_params, __FUNCTION__, __FILE__);
$this->assertNotNull($result['values'][0]['id'], 'in line ' . __LINE__);
/**
* Check with empty array
*/
- function testDeleteEmpty() {
+ public function testDeleteEmpty() {
$params = array();
$result = $this->callAPIFailure('job', 'delete', $params);
}
/**
* Check with No array
*/
- function testDeleteParamsNotArray() {
+ public function testDeleteParamsNotArray() {
$result = $this->callAPIFailure('job', 'delete', 'string');
}
/**
* Check if required fields are not passed
*/
- function testDeleteWithoutRequired() {
+ public function testDeleteWithoutRequired() {
$params = array(
'name' => 'API_Test_PP',
'title' => 'API Test Payment Processor',
/**
* Check with incorrect required fields
*/
- function testDeleteWithIncorrectData() {
+ public function testDeleteWithIncorrectData() {
$params = array(
'id' => 'abcd', );
$result = $this->callAPIFailure('job', 'delete', $params);
/**
* Check job delete
*/
- function testDelete() {
+ public function testDelete() {
$createResult = $this->callAPISuccess('job', 'create', $this->_params);
$params = array('id' => $createResult['id'],);
$result = $this->callAPIAndDocument('job', 'delete', $params, __FUNCTION__, __FILE__);
* @param int $id
* @param array $params
*/
- function hookPreRelationship($op, $objectName, $id, &$params ) {
+ public function hookPreRelationship($op, $objectName, $id, &$params ) {
if($op == 'delete') {
return;
}
protected $id;
public $DBResetRequired = FALSE;
- function setUp() {
+ public function setUp() {
$this->params = array(
'domain_id' => 1,
'name' => "my mail setting",
protected $_entity = 'MailingAB';
protected $_groupID;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
$this->_mailingID_A = $this->createMailing();
protected $_apiversion = 3;
protected $_entity = 'mailing';
- function setUp() {
+ public function setUp() {
parent::setUp();
$params = array(
'first_name' => 'abc1',
$this->_contact = $this->callAPISuccess("contact", "create", $params);
}
- function tearDown() {
+ public function tearDown() {
$this->callAPISuccess("contact", "delete", array('id' => $this->_contact['id']));
parent::tearDown();
}
/**
* Test that the API returns only the "Bounced" mailings when instructed to do so
*/
- function testMailingContactBounced( ) {
+ public function testMailingContactBounced( ) {
$op = new PHPUnit_Extensions_Database_Operation_Insert();
//Create the User
$op->execute($this->_dbconn,
protected $_email;
protected $_apiversion;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
$this->_apiversion = 3;
protected $_entity = 'Mailing';
protected $_contactID;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction();
CRM_Mailing_BAO_MailingJob::$mailsProcessed = 0; // DGW
);
}
- function tearDown() {
+ public function tearDown() {
CRM_Mailing_BAO_MailingJob::$mailsProcessed = 0; // DGW
parent::tearDown();
}
protected $_membershipTypeID;
protected $_membershipStatusID;
protected $_contribution = array();
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
protected $_apiversion =3;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->_contactID = $this->individualCreate();
$this->_membershipTypeID = $this->membershipTypeCreate(array('member_of_contact_id' => $this->_contactID));
CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'name', TRUE);
}
- function tearDown() {
+ public function tearDown() {
$this->membershipStatusDelete($this->_membershipStatusID);
$this->membershipTypeDelete(array('id' => $this->_membershipTypeID));
$this->contactDelete($this->_contactID);
/**
* Test civicrm_membership_status_get with empty params
*/
- function testGetEmptyParams() {
+ public function testGetEmptyParams() {
$result = $this->callAPISuccess('membership_status', 'get', array());
// It should be 8 statuses, 7 default from mysql_data
// plus one test status added in setUp
/**
* Test civicrm_membership_status_get. Success expected.
*/
- function testGet() {
+ public function testGet() {
$params = array(
'name' => 'test status',
);
/**
* Test civicrm_membership_status_get. Success expected.
*/
- function testGetLimit() {
+ public function testGetLimit() {
$result = $this->callAPISuccess('membership_status', 'get', array());
$this->assertGreaterThan(1, $result['count'], "Check more than one exists In line " . __LINE__);
$params['option.limit'] = 1;
$this->assertEquals(1, $result['count'], "Check only 1 retrieved " . __LINE__);
}
- function testCreateDuplicateName() {
+ public function testCreateDuplicateName() {
$params = array('name' => 'name');
$result = $this->callAPISuccess('membership_status', 'create', $params);
$result = $this->callAPIFailure('membership_status', 'create', $params,
);
}
- function testCreateWithMissingRequired() {
+ public function testCreateWithMissingRequired() {
$params = array('title' => 'Does not make sense');
$result = $this->callAPIFailure('membership_status', 'create', $params);
}
- function testCreate() {
+ public function testCreate() {
$params = array(
'name' => 'test membership status',
);
$this->membershipStatusDelete($result['id']);
}
- function testUpdate() {
+ public function testUpdate() {
$params = array(
'name' => 'test membership status', );
$result = $this->callAPISuccess('membership_status', 'create', $params);
///////////////// civicrm_membership_status_delete methods
- function testDeleteEmptyParams() {
+ public function testDeleteEmptyParams() {
$result = $this->callAPIFailure('membership_status', 'delete', array());
}
- function testDeleteWithMissingRequired() {
+ public function testDeleteWithMissingRequired() {
$params = array('title' => 'Does not make sense');
$result = $this->callAPIFailure('membership_status', 'delete', $params);
}
- function testDelete() {
+ public function testDelete() {
$membershipID = $this->membershipStatusCreate();
$params = array(
'id' => $membershipID,
/**
* Test that trying to delete membership status while membership still exists creates error
*/
- function testDeleteWithMembershipError() {
+ public function testDeleteWithMembershipError() {
$membershipStatusID = $this->membershipStatusCreate();
$this->_contactID = $this->individualCreate();
$this->_entity = 'membership';
);
}
- function tearDown() {
+ public function tearDown() {
$this->quickCleanup(array(
'civicrm_membership',
'civicrm_membership_payment',
/**
* Test civicrm_membership_delete()
*/
- function testMembershipDelete() {
+ public function testMembershipDelete() {
$membershipID = $this->contactMembershipCreate($this->_params);
$this->assertDBRowExist('CRM_Member_DAO_Membership', $membershipID);
$params = array(
$this->assertDBRowNotExist('CRM_Member_DAO_Membership', $membershipID);
}
- function testMembershipDeleteEmpty() {
+ public function testMembershipDeleteEmpty() {
$params = array();
$result = $this->callAPIFailure('membership', 'delete', $params);
}
- function testMembershipDeleteInvalidID() {
+ public function testMembershipDeleteInvalidID() {
$params = array('id' => 'blah');
$result = $this->callAPIFailure('membership', 'delete', $params);
}
/**
* Test civicrm_membership_delete() with invalid Membership Id
*/
- function testMembershipDeleteWithInvalidMembershipId() {
+ public function testMembershipDeleteWithInvalidMembershipId() {
$membershipId = 'membership';
$result = $this->callAPIFailure('membership', 'delete', $membershipId);
}
* these methods for backwards compatibility, also verifying basic
* behaviour is the same as new methods.
*/
- function testContactMembershipsGet() {
+ public function testContactMembershipsGet() {
$this->_membershipID = $this->contactMembershipCreate($this->_params);
$params = array();
$result = $this->callAPISuccess('membership', 'get', $params);
* Test civicrm_membership_get with params not array.
* Gets treated as contact_id, memberships expected.
*/
- function testGetWithParamsContactId() {
+ public function testGetWithParamsContactId() {
$this->_membershipID = $this->contactMembershipCreate($this->_params);
$params = array(
'contact_id' => $this->_contactID,
* Test civicrm_membership_get with params not array.
* Gets treated as contact_id, memberships expected.
*/
- function testGetInSyntax() {
+ public function testGetInSyntax() {
$this->_membershipID = $this->contactMembershipCreate($this->_params);
$this->_membershipID2 = $this->contactMembershipCreate($this->_params);
$this->_membershipID3 = $this->contactMembershipCreate($this->_params);
* Test civicrm_membership_get with params not array.
* Gets treated as contact_id, memberships expected.
*/
- function testGetInSyntaxOnContactID() {
+ public function testGetInSyntaxOnContactID() {
$this->_membershipID = $this->contactMembershipCreate($this->_params);
$contact2 = $this->individualCreate();
$contact3 = $this->individualCreate(array('first_name' => 'Scout', 'last_name' => 'Canine'));
* Test civicrm_membership_get with params not array.
* Gets treated as contact_id, memberships expected.
*/
- function testGetWithParamsMemberShipTypeId() {
+ public function testGetWithParamsMemberShipTypeId() {
$result = $this->callAPISuccess($this->_entity, 'create', $this->_params);
$params = array(
'membership_type_id' => $this->_membershipTypeID,
* Test civicrm_membership_get with params not array.
* Gets treated as contact_id, memberships expected.
*/
- function testGetWithParamsMemberShipTypeIdContactID() {
+ public function testGetWithParamsMemberShipTypeIdContactID() {
$params = $this->_params;
$this->callAPISuccess($this->_entity, 'create', $params);
$params['membership_type_id'] = $this->_membershipTypeID2;
* variables specific to participant so it can be replicated into other entities
* and / or moved to the automated test suite
*/
- function testGetWithParamsMemberShipIdAndCustom() {
+ public function testGetWithParamsMemberShipIdAndCustom() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params = $this->_params;
* Test civicrm_membership_get with proper params.
* Memberships expected.
*/
- function testGet() {
+ public function testGet() {
$membershipID = $this->contactMembershipCreate($this->_params);
$params = array(
'contact_id' => $this->_contactID,
* Test civicrm_membership_get with proper params.
* Memberships expected.
*/
- function testGetWithId() {
+ public function testGetWithId() {
$membershipID = $this->contactMembershipCreate($this->_params);
$params = array(
'contact_id' => $this->_contactID,
* Test civicrm_membership_get for only active.
* Memberships expected.
*/
- function testGetOnlyActive() {
+ public function testGetOnlyActive() {
$description = "Demonstrates use of 'filter' active_only' param";
$this->_membershipID = $this->contactMembershipCreate($this->_params);
$subfile = 'filterIsCurrent';
* Test civicrm_membership_get for non exist contact.
* empty Memberships.
*/
- function testGetNoContactExists() {
+ public function testGetNoContactExists() {
$params = array(
'contact_id' => 55555,
);
* Test civicrm_membership_get with relationship.
* get Memberships.
*/
- function testGetWithRelationship() {
+ public function testGetWithRelationship() {
$membershipOrgId = $this->organizationCreate(NULL);
$memberContactId = $this->individualCreate();
* Test suite for CRM-14758: API ( contact, create ) does not always create related membership
* and max_related property for Membership_Type and Membership entities
*/
- function testCreateWithRelationship() {
+ public function testCreateWithRelationship() {
// Create membership type: inherited through employment, max_related = 2
$params = array(
'name_a_b' => 'Employee of',
/**
* We are checking for no enotices + only id & end_date returned
*/
- function testMembershipGetWithReturn() {
+ public function testMembershipGetWithReturn() {
$membershipID = $this->contactMembershipCreate($this->_params);
$result = $this->callAPISuccess('membership', 'get', array('return' => 'end_date'));
foreach ($result['values'] as $membership) {
* Test civicrm_contact_memberships_create with empty params.
* Error expected.
*/
- function testCreateWithEmptyParams() {
+ public function testCreateWithEmptyParams() {
$params = array();
$result = $this->callAPIFailure('membership', 'create', $params);
}
/**
* If is_overide is passed in status must also be passed in
*/
- function testCreateOverrideNoStatus() {
+ public function testCreateOverrideNoStatus() {
$params = $this->_params;
unset($params['status_id']);
$result = $this->callAPIFailure('membership', 'create', $params);
}
- function testMembershipCreateMissingRequired() {
+ public function testMembershipCreateMissingRequired() {
$params = array(
'membership_type_id' => '1',
'join_date' => '2006-01-21',
$result = $this->callAPIFailure('membership', 'create', $params);
}
- function testMembershipCreate() {
+ public function testMembershipCreate() {
$params = array(
'contact_id' => $this->_contactID,
'membership_type_id' => $this->_membershipTypeID,
/*
* Check for useful message if contact doesn't exist
*/
- function testMembershipCreateWithInvalidContact() {
+ public function testMembershipCreateWithInvalidContact() {
$params = array(
'contact_id' => 999,
'membership_type_id' => $this->_membershipTypeID,
'contact_id is not valid : 999'
);
}
- function testMembershipCreateWithInvalidStatus() {
+ public function testMembershipCreateWithInvalidStatus() {
$params = $this->_params;
$params['status_id'] = 999;
$result = $this->callAPIFailure('membership', 'create', $params,
);
}
- function testMembershipCreateWithInvalidType() {
+ public function testMembershipCreateWithInvalidType() {
$params = $this->_params;
$params['membership_type_id'] = 999;
* variables specific to participant so it can be replicated into other entities
* and / or moved to the automated test suite
*/
- function testCreateWithCustom() {
+ public function testCreateWithCustom() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params = $this->_params;
* membership).
* success expected.
*/
- function testMembershipCreateWithId() {
+ public function testMembershipCreateWithId() {
$membershipID = $this->contactMembershipCreate($this->_params);
$params = array(
'id' => $membershipID,
* membership).
* success expected.
*/
- function testMembershipCreateUpdateWithIdNoContact() {
+ public function testMembershipCreateUpdateWithIdNoContact() {
$membershipID = $this->contactMembershipCreate($this->_params);
$params = array(
'id' => $membershipID,
* membership).
* success expected.
*/
- function testMembershipCreateUpdateWithIdNoDates() {
+ public function testMembershipCreateUpdateWithIdNoDates() {
$membershipID = $this->contactMembershipCreate($this->_params);
$params = array(
'id' => $membershipID,
* membership).
* success expected.
*/
- function testMembershipCreateUpdateWithIdNoDatesNoType() {
+ public function testMembershipCreateUpdateWithIdNoDatesNoType() {
$membershipID = $this->contactMembershipCreate($this->_params);
$params = array(
'id' => $membershipID,
* membership).
* success expected.
*/
- function testMembershipCreateUpdateWithIDAndSource() {
+ public function testMembershipCreateUpdateWithIDAndSource() {
$membershipID = $this->contactMembershipCreate($this->_params);
$params = array(
'id' => $membershipID,
/**
* Change custom field using update
*/
- function testUpdateWithCustom() {
+ public function testUpdateWithCustom() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params = $this->_params;
* Test civicrm_contact_memberships_create Invalid membership data
* Error expected.
*/
- function testMembershipCreateInvalidMemData() {
+ public function testMembershipCreateInvalidMemData() {
//membership_contact_id as string
$params = array(
'membership_contact_id' => 'Invalid',
* membership).
* Success expected.
*/
- function testMembershipCreateWithMemContact() {
+ public function testMembershipCreateWithMemContact() {
$params = array(
'membership_contact_id' => $this->_contactID,
'membership_type_id' => $this->_membershipTypeID,
* membership).
* Success expected.
*/
- function testMembershipCreateValidMembershipTypeString() {
+ public function testMembershipCreateValidMembershipTypeString() {
$params = array(
'membership_contact_id' => $this->_contactID,
'membership_type_id' => 'General',
* membership).
* Success expected.
*/
- function testMembershipCreateInValidMembershipTypeString() {
+ public function testMembershipCreateInValidMembershipTypeString() {
$params = array(
'membership_contact_id' => $this->_contactID,
'membership_type_id' => 'invalid',
/**
* Test that if membership join date is not set it defaults to today
*/
- function testEmptyJoinDate() {
+ public function testEmptyJoinDate() {
unset($this->_params['join_date'], $this->_params['is_override']);
$result = $this->callAPISuccess($this->_entity, 'create', $this->_params);
$result = $this->callAPISuccess($this->_entity, 'getsingle', array('id' => $result['id']));
* Test that if membership start date is not set it defaults to correct end date
* - fixed
*/
- function testEmptyStartDateFixed() {
+ public function testEmptyStartDateFixed() {
unset($this->_params['start_date'], $this->_params['is_override']);
$this->_params['membership_type_id'] = $this->_membershipTypeID2;
$result = $this->callAPISuccess($this->_entity, 'create', $this->_params);
* Test that if membership start date is not set it defaults to correct end date
* - fixed
*/
- function testEmptyStartDateRolling() {
+ public function testEmptyStartDateRolling() {
unset($this->_params['start_date'], $this->_params['is_override']);
$result = $this->callAPISuccess($this->_entity, 'create', $this->_params);
$result = $this->callAPISuccess($this->_entity, 'getsingle', array('id' => $result['id']));
* Test that if membership end date is not set it defaults to correct end date
* - rolling
*/
- function testEmptyEndDateFixed() {
+ public function testEmptyEndDateFixed() {
unset($this->_params['start_date'], $this->_params['is_override'], $this->_params['end_date']);
$this->_params['membership_type_id'] = $this->_membershipTypeID2;
$result = $this->callAPISuccess($this->_entity, 'create', $this->_params);
* Test that if membership end date is not set it defaults to correct end date
* - rolling
*/
- function testEmptyEndDateRolling() {
+ public function testEmptyEndDateRolling() {
unset($this->_params['is_override'], $this->_params['end_date']);
$this->_params['membership_type_id'] = $this->_membershipTypeID;
$result = $this->callAPISuccess($this->_entity, 'create', $this->_params);
/**
* Test that if datesdate are not set they not over-ridden if id is passed in
*/
- function testMembershipDatesNotOverridden() {
+ public function testMembershipDatesNotOverridden() {
$result = $this->callAPISuccess($this->_entity, 'create', $this->_params);
unset($this->_params['end_date'], $this->_params['start_date']);
$this->_params['id'] = $result['id'];
protected $_apiversion;
protected $_entity = 'MembershipType';
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
$this->_apiversion = 3;
$this->_contactID = $this->organizationCreate(NULL);
}
- function testGetWithoutId() {
+ public function testGetWithoutId() {
$params = array(
'name' => '60+ Membership',
'description' => 'people above 60 are given health instructions',
$this->assertEquals($membershiptype['count'], 0);
}
- function testGet() {
+ public function testGet() {
$id = $this->membershipTypeCreate(array('member_of_contact_id' => $this->_contactID));
$params = array(
}
///////////////// civicrm_membership_type_create methods
- function testCreateWithEmptyParams() {
+ public function testCreateWithEmptyParams() {
$membershiptype = $this->callAPIFailure('membership_type', 'create', array());
$this->assertEquals($membershiptype['error_message'],
'Mandatory key(s) missing from params array: domain_id, member_of_contact_id, financial_type_id, duration_unit, duration_interval, name'
);
}
- function testCreateWithoutMemberOfContactId() {
+ public function testCreateWithoutMemberOfContactId() {
$params = array(
'name' => '60+ Membership',
'description' => 'people above 60 are given health instructions',
);
}
- function testCreateWithoutContributionTypeId() {
+ public function testCreateWithoutContributionTypeId() {
$params = array(
'name' => '70+ Membership',
'description' => 'people above 70 are given health instructions',
);
}
- function testCreateWithoutDurationUnit() {
+ public function testCreateWithoutDurationUnit() {
$params = array(
'name' => '80+ Membership',
'description' => 'people above 80 are given health instructions',
);
}
- function testCreateWithoutDurationInterval() {
+ public function testCreateWithoutDurationInterval() {
$params = array(
'name' => '70+ Membership',
'description' => 'people above 70 are given health instructions',
);
}
- function testCreateWithoutNameandDomainIDandDurationUnit() {
+ public function testCreateWithoutNameandDomainIDandDurationUnit() {
$params = array(
'description' => 'people above 50 are given health instructions',
'member_of_contact_id' => $this->_contactID,
);
}
- function testCreateWithoutName() {
+ public function testCreateWithoutName() {
$params = array(
'description' => 'people above 50 are given health instructions',
'member_of_contact_id' => $this->_contactID,
$this->assertEquals($membershiptype['error_message'], 'Mandatory key(s) missing from params array: name');
}
- function testCreate() {
+ public function testCreate() {
$params = array(
'name' => '40+ Membership',
'description' => 'people above 40 are given health instructions',
}
- function testUpdateWithEmptyParams() {
+ public function testUpdateWithEmptyParams() {
$params = array();
$membershiptype = $this->callAPIFailure('membership_type', 'create', $params);
$this->assertEquals($membershiptype['error_message'],
);
}
- function testUpdateWithoutId() {
+ public function testUpdateWithoutId() {
$params = array(
'name' => '60+ Membership',
'description' => 'people above 60 are given health instructions',
$this->assertEquals($membershiptype['error_message'], 'Mandatory key(s) missing from params array: domain_id');
}
- function testUpdate() {
+ public function testUpdate() {
$id = $this->membershipTypeCreate(array('member_of_contact_id' => $this->_contactID, 'financial_type_id' => 2));
$newMembOrgParams = array(
'organization_name' => 'New membership organisation',
$this->getAndCheck($params, $id, $this->_entity);
}
- function testDeleteNotExists() {
+ public function testDeleteNotExists() {
$params = array(
'id' => 'doesNotExist',
);
);
}
- function testDelete() {
+ public function testDelete() {
$orgID = $this->organizationCreate(NULL);
$membershipTypeID = $this->membershipTypeCreate(array('member_of_contact_id' => $orgID));
$params = array(
protected $params;
- function setUp() {
+ public function setUp() {
$this->_apiversion = 3;
parent::setUp();
$this->useTransaction(TRUE);
protected $_noteID;
protected $_note;
- function setUp() {
+ public function setUp() {
$this->_apiversion = 3;
// Connect to the database
* Check retrieve note with empty parameter array
* Error expected
*/
- function testGetWithEmptyParams() {
+ public function testGetWithEmptyParams() {
$this->callAPISuccess('note', 'get', array());
}
* Check retrieve note with missing patrameters
* Error expected
*/
- function testGetWithoutEntityId() {
+ public function testGetWithoutEntityId() {
$params = array(
'entity_table' => 'civicrm_contact',
);
/**
* Check civicrm_note_get
*/
- function testGet() {
+ public function testGet() {
$entityId = $this->_noteID;
$params = array(
'entity_table' => 'civicrm_contact',
* Check create with empty parameter array
* Error Expected
*/
- function testCreateWithEmptyNoteField() {
+ public function testCreateWithEmptyNoteField() {
$this->_params['note'] = "";
$result = $this->callAPIFailure('note', 'create', $this->_params,
'Mandatory key(s) missing from params array: note');
* Check create with partial params
* Error expected
*/
- function testCreateWithoutEntityId() {
+ public function testCreateWithoutEntityId() {
unset($this->_params['entity_id']);
$result = $this->callAPIFailure('note', 'create', $this->_params,
'Mandatory key(s) missing from params array: entity_id');
* Check create with partially empty params
* Error expected
*/
- function testCreateWithEmptyEntityId() {
+ public function testCreateWithEmptyEntityId() {
$this->_params['entity_id'] = "";
$result = $this->callAPIFailure('note', 'create', $this->_params,
'Mandatory key(s) missing from params array: entity_id');
/**
* Check civicrm_note_create
*/
- function testCreate() {
+ public function testCreate() {
$result = $this->callAPIAndDocument('note', 'create', $this->_params, __FUNCTION__, __FILE__);
$this->assertEquals($result['values'][$result['id']]['note'], 'Hello!!! m testing Note', 'in line ' . __LINE__);
$this->noteDelete($note);
}
- function testCreateWithApostropheInString() {
+ public function testCreateWithApostropheInString() {
$params = array(
'entity_table' => 'civicrm_contact',
'entity_id' => $this->_contactID,
/**
* Check civicrm_note_create - tests used of default set to now
*/
- function testCreateWithoutModifiedDate() {
+ public function testCreateWithoutModifiedDate() {
unset($this->_params['modified_date']);
$apiResult = $this->callAPISuccess('note', 'create', $this->_params);
$this->assertAPISuccess($apiResult);
* Please don't copy & paste this - is of marginal value
* better to put time into the function on Syntax Conformance class that tests this
*/
- function testUpdateWithEmptyParams() {
+ public function testUpdateWithEmptyParams() {
$note = $this->callAPIFailure('note', 'create', array());
}
* Check update with missing parameter (contact id)
* Error expected
*/
- function testUpdateWithoutContactId() {
+ public function testUpdateWithoutContactId() {
$params = array(
'entity_id' => $this->_contactID,
'entity_table' => 'civicrm_contact', );
/**
* Check civicrm_note_update
*/
- function testUpdate() {
+ public function testUpdate() {
$params = array(
'id' => $this->_noteID,
'contact_id' => $this->_contactID,
* Check delete with empty parametes array
* Error expected
*/
- function testDeleteWithEmptyParams() {
+ public function testDeleteWithEmptyParams() {
$deleteNote = $this->callAPIFailure('note', 'delete', array(), 'Mandatory key(s) missing from params array: id');
}
* Check delete with wrong id
* Error expected
*/
- function testDeleteWithWrongID() {
+ public function testDeleteWithWrongID() {
$params = array(
'id' => 0,
);
/**
* Check civicrm_note_delete
*/
- function testDelete() {
+ public function testDelete() {
$additionalNote = $this->noteCreate($this->_contactID);
$params = array(
protected $_entity = 'OptionGroup';
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
$this->_params = array(
class api_v3_OptionValueTest extends CiviUnitTestCase {
protected $_apiversion = 3;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
}
/**
* Test limit param
*/
- function testGetOptionValueLimit() {
+ public function testGetOptionValueLimit() {
$params = array();
$result = $this->callAPISuccess('option_value', 'get', $params);
$this->assertGreaterThan(1, $result['count'], "Check more than one exists In line " . __LINE__);
/**
* Test offset param
*/
- function testGetOptionValueOffSet() {
+ public function testGetOptionValueOffSet() {
$result = $this->callAPISuccess('option_value', 'get', array(
'option_group_id' => 1,
/**
* Test offset param
*/
- function testGetSingleValueOptionValueSort() {
+ public function testGetSingleValueOptionValueSort() {
$description = "demonstrates use of Sort param (available in many api functions). Also, getsingle";
$subfile = 'SortOption';
$result = $this->callAPISuccess('option_value', 'getsingle', array(
/**
* Try to emulate a pagination: fetch the first page of 10 options, then fetch the second page with an offset of 9 (instead of 10) and check the start of the second page is the end of the 1st one.
*/
- function testGetValueOptionPagination() {
+ public function testGetValueOptionPagination() {
$pageSize = 10;
$page1 = $this->callAPISuccess('option_value', 'get', array('options' => array('limit' => $pageSize), ));
$page2 = $this->callAPISuccess('option_value', 'get', array(
protected $_participantPaymentID;
protected $_contributionTypeId;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
$event = $this->eventCreate(NULL);
/**
* Test civicrm_participant_payment_create with wrong params type
*/
- function testPaymentCreateWrongParamsType() {
+ public function testPaymentCreateWrongParamsType() {
$params = 'a string';
$result = $this->callAPIFailure('participant_payment', 'create', $params);
}
/**
* Test civicrm_participant_payment_create with empty params
*/
- function testPaymentCreateEmptyParams() {
+ public function testPaymentCreateEmptyParams() {
$params = array();
$result = $this->callAPIFailure('participant_payment', 'create', $params);
}
/**
* Check without contribution_id
*/
- function testPaymentCreateMissingContributionId() {
+ public function testPaymentCreateMissingContributionId() {
//Without Payment EntityID
$params = array(
'participant_id' => $this->_participantID, );
/**
* Check with valid array
*/
- function testPaymentCreate() {
+ public function testPaymentCreate() {
//Create Contribution & get contribution ID
$contributionID = $this->contributionCreate($this->_contactID);
/**
* Test civicrm_participant_payment_create with wrong params type
*/
- function testPaymentUpdateWrongParamsType() {
+ public function testPaymentUpdateWrongParamsType() {
$params = 'a string';
$result = $this->callAPIFailure('participant_payment', 'create', $params);
$this->assertEquals('Input variable `params` is not an array', $result['error_message'], 'In line ' . __LINE__);
/**
* Check with empty array
*/
- function testPaymentUpdateEmpty() {
+ public function testPaymentUpdateEmpty() {
$params = array();
$participantPayment = $this->callAPIFailure('participant_payment', 'create', $params);
}
/**
* Check with missing participant_id
*/
- function testPaymentUpdateMissingParticipantId() {
+ public function testPaymentUpdateMissingParticipantId() {
//WithoutParticipantId
$params = array(
'contribution_id' => '3', );
/**
* Check with missing contribution_id
*/
- function testPaymentUpdateMissingContributionId() {
+ public function testPaymentUpdateMissingContributionId() {
$params = array(
'participant_id' => $this->_participantID, );
$participantPayment = $this->callAPIFailure('participant_payment', 'create', $params);
/**
* Check financial records for offline Participants
*/
- function testPaymentOffline() {
+ public function testPaymentOffline() {
// create contribution w/o fee
$contributionID = $this->contributionCreate($this->_contactID, $this->_contributionTypeId, NULL, NULL, 4, FALSE);
/**
* Check financial records for online Participant
*/
- function testPaymentOnline() {
+ public function testPaymentOnline() {
$paymentProcessor = $this->processorCreate();
$pageParams['processor_id'] = $paymentProcessor->id;
/**
* Check financial records for online Participant pay later scenario
*/
- function testPaymentPayLaterOnline() {
+ public function testPaymentPayLaterOnline() {
$paymentProcessor = $this->processorCreate();
$pageParams['processor_id'] = $paymentProcessor->id;
/**
* Test civicrm_participant_payment_delete with wrong params type
*/
- function testPaymentDeleteWrongParamsType() {
+ public function testPaymentDeleteWrongParamsType() {
$params = 'a string';
$result = $this->callAPIFailure('participant_payment', 'delete', $params);
}
/**
* Check with empty array
*/
- function testPaymentDeleteWithEmptyParams() {
+ public function testPaymentDeleteWithEmptyParams() {
$params = array();
$deletePayment = $this->callAPIFailure('participant_payment', 'delete', $params);
$this->assertEquals('Mandatory key(s) missing from params array: id', $deletePayment['error_message']);
/**
* Check with wrong id
*/
- function testPaymentDeleteWithWrongID() {
+ public function testPaymentDeleteWithWrongID() {
$params = array(
'id' => 0, );
$deletePayment = $this->callAPIFailure('participant_payment', 'delete', $params);
/**
* Check with valid array
*/
- function testPaymentDelete() {
+ public function testPaymentDelete() {
// create contribution
$contributionID = $this->contributionCreate($this->_contactID, $this->_contributionTypeId);
* @param array $params
* @param $context
*/
- function _checkFinancialRecords($params, $context) {
+ public function _checkFinancialRecords($params, $context) {
$entityParams = array(
'entity_id' => $params['id'],
'entity_table' => 'civicrm_contribution',
public $DBResetRequired = FALSE;
- function setUp() {
+ public function setUp() {
$this->_apiversion = 3;
$this->params = array(
'name' => 'test status',
protected $_individualId;
protected $_params;
- function setUp() {
+ public function setUp() {
$this->_apiversion = 3;
parent::setUp();
$this->_entity = 'participant';
);
}
- function tearDown() {
+ public function tearDown() {
$this->eventDelete($this->_eventID);
$tablesToTruncate = array(
'civicrm_custom_group', 'civicrm_custom_field', 'civicrm_contact', 'civicrm_participant'
* variables specific to participant so it can be replicated into other entities
* and / or moved to the automated test suite
*/
- function testCreateWithCustom() {
+ public function testCreateWithCustom() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params = $this->_params;
/**
* Check with wrong params type
*/
- function testGetWrongParamsType() {
+ public function testGetWrongParamsType() {
$params = 'a string';
$result = $this->callAPIFailure('participant', 'get', $params);
}
/**
* Test civicrm_participant_get with empty params
*/
- function testGetEmptyParams() {
+ public function testGetEmptyParams() {
$this->callAPISuccess('participant', 'get', array());
}
/**
* Check with participant_id
*/
- function testGetParticipantIdOnly() {
+ public function testGetParticipantIdOnly() {
$params = array(
'participant_id' => $this->_participantID,
'return' => array(
/**
* Check with params id
*/
- function testGetParamsAsIdOnly() {
+ public function testGetParamsAsIdOnly() {
$params = array(
'id' => $this->_participantID,
);
/**
* Check with params id
*/
- function testGetNestedEventGet() {
+ public function testGetNestedEventGet() {
//create a second event & add participant to it.
$event = $this->eventCreate(NULL);
$this->callAPISuccess('participant', 'create', array('event_id' => $event['id'], 'contact_id' => $this->_contactID));
/**
* Check Participant Get respects return properties
*/
- function testGetWithReturnProperties() {
+ public function testGetWithReturnProperties() {
$params = array(
'contact_id' => $this->_contactID, 'return.status_id' => 1,
'return.participant_status_id' => 1,
/**
* Check with contact_id
*/
- function testGetContactIdOnly() {
+ public function testGetContactIdOnly() {
$params = array(
'contact_id' => $this->_contactID, );
$participant = $this->callAPISuccess('participant', 'get', $params);
* Check with event_id
* fetch first record
*/
- function testGetMultiMatchReturnFirst() {
+ public function testGetMultiMatchReturnFirst() {
$params = array(
'event_id' => $this->_eventID,
'rowCount' => 1, );
* Check with event_id
* in v3 this should return all participants
*/
- function testGetMultiMatchNoReturnFirst() {
+ public function testGetMultiMatchNoReturnFirst() {
$params = array(
'event_id' => $this->_eventID,
);
* Test civicrm_participant_get with empty params
* In this case all the participant records are returned.
*/
- function testSearchEmptyParams() {
+ public function testSearchEmptyParams() {
$result = $this->callAPISuccess('participant', 'get', array());
// expecting 3 participant records
$this->assertEquals($result['count'], 3);
/**
* Check with participant_id
*/
- function testSearchParticipantIdOnly() {
+ public function testSearchParticipantIdOnly() {
$params = array(
'participant_id' => $this->_participantID,
);
/**
* Check with contact_id
*/
- function testSearchContactIdOnly() {
+ public function testSearchContactIdOnly() {
// Should get 2 participant records for this contact.
$params = array(
'contact_id' => $this->_contactID2,
/**
* Check with event_id
*/
- function testSearchByEvent() {
+ public function testSearchByEvent() {
// Should get >= 3 participant records for this event. Also testing that last_name and event_title are returned.
$params = array(
'event_id' => $this->_eventID,
* Check with event_id
* fetch with limit
*/
- function testSearchByEventWithLimit() {
+ public function testSearchByEventWithLimit() {
// Should 2 participant records since we're passing rowCount = 2.
$params = array(
'event_id' => $this->_eventID,
/**
* Test civicrm_participant_create with empty params
*/
- function testCreateEmptyParams() {
+ public function testCreateEmptyParams() {
$params = array();
$result = $this->callAPIFailure('participant', 'create', $params);
}
/**
* Check with event_id
*/
- function testCreateMissingContactID() {
+ public function testCreateMissingContactID() {
$params = array(
'event_id' => $this->_eventID,
);
* Check with contact_id
* without event_id
*/
- function testCreateMissingEventID() {
+ public function testCreateMissingEventID() {
$params = array(
'contact_id' => $this->_contactID,
);
/**
* Check with contact_id & event_id
*/
- function testCreateEventIdOnly() {
+ public function testCreateEventIdOnly() {
$params = array(
'contact_id' => $this->_contactID,
'event_id' => $this->_eventID,
/**
* Check with complete array
*/
- function testCreateAllParams() {
+ public function testCreateAllParams() {
$params = $this->_params;
$participant = $this->callAPISuccess('participant', 'create', $params);
/**
* Test to check if receive date is being changed per CRM-9763
*/
- function testCreateUpdateReceiveDate() {
+ public function testCreateUpdateReceiveDate() {
$participant = $this->callAPISuccess('participant', 'create', $this->_params);
$update = array(
'id' => $participant['id'],
/**
* Test to check if participant fee level is being changed per CRM-9781
*/
- function testCreateUpdateParticipantFeeLevel() {
+ public function testCreateUpdateParticipantFeeLevel() {
$myParams = $this->_params + array('participant_fee_level' => CRM_Core_DAO::VALUE_SEPARATOR . "fee" . CRM_Core_DAO::VALUE_SEPARATOR);
$participant = $this->callAPISuccess('participant', 'create', $myParams);
$update = array(
/**
* Test the line items for participant fee with multiple price field values.
*/
- function testCreateParticipantLineItems() {
+ public function testCreateParticipantLineItems() {
// Create a price set for this event.
$priceset = $this->callAPISuccess('PriceSet', 'create', array(
/**
* Check with complete array
*/
- function testUpdate() {
+ public function testUpdate() {
$participantId = $this->participantCreate(array(
'contactID' => $this->_individualId,
'eventID' => $this->_eventID
* Try again without a custom separater to check that one isn't added
* (get & check won't accept an array)
*/
- function testUpdateCreateParticipantFeeLevelNoSeparator() {
+ public function testUpdateCreateParticipantFeeLevelNoSeparator() {
$myParams = $this->_params + array('participant_fee_level' => "fee");
$participant = $this->callAPISuccess('participant', 'create', $myParams);
/**
* Test civicrm_participant_update with wrong params type
*/
- function testUpdateWrongParamsType() {
+ public function testUpdateWrongParamsType() {
$params = 'a string';
$result = $this->callAPIFailure('participant', 'create', $params);
$this->assertEquals('Input variable `params` is not an array', $result['error_message'], 'In line ' . __LINE__);
/**
* Check with empty array
*/
- function testUpdateEmptyParams() {
+ public function testUpdateEmptyParams() {
$params = array();
$participant = $this->callAPIFailure('participant', 'create', $params);
$this->assertEquals($participant['error_message'], 'Mandatory key(s) missing from params array: event_id, contact_id');
/**
* Check without event_id
*/
- function testUpdateWithoutEventId() {
+ public function testUpdateWithoutEventId() {
$participantId = $this->participantCreate(array('contactID' => $this->_individualId, 'eventID' => $this->_eventID));
$params = array(
'contact_id' => $this->_individualId,
/**
* Check with Invalid participantId
*/
- function testUpdateWithWrongParticipantId() {
+ public function testUpdateWithWrongParticipantId() {
$params = array(
'id' => 1234,
'status_id' => 3,
/**
* Check with Invalid ContactId
*/
- function testUpdateWithWrongContactId() {
+ public function testUpdateWithWrongContactId() {
$participantId = $this->participantCreate(array(
'contactID' => $this->_individualId,
'eventID' => $this->_eventID,
/**
* Test civicrm_participant_delete with wrong params type
*/
- function testDeleteWrongParamsType() {
+ public function testDeleteWrongParamsType() {
$params = 'a string';
$result = $this->callAPIFailure('participant', 'delete', $params);
}
/**
* Test civicrm_participant_delete with empty params
*/
- function testDeleteEmptyParams() {
+ public function testDeleteEmptyParams() {
$params = array();
$result = $this->callAPIFailure('participant', 'delete', $params);
}
/**
* Check with participant_id
*/
- function testParticipantDelete() {
+ public function testParticipantDelete() {
$params = array(
'id' => $this->_participantID, );
$participant = $this->callAPISuccess('participant', 'delete', $params);
* and with event_id
* This should return an error because required param is missing..
*/
- function testParticipantDeleteMissingID() {
+ public function testParticipantDeleteMissingID() {
$params = array(
'event_id' => $this->_eventID, );
$participant = $this->callAPIFailure('participant', 'delete', $params);
/**
* Delete with a get - a 'criteria delete'
*/
- function testNestedDelete() {
+ public function testNestedDelete() {
$description = "Criteria delete by nesting a GET & a DELETE";
$subfile = "NestedDelete";
$participants = $this->callAPISuccess('Participant', 'Get', array());
/**
* Test creation of a participant with an associated contribution
*/
- function testCreateParticipantWithPayment() {
+ public function testCreateParticipantWithPayment() {
$description = "single function to create contact w partipation & contribution. Note that in the
case of 'contribution' the 'create' is implied (api.contribution.create)";
$subfile = "CreateParticipantPayment";
protected $_apiversion = 3;
protected $_params;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
// Create dummy processor
/**
* Check with no name
*/
- function testPaymentProcessorCreateWithoutName() {
+ public function testPaymentProcessorCreateWithoutName() {
$payProcParams = array(
'is_active' => 1,
);
/**
* Create payment processor
*/
- function testPaymentProcessorCreate() {
+ public function testPaymentProcessorCreate() {
$params = $this->_params;
$result = $this->callAPIAndDocument('payment_processor', 'create', $params, __FUNCTION__, __FILE__);
$this->assertNotNull($result['id'], 'in line ' . __LINE__);
/**
* Test using example code
*/
- function testPaymentProcessorCreateExample() {
+ public function testPaymentProcessorCreateExample() {
require_once 'api/v3/examples/PaymentProcessor/Create.php';
$result = payment_processor_create_example();
$expectedResult = payment_processor_create_expectedresult();
/**
* Check payment processor delete
*/
- function testPaymentProcessorDelete() {
+ public function testPaymentProcessorDelete() {
$id = $this->testPaymentProcessorCreate();
$params = array(
'id' => $id,
/**
* Check with valid params array.
*/
- function testPaymentProcessorsGet() {
+ public function testPaymentProcessorsGet() {
$params = $this->_params;
$params['user_name'] = 'test@test.com';
$this->callAPISuccess('payment_processor', 'create', $params);
protected $_ppTypeID;
protected $_apiversion;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
/**
* Check with no name
*/
- function testPaymentProcessorTypeCreateWithoutName() {
+ public function testPaymentProcessorTypeCreateWithoutName() {
$payProcParams = array(
'is_active' => 1, );
$result = $this->callAPIFailure('payment_processor_type', 'create', $payProcParams);
/**
* Create payment processor type
*/
- function testPaymentProcessorTypeCreate() {
+ public function testPaymentProcessorTypeCreate() {
$params = array( 'sequential' => 1,
'name' => 'API_Test_PP',
'title' => 'API Test Payment Processor',
/**
* Test using example code
*/
- function testPaymentProcessorTypeCreateExample() {
+ public function testPaymentProcessorTypeCreateExample() {
require_once 'api/v3/examples/PaymentProcessorType/Create.php';
$result = payment_processor_type_create_example();
$expectedResult = payment_processor_type_create_expectedresult();
/**
* Check with empty array
*/
- function testPaymentProcessorTypeDeleteEmpty() {
+ public function testPaymentProcessorTypeDeleteEmpty() {
$params = array();
$result = $this->callAPIFailure('payment_processor_type', 'delete', $params);
}
/**
* Check with No array
*/
- function testPaymentProcessorTypeDeleteParamsNotArray() {
+ public function testPaymentProcessorTypeDeleteParamsNotArray() {
$result = $this->callAPIFailure('payment_processor_type', 'delete', 'string');
}
/**
* Check if required fields are not passed
*/
- function testPaymentProcessorTypeDeleteWithoutRequired() {
+ public function testPaymentProcessorTypeDeleteWithoutRequired() {
$params = array(
'name' => 'API_Test_PP',
'title' => 'API Test Payment Processor',
/**
* Check with incorrect required fields
*/
- function testPaymentProcessorTypeDeleteWithIncorrectData() {
+ public function testPaymentProcessorTypeDeleteWithIncorrectData() {
$result = $this->callAPIFailure('payment_processor_type', 'delete', array('id' => 'abcd'));
}
/**
* Check payment processor type delete
*/
- function testPaymentProcessorTypeDelete() {
+ public function testPaymentProcessorTypeDelete() {
$payProcType = $this->paymentProcessorTypeCreate();
$params = array(
'id' => $payProcType,
/**
* Check with empty array
*/
- function testPaymentProcessorTypeUpdateEmpty() {
+ public function testPaymentProcessorTypeUpdateEmpty() {
$params = array();
$result = $this->callAPIFailure('payment_processor_type', 'create', $params);
$this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: name, title, class_name, billing_mode');
/**
* Check with No array
*/
- function testPaymentProcessorTypeUpdateParamsNotArray() {
+ public function testPaymentProcessorTypeUpdateParamsNotArray() {
$result = $this->callAPIFailure('payment_processor_type', 'create', 'string');
$this->assertEquals($result['error_message'], 'Input variable `params` is not an array');
}
/**
* Check with all parameters
*/
- function testPaymentProcessorTypeUpdate() {
+ public function testPaymentProcessorTypeUpdate() {
// create sample payment processor type.
$this->_ppTypeID = $this->paymentProcessorTypeCreate(NULL);
/**
* Check with empty array
*/
- function testPaymentProcessorTypesGetEmptyParams() {
+ public function testPaymentProcessorTypesGetEmptyParams() {
$results = $this->callAPISuccess('payment_processor_type', 'get', array( ));
$baselineCount = $results['count'];
/**
* Check with valid params array.
*/
- function testPaymentProcessorTypesGet() {
+ public function testPaymentProcessorTypesGet() {
$firstRelTypeParams = array(
'name' => 'API_Test_PP_11',
'title' => 'API Test Payment Processor 11',
protected $_params;
- function setUp() {
+ public function setUp() {
$this->_apiversion = 3;
parent::setUp();
$this->useTransaction();
protected $_entity = 'PledgePayment';
public $DBResetRequired = TRUE;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->_individualId = $this->individualCreate();
$this->_pledgeID = $this->pledgeCreate($this->_individualId);
$this->_contributionID = $this->contributionCreate($this->_individualId);
}
- function tearDown() {
+ public function tearDown() {
$tablesToTruncate = array(
'civicrm_contribution',
'civicrm_contact',
$this->quickCleanup($tablesToTruncate);
}
- function testGetPledgePayment() {
+ public function testGetPledgePayment() {
$params = array();
$result = $this->callAPIAndDocument('pledge_payment', 'get', $params, __FUNCTION__, __FILE__);
$this->assertEquals(5, $result['count'], " in line " . __LINE__);
/**
* Test that passing in a single variable works
*/
- function testGetSinglePledgePayment() {
+ public function testGetSinglePledgePayment() {
$createparams = array(
'contact_id' => $this->_individualId,
'pledge_id' => $this->_pledgeID,
/**
* Test that passing in a single variable works:: status_id
*/
- function testGetSinglePledgePaymentByStatusID() {
+ public function testGetSinglePledgePaymentByStatusID() {
$createparams = array(
'contact_id' => $this->_individualId,
'pledge_id' => $this->_pledgeID,
/**
* Test that creating a payment will add the contribution ID
*/
- function testCreatePledgePayment() {
+ public function testCreatePledgePayment() {
//check that 5 pledge payments exist at the start
$beforeAdd = $this->callAPISuccess('pledge_payment', 'get', array());
$this->assertEquals(5, $beforeAdd['count'], " in line " . __LINE__);
/**
* Test checks behaviour when more payments are created than should be possible
*/
- function testCreatePledgePaymentAllCreated() {
+ public function testCreatePledgePaymentAllCreated() {
$params = array(
'pledge_id' => $this->_pledgeID,
'status_id' => 1,
* Test that creating a payment will add the contribution ID where only one pledge payment
* in schedule
*/
- function testCreatePledgePaymentWhereOnlyOnePayment() {
+ public function testCreatePledgePaymentWhereOnlyOnePayment() {
$pledgeParams = array(
'contact_id' => $this->_individualId,
'pledge_create_date' => date('Ymd'),
$this->assertEquals(1, $afterAdd['count'], " in line " . __LINE__);
}
- function testUpdatePledgePayment() {
+ public function testUpdatePledgePayment() {
$params = array(
'pledge_id' => $this->_pledgeID,
'contribution_id' => $this->_contributionID,
$this->getAndCheck(array_merge($params,$updateparams), $result['id'], $this->_entity);
}
- function testDeletePledgePayment() {
+ public function testDeletePledgePayment() {
$params = array(
'contact_id' => $this->_individualId,
'pledge_id' => $this->_pledgeID,
$result = $this->callAPIAndDocument('pledge_payment', 'delete', $deleteParams, __FUNCTION__, __FILE__);
}
- function testGetFields() {
+ public function testGetFields() {
$result = $this->callAPISuccess('PledgePayment', 'GetFields', array());
$this->assertType('array', $result);
}
protected $scheduled_date;
public $DBResetRequired = True;
- function setUp() {
+ public function setUp() {
$this->_apiversion = 3;
parent::setUp();
$this->quickCleanup(array('civicrm_pledge', 'civicrm_pledge_payment'));
);
}
- function tearDown() {
+ public function tearDown() {
$this->contactDelete($this->_individualId);
}
* variables specific to participant so it can be replicated into other entities
* and / or moved to the automated test suite
*/
- function testCreateWithCustom() {
+ public function testCreateWithCustom() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params = $this->_params;
/*
*
*/
- function testgetfieldspledge() {
+ public function testgetfieldspledge() {
$result = $this->callAPISuccess('pledge', 'getfields', array('action' => 'get'));
$this->assertEquals(1, $result['values']['next_pay_date']['api.return']);
}
- function testGetPledge() {
+ public function testGetPledge() {
$this->_pledge = $this->callAPISuccess('pledge', 'create', $this->_params);
/**
* Test 'return.pledge_financial_type' => 1 works
*/
- function testGetPledgewithReturn() {
+ public function testGetPledgewithReturn() {
$this->_pledge = $this->callAPISuccess('pledge', 'create', $this->_params);
$params = array(
* Test 'return.pledge_contribution_type' => 1 works
* This is for legacy compatibility
*/
- function testGetPledgewithReturnLegacy() {
+ public function testGetPledgewithReturnLegacy() {
$this->_pledge = $this->callAPISuccess('pledge', 'create', $this->_params);
$params = array(
$this->assertEquals('Donation', $pledge['pledge_financial_type']);
}
- function testPledgeGetReturnFilters() {
+ public function testPledgeGetReturnFilters() {
$oldPledge = $this->callAPISuccess('pledge', 'create', $this->_params);
$overdueParams = array(
/*
* create 2 pledges - see if we can get by status id
*/
- function testGetOverduePledge() {
+ public function testGetOverduePledge() {
$overdueParams = array(
'scheduled_date' => 'first saturday of march last year',
'start_date' => 'first saturday of march last year',
/*
* create 2 pledges - see if we can get by status id
*/
- function testSortParamPledge() {
+ public function testSortParamPledge() {
$pledge1 = $this->callAPISuccess('pledge', 'create', $this->_params);
$overdueParams = array(
'scheduled_date' => 'first saturday of march last year',
$this->callAPISuccess('pledge', 'delete', array('id' => $pledge2['id']));
}
- function testCreatePledge() {
+ public function testCreatePledge() {
$result = $this->callAPIAndDocument('pledge', 'create', $this->_params, __FUNCTION__, __FILE__);
$this->assertEquals($result['values'][0]['amount'], 100.00, 'In line ' . __LINE__);
/*
* Test that pledge with weekly schedule calculates dates correctly
*/
- function testCreatePledgeWeeklySchedule() {
+ public function testCreatePledgeWeeklySchedule() {
$params = array(
'scheduled_date' => '20110510',
'frequency_unit' => 'week',
/*
* Test that pledge with weekly schedule calculates dates correctly
*/
- function testCreatePledgeMontlySchedule() {
+ public function testCreatePledgeMontlySchedule() {
$params = array(
'scheduled_date' => '20110510',
'frequency_unit' => 'Month',
* http://issues.civicrm.org/jira/browse/CRM-8551
*
*/
- function testCreatePledgeSinglePayment() {
+ public function testCreatePledgeSinglePayment() {
$params = array(
'scheduled_date' => '20110510',
'frequency_unit' => 'week',
* 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
*/
- function testCreatePledgeWithNonUnique() {
+ public function testCreatePledgeWithNonUnique() {
$params = $this->_params;
$params['original_installment_amount'] = $params['pledge_original_installment_amount'];
$pledge = $this->callAPISuccess('pledge', 'delete', $pledgeID);
}
- function testCreateCancelPledge() {
+ public function testCreateCancelPledge() {
$result = $this->callAPISuccess('pledge', 'create', $this->_params);
/**
* Test that status is set to pending
*/
- function testCreatePledgeNoStatus() {
+ public function testCreatePledgeNoStatus() {
$params = $this->_params;
unset($params['status_id']);
/**
* To Update Pledge
*/
- function testCreateUpdatePledge() {
+ public function testCreateUpdatePledge() {
// we test 'sequential' param here too
$pledgeID = $this->pledgeCreate($this->_individualId);
$old_params = array(
* Here we ensure we are maintaining our 'contract' & supporting previously working syntax
* ie contribution_type_id
*/
- function testCreateUpdatePledgeLegacy() {
+ public function testCreateUpdatePledgeLegacy() {
// we test 'sequential' param here too
$pledgeID = $this->pledgeCreate($this->_individualId);
}
///////////////// civicrm_pledge_delete methods
- function testDeleteEmptyParamsPledge() {
+ public function testDeleteEmptyParamsPledge() {
$pledge = $this->callAPIFailure('pledge', 'delete', array(), 'Mandatory key(s) missing from params array: id');
}
- function testDeleteWrongParamPledge() {
+ public function testDeleteWrongParamPledge() {
$params = array(
'pledge_source' => 'SSF',
);
/**
* Legacy support for pledge_id
*/
- function testDeletePledge() {
+ public function testDeletePledge() {
$pledgeID = $this->pledgeCreate($this->_individualId);
$params = array(
/**
* Std is to accept id
*/
- function testDeletePledgeUseID() {
+ public function testDeletePledgeUseID() {
$pledgeID = $this->pledgeCreate($this->_individualId);
$params = array(
* Note that the function gives incorrect results if no pledges exist as it does a
* contact search instead - test only checks that the get finds the one existing
*/
- function testGetEmpty() {
+ public function testGetEmpty() {
$result = $this->callAPISuccess('pledge', 'create', $this->_params);
$result = $this->callAPISuccess('pledge', 'get', array());
$this->assertAPISuccess($result, "This test is failing because it's acting like a contact get when no params set. Not sure the fix");
);
}
- function tearDown() {
+ public function tearDown() {
$tablesToTruncate = array(
'civicrm_contact',
'civicrm_contribution',
$this->priceFieldID1 = $priceField1['id'];
}
- function tearDown() {
+ public function tearDown() {
$tablesToTruncate = array(
'civicrm_contact',
'civicrm_contribution',
);
}
- function tearDown() {
+ public function tearDown() {
}
/**
protected $_entity = 'Product';
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction();
$this->_params = array(
// $this->quickCleanup(array('civicrm_product'), TRUE);
// }
- function testGetFields() {
+ public function testGetFields() {
$fields = $this->callAPISuccess($this->_entity, 'getfields', array('action' => 'create'));
$this->assertArrayHasKey('period_type', $fields['values']);
}
- function testGetOptions() {
+ public function testGetOptions() {
$options = $this->callAPISuccess($this->_entity, 'getoptions', array('field' => 'period_type'));
$this->assertArrayHasKey('rolling', $options['values']);
}
protected $_membershipTypeID;
protected $_contactID;
- function setUp() {
+ public function setUp() {
$this->_apiversion = 3;
parent::setUp();
$config = CRM_Core_Config::singleton();
$this->_membershipTypeID = $this->membershipTypeCreate();
}
- function tearDown() {
+ public function tearDown() {
$this->quickCleanup(array(
'civicrm_contact',
/**
* Check Without ProfileId
*/
- function testProfileGetWithoutProfileId() {
+ public function testProfileGetWithoutProfileId() {
$params = array(
'contact_id' => 1,
);
/**
* Check with no invalid profile Id
*/
- function testProfileGetInvalidProfileId() {
+ public function testProfileGetInvalidProfileId() {
$params = array(
'contact_id' => 1,
'profile_id' => 1000,
/**
* Check with success
*/
- function testProfileGet() {
+ public function testProfileGet() {
$pofileFieldValues = $this->_createIndividualContact();
$expected = current($pofileFieldValues);
$contactId = key($pofileFieldValues);
}
}
- function testProfileGetMultiple() {
+ public function testProfileGetMultiple() {
$pofileFieldValues = $this->_createIndividualContact();
$expected = current($pofileFieldValues);
$contactId = key($pofileFieldValues);
));
}
- function testProfileGetBillingUseIsBillingLocation() {
+ public function testProfileGetBillingUseIsBillingLocation() {
$individual = $this->_createIndividualContact();
$contactId = key($individual);
$this->callAPISuccess('address', 'create', array(
), $result['values']['Billing']);
}
- function testProfileGetMultipleHasBillingLocation() {
+ public function testProfileGetMultipleHasBillingLocation() {
$individual = $this->_createIndividualContact();
$contactId = key($individual);
$this->callAPISuccess('address', 'create', array('contact_id' => $contactId , 'street_address' => '25 Big Street', 'city' => 'big city', 'location_type_id' => 5));
/**
* Get Billing empty contact - this will return generic defaults
*/
- function testProfileGetBillingEmptyContact() {
+ public function testProfileGetBillingEmptyContact() {
$params = array(
'profile_id' => array('Billing'),
/**
* Check contact activity profile without activity id
*/
- function testContactActivityGetWithoutActivityId() {
+ public function testContactActivityGetWithoutActivityId() {
list($params, $expected) = $this->_createContactWithActivity();
unset($params['activity_id']);
/**
* Check contact activity profile wrong activity id
*/
- function testContactActivityGetWrongActivityId() {
+ public function testContactActivityGetWrongActivityId() {
list($params, $expected) = $this->_createContactWithActivity();
$params['activity_id'] = 100001;
/**
* Check contact activity profile with wrong activity type
*/
- function testContactActivityGetWrongActivityType() {
+ public function testContactActivityGetWrongActivityType() {
//flush cache by calling with reset
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name', TRUE);
/**
* Check contact activity profile with success
*/
- function testContactActivityGetSuccess() {
+ public function testContactActivityGetSuccess() {
list($params, $expected) = $this->_createContactWithActivity();
$result = $this->callAPISuccess('profile', 'get', $params);
/**
* Check getfields works & gives us our fields
*/
- function testGetFields() {
+ public function testGetFields() {
$this->_createIndividualProfile();
$this->_addCustomFieldToProfile($this->_profileID);
$result = $this->callAPIAndDocument('profile', 'getfields', array('action' => 'submit', 'profile_id' => $this->_profileID), __FUNCTION__, __FILE__,
/**
* Check getfields works & gives us our fields - partipant profile
*/
- function testGetFieldsParticipantProfile() {
+ public function testGetFieldsParticipantProfile() {
$result = $this->callAPISuccess('profile', 'getfields', array(
'action' => 'submit',
'profile_id' => 'participant_status',
* Check getfields works & gives us our fields - membership_batch_entry
* (getting to the end with no e-notices is pretty good evidence it's working)
*/
- function testGetFieldsMembershipBatchProfile() {
+ public function testGetFieldsMembershipBatchProfile() {
$result = $this->callAPISuccess('profile', 'getfields', array(
'action' => 'submit',
'profile_id' => 'membership_batch_entry',
* Check getfields works & gives us our fields - do them all
* (getting to the end with no e-notices is pretty good evidence it's working)
*/
- function testGetFieldsAllProfiles() {
+ public function testGetFieldsAllProfiles() {
$result = $this->callAPISuccess('uf_group', 'get', array('return' => 'id'));
$profileIDs = array_keys($result['values']);
foreach ($profileIDs as $profileID) {
/**
* Check Without ProfileId
*/
- function testProfileSubmitWithoutProfileId() {
+ public function testProfileSubmitWithoutProfileId() {
$params = array(
'contact_id' => 1,
);
/**
* Check with no invalid profile Id
*/
- function testProfileSubmitInvalidProfileId() {
+ public function testProfileSubmitInvalidProfileId() {
$params = array(
'contact_id' => 1,
'profile_id' => 1000,
/**
* Check with missing required field in profile
*/
- function testProfileSubmitCheckProfileRequired() {
+ public function testProfileSubmitCheckProfileRequired() {
$pofileFieldValues = $this->_createIndividualContact();
current($pofileFieldValues);
$contactId = key($pofileFieldValues);
/**
* Check with success
*/
- function testProfileSubmit() {
+ public function testProfileSubmit() {
$pofileFieldValues = $this->_createIndividualContact();
current($pofileFieldValues);
$contactId = key($pofileFieldValues);
* Ensure caches are being cleared so we don't get into a debugging trap because of cached metadata
* First we delete & create to increment the version & then check for caching probs
*/
- function testProfileSubmitCheckCaching() {
+ public function testProfileSubmitCheckCaching() {
$this->callAPISuccess('membership_type', 'delete', array('id' => $this->_membershipTypeID));
$this->_membershipTypeID = $this->membershipTypeCreate();
/**
* Test that the fields are returned in the right order despite the faffing around that goes on
*/
- function testMembershipGetFieldsOrder() {
+ public function testMembershipGetFieldsOrder() {
$result = $this->callAPISuccess('profile', 'getfields', array('action' => 'submit', 'profile_id' => 'membership_batch_entry'));
$weight = 1;
foreach($result['values'] as $fieldName => $field) {
/**
* Check we can submit membership batch profiles (create mode)
*/
- function testProfileSubmitMembershipBatch() {
+ public function testProfileSubmitMembershipBatch() {
$this->_contactID = $this->individualCreate();
$this->callAPISuccess('profile', 'submit', array(
'profile_id' => 'membership_batch_entry',
/**
* Set is deprecated but we need to ensure it still works
*/
- function testLegacySet() {
+ public function testLegacySet() {
$pofileFieldValues = $this->_createIndividualContact();
current($pofileFieldValues);
$contactId = key($pofileFieldValues);
/**
* Check contact activity profile without activity id
*/
- function testContactActivitySubmitWithoutActivityId() {
+ public function testContactActivitySubmitWithoutActivityId() {
list($params, $expected) = $this->_createContactWithActivity();
$params = array_merge($params, $expected);
/**
* Check contact activity profile wrong activity id
*/
- function testContactActivitySubmitWrongActivityId() {
+ public function testContactActivitySubmitWrongActivityId() {
list($params, $expected) = $this->_createContactWithActivity();
$params = array_merge($params, $expected);
$params['activity_id'] = 100001;
/**
* Check contact activity profile with wrong activity type
*/
- function testContactActivitySubmitWrongActivityType() {
+ public function testContactActivitySubmitWrongActivityType() {
//flush cache by calling with reset
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name', TRUE);
/**
* Check contact activity profile with success
*/
- function testContactActivitySubmitSuccess() {
+ public function testContactActivitySubmitSuccess() {
list($params, $expected) = $this->_createContactWithActivity();
$updateParams = array(
/**
* Check profile apply Without ProfileId
*/
- function testProfileApplyWithoutProfileId() {
+ public function testProfileApplyWithoutProfileId() {
$params = array(
'contact_id' => 1,
);
/**
* Check profile apply with no invalid profile Id
*/
- function testProfileApplyInvalidProfileId() {
+ public function testProfileApplyInvalidProfileId() {
$params = array(
'contact_id' => 1,
'profile_id' => 1000,
/**
* Check with success
*/
- function testProfileApply() {
+ public function testProfileApply() {
$pofileFieldValues = $this->_createIndividualContact();
current($pofileFieldValues);
$contactId = key($pofileFieldValues);
*
* @return mixed
*/
- function _createIndividualContact($params = array()) {
+ public function _createIndividualContact($params = array()) {
$contactParams = array_merge(array(
'first_name' => 'abc1',
'last_name' => 'xyz1',
/**
* @return array
*/
- function _createContactWithActivity() {
+ public function _createContactWithActivity() {
// @TODO: Create profile with custom fields
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
/**
* Create a profile
*/
- function _createIndividualProfile() {
+ public function _createIndividualProfile() {
// creating these via the api as we want to utilise & test the flushing of caches when fields created
// via the api
/**
* @param int $profileID
*/
- function _addCustomFieldToProfile($profileID) {
+ public function _addCustomFieldToProfile($profileID) {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, '');
$this->uFFieldCreate(array('uf_group_id' => $profileID, 'field_name' => 'custom_' . $ids['custom_field_id'], 'contact_type' => 'Contact'));
}
protected $_entity;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->_cId_a = $this->individualCreate();
$this->_cId_a_2 = $this->individualCreate(array('last_name' => 'c2', 'email' => 'c@w.com', 'contact_type' => 'Individual'));
}
- function tearDown() {
+ public function tearDown() {
$this->contactDelete($this->_cId_a);
$this->contactDelete($this->_cId_a_2);
$this->contactDelete($this->_cId_b);
/**
* Check with empty array
*/
- function testRelationshipCreateEmpty() {
+ public function testRelationshipCreateEmpty() {
$this->callAPIFailure('relationship', 'create', array());
}
/**
* Check if required fields are not passed
*/
- function testRelationshipCreateWithoutRequired() {
+ public function testRelationshipCreateWithoutRequired() {
$params = array(
'start_date' => array('d' => '10', 'M' => '1', 'Y' => '2008'),
'end_date' => array('d' => '10', 'M' => '1', 'Y' => '2009'),
/**
* Check with incorrect required fields
*/
- function testRelationshipCreateWithIncorrectData() {
+ public function testRelationshipCreateWithIncorrectData() {
$params = array(
'contact_id_a' => $this->_cId_a,
/**
* Check relationship creation with invalid Relationship
*/
- function testRelationshipCreatInvalidRelationship() {
+ public function testRelationshipCreatInvalidRelationship() {
// both the contact of type Individual
$params = array(
'contact_id_a' => $this->_cId_a,
/**
* Check relationship already exists
*/
- function testRelationshipCreateAlreadyExists() {
+ public function testRelationshipCreateAlreadyExists() {
$params = array(
'contact_id_a' => $this->_cId_a,
'contact_id_b' => $this->_cId_b,
/**
* Check relationship already exists
*/
- function testRelationshipCreateUpdateAlreadyExists() {
+ public function testRelationshipCreateUpdateAlreadyExists() {
$params = array(
'contact_id_a' => $this->_cId_a,
'contact_id_b' => $this->_cId_b,
/**
* Checkupdate doesn't reset stuff badly - CRM-11789
*/
- function testRelationshipCreateUpdateDoesntMangle() {
+ public function testRelationshipCreateUpdateDoesntMangle() {
$params = array(
'contact_id_a' => $this->_cId_a,
'contact_id_b' => $this->_cId_b,
/**
* Check relationship creation
*/
- function testRelationshipCreate() {
+ public function testRelationshipCreate() {
$params = array(
'contact_id_a' => $this->_cId_a,
'contact_id_b' => $this->_cId_b,
/**
* Ensure disabling works
*/
- function testRelationshipUpdate() {
+ public function testRelationshipUpdate() {
$result = $this->callAPISuccess('relationship', 'create', $this->_params);
$relID = $result['id'];
$result = $this->callAPISuccess('relationship', 'create', array('id' => $relID, 'description' => 'blah'));
/**
* Check relationship creation
*/
- function testRelationshipCreateEmptyEndDate() {
+ public function testRelationshipCreateEmptyEndDate() {
$params = array(
'contact_id_a' => $this->_cId_a,
'contact_id_b' => $this->_cId_b,
/**
* Check relationship creation with custom data
*/
- function testRelationshipCreateWithCustomData() {
+ public function testRelationshipCreateWithCustomData() {
$customGroup = $this->createCustomGroup();
$this->_ids = $this->createCustomField();
//few custom Values for comparing
* variables specific to participant so it can be replicated into other entities
* and / or moved to the automated test suite
*/
- function testGetWithCustom() {
+ public function testGetWithCustom() {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
$params = $this->_params;
/**
* @return mixed
*/
- function createCustomGroup() {
+ public function createCustomGroup() {
$params = array(
'title' => 'Custom Group',
'extends' => array('Relationship'),
/**
* @return array
*/
- function createCustomField() {
+ public function createCustomField() {
$ids = array();
$params = array(
'custom_group_id' => $this->_customGroupId,
/**
* Check with empty array
*/
- function testRelationshipDeleteEmpty() {
+ public function testRelationshipDeleteEmpty() {
$params = array();
$result = $this->callAPIFailure('relationship', 'delete', $params, 'Mandatory key(s) missing from params array: id');
}
/**
* Check if required fields are not passed
*/
- function testRelationshipDeleteWithoutRequired() {
+ public function testRelationshipDeleteWithoutRequired() {
$params = array(
'start_date' => '2008-12-20',
'end_date' => '2009-12-20',
/**
* Check with incorrect required fields
*/
- function testRelationshipDeleteWithIncorrectData() {
+ public function testRelationshipDeleteWithIncorrectData() {
$params = array(
'contact_id_a' => $this->_cId_a,
'contact_id_b' => $this->_cId_b,
/**
* Check relationship creation
*/
- function testRelationshipDelete() {
+ public function testRelationshipDelete() {
$params = array(
'contact_id_a' => $this->_cId_a,
'contact_id_b' => $this->_cId_b,
/**
* Check with empty array
*/
- function testRelationshipUpdateEmpty() {
+ public function testRelationshipUpdateEmpty() {
$result = $this->callAPIFailure('relationship', 'create', array(),
'Mandatory key(s) missing from params array: contact_id_a, contact_id_b, relationship_type_id');
}
/**
* Check relationship update
*/
- function testRelationshipCreateDuplicate() {
+ public function testRelationshipCreateDuplicate() {
$relParams = array(
'contact_id_a' => $this->_cId_a,
'contact_id_b' => $this->_cId_b,
/**
* Check with valid params array.
*/
- function testRelationshipsGet() {
+ public function testRelationshipsGet() {
$relParams = array(
'contact_id_a' => $this->_cId_a,
'contact_id_b' => $this->_cId_b,
* Check with valid params array.
* (The get function will behave differently without 'contact_id' passed
*/
- function testRelationshipsGetGeneric() {
+ public function testRelationshipsGetGeneric() {
$relParams = array(
'contact_id_a' => $this->_cId_a,
'contact_id_b' => $this->_cId_b,
$result = $this->callAPISuccess('relationship', 'get', $params);
}
- function testGetIsCurrent() {
+ public function testGetIsCurrent() {
$rel2Params =array(
'contact_id_a' => $this->_cId_a,
'contact_id_b' => $this->_cId_b2,
/*
* Test using various operators
*/
- function testGetTypeOperators() {
+ public function testGetTypeOperators() {
$relTypeParams = array(
'name_a_b' => 'Relation 3 for delete',
'name_b_a' => 'Relation 6 for delete',
/**
* Check with invalid relationshipType Id
*/
- function testRelationshipTypeAddInvalidId() {
+ public function testRelationshipTypeAddInvalidId() {
$relTypeParams = array(
'id' => 'invalid',
'name_a_b' => 'Relation 1 for delete',
/**
* Check with valid data with contact_b
*/
- function testGetRelationshipWithContactB() {
+ public function testGetRelationshipWithContactB() {
$relParams = array(
'contact_id_a' => $this->_cId_a,
'contact_id_b' => $this->_cId_b,
/**
* Check with valid data with relationshipTypes
*/
- function testGetRelationshipWithRelTypes() {
+ public function testGetRelationshipWithRelTypes() {
$relParams = array(
'contact_id_a' => $this->_cId_a,
'contact_id_b' => $this->_cId_b,
* We should get 1 result without or with correct relationship type id & 0 with
* an incorrect one
*/
- function testGetRelationshipByTypeReciprocal() {
+ public function testGetRelationshipByTypeReciprocal() {
$created = $this->callAPISuccess($this->_entity, 'create', $this->_params);
$result = $this->callAPISuccess($this->_entity, 'get', array(
'contact_id' => $this->_cId_a,
* We should get 1 result without or with correct relationship type id & 0 with
* an incorrect one
*/
- function testGetRelationshipByTypeDAO() {
+ public function testGetRelationshipByTypeDAO() {
$this->ids['relationship'] = $this->callAPISuccess($this->_entity, 'create', array('format.only_id' => TRUE,) + $this->_params);
$result = $this->callAPISuccess($this->_entity, 'getcount', array(
'contact_id_a' => $this->_cId_a,),
* We should get 1 result without or with correct relationship type id & 0 with
* an incorrect one
*/
- function testGetRelationshipByTypeArrayDAO() {
+ public function testGetRelationshipByTypeArrayDAO() {
$created = $this->callAPISuccess($this->_entity, 'create', $this->_params);
$org3 = $this->organizationCreate();
$relType2 = 5; // lets just assume built in ones aren't being messed with!
* We should get 1 result without or with correct relationship type id & 0 with
* an incorrect one
*/
- function testGetRelationshipByTypeArrayReciprocal() {
+ public function testGetRelationshipByTypeArrayReciprocal() {
$created = $this->callAPISuccess($this->_entity, 'create', $this->_params);
$org3 = $this->organizationCreate();
$relType2 = 5; // lets just assume built in ones aren't being messed with!
* We should get 1 result without or with correct relationship type id & 0 with
* an incorrect one
*/
- function testGetRelationshipByMembershipTypeDAO() {
+ public function testGetRelationshipByMembershipTypeDAO() {
$created = $this->callAPISuccess($this->_entity, 'create', $this->_params);
$org3 = $this->organizationCreate();
* We should get 1 result without or with correct relationship type id & 0 with
* an incorrect one
*/
- function testGetRelationshipByMembershipTypeReciprocal() {
+ public function testGetRelationshipByMembershipTypeReciprocal() {
$created = $this->callAPISuccess($this->_entity, 'create', $this->_params);
$org3 = $this->organizationCreate();
/**
* Check for enotices on enable & disable as reported in CRM-14350
*/
- function testSetActive() {
+ public function testSetActive() {
$relationship = $this->callAPISuccess($this->_entity, 'create', $this->_params);
$this->callAPISuccess($this->_entity, 'create', array('id' => $relationship['id'], 'is_active' => 0));
$this->callAPISuccess($this->_entity, 'create', array('id' => $relationship['id'], 'is_active' => 1));
protected $_relTypeID;
protected $_apiversion = 3;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->_cId_a = $this->individualCreate();
$this->_cId_b = $this->organizationCreate();
}
- function tearDown() {
+ public function tearDown() {
$tablesToTruncate = array(
'civicrm_contact',
/**
* Check with no name
*/
- function testRelationshipTypeCreateWithoutName() {
+ public function testRelationshipTypeCreateWithoutName() {
$relTypeParams = array(
'contact_type_a' => 'Individual',
'contact_type_b' => 'Organization',
/**
* Check with no contact type
*/
- function testRelationshipTypeCreateWithoutContactType() {
+ public function testRelationshipTypeCreateWithoutContactType() {
$relTypeParams = array(
'name_a_b' => 'Relation 1 without contact type',
'name_b_a' => 'Relation 2 without contact type',
/**
* Create relationship type
*/
- function testRelationshipTypeCreate() {
+ public function testRelationshipTypeCreate() {
$params = array(
'name_a_b' => 'Relation 1 for relationship type create',
'name_b_a' => 'Relation 2 for relationship type create',
/**
* Test using example code
*/
- function testRelationshipTypeCreateExample() {
+ public function testRelationshipTypeCreateExample() {
require_once 'api/v3/examples/RelationshipType/Create.php';
$result = relationship_type_create_example();
$expectedResult = relationship_type_create_expectedresult();
/**
* Check if required fields are not passed
*/
- function testRelationshipTypeDeleteWithoutRequired() {
+ public function testRelationshipTypeDeleteWithoutRequired() {
$params = array(
'name_b_a' => 'Relation 2 delete without required',
'contact_type_b' => 'Individual',
/**
* Check with incorrect required fields
*/
- function testRelationshipTypeDeleteWithIncorrectData() {
+ public function testRelationshipTypeDeleteWithIncorrectData() {
$params = array(
'id' => 'abcd',
'name_b_a' => 'Relation 2 delete with incorrect',
/**
* Check relationship type delete
*/
- function testRelationshipTypeDelete() {
+ public function testRelationshipTypeDelete() {
$id = $this->_relationshipTypeCreate();
// create sample relationship type.
$params = array(
/**
* Check with empty array
*/
- function testRelationshipTypeUpdateEmpty() {
+ public function testRelationshipTypeUpdateEmpty() {
$params = array();
$result = $this->callAPIFailure('relationship_type', 'create', $params);
$this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: name_a_b, name_b_a, contact_type_a, contact_type_b');
/**
* Check with no contact type
*/
- function testRelationshipTypeUpdateWithoutContactType() {
+ public function testRelationshipTypeUpdateWithoutContactType() {
// create sample relationship type.
$this->_relTypeID = $this->_relationshipTypeCreate();
/**
* Check with all parameters
*/
- function testRelationshipTypeUpdate() {
+ public function testRelationshipTypeUpdate() {
// create sample relationship type.
$this->_relTypeID = $this->_relationshipTypeCreate();
/**
* Check with empty array
*/
- function testRelationshipTypesGetEmptyParams() {
+ public function testRelationshipTypesGetEmptyParams() {
$firstRelTypeParams = array(
'name_a_b' => 'Relation 27 for create',
'name_b_a' => 'Relation 28 for create',
/**
* Check with params Not Array.
*/
- function testRelationshipTypesGetParamsNotArray() {
+ public function testRelationshipTypesGetParamsNotArray() {
$results = $this->callAPIFailure('relationship_type', 'get', 'string');
}
/**
* Check with valid params array.
*/
- function testRelationshipTypesGet() {
+ public function testRelationshipTypesGet() {
$firstRelTypeParams = array(
'name_a_b' => 'Relation 30 for create',
'name_b_a' => 'Relation 31 for create',
/**
* Create relationship type.
*/
- function _relationshipTypeCreate($params = NULL) {
+ public function _relationshipTypeCreate($params = NULL) {
if (!is_array($params) || empty($params)) {
$params = array(
'name_a_b' => 'Relation 1 for create',
class api_v3_ReportTemplateTest extends CiviUnitTestCase {
protected $_apiversion = 3;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
}
/**
*
*/
- function testReportTemplateGetRowsContactSummary() {
+ public function testReportTemplateGetRowsContactSummary() {
$description = "Retrieve rows from a report template (optionally providing the instance_id)";
$result = $this->callAPIAndDocument('report_template', 'getrows', array(
'report_id' => 'contact/summary',
/**
* @dataProvider getReportTemplates
*/
- function testReportTemplateGetRowsAllReports($reportID) {
+ public function testReportTemplateGetRowsAllReports($reportID) {
if(stristr($reportID, 'has existing issues')) {
$this->markTestIncomplete($reportID);
}
/**
* @dataProvider getReportTemplates
*/
- function testReportTemplateGetStatisticsAllReports($reportID) {
+ public function testReportTemplateGetStatisticsAllReports($reportID) {
if(stristr($reportID, 'has existing issues')) {
$this->markTestIncomplete($reportID);
}
protected $_domainID2;
protected $_domainID3;
- function setUp() {
+ public function setUp() {
parent::setUp();
$params = array(
'name' => 'Default Domain Name',
$this->hookClass = CRM_Utils_Hook::singleton();
}
- function tearDown() {
+ public function tearDown() {
CRM_Utils_Hook::singleton()->reset();
parent::tearDown();
$this->callAPISuccess('system','flush', array());
* Set additional settings into metadata (implements hook)
* @param array $metaDataFolders
*/
- function setExtensionMetadata(&$metaDataFolders) {
+ public function setExtensionMetadata(&$metaDataFolders) {
global $civicrm_root;
$metaDataFolders[] = $civicrm_root . '/tests/phpunit/api/v3/settings';
}
/**
* Check getfields works
*/
- function testGetFields() {
+ public function testGetFields() {
$description = 'Demonstrate return from getfields - see subfolder for variants';
$result = $this->callAPIAndDocument('setting', 'getfields', array(), __FUNCTION__, __FILE__, $description);
$this->assertArrayHasKey('customCSSURL', $result['values']);
/**
* Let's check it's loading from cache by meddling with the cache
*/
- function testGetFieldsCaching() {
+ public function testGetFieldsCaching() {
$settingsMetadata = array();
CRM_Core_BAO_Cache::setItem($settingsMetadata,'CiviCRM setting Specs', 'settingsMetadata__');
CRM_Core_BAO_Cache::setItem($settingsMetadata,'CiviCRM setting Spec', 'All');
$this->quickCleanup(array('civicrm_cache'));
}
- function testGetFieldsFilters() {
+ public function testGetFieldsFilters() {
$params = array('name' => 'advanced_search_options');
$result = $this->callAPISuccess('setting', 'getfields', $params);
$this->assertArrayNotHasKey('customCSSURL', $result['values']);
/**
* Test that getfields will filter on group
*/
- function testGetFieldsGroupFilters() {
+ public function testGetFieldsGroupFilters() {
$params = array('filters' => array('group' => 'multisite'));
$result = $this->callAPISuccess('setting', 'getfields', $params);
$this->assertArrayNotHasKey('customCSSURL', $result['values']);
/**
* Test that getfields will filter on another field (prefetch)
*/
- function testGetFieldsPrefetchFilters() {
+ public function testGetFieldsPrefetchFilters() {
$params = array('filters' => array('prefetch' => 1));
$result = $this->callAPISuccess('setting', 'getfields', $params);
$this->assertArrayNotHasKey('disable_mandatory_tokens_check', $result['values']);
* are very similar, but they exercise different codepaths. The first uses the API
* and setItems [plural]; the second uses setItem [singular].
*/
- function testOnChange() {
+ public function testOnChange() {
global $_testOnChange_hookCalls;
$this->setMockSettingsMetaData(array(
'onChangeExample' => array(
* @param $newValue
* @param $metadata
*/
- static function _testOnChange_onChangeExample($oldValue, $newValue, $metadata) {
+ public static function _testOnChange_onChangeExample($oldValue, $newValue, $metadata) {
global $_testOnChange_hookCalls;
$_testOnChange_hookCalls['count']++;
$_testOnChange_hookCalls['oldValue'] = $oldValue;
/**
* Check getfields works
*/
- function testCreateSetting() {
+ public function testCreateSetting() {
$description = "shows setting a variable for a given domain - if no domain is set current is assumed";
$params = array(
/**
* Check getfields works
*/
- function testCreateInvalidSettings() {
+ public function testCreateInvalidSettings() {
$params = array(
'domain_id' => $this->_domainID2,
'invalid_key' => 1,
/**
* Check invalid settings rejected -
*/
- function testCreateInvalidURLSettings() {
+ public function testCreateInvalidURLSettings() {
$params = array(
'domain_id' => $this->_domainID2,
'userFrameworkResourceURL' => 'dfhkdhfd',
/**
* Check getfields works
*/
- function testCreateInvalidBooleanSettings() {
+ public function testCreateInvalidBooleanSettings() {
$params = array(
'domain_id' => $this->_domainID2,
'track_civimail_replies' => 'dfhkdhfd',
/**
* Check getfields works
*/
- function testCreateSettingMultipleDomains() {
+ public function testCreateSettingMultipleDomains() {
$description = "shows setting a variable for all domains";
$params = array(
}
- function testGetSetting() {
+ public function testGetSetting() {
$params = array(
'domain_id' => $this->_domainID2,
'return' => 'uniq_email_per_site',
/**
* Check that setting defined in extension can be retrieved
*/
- function testGetExtensionSetting() {
+ public function testGetExtensionSetting() {
$this->hookClass->setHook('civicrm_alterSettingsFolders', array($this, 'setExtensionMetadata'));
$data = NULL;
// the caching of data to all duplicates the caching of data to the empty string
/**
* Setting api should set & fetch settings stored in config as well as those in settings table
*/
- function testSetConfigSetting() {
+ public function testSetConfigSetting() {
$config = CRM_Core_Config::singleton();
$this->assertFalse($config->debug == 1);
$params = array(
/**
* Setting api should set & fetch settings stored in config as well as those in settings table
*/
- function testGetConfigSetting() {
+ public function testGetConfigSetting() {
$settings = $this->callAPISuccess('setting', 'get', array(
'name' => 'defaultCurrency', 'sequential' => 1,)
);
/**
* Setting api should set & fetch settings stored in config as well as those in settings table
*/
- function testGetSetConfigSettingMultipleDomains() {
+ public function testGetSetConfigSettingMultipleDomains() {
$settings = $this->callAPISuccess('setting', 'create', array(
'defaultCurrency' => 'USD', 'domain_id' => $this->_currentDomain)
);
/**
* Use getValue against a config setting
*/
- function testGetValueConfigSetting() {
+ public function testGetValueConfigSetting() {
$params = array( 'name' => 'monetaryThousandSeparator',
'group' => 'Localization Setting',
);
$this->assertEquals(',', $result);
}
- function testGetValue() {
+ public function testGetValue() {
$params = array( 'name' => 'petition_contacts',
'group' => 'Campaign Preferences'
);
$this->assertEquals('Petition Contacts', $result);
}
- function testGetDefaults() {
+ public function testGetDefaults() {
$description = "gets defaults setting a variable for a given domain - if no domain is set current is assumed";
$params = array(
/**
* Function tests reverting a specific parameter
*/
- function testRevert() {
+ public function testRevert() {
$params = array( 'address_format' => 'xyz',
'mailing_format' => 'bcs',
);
/**
* Tests reverting ALL parameters (specific domain)
*/
- function testRevertAll() {
+ public function testRevertAll() {
$params = array( 'address_format' => 'xyz',
'mailing_format' => 'bcs',
);
/**
* Tests filling missing params
*/
- function testFill() {
+ public function testFill() {
$domparams = array(
'name' => 'B Team Domain',
);
protected $params;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
$phoneBankActivity = $this->callAPISuccess('Option_value', 'Get', array('label' => 'PhoneBank', 'sequential' => 1));
public $DBResetRequired = FALSE;
- function setUp() {
+ public function setUp() {
$phoneBankActivityTypeID = $this->callAPISuccessGetValue('Option_value', array('label' => 'PhoneBank', 'return' => 'value'), 'integer');
$this->useTransaction();
$this->enableCiviCampaign();
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)
*/
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->enableCiviCampaign();
$this->toBeImplemented['get'] = array('Profile', 'CustomValue', 'Constant', 'CustomSearch', 'Extension', 'ReportTemplate', 'System', 'Setting');
$this->deletableTestObjects = array();
}
- function tearDown() {
+ public function tearDown() {
foreach ($this->deletableTestObjects as $entityName => $entities) {
foreach ($entities as $entityID) {
CRM_Core_DAO::deleteTestObjects($entityName, array('id' => $entityID));
* @param string $entityName
*
*/
- function testLimit($entityName) {
+ public function testLimit($entityName) {
$cases = array(); // each case is array(0 => $inputtedApiOptions, 1 => $expectedResultCount)
$cases[] = array(
array('options' => array('limit' => NULL)),
* @param string $entityName
*
*/
- function testSqlOperators($entityName) {
+ public function testSqlOperators($entityName) {
$baoString = _civicrm_api3_get_BAO($entityName);
if (empty($baoString)) {
$this->markTestIncomplete("Entity [$entityName] cannot be mocked - no known DAO");
* @param integer $limit
* @param string $message
*/
- function checkLimitAgainstExpected($entityName, $params, $limit, $message) {
+ public function checkLimitAgainstExpected($entityName, $params, $limit, $message) {
$result = $this->callAPISuccess($entityName, 'get', $params);
if($limit == 30) {
$this->assertGreaterThanOrEqual($limit, $result['count'], $message);
/**
* Test system log function
*/
- function testSystemLog() {
+ public function testSystemLog() {
$this->callAPISuccess('system', 'log', array('level' => 'info', 'message' => 'We wish you a merry Christmas'));
$result = $this->callAPISuccess('SystemLog', 'getsingle', array(
'sequential' => 1,
/**
* Test system log function
*/
- function testSystemLogNoLevel() {
+ public function testSystemLogNoLevel() {
$this->callAPISuccess('system', 'log', array('message' => 'We wish you a merry Christmas', 'level' => 'alert'));
$result = $this->callAPISuccess('SystemLog', 'getsingle', array(
'sequential' => 1,
$this->assertEquals($result['level'], 'alert');
}
- function testSystemGet() {
+ public function testSystemGet() {
$result = $this->callAPISuccess('system', 'get', array());
$this->assertRegExp('/^[0-9]+\.[0-9]+\.[0-9a-z\-]+$/', $result['values'][0]['version']);
$this->assertEquals('UnitTests', $result['values'][0]['uf']);
protected $tagID;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
$this->tag = $this->tagCreate();
/**
* Test civicrm_tag_create with empty params.
*/
- function testCreateEmptyParams() {
+ public function testCreateEmptyParams() {
$result = $this->callAPIFailure('tag', 'create', array(),'Mandatory key(s) missing from params array: name');
}
/**
* Test civicrm_tag_create
*/
- function testCreatePasstagInParams() {
+ public function testCreatePasstagInParams() {
$params = array(
'tag' => 10,
'name' => 'New Tag23',
/**
* Test civicrm_tag_create - success expected.
*/
- function testCreate() {
+ public function testCreate() {
$params = array(
'name' => 'Super Heros',
'description' => 'Outside undie-wearers',
* Test civicrm_tag_create activity tag- success expected. Test checks that used_for is set
* and not over-written by default on update
*/
- function testCreateEntitySpecificTag() {
+ public function testCreateEntitySpecificTag() {
$params = array(
'name' => 'New Tag4',
'description' => 'This is description for New Activity tag',
/**
* Test civicrm_tag_delete without tag id.
*/
- function testDeleteWithoutTagId() {
+ public function testDeleteWithoutTagId() {
$result = $this->callAPIFailure('tag', 'delete', array(), 'Mandatory key(s) missing from params array: id');
}
/**
* Test civicrm_tag_delete .
*/
- function testTagDeleteOldSyntax() {
+ public function testTagDeleteOldSyntax() {
$params = array(
'tag_id' => $this->tagID,
);
/**
* Test civicrm_tag_delete = $params['id'] is correct
*/
- function testTagDeleteCorrectSyntax() {
+ public function testTagDeleteCorrectSyntax() {
$params = array(
'id' => $this->tagID,
);
unset($this->ids['tag']);
}
- function testTagGetfields() {
+ public function testTagGetfields() {
$description = "demonstrate use of getfields to interrogate api";
$params = array('action' => 'create');
$result = $this->callAPIAndDocument('tag', 'getfields', $params, __FUNCTION__, __FILE__, $description, NULL, 'getfields');
$this->assertEquals('civicrm_contact', $result['values']['used_for']['api.default']);
}
- function testTagGetList() {
+ public function testTagGetList() {
$description = "Demonstrates use of api.getlist for autocomplete and quicksearch applications";
$params = array(
'input' => $this->tag['name'],
$this->assertAPISuccess($result);
}
- function tearDown() {
+ public function tearDown() {
$this->quickCleanup(array(
'civicrm_contribution',
'civicrm_contribution_soft',
CRM_Core_PseudoConstant::flush('taxRates');
}
- function setUpContributionPage() {
+ public function setUpContributionPage() {
$contributionPageResult = $this->callAPISuccess($this->_entity, 'create', $this->params);
if (empty($this->_ids['price_set'])) {
$priceSet = $this->callAPISuccess('price_set', 'create', $this->_priceSetParams);
/**
* Online and offline contrbution from above created contrbution page
*/
- function testCreateContributionOnline() {
+ public function testCreateContributionOnline() {
$this->setUpContributionPage();
$params = array(
'contact_id' => $this->_individualId,
$this->_checkFinancialRecords($contribution, 'online');
}
- function testCreateContributionChainedLineItems() {
+ public function testCreateContributionChainedLineItems() {
$this->setUpContributionPage();
$params = array(
'contact_id' => $this->_individualId,
$this->assertEquals(2, $lineItems['count']);
}
- function testCreateContributionPayLaterOnline() {
+ public function testCreateContributionPayLaterOnline() {
$this->setUpContributionPage();
$params = array(
'contact_id' => $this->_individualId,
$this->assertEquals($contribution['values'][$contribution['id']]['contribution_status_id'], 2, 'In line ' . __LINE__);
$this->_checkFinancialRecords($contribution, 'payLater');
}
- function testCreateContributionPendingOnline() {
+ public function testCreateContributionPendingOnline() {
$this->setUpContributionPage();
$params = array(
'contact_id' => $this->_individualId,
* Updation of contrbution
* Function tests that line items, financial records are updated when contribution amount is changed
*/
- function testCreateUpdateContributionChangeTotal() {
+ public function testCreateUpdateContributionChangeTotal() {
$this->setUpContributionPage();
$this->contributionParams = array(
'contact_id' => $this->_individualId,
*
* @return null|string
*/
- function _getFinancialTrxnAmount($contId) {
+ public function _getFinancialTrxnAmount($contId) {
$query = "SELECT
SUM( ft.total_amount ) AS total
FROM civicrm_financial_trxn AS ft
*
* @return null|string
*/
- function _getFinancialItemAmount($contId) {
+ public function _getFinancialItemAmount($contId) {
$lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
$query = "SELECT
SUM(amount)
* @param array $params
* @param $context
*/
- function _checkFinancialRecords($params, $context) {
+ public function _checkFinancialRecords($params, $context) {
$entityParams = array(
'entity_id' => $params['id'],
'entity_table' => 'civicrm_contribution',
* @param array $params
* @param int $financialTypeId
*/
- function _getFinancialAccountId($financialTypeId) {
+ public function _getFinancialAccountId($financialTypeId) {
$accountRel = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Income Account is' "));
$searchParams = array(
}
///////////////// civicrm_contribution_delete methods
- function testDeleteContribution() {
+ public function testDeleteContribution() {
$contributionID = $this->contributionCreate($this->_individualId, $this->financialtypeID, 'dfsdf', 12389);
$params = array(
'id' => $contributionID,
);
}
- function tearDown() {
+ public function tearDown() {
$this->quickCleanup(
array(
'civicrm_group',
$this->callAPIFailure('uf_field', 'create', $params);
}
- function testCreateUFFieldWithWrongParams() {
+ public function testCreateUFFieldWithWrongParams() {
$this->callAPIFailure('uf_field', 'create', array('field_name' => 'test field'));
$this->callAPIFailure('uf_field', 'create', array('label' => 'name-less field'));
}
);
}
- function tearDown() {
+ public function tearDown() {
// Truncate the tables
$this->quickCleanup(
array(
}
}
- function testUFGroupCreate() {
+ public function testUFGroupCreate() {
$result = $this->callAPIAndDocument('uf_group', 'create', $this->params, __FUNCTION__, __FILE__);
$this->assertAPISuccess($result);
}
}
- function testUFGroupCreateWithWrongParams() {
+ public function testUFGroupCreateWithWrongParams() {
$result = $this->callAPIFailure('uf_group', 'create', array('name' => 'A title-less group'));
}
- function testUFGroupUpdate() {
+ public function testUFGroupUpdate() {
$params = array(
'id' => $this->_ufGroupId,
'add_captcha' => 1,
$this->assertEquals($result['values'][$result['id']]['limit_listings_group_id'], $params['group'], 'in line ' . __LINE__);
}
- function testUFGroupGet() {
+ public function testUFGroupGet() {
$result = $this->callAPISuccess('uf_group', 'create', $this->params);
$params = array('id' => $result['id']);
$result = $this->callAPIAndDocument('uf_group', 'get', $params, __FUNCTION__, __FILE__);
}
}
- function testUFGroupUpdateWithEmptyParams() {
+ public function testUFGroupUpdateWithEmptyParams() {
$result = $this->callAPIFailure('uf_group', 'create', array(), $this->_ufGroupId);
}
- function testUFGroupDelete() {
+ public function testUFGroupDelete() {
$ufGroup = $this->callAPISuccess('uf_group', 'create', $this->params);
$params = array('id' => $ufGroup['id']);
$this->assertEquals(1, $this->callAPISuccess('uf_group', 'getcount', $params), "in line " . __LINE__);
);
}
- function tearDown() {
+ public function tearDown() {
// Truncate the tables
$this->quickCleanup(
array(
/**
* Test civicrm_activity_create() using example code
*/
- function testUFJoinCreateExample() {
+ public function testUFJoinCreateExample() {
require_once 'api/v3/examples/UFJoin/Create.php';
$result = UF_join_create_example();
$expectedResult = UF_join_create_expectedresult();
);
}
- function tearDown() {
+ public function tearDown() {
// Truncate the tables
$this->quickCleanup(
array(
$this->assertEquals($result['values'][$result['id']]['contact_id'], 69);
}
- function testGetUFMatchIDWrongParam() {
+ public function testGetUFMatchIDWrongParam() {
$params = 'a string';
$result = $this->callAPIFailure('uf_match', 'get', $params);
}
$this->assertEquals($result['values'][$result['id']]['uf_id'], 42);
}
- function testGetUFIDWrongParam() {
+ public function testGetUFIDWrongParam() {
$params = 'a string';
$result = $this->callAPIFailure('uf_match', 'get', $params);
}
/**
* Test civicrm_activity_create() using example code
*/
- function testUFMatchGetExample() {
+ public function testUFMatchGetExample() {
require_once 'api/v3/examples/UFMatch/Get.php';
$result = UF_match_get_example();
$expectedResult = UF_match_get_expectedresult();
$this->assertEquals($result, $expectedResult);
}
- function testCreate() {
+ public function testCreate() {
$result = $this->callAPISuccess('uf_match', 'create', $this->_params);
$this->getAndCheck($this->_params, $result['id'], 'uf_match');
}
- function testDelete() {
+ public function testDelete() {
$result = $this->callAPISuccess('uf_match', 'create', $this->_params);
$this->assertEquals(1, $this->callAPISuccess('uf_match', 'getcount', array( 'id' => $result['id'],
)));
$this->useTransaction(TRUE);
}
- function testAddFormattedParam() {
+ public function testAddFormattedParam() {
$values = array('contact_type' => 'Individual');
$params = array('something' => 1);
$result = _civicrm_api3_deprecated_add_formatted_param($values, $params);
$this->assertTrue($result);
}
- function testCheckPermissionReturn() {
+ public function testCheckPermissionReturn() {
$check = array('check_permissions' => TRUE);
$config = CRM_Core_Config::singleton();
$config->userPermissionClass->permissions = array();
$this->assertTrue($this->runPermissionCheck('contact', 'create', $check), 'overfluous permissions should be enough');
}
- function testCheckPermissionThrow() {
+ public function testCheckPermissionThrow() {
$check = array('check_permissions' => TRUE);
$config = CRM_Core_Config::singleton();
try {
$this->assertTrue($this->runPermissionCheck('contact', 'create', $check), 'overfluous permissions should return true');
}
- function testCheckPermissionSkip() {
+ public function testCheckPermissionSkip() {
$config = CRM_Core_Config::singleton();
$config->userPermissionClass->permissions = array('access CiviCRM');
$params = array('check_permissions' => TRUE);
* @throws Exception
* @return bool TRUE or FALSE depending on the outcome of the authorization check
*/
- function runPermissionCheck($entity, $action, $params, $throws = FALSE) {
+ public function runPermissionCheck($entity, $action, $params, $throws = FALSE) {
$dispatcher = new \Symfony\Component\EventDispatcher\EventDispatcher();
$dispatcher->addSubscriber(new \Civi\API\Subscriber\PermissionCheck());
$kernel = new \Civi\API\Kernel($dispatcher);
/**
* Test verify mandatory - includes DAO & passed as well as empty & NULL fields
*/
- function testVerifyMandatory() {
+ public function testVerifyMandatory() {
_civicrm_api3_initialize(TRUE);
$params = array(
'entity_table' => 'civicrm_contact',
/**
* Test verify one mandatory - includes DAO & passed as well as empty & NULL fields
*/
- function testVerifyOneMandatory() {
+ public function testVerifyOneMandatory() {
_civicrm_api3_initialize(TRUE);
$params = array(
'entity_table' => 'civicrm_contact',
/**
* Test verify one mandatory - includes DAO & passed as well as empty & NULL fields
*/
- function testVerifyOneMandatoryOneSet() {
+ public function testVerifyOneMandatoryOneSet() {
_civicrm_api3_initialize(TRUE);
$params = array('version' => 3, 'entity_table' => 'civicrm_contact', 'note' => 'note', 'contact_id' => $this->_contactID, 'modified_date' => '2011-01-31', 'subject' => NULL);
/**
* Test GET DAO function returns DAO
*/
- function testGetDAO() {
+ public function testGetDAO() {
$params = array(
'civicrm_api3_custom_group_get' => 'CRM_Core_DAO_CustomGroup',
'custom_group' => 'CRM_Core_DAO_CustomGroup',
/**
* Test GET BAO function returns BAO when it exists
*/
- function testGetBAO() {
+ public function testGetBAO() {
$params = array(
'civicrm_api3_website_get' => 'CRM_Core_BAO_Website',
'civicrm_api3_survey_get' => 'CRM_Campaign_BAO_Survey',
}
}
- function test_civicrm_api3_validate_fields() {
+ public function test_civicrm_api3_validate_fields() {
$params = array('start_date' => '2010-12-20', 'end_date' => '');
$fields = civicrm_api3('relationship', 'getfields', array('action' => 'get'));
_civicrm_api3_validate_fields('relationship', 'get', $params, $fields['values']);
$this->assertEquals('', $params['end_date']);
}
- function test_civicrm_api3_validate_fields_membership() {
+ public function test_civicrm_api3_validate_fields_membership() {
$params = array('start_date' => '2010-12-20', 'end_date' => '', 'membership_end_date' => '0', 'join_date' => '2010-12-20', 'membership_start_date' => '2010-12-20');
$fields = civicrm_api3('Membership', 'getfields', array('action' => 'get'));
_civicrm_api3_validate_fields('Membership', 'get', $params, $fields['values']);
$this->assertEquals('20101220000000', $params['join_date'], 'join_date not set in line ' . __LINE__);
}
- function test_civicrm_api3_validate_fields_event() {
+ public function test_civicrm_api3_validate_fields_event() {
$params = array(
'registration_start_date' => 20080601,
$this->assertEquals('20080601000000', $params['registration_start_date']);
}
- function test_civicrm_api3_validate_fields_exception() {
+ public function test_civicrm_api3_validate_fields_exception() {
$params = array(
'join_date' => 'abc',
);
}
}
- function testGetFields() {
+ public function testGetFields() {
$result = $this->callAPISuccess('membership', 'getfields', array());
$this->assertArrayHasKey('values', $result);
$result = $this->callAPISuccess('relationship', 'getfields', array());
$this->assertArrayHasKey('values', $result);
}
- function testGetFields_AllOptions() {
+ public function testGetFields_AllOptions() {
$result = $this->callAPISuccess('contact', 'getfields', array(
'options' => array(
'get_options' => 'all',
public $DBResetRequired = FALSE;
- function setUp() {
+ public function setUp() {
parent::setUp();
$this->useTransaction();