$dao->query($union);
- $allow = array(0);
- $deny = array(0);
+ $allow = array(0);
+ $deny = array(0);
$override = array();
while ($dao->fetch()) {
* @static
*/
public static function getClause($table, $id, &$tables) {
- $table = CRM_Utils_Type::escape($table, 'String');
- $id = CRM_Utils_Type::escape($id, 'Integer');
+ $table = CRM_Utils_Type::escape($table, 'String');
+ $id = CRM_Utils_Type::escape($id, 'Integer');
$whereTables = array();
$ssTable = CRM_Contact_BAO_SavedSearch::getTableName();
$rule = new CRM_ACL_BAO_ACL();
- $acl = self::getTableName();
+ $acl = self::getTableName();
$contact = CRM_Contact_BAO_Contact::getTableName();
- $c2g = CRM_Contact_BAO_GroupContact::getTableName();
- $group = CRM_Contact_BAO_Group::getTableName();
+ $c2g = CRM_Contact_BAO_GroupContact::getTableName();
+ $group = CRM_Contact_BAO_Group::getTableName();
$query = " SELECT $acl.*
FROM $acl ";
$rule = new CRM_ACL_BAO_ACL();
- $acl = self::getTableName();
- $aclRole = 'civicrm_acl_role';
+ $acl = self::getTableName();
+ $aclRole = 'civicrm_acl_role';
$aclRoleJoin = CRM_ACL_DAO_EntityRole::getTableName();
- $contact = CRM_Contact_BAO_Contact::getTableName();
- $c2g = CRM_Contact_BAO_GroupContact::getTableName();
- $group = CRM_Contact_BAO_Group::getTableName();
+ $contact = CRM_Contact_BAO_Contact::getTableName();
+ $c2g = CRM_Contact_BAO_GroupContact::getTableName();
+ $group = CRM_Contact_BAO_Group::getTableName();
$query = " SELECT $acl.*
FROM $acl
$rule = new CRM_ACL_BAO_ACL();
- $acl = self::getTableName();
- $c2g = CRM_Contact_BAO_GroupContact::getTableName();
- $group = CRM_Contact_BAO_Group::getTableName();
+ $acl = self::getTableName();
+ $c2g = CRM_Contact_BAO_GroupContact::getTableName();
+ $group = CRM_Contact_BAO_Group::getTableName();
$results = array();
if ($contact_id) {
$aclRole = 'civicrm_acl_role';
$aclER = CRM_ACL_DAO_EntityRole::getTableName();
- $c2g = CRM_Contact_BAO_GroupContact::getTableName();
+ $c2g = CRM_Contact_BAO_GroupContact::getTableName();
$group = CRM_Contact_BAO_Group::getTableName();
$query = " SELECT $acl.*
WHERE g.id IN ( $ids )
AND g.is_active = 1
";
- $dao = CRM_Core_DAO::executeQuery($query);
+ $dao = CRM_Core_DAO::executeQuery($query);
$staticGroupIDs = array();
$cachedGroupIDs = array();
while ($dao->fetch()) {
$tmpTables = array();
foreach (unserialize($dao->where_tables) as $tmpName => $tmpInfo) {
if ($tmpName == '`civicrm_group_contact-' . $dao->id . '`') {
- $tmpName = '`civicrm_group_contact-ACL`';
- $tmpInfo = str_replace('civicrm_group_contact-' . $dao->id, 'civicrm_group_contact-ACL', $tmpInfo);
+ $tmpName = '`civicrm_group_contact-ACL`';
+ $tmpInfo = str_replace('civicrm_group_contact-' . $dao->id, 'civicrm_group_contact-ACL', $tmpInfo);
$staticGroupIDs[] = $dao->id;
}
elseif ($tmpName == '`civicrm_group_contact_cache_' . $dao->id . '`') {
- $tmpName = '`civicrm_group_contact_cache-ACL`';
- $tmpInfo = str_replace('civicrm_group_contact_cache_' . $dao->id, 'civicrm_group_contact_cache-ACL', $tmpInfo);
+ $tmpName = '`civicrm_group_contact_cache-ACL`';
+ $tmpInfo = str_replace('civicrm_group_contact_cache_' . $dao->id, 'civicrm_group_contact_cache-ACL', $tmpInfo);
$cachedGroupIDs[] = $dao->id;
}
$tmpTables[$tmpName] = $tmpInfo;
}
if (($dao->saved_search_id || $dao->children || $dao->parents) &&
- $dao->cache_date == NULL) {
+ $dao->cache_date == NULL
+ ) {
CRM_Contact_BAO_GroupContactCache::load($dao);
}
}
// CRM_Core_DAO::singleValueQuery("TRUNCATE TABLE civicrm_acl_contact_cache"); // No, force-commits transaction
// CRM_Core_DAO::singleValueQuery("DELETE FROM civicrm_acl_contact_cache"); // Transaction-safe
if (CRM_Core_Transaction::isActive()) {
- CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_COMMIT, function() {
+ CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_COMMIT, function () {
CRM_Core_DAO::singleValueQuery("TRUNCATE TABLE civicrm_acl_contact_cache");
});
}
$label = ts('Role');
$role = array(
- '-1' => ts('- select role -'),
- '0' => ts('Everyone'),
- ) + CRM_Core_OptionGroup::values('acl_role');
+ '-1' => ts('- select role -'),
+ '0' => ts('Everyone'),
+ ) + CRM_Core_OptionGroup::values('acl_role');
$this->add('select', 'entity_id', $label, $role, TRUE);
$group = array(
- '-1' => ts('- select -'),
- '0' => ts('All Groups'),
- ) + CRM_Core_PseudoConstant::group();
+ '-1' => ts('- select -'),
+ '0' => ts('All Groups'),
+ ) + CRM_Core_PseudoConstant::group();
$customGroup = array(
- '-1' => ts('- select -'),
- '0' => ts('All Custom Groups'),
- ) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id');
+ '-1' => ts('- select -'),
+ '0' => ts('All Custom Groups'),
+ ) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id');
$ufGroup = array(
- '-1' => ts('- select -'),
- '0' => ts('All Profiles'),
- ) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
+ '-1' => ts('- select -'),
+ '0' => ts('All Profiles'),
+ ) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
$event = array(
- '-1' => ts('- select -'),
- '0' => ts('All Events'),
- ) + CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
+ '-1' => ts('- select -'),
+ '0' => ts('All Events'),
+ ) + CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
$this->add('select', 'group_id', ts('Group'), $group);
$this->add('select', 'custom_group_id', ts('Custom Data'), $customGroup);
$label = ts('Role');
$role = array(
- '-1' => ts('- select role -'),
- '0' => ts('Everyone'),
- ) + CRM_Core_OptionGroup::values('acl_role');
+ '-1' => ts('- select role -'),
+ '0' => ts('Everyone'),
+ ) + CRM_Core_OptionGroup::values('acl_role');
$entityID = &$this->add('select', 'entity_id', $label, $role, TRUE);
if ($this->_id) {
$this->addButtons(
array(
array(
- 'type' => 'next',
- 'name' => ts('Save'),
- 'spacing' => '',
- 'isDefault' => FALSE ),
+ 'type' => 'next',
+ 'name' => ts('Save'),
+ 'spacing' => '',
+ 'isDefault' => FALSE
+ ),
)
);
}
if (!empty($warningPermissionNames)) {
CRM_Core_Session::setStatus(
- ts('The %1 role was assigned one or more permissions that may prove dangerous for users of that role to have. Please reconsider assigning %2 to them.', array(1 => $wp_roles->role_names[$role], 2 => implode(', ', $warningPermissionNames))),
+ ts('The %1 role was assigned one or more permissions that may prove dangerous for users of that role to have. Please reconsider assigning %2 to them.', array(
+ 1 => $wp_roles->role_names[$role],
+ 2 => implode(', ', $warningPermissionNames)
+ )),
ts('Unsafe Permission Settings')
);
}
);
// set breadcrumb to append to admin/access
- $breadCrumb = array(array(
- 'title' => ts('Access Control'),
+ $breadCrumb = array(
+ array(
+ 'title' => ts('Access Control'),
'url' => CRM_Utils_System::url('civicrm/admin/access',
'reset=1'
),
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadCrumb);
// what action to take ?
if ($action & (CRM_Core_Action::ADD | CRM_Core_Action::DELETE)) {
$roles = CRM_Core_OptionGroup::values('acl_role');
$group = array(
- '-1' => ts('- select -'),
- '0' => ts('All Groups'),
- ) + CRM_Core_PseudoConstant::group();
+ '-1' => ts('- select -'),
+ '0' => ts('All Groups'),
+ ) + CRM_Core_PseudoConstant::group();
$customGroup = array(
- '-1' => ts('- select -'),
- '0' => ts('All Custom Groups'),
- ) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id');
+ '-1' => ts('- select -'),
+ '0' => ts('All Custom Groups'),
+ ) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id');
$ufGroup = array(
- '-1' => ts('- select -'),
- '0' => ts('All Profiles'),
- ) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
+ '-1' => ts('- select -'),
+ '0' => ts('All Profiles'),
+ ) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
$event = array(
- '-1' => ts('- select -'),
- '0' => ts('All Events'),
- ) + CRM_Event_PseudoConstant::event();
+ '-1' => ts('- select -'),
+ '0' => ts('All Events'),
+ ) + CRM_Event_PseudoConstant::event();
while ($dao->fetch()) {
$acl[$dao->id] = array();
);
// set breadcrumb to append to admin/access
- $breadCrumb = array(array(
- 'title' => ts('Access Control'),
+ $breadCrumb = array(
+ array(
+ 'title' => ts('Access Control'),
'url' => CRM_Utils_System::url('civicrm/admin/access', 'reset=1'),
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadCrumb);
// what action to take ?
);
// set breadcrumb to append to admin/access
- $breadCrumb = array(array(
- 'title' => ts('Access Control'),
+ $breadCrumb = array(
+ array(
+ 'title' => ts('Access Control'),
'url' => CRM_Utils_System::url('civicrm/admin/access',
'reset=1'
),
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadCrumb);
CRM_Utils_System::setTitle(ts('Assign Users to Roles'));
*/
public static function getNames($activityID, $recordTypeID, $alsoIDs = FALSE) {
$names = array();
- $ids = array();
+ $ids = array();
if (empty($activityID)) {
return $alsoIDs ? array($names, $ids) : $names;
public static function retrieveContactIdsByActivityId($activityID, $recordTypeID) {
$activityContact = array();
if (!CRM_Utils_Rule::positiveInteger($activityID) ||
- !CRM_Utils_Rule::positiveInteger($recordTypeID)) {
+ !CRM_Utils_Rule::positiveInteger($recordTypeID)
+ ) {
return $activityContact;
}
'fileName' => $icsFileName,
'cleanName' => $icsFileName,
'fullPath' => $this->icsfile,
- );
+ );
return 'activity_ics';
}
}
$types = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
//get the component activity types.
$compActTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE, TRUE);
- $activityTypeIds = self::buildWhereAndQill($query, $value, $types, $op, $grouping, array('Activity Type', 'civicrm_activity.activity_type_id'));
+ $activityTypeIds = self::buildWhereAndQill($query, $value, $types, $op, $grouping, array(
+ 'Activity Type',
+ 'civicrm_activity.activity_type_id'
+ ));
foreach ($activityTypeIds as $activityTypeId) {
if (array_key_exists($activityTypeId, $compActTypes)) {
case 'activity_status':
$status = CRM_Core_PseudoConstant::activityStatus();
- $activityTypeIds = self::buildWhereAndQill($query, $value, $status, $op, $grouping, array('Activity Status', 'civicrm_activity.status_id'));
+ $activityTypeIds = self::buildWhereAndQill($query, $value, $status, $op, $grouping, array(
+ 'Activity Status',
+ 'civicrm_activity.status_id'
+ ));
break;
case 'activity_subject':
case 'activity_test':
// We dont want to include all tests for sql OR CRM-7827
if (!$value || $query->getOperator() != 'OR') {
- $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_activity.is_test", $op, $value, "Boolean");
+ $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_activity.is_test", $op, $value, "Boolean");
if ($value) {
$query->_qill[$grouping][] = ts('Activity is a Test');
}
case 'activity_result':
if (is_array($value)) {
$safe = NULL;
- while (list(,$k) = each($value)) {
+ while (list(, $k) = each($value)) {
$safe[] = "'" . CRM_Utils_Type::escape($k, 'String') . "'";
}
$query->_where[$grouping][] = "civicrm_activity.result IN (" . implode(',', $safe) . ")";
}
elseif ($value == 2) {
$query->_where[$grouping][] = "civicrm_activity.parent_id IS NULL";
- $query->_qill[$grouping][] = ts('Activities which are not Followup Activities');
+ $query->_qill[$grouping][] = ts('Activities which are not Followup Activities');
}
break;
}
$form->addSelect('activity_engagement_level', array('entity' => 'activity', 'context' => 'search'));
// Add survey result field.
- $optionGroups = CRM_Campaign_BAO_Survey::getResultSets('name');
+ $optionGroups = CRM_Campaign_BAO_Survey::getResultSets('name');
$resultOptions = array();
foreach ($optionGroups as $gid => $name) {
if ($name) {
$value = array();
$value = CRM_Core_OptionGroup::values($name);
if (!empty($value)) {
- while (list($k,$v) = each($value)) {
+ while (list($k, $v) = each($value)) {
$resultOptions[$v] = $v;
}
}
'assignee_contact_id' => array(
'type' => 'entityRef',
'label' => ts('Assigned to'),
- 'attributes' => array('multiple' => TRUE, 'create' => TRUE, 'api' => array('params' => array('is_deceased' => 0))),
+ 'attributes' => array(
+ 'multiple' => TRUE,
+ 'create' => TRUE,
+ 'api' => array('params' => array('is_deceased' => 0))
+ ),
),
'followup_assignee_contact_id' => array(
'type' => 'entityRef',
'label' => ts('Assigned to'),
- 'attributes' => array('multiple' => TRUE, 'create' => TRUE, 'api' => array('params' => array('is_deceased' => 0))),
+ 'attributes' => array(
+ 'multiple' => TRUE,
+ 'create' => TRUE,
+ 'api' => array('params' => array('is_deceased' => 0))
+ ),
),
'followup_activity_type_id' => array(
'type' => 'select',
$urlString = 'civicrm/contact/search/advanced';
}
elseif ($path == 'civicrm/group/search'
- || $path == 'civicrm/contact/search'
+ || $path == 'civicrm/contact/search'
|| $path == 'civicrm/contact/search/advanced'
|| $path == 'civicrm/contact/search/custom'
- || $path == 'civicrm/group/search') {
+ || $path == 'civicrm/group/search'
+ ) {
$urlString = $path;
}
else {
//enable form element (ActivityLinks sets this true)
$this->assign('suppressForm', FALSE);
- $element = & $this->add('select', 'activity_type_id', ts('Activity Type'),
+ $element = &$this->add('select', 'activity_type_id', ts('Activity Type'),
$this->_fields['followup_activity_type_id']['attributes'],
FALSE, array(
'onchange' => "CRM.buildCustomData( 'Activity', this.value );",
unset($params['id']);
$linkedEntities = array(
array(
- 'table' => 'civicrm_activity_contact',
- 'findCriteria' => array(
+ 'table' => 'civicrm_activity_contact',
+ 'findCriteria' => array(
'activity_id' => $this->_activityId,
),
'linkedColumns' => array('activity_id'),
$mailStatus = '';
if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
- 'activity_assignee_notification')) {
+ 'activity_assignee_notification')
+ ) {
$activityIDs = array($activity->id);
if ($followupActivity) {
$activityIDs = array_merge($activityIDs, array($followupActivity->id));
public function preProcess() {
//get the activity values
$activityId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
- $context = CRM_Utils_Request::retrieve('context', 'String', $this);
- $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
+ $context = CRM_Utils_Request::retrieve('context', 'String', $this);
+ $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
//check for required permissions, CRM-6264
if ($activityId &&
$session = CRM_Core_Session::singleton();
if (!in_array($context, array(
- 'home', 'dashlet', 'dashletFullscreen'))) {
+ 'home',
+ 'dashlet',
+ 'dashletFullscreen'
+ ))
+ ) {
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=activity");
}
else {
// we allow the controller to set force/reset externally, useful when we are being
// driven by the wizard framework
- $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
- $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
+ $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
+ $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
+ $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'search');
$this->assign("context", $this->_context);
}
else {
$session->replaceUserContext(CRM_Utils_System::url("civicrm/contact/search/$searchFormName",
- $urlParams
- ));
+ $urlParams
+ ));
}
}
$status = array(ts('%count activities tagged', array('count' => $added, 'plural' => '%count activities tagged')));
if ($notAdded) {
- $status[] = ts('%count activities already had this tag', array('count' => $notAdded, 'plural' => '%count activities already had this tag'));
+ $status[] = ts('%count activities already had this tag', array(
+ 'count' => $notAdded,
+ 'plural' => '%count activities already had this tag'
+ ));
}
$status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
CRM_Core_Session::setStatus($status, ts("Added Tag <em>%1</em>", array(1 => $this->_tags[$key])), 'success', array('expires' => 0));
*/
public function postProcess() {
- $formparams = $this->exportValues();
- $caseId = $formparams['unclosed_case_id'];
+ $formparams = $this->exportValues();
+ $caseId = $formparams['unclosed_case_id'];
$filedActivities = 0;
foreach ($this->_activityHolderIds as $key => $id) {
$targetContactValues = $defaults = array();
}
else {
CRM_Core_Session::setStatus(ts('Not permitted to file activity %1 %2.', array(
- 1 => empty($defaults['subject']) ? '' : $defaults['subject'],
- 2 => $defaults['activity_date_time'])),
+ 1 => empty($defaults['subject']) ? '' : $defaults['subject'],
+ 2 => $defaults['activity_date_time']
+ )),
ts("Error"), "error");
}
}
$validate = FALSE;
//validations
if (count($this->_activityHolderIds) > $this->_maxActivities) {
- CRM_Core_Session::setStatus(ts("The maximum number of Activities you can select to send an email is %1. You have selected %2. Please select fewer Activities from your search results and try again.", array(1 => $this->_maxActivities, 2 => count($this->_activityHolderIds))), ts("Maximum Exceeded"), "error");
+ CRM_Core_Session::setStatus(ts("The maximum number of Activities you can select to send an email is %1. You have selected %2. Please select fewer Activities from your search results and try again.", array(
+ 1 => $this->_maxActivities,
+ 2 => count($this->_activityHolderIds)
+ )), ts("Maximum Exceeded"), "error");
$validate = TRUE;
}
// then redirect
$validate = FALSE;
//validations
if (count($this->_activityHolderIds) > $this->_maxActivities) {
- CRM_Core_Session::setStatus(ts("The maximum number of Activities you can select for Batch Update is %1. You have selected %2. Please select fewer Activities from your search results and try again.", array(1 => $this->_maxActivities, 2 => count($this->_activityHolderIds))), ts('Maximum Exceeded'), 'error');
+ CRM_Core_Session::setStatus(ts("The maximum number of Activities you can select for Batch Update is %1. You have selected %2. Please select fewer Activities from your search results and try again.", array(
+ 1 => $this->_maxActivities,
+ 2 => count($this->_activityHolderIds)
+ )), ts('Maximum Exceeded'), 'error');
$validate = TRUE;
}
$ufGroupElement = $this->add('select', 'uf_group_id', ts('Select Profile'),
array(
- '' => ts('- select profile -')) + $profiles, TRUE
+ '' => ts('- select profile -')
+ ) + $profiles, TRUE
);
$this->addDefaultButtons(ts('Continue'));
}
list($total, $removed, $notRemoved) = CRM_Core_BAO_EntityTag::removeEntitiesFromTag($this->_activityHolderIds, $key, 'civicrm_activity');
- $status = array(ts('%count activities un-tagged', array('count' => $removed, 'plural' => '%count activities un-tagged')));
+ $status = array(
+ ts('%count activities un-tagged', array(
+ 'count' => $removed,
+ 'plural' => '%count activities un-tagged'
+ ))
+ );
if ($notRemoved) {
- $status[] = ts('1 activity already did not have this tag', array('count' => $notRemoved, 'plural' => '%count activities already did not have this tag'));
+ $status[] = ts('1 activity already did not have this tag', array(
+ 'count' => $notRemoved,
+ 'plural' => '%count activities already did not have this tag'
+ ));
}
$status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
CRM_Core_Session::setStatus($status, ts("Removed Tag <em>%1</em>", array(1 => $this->_tags[$key])), 'success', array('expires' => 0));
$this->assign('uploadSize', $uploadSize);
$this->setMaxFileSize($uploadFileSize);
$this->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
- $this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize);
+ $this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(
+ 1 => $uploadSize,
+ 2 => $uploadFileSize
+ )), 'maxfilesize', $uploadFileSize);
$this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
$this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
//get the saved mapping details
$mappingArray = CRM_Core_BAO_Mapping::getMappings(CRM_Core_OptionGroup::getValue('mapping_type',
- 'Import Activity',
- 'name'
- ));
+ 'Import Activity',
+ 'name'
+ ));
$this->assign('savedMapping', $mappingArray);
$this->add('select', 'savedMapping', ts('Mapping Option'), array('' => ts('- select -')) + $mappingArray);
$this->setDefaults(array(
'onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP,
- ));
+ ));
//build date formats
CRM_Core_Form_Date::buildAllowedDateFormats($this);
public function postProcess() {
$this->controller->resetPage('MapField');
- $fileName = $this->controller->exportValue($this->_name, 'uploadFile');
+ $fileName = $this->controller->exportValue($this->_name, 'uploadFile');
$skipColumnHeader = $this->controller->exportValue($this->_name, 'skipColumnHeader');
- $onDuplicate = $this->controller->exportValue($this->_name, 'onDuplicate');
- $dateFormats = $this->controller->exportValue($this->_name, 'dateFormats');
- $savedMapping = $this->controller->exportValue($this->_name, 'savedMapping');
+ $onDuplicate = $this->controller->exportValue($this->_name, 'onDuplicate');
+ $dateFormats = $this->controller->exportValue($this->_name, 'dateFormats');
+ $savedMapping = $this->controller->exportValue($this->_name, 'savedMapping');
$this->set('onDuplicate', $onDuplicate);
$this->set('dateFormats', $dateFormats);
class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField {
-
-
/**
* Set variables up before form is built
*
$this->assign('rowDisplayCount', 2);
}
$highlightedFields = array();
- $requiredFields = array('activity_date_time', 'activity_type_id', 'activity_label', 'target_contact_id', 'activity_subject');
+ $requiredFields = array(
+ 'activity_date_time',
+ 'activity_type_id',
+ 'activity_label',
+ 'target_contact_id',
+ 'activity_subject'
+ );
foreach ($requiredFields as $val) {
$highlightedFields[] = $val;
}
list($mappingName, $mappingContactType, $mappingLocation, $mappingPhoneType, $mappingRelation) = CRM_Core_BAO_Mapping::getMappingFields($savedMapping);
//get loaded Mapping Fields
- $mappingName = CRM_Utils_Array::value('1', $mappingName);
+ $mappingName = CRM_Utils_Array::value('1', $mappingName);
$mappingContactType = CRM_Utils_Array::value('1', $mappingContactType);
- $mappingLocation = CRM_Utils_Array::value('1', $mappingLocation);
- $mappingPhoneType = CRM_Utils_Array::value('1', $mappingPhoneType);
- $mappingRelation = CRM_Utils_Array::value('1', $mappingRelation);
+ $mappingLocation = CRM_Utils_Array::value('1', $mappingLocation);
+ $mappingPhoneType = CRM_Utils_Array::value('1', $mappingPhoneType);
+ $mappingRelation = CRM_Utils_Array::value('1', $mappingRelation);
$this->assign('loadedMapping', $savedMapping);
$this->set('loadedMapping', $savedMapping);
- $params = array('id' => $savedMapping);
- $temp = array();
+ $params = array('id' => $savedMapping);
+ $temp = array();
$mappingDetails = CRM_Core_BAO_Mapping::retrieve($params, $temp);
$this->assign('savedName', $mappingDetails->name);
$defaults = array();
$mapperKeys = array_keys($this->_mapperFields);
- $hasHeaders = !empty($this->_columnHeaders);
- $headerPatterns = $this->get('headerPatterns');
- $dataPatterns = $this->get('dataPatterns');
+ $hasHeaders = !empty($this->_columnHeaders);
+ $headerPatterns = $this->get('headerPatterns');
+ $dataPatterns = $this->get('dataPatterns');
$hasLocationTypes = $this->get('fieldTypes');
/* Initialize all field usages to false */
$defaults["mapper[$i]"] = array(
$this->defaultFromHeader($this->_columnHeaders[$i],
$headerPatterns
- ));
+ )
+ );
}
else {
$defaults["mapper[$i]"] = array($this->defaultFromData($dataPatterns, $i));
);
$params = array(
- 'used' => 'Unsupervised',
+ 'used' => 'Unsupervised',
'contact_type' => 'Individual',
);
list($ruleFields, $threshold) = CRM_Dedupe_BAO_RuleGroup::dedupeRuleFieldsWeight($params);
}
else {
$errors['_qf_default'] .= ts('Missing required field: Provide %1 or %2',
- array(
- 1 => $title,
- 2 => 'Activity Type Label',
- )) . '<br />';
+ array(
+ 1 => $title,
+ 2 => 'Activity Type Label',
+ )) . '<br />';
}
}
else {
$config = CRM_Core_Config::singleton();
$seperator = $config->fieldSeparator;
- $mapperKeys = array();
- $mapper = array();
- $mapperKeys = $this->controller->exportValue($this->_name, 'mapper');
- $mapperKeysMain = array();
- $mapperLocType = array();
+ $mapperKeys = array();
+ $mapper = array();
+ $mapperKeys = $this->controller->exportValue($this->_name, 'mapper');
+ $mapperKeysMain = array();
+ $mapperLocType = array();
$mapperPhoneType = array();
for ($i = 0; $i < $this->_columnCount; $i++) {
$skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
//get the data from the session
- $dataValues = $this->get('dataValues');
- $mapper = $this->get('mapper');
- $invalidRowCount = $this->get('invalidRowCount');
+ $dataValues = $this->get('dataValues');
+ $mapper = $this->get('mapper');
+ $invalidRowCount = $this->get('invalidRowCount');
$conflictRowCount = $this->get('conflictRowCount');
- $mismatchCount = $this->get('unMatchCount');
+ $mismatchCount = $this->get('unMatchCount');
//get the mapping name displayed if the mappingId is set
$mappingId = $this->get('loadMappingId');
$properties = array(
'mapper',
- 'dataValues', 'columnCount',
- 'totalRowCount', 'validRowCount',
- 'invalidRowCount', 'conflictRowCount',
+ 'dataValues',
+ 'columnCount',
+ 'totalRowCount',
+ 'validRowCount',
+ 'invalidRowCount',
+ 'conflictRowCount',
'downloadErrorRecordsUrl',
'downloadConflictRecordsUrl',
'downloadMismatchRecordsUrl',
* @return void
*/
public function postProcess() {
- $fileName = $this->controller->exportValue('DataSource', 'uploadFile');
+ $fileName = $this->controller->exportValue('DataSource', 'uploadFile');
$skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
- $invalidRowCount = $this->get('invalidRowCount');
+ $invalidRowCount = $this->get('invalidRowCount');
$conflictRowCount = $this->get('conflictRowCount');
- $onDuplicate = $this->get('onDuplicate');
+ $onDuplicate = $this->get('onDuplicate');
$config = CRM_Core_Config::singleton();
$seperator = $config->fieldSeparator;
}
$this->assign('dupeActionString', $dupeActionString);
- $properties = array('totalRowCount', 'validRowCount', 'invalidRowCount', 'conflictRowCount', 'downloadConflictRecordsUrl', 'downloadErrorRecordsUrl', 'duplicateRowCount', 'downloadDuplicateRecordsUrl', 'downloadMismatchRecordsUrl', 'groupAdditions', 'unMatchCount');
+ $properties = array(
+ 'totalRowCount',
+ 'validRowCount',
+ 'invalidRowCount',
+ 'conflictRowCount',
+ 'downloadConflictRecordsUrl',
+ 'downloadErrorRecordsUrl',
+ 'duplicateRowCount',
+ 'downloadDuplicateRecordsUrl',
+ 'downloadMismatchRecordsUrl',
+ 'groupAdditions',
+ 'unMatchCount'
+ );
foreach ($properties as $property) {
$this->assign($property, $this->get($property));
}
* $Id$
*
*/
-
-
abstract class CRM_Activity_Import_Parser extends CRM_Import_Parser {
protected $_fileName;
}
if ($this->_invalidRowCount) {
// removed view url for invlaid contacts
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('Reason'),
),
$customHeaders
self::exportCSV($this->_errorFileName, $headers, $this->_errors);
}
if ($this->_conflictCount) {
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('Reason'),
),
$customHeaders
self::exportCSV($this->_conflictFileName, $headers, $this->_conflicts);
}
if ($this->_duplicateCount) {
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('View Activity History URL'),
),
$customHeaders
*/
public function summary(&$values) {
$erroneousField = NULL;
- $response = $this->setActiveFieldValues($values, $erroneousField);
- $index = -1;
- $errorRequired = FALSE;
+ $response = $this->setActiveFieldValues($values, $erroneousField);
+ $index = -1;
+ $errorRequired = FALSE;
if ($this->_activityTypeIndex > -1 && $this->_activityLabelIndex > -1) {
array_unshift($values, ts('Please select either Activity Type ID OR Activity Type Label.'));
// Using new Dedupe rule.
$ruleParams = array(
'contact_type' => 'Individual',
- 'used' => 'Unsupervised',
+ 'used' => 'Unsupervised',
);
$fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
*/
class CRM_Activity_Page_AJAX {
public static function getCaseActivity() {
- $caseID = CRM_Utils_Type::escape($_GET['caseID'], 'Integer');
+ $caseID = CRM_Utils_Type::escape($_GET['caseID'], 'Integer');
$contactID = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
- $userID = CRM_Utils_Type::escape($_GET['userID'], 'Integer');
- $context = CRM_Utils_Type::escape(CRM_Utils_Array::value('context', $_GET), 'String');
+ $userID = CRM_Utils_Type::escape($_GET['userID'], 'Integer');
+ $context = CRM_Utils_Type::escape(CRM_Utils_Array::value('context', $_GET), 'String');
$sortMapper = array(
0 => 'display_date',
- 1 => 'ca.subject',
- 2 => 'ca.activity_type_id',
+ 1 => 'ca.subject',
+ 2 => 'ca.activity_type_id',
3 => 'acc.sort_name',
- 4 => 'cc.sort_name',
- 5 => 'ca.status_id',
+ 4 => 'cc.sort_name',
+ 5 => 'ca.status_id',
);
- $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
- $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
- $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
- $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
+ $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
+ $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
+ $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
+ $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
$params = $_POST;
$activities = CRM_Case_BAO_Case::getCaseActivity($caseID, $params, $contactID, $context, $userID);
$iFilteredTotal = $iTotal = $params['total'];
- $selectorElements = array('display_date', 'subject', 'type', 'with_contacts', 'reporter', 'status', 'links', 'class');
+ $selectorElements = array(
+ 'display_date',
+ 'subject',
+ 'type',
+ 'with_contacts',
+ 'reporter',
+ 'status',
+ 'links',
+ 'class'
+ );
echo CRM_Utils_JSON::encodeDataTableSelector($activities, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
public static function getCaseGlobalRelationships() {
$sortMapper = array(
0 => 'sort_name',
- 1 => 'phone',
- 2 => 'email',
+ 1 => 'phone',
+ 2 => 'email',
);
- $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
- $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
- $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
- $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
+ $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
+ $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
+ $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
+ $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
$params = $_POST;
}
public static function getCaseClientRelationships() {
- $caseID = CRM_Utils_Type::escape($_GET['caseID'], 'Integer');
+ $caseID = CRM_Utils_Type::escape($_GET['caseID'], 'Integer');
$contactID = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
$sortMapper = array(
0 => 'relation',
- 1 => 'name',
- 2 => 'phone',
- 3 => 'email',
+ 1 => 'name',
+ 2 => 'phone',
+ 3 => 'email',
);
- $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
- $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
- $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
- $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : 'relation';
+ $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
+ $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
+ $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
+ $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : 'relation';
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
$params = $_POST;
// sort clientRelationships array using jquery call params
foreach ($clientRelationships as $key => $row) {
- $sortArray[$key] = $row[$sort];
+ $sortArray[$key] = $row[$sort];
}
$sort_type = "SORT_" . strtoupper($sortOrder);
array_multisort($sortArray, constant($sort_type), $clientRelationships);
// after sort we can update username fields to be a url
foreach ($clientRelationships as $key => $value) {
$clientRelationships[$key]['name'] = '<a href=' . CRM_Utils_System::url('civicrm/contact/view',
- 'action=view&reset=1&cid=' . $clientRelationships[$key]['cid']) . '>' . $clientRelationships[$key]['name'] . '</a>';
+ 'action=view&reset=1&cid=' . $clientRelationships[$key]['cid']) . '>' . $clientRelationships[$key]['name'] . '</a>';
}
$iFilteredTotal = $iTotal = $params['total'] = count($allClientRelationships);
public static function getCaseRoles() {
- $caseID = CRM_Utils_Type::escape($_GET['caseID'], 'Integer');
+ $caseID = CRM_Utils_Type::escape($_GET['caseID'], 'Integer');
$contactID = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
$sortMapper = array(
0 => 'relation',
- 1 => 'name',
- 2 => 'phone',
- 3 => 'email',
- 4 => 'actions',
+ 1 => 'name',
+ 2 => 'phone',
+ 3 => 'email',
+ 4 => 'actions',
);
- $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
- $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
- $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
- $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : 'relation';
+ $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
+ $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
+ $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
+ $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : 'relation';
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
$params = $_POST;
$caseRelationships = CRM_Case_BAO_Case::getCaseRoles($contactID, $caseID);
$caseTypeName = CRM_Case_BAO_Case::getCaseType($caseID, 'name');
$xmlProcessor = new CRM_Case_XMLProcessor_Process();
- $caseRoles = $xmlProcessor->get($caseTypeName, 'CaseRoles');
+ $caseRoles = $xmlProcessor->get($caseTypeName, 'CaseRoles');
$hasAccessToAllCases = CRM_Core_Permission::check('access all cases and activities');
// sort clientRelationships array using jquery call params
foreach ($caseRelationships as $key => $row) {
- $sortArray[$key] = $row[$sort];
+ $sortArray[$key] = $row[$sort];
}
$sort_type = "SORT_" . strtoupper($sortOrder);
// view user links
if (!empty($row['cid'])) {
$row['name'] = '<a class="view-contact" title="' . ts('View Contact') . '" href=' . CRM_Utils_System::url('civicrm/contact/view',
- 'action=view&reset=1&cid=' . $row['cid']) . '>' . $row['name'] . '</a>';
+ 'action=view&reset=1&cid=' . $row['cid']) . '>' . $row['name'] . '</a>';
}
// email column links/icon
if ($row['email']) {
switch ($row['source']) {
case 'caseRel':
$row['actions'] =
- '<a href="#editCaseRoleDialog" title="' . ts('Reassign %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '" data-rel_id="' . $row['rel_id'] . '"data-key="' . CRM_Core_Key::get('civicrm/ajax/relation') . '">' .
+ '<a href="#editCaseRoleDialog" title="' . ts('Reassign %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '" data-rel_id="' . $row['rel_id'] . '"data-key="' . CRM_Core_Key::get('civicrm/ajax/relation') . '">' .
'<span class="icon ui-icon-pencil"></span>' .
- '</a>' .
- '<a href="#deleteCaseRoleDialog" title="' . ts('Remove %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '" data-key="' . CRM_Core_Key::get('civicrm/ajax/delcaserole') . '">' .
+ '</a>' .
+ '<a href="#deleteCaseRoleDialog" title="' . ts('Remove %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '" data-key="' . CRM_Core_Key::get('civicrm/ajax/delcaserole') . '">' .
'<span class="icon delete-icon"></span>' .
- '</a>';
+ '</a>';
break;
case 'caseRoles':
$row['actions'] =
- '<a href="#editCaseRoleDialog" title="' . ts('Assign %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '" data-key="' . CRM_Core_Key::get('civicrm/ajax/relation') . '">' .
+ '<a href="#editCaseRoleDialog" title="' . ts('Assign %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '" data-key="' . CRM_Core_Key::get('civicrm/ajax/relation') . '">' .
'<span class="icon ui-icon-pencil"></span>' .
- '</a>';
+ '</a>';
break;
}
}
*/
if (in_array($params['mode'], array(
- 'move', 'file'))) {
+ 'move',
+ 'file'
+ ))) {
$caseActivity = new CRM_Case_DAO_CaseActivity();
$caseActivity->case_id = $params['caseID'];
$caseActivity->activity_id = $otherActivity->id;
$iFilteredTotal = $iTotal = $params['total'];
$selectorElements = array(
- 'activity_type', 'subject', 'source_contact',
- 'target_contact', 'assignee_contact',
- 'activity_date', 'status', 'links', 'class',
+ 'activity_type',
+ 'subject',
+ 'source_contact',
+ 'target_contact',
+ 'assignee_contact',
+ 'activity_date',
+ 'status',
+ 'links',
+ 'class',
);
echo CRM_Utils_JSON::encodeDataTableSelector($activities, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
* @return void
*/
public function run() {
- $context = CRM_Utils_Request::retrieve('context', 'String', $this);
+ $context = CRM_Utils_Request::retrieve('context', 'String', $this);
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
- $action = CRM_Utils_Request::retrieve('action', 'String', $this);
+ $action = CRM_Utils_Request::retrieve('action', 'String', $this);
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
//do check for view/edit operation.
);
if (in_array($activityTypeId, array(
- $emailTypeValue, $letterTypeValue))) {
+ $emailTypeValue,
+ $letterTypeValue
+ ))) {
return;
}
}
$extraParams .= "&compContext={$compContext}";
}
- $showView = TRUE;
+ $showView = TRUE;
$showUpdate = $showDelete = FALSE;
$qsUpdate = NULL;
case 'Email':
case 'Bulk Email':
- $url = 'civicrm/activity/view';
+ $url = 'civicrm/activity/view';
$delUrl = 'civicrm/activity';
$qsView = "atype={$activityTypeId}&action=view&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}";
if ($activityTypeName == 'Email') {
case 'Change Case Status':
case 'Change Case Start Date':
$showUpdate = $showDelete = FALSE;
- $url = 'civicrm/activity';
- $qsView = "atype={$activityTypeId}&action=view&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}";
- $qsUpdate = "atype={$activityTypeId}&action=update&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}";
+ $url = 'civicrm/activity';
+ $qsView = "atype={$activityTypeId}&action=view&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}";
+ $qsUpdate = "atype={$activityTypeId}&action=update&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}";
break;
default:
- $url = 'civicrm/activity';
+ $url = 'civicrm/activity';
$showView = $showDelete = $showUpdate = TRUE;
- $qsView = "atype={$activityTypeId}&action=view&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}";
+ $qsView = "atype={$activityTypeId}&action=view&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}";
$qsUpdate = "atype={$activityTypeId}&action=update&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}";
//when type is not available lets hide view and update.
$actionLinks = array();
if ($showView) {
- $actionLinks += array(CRM_Core_Action::
- VIEW => array(
- 'name' => ts('View'),
- 'url' => $url,
- 'qs' => $qsView,
- 'title' => ts('View Activity'),
- ));
+ $actionLinks += array(
+ CRM_Core_Action::
+ VIEW => array(
+ 'name' => ts('View'),
+ 'url' => $url,
+ 'qs' => $qsView,
+ 'title' => ts('View Activity'),
+ )
+ );
}
if ($showUpdate) {
$updateUrl = 'civicrm/activity/pdf/add';
}
if (CRM_Activity_BAO_Activity::checkPermission($activityId, CRM_Core_Action::UPDATE)) {
- $actionLinks += array(CRM_Core_Action::
- UPDATE => array(
- 'name' => ts('Edit'),
- 'url' => $updateUrl,
- 'qs' => $qsUpdate,
- 'title' => ts('Update Activity'),
- ));
+ $actionLinks += array(
+ CRM_Core_Action::
+ UPDATE => array(
+ 'name' => ts('Edit'),
+ 'url' => $updateUrl,
+ 'qs' => $qsUpdate,
+ 'title' => ts('Update Activity'),
+ )
+ );
}
}
$activityTypeName &&
CRM_Case_BAO_Case::checkPermission($activityId, 'File On Case', $activityTypeId)
) {
- $actionLinks += array(CRM_Core_Action::
- ADD => array(
- 'name' => ts('File on Case'),
- 'url' => '#',
- 'extra' => 'onclick="javascript:fileOnCase( \'file\', \'%%id%%\', null, this ); return false;"',
- 'title' => ts('File on Case'),
- ));
+ $actionLinks += array(
+ CRM_Core_Action::
+ ADD => array(
+ 'name' => ts('File on Case'),
+ 'url' => '#',
+ 'extra' => 'onclick="javascript:fileOnCase( \'file\', \'%%id%%\', null, this ); return false;"',
+ 'title' => ts('File on Case'),
+ )
+ );
}
if ($showDelete) {
if (!isset($delUrl) || !$delUrl) {
$delUrl = $url;
}
- $actionLinks += array(CRM_Core_Action::
- DELETE => array(
- 'name' => ts('Delete'),
- 'url' => $delUrl,
- 'qs' => $qsDelete,
- 'title' => ts('Delete Activity'),
- ));
+ $actionLinks += array(
+ CRM_Core_Action::
+ DELETE => array(
+ 'name' => ts('Delete'),
+ 'url' => $delUrl,
+ 'qs' => $qsDelete,
+ 'title' => ts('Delete Activity'),
+ )
+ );
}
if ($accessMailingReport) {
- $actionLinks += array(CRM_Core_Action::
- BROWSE => array(
- 'name' => ts('Mailing Report'),
- 'url' => 'civicrm/mailing/report',
- 'qs' => "mid={$sourceRecordId}&reset=1&cid=%%cid%%&context=activitySelector",
- 'title' => ts('View Mailing Report'),
- ));
+ $actionLinks += array(
+ CRM_Core_Action::
+ BROWSE => array(
+ 'name' => ts('Mailing Report'),
+ 'url' => 'civicrm/mailing/report',
+ 'qs' => "mid={$sourceRecordId}&reset=1&cid=%%cid%%&context=activitySelector",
+ 'title' => ts('View Mailing Report'),
+ )
+ );
}
return $actionLinks;
* @param array $params
*/
public function getPagerParams($action, &$params) {
- $params['status'] = ts('Activities %%StatusMessage%%');
+ $params['status'] = ts('Activities %%StatusMessage%%');
$params['csvString'] = NULL;
- $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
+ $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
$params['buttonTop'] = 'PagerTopButton';
$params['buttonBottom'] = 'PagerBottomButton';
if (!isset(self::$_columnHeaders)) {
self::$_columnHeaders = array(
array(
- 'name' => ts('Type'),
+ 'name' => ts('Type'),
'sort' => 'activity_type',
'direction' => CRM_Utils_Sort::DONTCARE,
),
array(
- 'name' => ts('Subject'),
+ 'name' => ts('Subject'),
'sort' => 'subject',
'direction' => CRM_Utils_Sort::DONTCARE,
),
array(
- 'name' => ts('Added By'),
+ 'name' => ts('Added By'),
'sort' => 'source_contact_name',
'direction' => CRM_Utils_Sort::DONTCARE,
),
// submitted form values
$this->_queryParams = &$queryParams;
- $this->_single = $single;
- $this->_limit = $limit;
- $this->_context = $context;
+ $this->_single = $single;
+ $this->_limit = $limit;
+ $this->_context = $context;
$this->_compContext = $compContext;
$this->_activityClause = $activityClause;
FALSE,
$this->_activityClause
);
- $rows = array();
- $mailingIDs = CRM_Mailing_BAO_Mailing::mailingACLIDs();
+ $rows = array();
+ $mailingIDs = CRM_Mailing_BAO_Mailing::mailingACLIDs();
$accessCiviMail = CRM_Core_Permission::check('access CiviMail');
//get all campaigns.
$contactId = CRM_Utils_Array::value('source_contact_id', $row);
}
- $row['target_contact_name'] = CRM_Activity_BAO_ActivityContact::getNames($row['activity_id'], $targetID);
+ $row['target_contact_name'] = CRM_Activity_BAO_ActivityContact::getNames($row['activity_id'], $targetID);
$row['assignee_contact_name'] = CRM_Activity_BAO_ActivityContact::getNames($row['activity_id'], $assigneeID);
list($row['source_contact_name'], $row['source_contact_id']) = CRM_Activity_BAO_ActivityContact::getNames($row['activity_id'], $sourceID, TRUE);
$row['source_contact_name'] = implode(',', array_values($row['source_contact_name']));
$row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id
);
$accessMailingReport = FALSE;
- $activityTypeId = $row['activity_type_id'];
+ $activityTypeId = $row['activity_type_id'];
if ($row['activity_is_test']) {
$row['activity_type'] = $row['activity_type'] . " (test)";
}
$config = CRM_Core_Config::singleton();
if (in_array('CiviCase', $config->enableComponents)) {
if (CRM_Core_Permission::check('access all cases and activities') ||
- CRM_Core_Permission::check('access my cases and activities')) {
+ CRM_Core_Permission::check('access my cases and activities')
+ ) {
self::$_tasks[6] = array(
'title' => ts('File on Case'),
'class' => 'CRM_Activity_Form_Task_FileOnCase',
* Basic setup
*/
public function preProcess() {
- $this->_id = $this->get('id');
+ $this->_id = $this->get('id');
$this->_BAOName = $this->get('BAOName');
- $this->_values = array();
+ $this->_values = array();
if (isset($this->_id)) {
$params = array('id' => $this->_id);
// this is needed if the form is outside the CRM name space
}
$contactType = CRM_Contact_BAO_ContactType::add($params);
CRM_Core_Session::setStatus(ts("The Contact Type '%1' has been saved.",
- array(1 => $contactType->label)
- ), ts('Saved'), 'success');
+ array(1 => $contactType->label)
+ ), ts('Saved'), 'success');
}
}
break;
case CRM_Core_Action::UPDATE:
- if (! CRM_Extension_System::singleton()->getBrowser()->isEnabled()) {
+ if (!CRM_Extension_System::singleton()->getBrowser()->isEnabled()) {
CRM_Core_Error::fatal(ts('The system administrator has disabled this feature.'));
}
$info = CRM_Extension_System::singleton()->getBrowser()->getExtension($this->_key);
'version' => 3,
'key' => $this->_key,
));
- if (! CRM_Utils_Array::value('is_error', $result, FALSE)) {
+ if (!CRM_Utils_Array::value('is_error', $result, FALSE)) {
CRM_Core_Session::setStatus("", ts('Extension Upgraded'), "success");
}
else {
$attributes['name'], TRUE
);
- $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_Job', $this->_id));
+ $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array(
+ 'CRM_Core_DAO_Job',
+ $this->_id
+ ));
$this->add('text', 'description', ts('Description'),
$attributes['description']
}
$domainID = CRM_Core_Config::domainID();
- $dao = new CRM_Core_DAO_Job();
- $dao->id = $this->_id;
+ $dao = new CRM_Core_DAO_Job();
+ $dao->id = $this->_id;
$dao->domain_id = $domainID;
if (!$dao->find(TRUE)) {
return $defaults;
$dao = new CRM_Core_DAO_Job();
- $dao->id = $this->_id;
- $dao->domain_id = $domainID;
+ $dao->id = $this->_id;
+ $dao->domain_id = $domainID;
$dao->run_frequency = $values['run_frequency'];
- $dao->parameters = $values['parameters'];
- $dao->name = $values['name'];
- $dao->api_entity = $values['api_entity'];
- $dao->api_action = $values['api_action'];
- $dao->description = $values['description'];
- $dao->is_active = CRM_Utils_Array::value('is_active', $values, 0);
+ $dao->parameters = $values['parameters'];
+ $dao->name = $values['name'];
+ $dao->api_entity = $values['api_entity'];
+ $dao->api_action = $values['api_action'];
+ $dao->description = $values['description'];
+ $dao->is_active = CRM_Utils_Array::value('is_active', $values, 0);
$dao->save();
$locationType->save();
CRM_Core_Session::setStatus(ts("The location type '%1' has been saved.",
- array(1 => $locationType->name)
- ), ts('Saved'), 'success');
+ array(1 => $locationType->name)
+ ), ts('Saved'), 'success');
}
}
$this->add('checkbox', 'is_ssl', ts('Use SSL?'));
$usedfor = array(
- 1 => ts('Bounce Processing'),
+ 1 => ts('Bounce Processing'),
0 => ts('Email-to-Activity Processing'),
);
$this->add('select', 'is_default', ts('Used For?'), $usedfor);
$params = array();
foreach ($fields as $f) {
if (in_array($f, array(
- 'is_default', 'is_ssl'))) {
+ 'is_default',
+ 'is_ssl'
+ ))) {
$params[$f] = CRM_Utils_Array::value($f, $formValues, FALSE);
}
else {
$this->add('text', 'name', ts('Name'),
CRM_Core_DAO::getAttribute('CRM_Core_DAO_Mapping', 'name'), TRUE
);
- $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_Mapping', $this->_id));
+ $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array(
+ 'CRM_Core_DAO_Mapping',
+ $this->_id
+ ));
$this->addElement('text', 'description', ts('Description'),
CRM_Core_DAO::getAttribute('CRM_Core_DAO_Mapping', 'description')
//set the context for redirection after form submit or cancel
$session = CRM_Core_Session::singleton();
$session->replaceUserContext(CRM_Utils_System::url('civicrm/admin/messageTemplates',
- 'selectedChild=user&reset=1'
- ));
+ 'selectedChild=user&reset=1'
+ ));
}
// FIXME: we need to fix the Cancel button here as we don’t know whether it’s a workflow template in buildQuickForm()
return;
}
- $breadCrumb = array(array(
- 'title' => ts('Message Templates'),
+ $breadCrumb = array(
+ array(
+ 'title' => ts('Message Templates'),
'url' => CRM_Utils_System::url('civicrm/admin/messageTemplates',
'action=browse&reset=1'
),
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadCrumb);
$this->applyFilter('__ALL__', 'trim');
$this->addWysiwyg('msg_html', ts('HTML Message'),
array(
'cols' => '80',
- 'rows' => '8',
+ 'rows' => '8',
'onkeyup' => "return verify(this)",
)
);
$this->add('select', 'pdf_format_id', ts('PDF Page Format'),
array(
- 'null' => ts('- default -')) + CRM_Core_BAO_PdfFormat::getList(TRUE), FALSE
+ 'null' => ts('- default -')
+ ) + CRM_Core_BAO_PdfFormat::getList(TRUE), FALSE
);
$this->add('checkbox', 'is_active', ts('Enabled?'));
CRM_Core_BAO_Navigation::resetNavigation();
CRM_Core_Session::setStatus(ts('Menu \'%1\' has been saved.',
- array(1 => $navigation->label)
- ), ts('Saved'), 'success');
+ array(1 => $navigation->label)
+ ), ts('Saved'), 'success');
}
}
$element = $this->add('checkbox', 'is_active', ts('Enabled?'));
if ($this->_action & CRM_Core_Action::UPDATE) {
if (in_array($this->_values['name'], array(
- 'encounter_medium', 'case_type', 'case_status'))) {
+ 'encounter_medium',
+ 'case_type',
+ 'case_status'
+ ))) {
static $caseCount = NULL;
if (!isset($caseCount)) {
$caseCount = CRM_Case_BAO_Case::caseCount(NULL, FALSE);
'name'
);
$this->_gLabel = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $this->_gid, 'title');
- $url = "civicrm/admin/options/{$this->_gName}";
- $params = "reset=1";
+ $url = "civicrm/admin/options/{$this->_gName}";
+ $params = "reset=1";
if (($this->_action & CRM_Core_Action::DELETE) &&
in_array($this->_gName, array('email_greeting', 'postal_greeting', 'addressee'))
) {
// Don't allow delete if the option value belongs to addressee, postal or email greetings and is in use.
- $findValue = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', $this->_id, 'value');
+ $findValue = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', $this->_id, 'value');
$queryParam = array(1 => array($findValue, 'Integer'));
$columnName = $this->_gName . "_id";
- $sql = "SELECT count(id) FROM civicrm_contact WHERE " . $columnName . " = %1";
- $isInUse = CRM_Core_DAO::singleValueQuery($sql, $queryParam);
+ $sql = "SELECT count(id) FROM civicrm_contact WHERE " . $columnName . " = %1";
+ $isInUse = CRM_Core_DAO::singleValueQuery($sql, $queryParam);
if ($isInUse) {
$scriptURL = "<a href='" . CRM_Utils_System::docURL2('Update Greetings and Address Data for Contacts', TRUE, NULL, NULL, NULL, "wiki") . "'>" . ts('Learn more about a script that can automatically update contact addressee and greeting options.') . "</a>";
- CRM_Core_Session::setStatus(ts('The selected %1 option has <strong>not been deleted</strong> because it is currently in use. Please update these contacts to use a different format before deleting this option. %2', array(1 => $this->_gLabel, 2 => $scriptURL)), ts('Sorry'), 'error');
+ CRM_Core_Session::setStatus(ts('The selected %1 option has <strong>not been deleted</strong> because it is currently in use. Please update these contacts to use a different format before deleting this option. %2', array(
+ 1 => $this->_gLabel,
+ 2 => $scriptURL
+ )), ts('Sorry'), 'error');
$redirect = CRM_Utils_System::url($url, $params);
CRM_Utils_System::redirect($redirect);
}
//setDefault of contact types for email greeting, postal greeting, addressee, CRM-4575
if (in_array($this->_gName, array(
- 'email_greeting', 'postal_greeting', 'addressee'))) {
+ 'email_greeting',
+ 'postal_greeting',
+ 'addressee'
+ ))) {
$defaults['contactOptions'] = (CRM_Utils_Array::value('filter', $defaults)) ? $defaults['filter'] : NULL;
}
// CRM-11516
);
if (!in_array($this->_gName, array(
- 'email_greeting', 'postal_greeting', 'addressee')) && !$isReserved) {
+ 'email_greeting',
+ 'postal_greeting',
+ 'addressee'
+ )) && !$isReserved
+ ) {
$this->addRule('label',
ts('This Label already exists in the database for this option group. Please select a different Value.'),
'optionExists',
if ($this->_gName == 'case_status') {
$classes = array(
- 'Opened' => ts('Opened'),
+ 'Opened' => ts('Opened'),
'Closed' => ts('Closed'),
);
//get contact type for which user want to create a new greeting/addressee type, CRM-4575
if (in_array($this->_gName, array(
- 'email_greeting', 'postal_greeting', 'addressee')) && !$isReserved) {
+ 'email_greeting',
+ 'postal_greeting',
+ 'addressee'
+ )) && !$isReserved
+ ) {
$values = array(
- 1 => ts('Individual'),
+ 1 => ts('Individual'),
2 => ts('Household'),
3 => ts('Organization'),
4 => ts('Multiple Contact Merge'),
$errors['grouping'] = ts('Status class is a required field');
}
- if (in_array($self->_gName, array('email_greeting', 'postal_greeting', 'addressee')) && empty($self->_defaultValues['is_reserved'])) {
- $label = $fields['label'];
- $condition = " AND v.label = '{$label}' ";
- $values = CRM_Core_OptionGroup::values($self->_gName, FALSE, FALSE, FALSE, $condition, 'filter');
+ if (in_array($self->_gName, array(
+ 'email_greeting',
+ 'postal_greeting',
+ 'addressee'
+ )) && empty($self->_defaultValues['is_reserved'])
+ ) {
+ $label = $fields['label'];
+ $condition = " AND v.label = '{$label}' ";
+ $values = CRM_Core_OptionGroup::values($self->_gName, FALSE, FALSE, FALSE, $condition, 'filter');
$checkContactOptions = TRUE;
if ($self->_id && ($self->_defaultValues['contactOptions'] == $fields['contactOptions'])) {
CRM_Financial_BAO_FinancialTypeAccount::add($params);
}
- CRM_Core_Session::setStatus(ts('The %1 \'%2\' has been saved.', array(1 => $this->_gLabel, 2 => $optionValue->label)), ts('Saved'), 'success');
+ CRM_Core_Session::setStatus(ts('The %1 \'%2\' has been saved.', array(
+ 1 => $this->_gLabel,
+ 2 => $optionValue->label
+ )), ts('Saved'), 'success');
}
}
$attributes['name'], TRUE
);
- $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Financial_DAO_PaymentProcessor', $this->_id));
+ $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array(
+ 'CRM_Financial_DAO_PaymentProcessor',
+ $this->_id
+ ));
$this->add('text', 'description', ts('Description'),
$attributes['description']
$errors = array();
if (!(self::checkSection($fields, $errors) ||
- self::checkSection($fields, $errors, 'test')
- )) {
+ self::checkSection($fields, $errors, 'test')
+ )
+ ) {
$errors['_qf_default'] = ts('You must have at least the test or live section filled');
}
$domainID = CRM_Core_Config::domainID();
$dao = new CRM_Financial_DAO_PaymentProcessor();
- $dao->id = $this->_id;
+ $dao->id = $this->_id;
$dao->domain_id = $domainID;
if (!$dao->find(TRUE)) {
return $defaults;
// now get testID
$testDAO = new CRM_Financial_DAO_PaymentProcessor();
- $testDAO->name = $dao->name;
- $testDAO->is_test = 1;
+ $testDAO->name = $dao->name;
+ $testDAO->is_test = 1;
$testDAO->domain_id = $domainID;
if ($testDAO->find(TRUE)) {
$this->_testID = $testDAO->id;
public function updatePaymentProcessor(&$values, $domainID, $test) {
$dao = new CRM_Financial_DAO_PaymentProcessor();
- $dao->id = $test ? $this->_testID : $this->_id;
- $dao->domain_id = $domainID;
- $dao->is_test = $test;
+ $dao->id = $test ? $this->_testID : $this->_id;
+ $dao->domain_id = $domainID;
+ $dao->is_test = $test;
$dao->is_default = CRM_Utils_Array::value('is_default', $values, 0);
$dao->is_active = CRM_Utils_Array::value('is_active', $values, 0);
}
// also copy meta fields from the info DAO
- $dao->is_recur = $this->_ppDAO->is_recur;
+ $dao->is_recur = $this->_ppDAO->is_recur;
$dao->billing_mode = $this->_ppDAO->billing_mode;
- $dao->class_name = $this->_ppDAO->class_name;
+ $dao->class_name = $this->_ppDAO->class_name;
$dao->payment_type = $this->_ppDAO->payment_type;
$dao->save();
$dao = new CRM_Financial_DAO_PaymentProcessorType();
- $dao->id = $this->_id;
+ $dao->id = $this->_id;
$dao->is_default = CRM_Utils_Array::value('is_default', $values, 0);
- $dao->is_active = CRM_Utils_Array::value('is_active', $values, 0);
- $dao->is_recur = CRM_Utils_Array::value('is_recur', $values, 0);
+ $dao->is_active = CRM_Utils_Array::value('is_active', $values, 0);
+ $dao->is_recur = CRM_Utils_Array::value('is_recur', $values, 0);
$dao->name = $values['name'];
$dao->description = $values['description'];
$this->add('select', 'paper_size', ts('Paper Size'),
array(
- 0 => ts('- default -')) + CRM_Core_BAO_PaperSize::getList(TRUE), FALSE,
+ 0 => ts('- default -')
+ ) + CRM_Core_BAO_PaperSize::getList(TRUE), FALSE,
array('onChange' => "selectPaper( this.value );")
);
$this->add('text', 'margin_bottom', ts('Bottom Margin'), array('size' => 8, 'maxlength' => 8), TRUE);
$this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_BAO_PdfFormat', 'weight'), TRUE);
- $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_BAO_PdfFormat', $this->_id));
+ $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array(
+ 'CRM_Core_BAO_PdfFormat',
+ $this->_id
+ ));
$this->addRule('margin_left', ts('Margin must be numeric'), 'numeric');
$this->addRule('margin_right', ts('Margin must be numeric'), 'numeric');
$this->addRule('margin_top', ts('Margin must be numeric'), 'numeric');
public function preProcess() {
$this->_indexID = CRM_Utils_Request::retrieve('id', 'Integer', $this, FALSE);
- $this->_config = CRM_Utils_Request::retrieve('config', 'Integer', $this, 0);
- $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
+ $this->_config = CRM_Utils_Request::retrieve('config', 'Integer', $this, 0);
+ $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/admin/tplstrings', 'reset=1'));
is_array($this->_params[$settingName])
) {
$this->_config->$settingName = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
- array_keys($this->_params[$settingName])
- ) . CRM_Core_DAO::VALUE_SEPARATOR;
+ array_keys($this->_params[$settingName])
+ ) . CRM_Core_DAO::VALUE_SEPARATOR;
}
else {
$this->_config->$settingName = NULL;
// Address Standardization
$addrProviders = array(
- '' => '- select -') + CRM_Core_SelectValues::addressProvider();
+ '' => '- select -'
+ ) + CRM_Core_SelectValues::addressProvider();
$this->_varNames = array(
CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME => array(
CRM_Utils_System::setTitle(ts('CiviContribute Component Settings'));
$this->_varNames = array(
CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME => array(
- 'invoice_prefix' => array(
- 'html_type' => 'text',
- 'title' => ts('Invoice Prefix'),
- 'weight' => 1,
- 'description' => ts('Enter prefix to be display on PDF for invoice'),
- ),
- 'credit_notes_prefix' => array(
- 'html_type' => 'text',
- 'title' => ts('Credit Notes Prefix'),
- 'weight' => 2,
- 'description' => ts('Enter prefix to be display on PDF for credit notes.'),
- ),
- 'due_date' => array(
- 'html_type' => 'text',
- 'title' => ts('Due Date'),
- 'weight' => 3,
- ),
- 'due_date_period' => array(
- 'html_type' => 'select',
- 'title' => ts('For transmission'),
- 'weight' => 4,
- 'description' => ts('Select the interval for due date.'),
- 'option_values' => array(
- 'select' => ts('- select -'),
- 'days' => ts('Days'),
- 'months' => ts('Months'),
- 'years' => ts('Years'),
- ),
- ),
- 'notes' => array(
- 'html_type' => 'wysiwyg',
- 'title' => ts('Notes or Standard Terms'),
- 'weight' => 5,
- 'description' => ts('Enter note or message to be displayed on PDF invoice or credit notes '),
- 'attributes' => array('rows' => 2, 'cols' => 40),
- ),
- 'is_email_pdf' => array(
- 'html_type' => 'checkbox',
- 'title' => ts('Automatically email invoice when user purchases online'),
- 'weight' => 6,
- ),
- 'tax_term' => array(
- 'html_type' => 'text',
- 'title' => ts('Tax Term'),
- 'weight' => 7,
+ 'invoice_prefix' => array(
+ 'html_type' => 'text',
+ 'title' => ts('Invoice Prefix'),
+ 'weight' => 1,
+ 'description' => ts('Enter prefix to be display on PDF for invoice'),
+ ),
+ 'credit_notes_prefix' => array(
+ 'html_type' => 'text',
+ 'title' => ts('Credit Notes Prefix'),
+ 'weight' => 2,
+ 'description' => ts('Enter prefix to be display on PDF for credit notes.'),
+ ),
+ 'due_date' => array(
+ 'html_type' => 'text',
+ 'title' => ts('Due Date'),
+ 'weight' => 3,
+ ),
+ 'due_date_period' => array(
+ 'html_type' => 'select',
+ 'title' => ts('For transmission'),
+ 'weight' => 4,
+ 'description' => ts('Select the interval for due date.'),
+ 'option_values' => array(
+ 'select' => ts('- select -'),
+ 'days' => ts('Days'),
+ 'months' => ts('Months'),
+ 'years' => ts('Years'),
),
- 'tax_display_settings' => array(
- 'html_type' => 'select',
- 'title' => ts('Tax Display Settings'),
- 'weight' => 8,
- 'option_values' => array(
- 'Do_not_show' => ts('Do not show breakdown, only show total -i.e ' .
- $config->defaultCurrencySymbol . '120.00'),
- 'Inclusive' => ts('Show [tax term] inclusive price - i.e. ' .
- $config->defaultCurrencySymbol .
- '120.00 (includes [tax term] of ' .
- $config->defaultCurrencySymbol . '20.00)'),
- 'Exclusive' => ts('Show [tax term] exclusive price - i.e. ' .
- $config->defaultCurrencySymbol . '100.00 + ' .
- $config->defaultCurrencySymbol . '20.00 [tax term]'),
- ),
+ ),
+ 'notes' => array(
+ 'html_type' => 'wysiwyg',
+ 'title' => ts('Notes or Standard Terms'),
+ 'weight' => 5,
+ 'description' => ts('Enter note or message to be displayed on PDF invoice or credit notes '),
+ 'attributes' => array('rows' => 2, 'cols' => 40),
+ ),
+ 'is_email_pdf' => array(
+ 'html_type' => 'checkbox',
+ 'title' => ts('Automatically email invoice when user purchases online'),
+ 'weight' => 6,
+ ),
+ 'tax_term' => array(
+ 'html_type' => 'text',
+ 'title' => ts('Tax Term'),
+ 'weight' => 7,
+ ),
+ 'tax_display_settings' => array(
+ 'html_type' => 'select',
+ 'title' => ts('Tax Display Settings'),
+ 'weight' => 8,
+ 'option_values' => array(
+ 'Do_not_show' => ts('Do not show breakdown, only show total -i.e ' .
+ $config->defaultCurrencySymbol . '120.00'),
+ 'Inclusive' => ts('Show [tax term] inclusive price - i.e. ' .
+ $config->defaultCurrencySymbol .
+ '120.00 (includes [tax term] of ' .
+ $config->defaultCurrencySymbol . '20.00)'),
+ 'Exclusive' => ts('Show [tax term] exclusive price - i.e. ' .
+ $config->defaultCurrencySymbol . '100.00 + ' .
+ $config->defaultCurrencySymbol . '20.00 [tax term]'),
),
),
+ ),
);
parent::preProcess();
}
cj("#crm-preferences-display-form-block-wysiwyg_input_format").hide()
}';
- $formats = filter_formats();
- $format_options = array();
+ $formats = filter_formats();
+ $format_options = array();
foreach ($formats as $id => $format) {
$format_options[$id] = $format->name;
}
'title' => ts('Use Shopping Cart Style Event Registration'),
'weight' => 1,
'description' => ts('This feature allows users to register for more than one event at a time. When enabled, users will add event(s) to a "cart" and then pay for them all at once. Enabling this setting will affect online registration for all active events. The code is an alpha state, and you will potentially need to have developer resources to debug and fix sections of the codebase while testing and deploying it. %1',
- array(1 => $docLink)),
+ array(1 => $docLink)),
),
'show_events' => array(
'html_type' => 'select',
'description' => ts('Make CiviCRM aware of multiple domains. You should configure a domain group if enabled') . ' ' . $msDoc,
),
/** Remove this checkbox until some one knows what this setting does
- 'uniq_email_per_site' => array(
- 'html_type' => 'checkbox',
- 'title' => ts('Ensure multi sites have a unique email per site'),
- 'weight' => 2,
- 'description' => NULL,
- ),
+ * 'uniq_email_per_site' => array(
+ * 'html_type' => 'checkbox',
+ * 'title' => ts('Ensure multi sites have a unique email per site'),
+ * 'weight' => 2,
+ * 'description' => NULL,
+ * ),
*/
'domain_group_id' => array(
'html_type' => 'entity_reference',
'description' => ts('Contacts created on this site are added to this group'),
),
/** Remove this checkbox until some one knows what this setting does
- 'event_price_set_domain_id' => array(
- 'html_type' => 'text',
- 'title' => ts('Domain for event price sets'),
- 'weight' => 4,
- 'description' => NULL,
- ),
- */
+ * 'event_price_set_domain_id' => array(
+ * 'html_type' => 'text',
+ * 'title' => ts('Domain for event price sets'),
+ * 'weight' => 4,
+ * 'description' => NULL,
+ * ),
+ */
),
);
$params = $this->controller->exportValues($this->_name);
// action is taken depending upon the mode
- $dao = new CRM_Core_DAO_PreferencesDate();
- $dao->id = $this->_id;
+ $dao = new CRM_Core_DAO_PreferencesDate();
+ $dao->id = $this->_id;
$dao->description = $params['description'];
- $dao->start = $params['start'];
- $dao->end = $params['end'];
+ $dao->start = $params['start'];
+ $dao->end = $params['end'];
$dao->date_format = $params['date_format'];
$dao->time_format = $params['time_format'];
$dao->save();
CRM_Core_Session::setStatus(ts("The date type '%1' has been saved.",
- array(1 => $params['name'])
- ), ts('Saved'), 'success');
+ array(1 => $params['name'])
+ ), ts('Saved'), 'success');
}
}
// add select for contact type
$contactTypeA = &$this->add('select', 'contact_types_a', ts('Contact Type A') . ' ',
array(
- '' => ts('All Contacts')) + $contactTypes
+ '' => ts('All Contacts')
+ ) + $contactTypes
);
$contactTypeB = &$this->add('select', 'contact_types_b', ts('Contact Type B') . ' ',
array(
- '' => ts('All Contacts')) + $contactTypes
+ '' => ts('All Contacts')
+ ) + $contactTypes
);
$isActive = &$this->add('checkbox', 'is_active', ts('Enabled?'));
CRM_Core_Error::fatal('Could not find mapping for scheduled reminders.');
}
- $sel = & $this->add(
+ $sel = &$this->add(
'hierselect',
- 'entity',
- ts('Entity'),
- array(
- 'name' => 'entity[0]',
- 'style' => 'vertical-align: top;',
- ),
+ 'entity',
+ ts('Entity'),
+ array(
+ 'name' => 'entity[0]',
+ 'style' => 'vertical-align: top;',
+ ),
TRUE
);
$sel->setOptions(array($sel1, $sel2, $sel3));
$this->add('select', 'start_action_unit', ts('Frequency'), $freqUnitsDisplay, TRUE);
$condition = array(
- 'before' => ts('before'),
+ 'before' => ts('before'),
'after' => ts('after'),
);
//reminder_action
$this->setPageTitle(ts('Scheduled Reminder'));
}
+
/**
* Global form rule
*
}
if (!empty($this->_mappingID) && !empty($this->_compId)) {
- $params['mapping_id'] = $this->_mappingID;
+ $params['mapping_id'] = $this->_mappingID;
$params['entity_value'] = $this->_compId;
$params['entity_status'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $values['entity']);
}
//TODO: handle postprocessing of SMS and/or Email info based on $modePrefixes
$composeFields = array(
- 'template', 'saveTemplate',
- 'updateTemplate', 'saveTemplateName',
+ 'template',
+ 'saveTemplate',
+ 'updateTemplate',
+ 'saveTemplateName',
);
$msgTemplate = NULL;
//mail template is composed
if ($this->_action) {
if ($this->_action & CRM_Core_Action::UPDATE) {
$status = ts("Your Reminder titled %1 has been updated.",
- array(1 => "<strong>{$values['title']}</strong>")
+ array(1 => "<strong>{$values['title']}</strong>")
);
}
public function setDefaultValues() {
if (!$this->_defaults) {
$this->_defaults = array();
- $formArray = array('Component', 'Localization');
- $formMode = FALSE;
+ $formArray = array('Component', 'Localization');
+ $formMode = FALSE;
if (in_array($this->_name, $formArray)) {
$formMode = TRUE;
}
CRM_Core_Config_Defaults::setValues($this->_defaults, $formMode);
$list = array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options',
- FALSE, FALSE, TRUE, NULL, 'name'
- ));
+ FALSE, FALSE, TRUE, NULL, 'name'
+ ));
$cRlist = array_flip(CRM_Core_OptionGroup::values('contact_reference_options',
- FALSE, FALSE, TRUE, NULL, 'name'
- ));
+ FALSE, FALSE, TRUE, NULL, 'name'
+ ));
$listEnabled = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'contact_autocomplete_options'
//Set defaults for autocomplete and contact reference options
$this->_defaults['autocompleteContactSearch'] = array(
- '1' => 1) + $autoSearchFields;
+ '1' => 1
+ ) + $autoSearchFields;
$this->_defaults['autocompleteContactReference'] = array(
- '1' => 1) + $cRSearchFields;
+ '1' => 1
+ ) + $cRSearchFields;
// we can handle all the ones defined in the metadata here. Others to be converted
foreach ($this->_settings as $setting => $group) {
$settingMetaData = civicrm_api('setting', 'getfields', array('version' => 3, 'name' => $setting));
$this->_defaults[$setting] = civicrm_api('setting', 'getvalue', array(
- 'version' => 3,
- 'name' => $setting,
- 'group' => $group,
- 'default_value' => CRM_Utils_Array::value('default', $settingMetaData['values'][$setting]),
+ 'version' => 3,
+ 'name' => $setting,
+ 'group' => $group,
+ 'default_value' => CRM_Utils_Array::value('default', $settingMetaData['values'][$setting]),
)
);
}
// save autocomplete search options
if (!empty($params['autocompleteContactSearch'])) {
$value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
- array_keys($params['autocompleteContactSearch'])
- ) . CRM_Core_DAO::VALUE_SEPARATOR;
+ array_keys($params['autocompleteContactSearch'])
+ ) . CRM_Core_DAO::VALUE_SEPARATOR;
CRM_Core_BAO_Setting::setItem($value,
CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
// save autocomplete contact reference options
if (!empty($params['autocompleteContactReference'])) {
$value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
- array_keys($params['autocompleteContactReference'])
- ) . CRM_Core_DAO::VALUE_SEPARATOR;
+ array_keys($params['autocompleteContactReference'])
+ ) . CRM_Core_DAO::VALUE_SEPARATOR;
CRM_Core_BAO_Setting::setItem($value,
CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'fatalErrorTemplate' => CRM_Core_BAO_Setting::DEVELOPER_PREFERENCES_NAME,
'fatalErrorHandler' => CRM_Core_BAO_Setting::DEVELOPER_PREFERENCES_NAME,
);
+
/**
* Build the form object
*
$values['currencyLimit'] = array($values['defaultCurrency']);
}
elseif (!in_array($values['defaultCurrency'],
- $values['currencyLimit']
- )) {
+ $values['currencyLimit']
+ )
+ ) {
$values['currencyLimit'][] = $values['defaultCurrency'];
}
$errors['mailerJobSize'] = ts('The job size must be at least 1000 or set to 0 (unlimited).');
}
elseif (CRM_Utils_Array::value('mailerJobSize', $fields) <
- CRM_Utils_Array::value('mailerBatchLimit', $fields)) {
+ CRM_Utils_Array::value('mailerBatchLimit', $fields)
+ ) {
$errors['mailerJobSize'] = ts('A job size smaller than the batch limit will negate the effect of the batch limit.');
}
}
*/
public function preProcess() {
- $config = CRM_Core_Config::singleton();
+ $config = CRM_Core_Config::singleton();
$this->_uploadMaxSize = (int) ini_get('upload_max_filesize');
// check for post max size
CRM_Core_Config_Defaults::formatUnitSize(ini_get('post_max_size'), TRUE);
CRM_Utils_System::setTitle(ts('Settings - Upload Directories'));
$directories = array(
- 'uploadDir' => ts('Temporary Files'),
+ 'uploadDir' => ts('Temporary Files'),
'imageUploadDir' => ts('Images'),
'customFileUploadDir' => ts('Custom Files'),
'customTemplateDir' => ts('Custom Templates'),
// Autocomplete for Contact Search (quick search etc.)
$options = array(
- ts('Contact Name') => 1) + array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options',
+ ts('Contact Name') => 1
+ ) + array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options',
FALSE, FALSE, TRUE
));
$this->addCheckBox('autocompleteContactSearch', ts('Autocomplete Contact Search'), $options,
// Autocomplete for Contact Reference (custom fields)
$optionsCR = array(
- ts('Contact Name') => 1) + array_flip(CRM_Core_OptionGroup::values('contact_reference_options',
+ ts('Contact Name') => 1
+ ) + array_flip(CRM_Core_OptionGroup::values('contact_reference_options',
FALSE, FALSE, TRUE
));
$this->addCheckBox('autocompleteContactReference', ts('Contact Reference Options'), $optionsCR,
$toDisplayName = $toEmail;
}
- $to = '"' . $toDisplayName . '"' . "<$toEmail>";
- $from = '"' . $domainEmailName . '" <' . $domainEmailAddress . '>';
- $testMailStatusMsg = ts('Sending test email. FROM: %1 TO: %2.<br />', array(1 => $domainEmailAddress, 2 => $toEmail));
+ $to = '"' . $toDisplayName . '"' . "<$toEmail>";
+ $from = '"' . $domainEmailName . '" <' . $domainEmailAddress . '>';
+ $testMailStatusMsg = ts('Sending test email. FROM: %1 TO: %2.<br />', array(
+ 1 => $domainEmailAddress,
+ 2 => $toEmail
+ ));
$params = array();
if ($formValues['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_SMTP) {
if ($formValues['smtpAuth']) {
$params['username'] = $formValues['smtpUsername'];
$params['password'] = $formValues['smtpPassword'];
- $params['auth'] = TRUE;
+ $params['auth'] = TRUE;
}
else {
$params['auth'] = FALSE;
$mailerName = 'sendmail';
}
elseif ($formValues['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_MAIL) {
- $subject = "Test for PHP mail settings";
- $message = "mail settings are correct.";
+ $subject = "Test for PHP mail settings";
+ $message = "mail settings are correct.";
$mailerName = 'mail';
}
$this->_oldBaseURL,
$this->_oldBaseDir,
$this->_oldSiteName
- ) = CRM_Core_BAO_ConfigSetting::getConfigSettings();
+ ) = CRM_Core_BAO_ConfigSetting::getConfigSettings();
$this->assign('oldBaseURL', $this->_oldBaseURL);
$this->assign('oldBaseDir', $this->_oldBaseDir);
$this->_defaults['newBaseURL'],
$this->_defaults['newBaseDir'],
$this->_defaults['newSiteName']
- ) = CRM_Core_BAO_ConfigSetting::getBestGuessSettings();
+ ) = CRM_Core_BAO_ConfigSetting::getBestGuessSettings();
}
return $this->_defaults;
}
$from = array($this->_oldBaseURL, $this->_oldBaseDir);
- $to = array(trim($params['newBaseURL']),
+ $to = array(
+ trim($params['newBaseURL']),
trim($params['newBaseDir']),
);
if ($this->_oldSiteName &&
'cvv_backoffice_required' => CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,
'disable_core_css' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
);
+
/**
* Build the form object
*
$this->add('text', 'name', ts('Name'),
CRM_Core_DAO::getAttribute('CRM_Core_DAO_Tag', 'name'), TRUE
);
- $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_Tag', $this->_id));
+ $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array(
+ 'CRM_Core_DAO_Tag',
+ $this->_id
+ ));
$this->add('text', 'description', ts('Description'),
CRM_Core_DAO::getAttribute('CRM_Core_DAO_Tag', 'description')
$breadCrumbUrl = CRM_Utils_System::url('civicrm/admin/options/wordreplacements',
"reset=1"
);
- $breadCrumb = array(array(
- 'title' => ts('Word Replacements'),
+ $breadCrumb = array(
+ array(
+ 'title' => ts('Word Replacements'),
'url' => $breadCrumbUrl,
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadCrumb);
}
* @return void
*/
public function buildQuickForm() {
- $config = CRM_Core_Config::singleton();
- $values = $config->localeCustomStrings[$config->lcMessages];
+ $config = CRM_Core_Config::singleton();
+ $values = $config->localeCustomStrings[$config->lcMessages];
//CRM-14179
$instances = 0;
public static function formRule($values) {
$errors = array();
- $oldValues = CRM_Utils_Array::value('old', $values);
- $newValues = CRM_Utils_Array::value('new', $values);
- $enabled = CRM_Utils_Array::value('enabled', $values);
+ $oldValues = CRM_Utils_Array::value('old', $values);
+ $newValues = CRM_Utils_Array::value('new', $values);
+ $enabled = CRM_Utils_Array::value('enabled', $values);
$exactMatch = CRM_Utils_Array::value('cb', $values);
foreach ($oldValues as $k => $v) {
CRM_Core_Session::setStatus("", ts("Settings Saved"), "success");
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/options/wordreplacements',
- "reset=1"
- ));
+ "reset=1"
+ ));
}
}
}
*/
public static function getStatusMsg() {
require_once 'api/v3/utils.php';
- $recordID = CRM_Utils_Type::escape($_GET['id'], 'Integer');
+ $recordID = CRM_Utils_Type::escape($_GET['id'], 'Integer');
$entity = CRM_Utils_Type::escape($_GET['entity'], 'String');
$ret = array();
$template->assign('contexts', $contexts);
$ret['illegal'] = TRUE;
- $table = $template->fetch('CRM/Price/Page/table.tpl');
+ $table = $template->fetch('CRM/Price/Page/table.tpl');
$ret['content'] = ts('Unable to disable the \'%1\' price set - it is currently in use by one or more active events, contribution pages or contributions.', array(
- 1 => $priceSet)) . "<br/> $table";
+ 1 => $priceSet
+ )) . "<br/> $table";
}
else {
$ret['content'] = ts('Are you sure you want to disable \'%1\' Price Set?', array(1 => $priceSet));
}
$groups = array(
- 'Customize Data and Screens' => ts('Customize Data and Screens'),
+ 'Customize Data and Screens' => ts('Customize Data and Screens'),
'Communications' => ts('Communications'),
'Localization' => ts('Localization'),
'Users and Permissions' => ts('Users and Permissions'),
public function run() {
//if javascript is enabled
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean',
- $this, '', '', 'GET'
- )) {
+ $this, '', '', 'GET'
+ )
+ ) {
CRM_Core_BAO_CMSUser::synchronize();
return;
}
$eventTemplate = new CRM_Event_DAO_Event();
- $eventTypes = CRM_Event_PseudoConstant::eventType();
- $participantRoles = CRM_Event_PseudoConstant::participantRole();
+ $eventTypes = CRM_Event_PseudoConstant::eventType();
+ $participantRoles = CRM_Event_PseudoConstant::participantRole();
$participantListings = CRM_Event_PseudoConstant::participantListing();
//find all event templates.
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(),
- 'reset=1&action=browse'
- ));
+ 'reset=1&action=browse'
+ ));
}
/**
public function preProcess() {
CRM_Utils_System::setTitle(ts('CiviCRM Extensions'));
$destination = CRM_Utils_System::url('civicrm/admin/extensions',
- 'reset=1');
+ 'reset=1');
$destination = urlencode($destination);
$this->assign('destination', $destination);
public function run() {
// set title and breadcrumb
CRM_Utils_System::setTitle(ts('Settings - Scheduled Jobs'));
- $breadCrumb = array(array(
- 'title' => ts('Scheduled Jobs'),
+ $breadCrumb = array(
+ array(
+ 'title' => ts('Scheduled Jobs'),
'url' => CRM_Utils_System::url('civicrm/admin',
'reset=1'
),
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadCrumb);
$this->_id = CRM_Utils_Request::retrieve('id', 'String',
public function run() {
// set title and breadcrumb
CRM_Utils_System::setTitle(ts('Settings - Scheduled Jobs Log'));
- $breadCrumb = array(array(
- 'title' => ts('Administration'),
+ $breadCrumb = array(
+ array(
+ 'title' => ts('Administration'),
'url' => CRM_Utils_System::url('civicrm/admin',
'reset=1'
),
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadCrumb);
return parent::run();
}
// rebuild the action links HTML, as we need to handle %%orig_id%% for revertible templates
$values['action'] = CRM_Core_Action::formLink($links, $action, array(
- 'id' => $object->id,
+ 'id' => $object->id,
'orig_id' => CRM_Utils_Array::value($object->id, $this->_revertible),
),
ts('more'),
if (self::$_gName == 'acl_role') {
CRM_Utils_System::setTitle(ts('Manage ACL Roles'));
// set breadcrumb to append to admin/access
- $breadCrumb = array(array(
- 'title' => ts('Access Control'),
+ $breadCrumb = array(
+ array(
+ 'title' => ts('Access Control'),
'url' => CRM_Utils_System::url('civicrm/admin/access',
'reset=1'
),
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadCrumb);
}
else {
CRM_Utils_System::setTitle(ts("%1 Options", array(1 => self::$_gLabel)));
}
if (in_array(self::$_gName,
- array(
- 'from_email_address', 'email_greeting',
- 'postal_greeting', 'addressee',
- 'communication_style',
- 'case_status', 'encounter_medium',
- 'case_type', 'payment_instrument',
- 'soft_credit_type', 'website_type',
- )
- )) {
+ array(
+ 'from_email_address',
+ 'email_greeting',
+ 'postal_greeting',
+ 'addressee',
+ 'communication_style',
+ 'case_status',
+ 'encounter_medium',
+ 'case_type',
+ 'payment_instrument',
+ 'soft_credit_type',
+ 'website_type',
+ )
+ )) {
$this->assign('showIsDefault', TRUE);
}
'url' => 'civicrm/contact/search/custom',
'qs' => 'reset=1&csid=%%value%%',
'title' => ts('Run %1', array(1 => self::$_gName)),
- ));
+ )
+ );
self::$_links = $runLink + self::$_links;
}
}
}
$groupParams = array('name' => self::$_gName);
$optionValue = CRM_Core_OptionValue::getRows($groupParams, $this->links(), 'component_id,weight');
- $gName = self::$_gName;
- $returnURL = CRM_Utils_System::url("civicrm/admin/options/$gName",
+ $gName = self::$_gName;
+ $returnURL = CRM_Utils_System::url("civicrm/admin/options/$gName",
"reset=1&group=$gName"
);
$filter = "option_group_id = " . self::$_gId;
$visibilities = CRM_Core_PseudoConstant::visibility();
// these statuses are reserved, but disabled by default - so should be disablable after being enabled
- $disablable = array('On waitlist', 'Awaiting approval', 'Pending from waitlist', 'Pending from approval', 'Rejected');
+ $disablable = array(
+ 'On waitlist',
+ 'Awaiting approval',
+ 'Pending from waitlist',
+ 'Pending from approval',
+ 'Rejected'
+ );
while ($dao->fetch()) {
CRM_Core_DAO::storeValues($dao, $statusTypes[$dao->id]);
// set title and breadcrumb
CRM_Utils_System::setTitle(ts('Settings - Payment Processor'));
//CRM-15546
- $paymentProcessorTypes = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_PaymentProcessor', 'payment_processor_type_id', array('labelColumn' => 'name', 'flip' => 1));
+ $paymentProcessorTypes = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_PaymentProcessor', 'payment_processor_type_id', array(
+ 'labelColumn' => 'name',
+ 'flip' => 1
+ ));
$this->assign('defaultPaymentProcessorType', $paymentProcessorTypes['PayPal']);
- $breadCrumb = array(array(
- 'title' => ts('Administration'),
+ $breadCrumb = array(
+ array(
+ 'title' => ts('Administration'),
'url' => CRM_Utils_System::url('civicrm/admin',
- 'reset=1'
+ 'reset=1'
),
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadCrumb);
return parent::run();
}
// get all custom groups sorted by weight
$paymentProcessor = array();
$dao = new CRM_Financial_DAO_PaymentProcessor();
- $dao->is_test = 0;
- $dao->domain_id = CRM_Core_Config::domainID();
+ $dao->is_test = 0;
+ $dao->domain_id = CRM_Core_Config::domainID();
$dao->orderBy('name');
$dao->find();
}
if ((CRM_Utils_Array::value('height_image_1', $formattedRow) >
- CRM_Utils_Array::value('height_image_2', $formattedRow)) && !empty($formattedRow['height_image_1'])) {
+ CRM_Utils_Array::value('height_image_2', $formattedRow)) && !empty($formattedRow['height_image_1'])
+ ) {
$startOffset = CRM_Utils_Array::value('height_image_1', $formattedRow);
}
elseif (!empty($formattedRow['height_image_2'])) {
class CRM_Badge_Form_Layout extends CRM_Admin_Form {
const FIELD_ROWCOUNT = 6;
+
/**
* Build the form object
*
* @copyright CiviCRM LLC (c) 2004-2014
*
*/
-
class CRM_Badge_Page_AJAX {
public static function getImageProp() {
$img = $_GET['img'];
if ($context == 'financialBatch') {
$links = array(
'transaction' => array(
- 'name' => ts('Transactions'),
- 'url' => 'civicrm/batchtransaction',
- 'qs' => 'reset=1&bid=%%id%%',
+ 'name' => ts('Transactions'),
+ 'url' => 'civicrm/batchtransaction',
+ 'qs' => 'reset=1&bid=%%id%%',
'title' => ts('View/Add Transactions to Batch'),
),
'edit' => array(
- 'name' => ts('Edit'),
- 'url' => 'civicrm/financial/batch',
- 'qs' => 'reset=1&action=update&id=%%id%%&context=1',
+ 'name' => ts('Edit'),
+ 'url' => 'civicrm/financial/batch',
+ 'qs' => 'reset=1&action=update&id=%%id%%&context=1',
'title' => ts('Edit Batch'),
),
'close' => array(
- 'name' => ts('Close'),
+ 'name' => ts('Close'),
'title' => ts('Close Batch'),
- 'url' => '#',
+ 'url' => '#',
'extra' => 'rel="close"',
),
'export' => array(
- 'name' => ts('Export'),
+ 'name' => ts('Export'),
'title' => ts('Export Batch'),
- 'url' => '#',
+ 'url' => '#',
'extra' => 'rel="export"',
),
'reopen' => array(
- 'name' => ts('Re-open'),
+ 'name' => ts('Re-open'),
'title' => ts('Re-open Batch'),
- 'url' => '#',
+ 'url' => '#',
'extra' => 'rel="reopen"',
),
'delete' => array(
- 'name' => ts('Delete'),
+ 'name' => ts('Delete'),
'title' => ts('Delete Batch'),
- 'url' => '#',
+ 'url' => '#',
'extra' => 'rel="delete"',
),
'download' => array(
- 'name' => ts('Download'),
- 'url' => 'civicrm/file',
- 'qs' => 'reset=1&id=%%fid%%&eid=%%eid%%',
+ 'name' => ts('Download'),
+ 'url' => 'civicrm/file',
+ 'qs' => 'reset=1&id=%%fid%%&eid=%%eid%%',
'title' => ts('Download Batch'),
),
);
}
-
/**
* Calculate sum of all entries in a batch
* Used to validate and update item_count and total when closing an accounting batch
/**
* Format markup for comparing two totals
*
- * @param $actual: calculated total
- * @param $expected: user-entered total
+ * @param $actual : calculated total
+ * @param $expected : user-entered total
* @return array
*/
public static function displayTotals($actual, $expected) {
* @var array
*/
public $_fields = array();
+
/**
* Build all the data structures needed to build the form
*
$this->_profileId = CRM_Batch_BAO_Batch::getProfileId($this->_batchInfo['type_id']);
}
CRM_Core_Resources::singleton()
- ->addScriptFile('civicrm', 'templates/CRM/Batch/Form/Entry.js', 1, 'html-header')
- ->addSetting(array('batch' => array('type_id' => $this->_batchInfo['type_id'])))
- ->addSetting(array('setting' => array('monetaryThousandSeparator' => CRM_Core_Config::singleton()->monetaryThousandSeparator)))
- ->addSetting(array('setting' => array('monetaryDecimalPoint' => CRM_Core_Config::singleton()->monetaryDecimalPoint)));
+ ->addScriptFile('civicrm', 'templates/CRM/Batch/Form/Entry.js', 1, 'html-header')
+ ->addSetting(array('batch' => array('type_id' => $this->_batchInfo['type_id'])))
+ ->addSetting(array('setting' => array('monetaryThousandSeparator' => CRM_Core_Config::singleton()->monetaryThousandSeparator)))
+ ->addSetting(array('setting' => array('monetaryDecimalPoint' => CRM_Core_Config::singleton()->monetaryDecimalPoint)));
}
$fileFieldExists = FALSE;
$preserveDefaultsArray = array(
- 'first_name', 'last_name', 'middle_name',
+ 'first_name',
+ 'last_name',
+ 'middle_name',
'organization_name',
'household_name',
);
$config = CRM_Core_Config::singleton();
for ($rowNumber = 1; $rowNumber <= $this->_batchInfo['item_count']; $rowNumber++) {
- $this->addEntityRef("primary_contact_id[{$rowNumber}]", '', array('create' => TRUE, 'placeholder' => ts('- select -')));
+ $this->addEntityRef("primary_contact_id[{$rowNumber}]", '', array(
+ 'create' => TRUE,
+ 'placeholder' => ts('- select -')
+ ));
// special field specific to membership batch udpate
if ($this->_batchInfo['type_id'] == 2) {
$this->assign('fields', $this->_fields);
CRM_Core_Resources::singleton()
- ->addSetting(array(
- 'contact' => array(
- 'return' => implode(',', $contactReturnProperties),
- 'fieldmap' => array_flip($contactReturnProperties),
- )));
+ ->addSetting(array(
+ 'contact' => array(
+ 'return' => implode(',', $contactReturnProperties),
+ 'fieldmap' => array_flip($contactReturnProperties),
+ )
+ ));
// don't set the status message when form is submitted.
$buttonName = $this->controller->getButtonName('submit');
$domainEmail = "$domainEmail[0] <$domainEmail[1]>";
$value['from_email_address'] = $domainEmail;
- $value['membership_id'] = $membership->id;
+ $value['membership_id'] = $membership->id;
$value['contribution_id'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipPayment', $membership->id, 'contribution_id', 'membership_id');
CRM_Member_Form_Membership::emailReceipt($this, $value, $membership);
}
5 => '',
);
- $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
- $offset =
+ $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
+ $offset =
isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
- $rowCount =
+ $rowCount =
isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
- $sort =
+ $sort =
isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
$sortOrder =
isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
- $context =
+ $context =
isset($_REQUEST['context']) ? CRM_Utils_Type::escape($_REQUEST['context'], 'String') : NULL;
$params = $_REQUEST;
}
global $user;
- $node->uid = $user->uid;
- $node->title = $group->title;
- $node->type = 'og';
+ $node->uid = $user->uid;
+ $node->title = $group->title;
+ $node->type = 'og';
$node->status = 1;
// set the og values
* @param null $groupType
*/
public static function updateCiviGroup(&$params, $op, $groupType = NULL) {
- $abort = FALSE;
+ $abort = FALSE;
$params['version'] = 3;
- $params['id'] = CRM_Bridge_OG_Utils::groupID($params['source'], $params['title'], $abort);
+ $params['id'] = CRM_Bridge_OG_Utils::groupID($params['source'], $params['title'], $abort);
if ($op == 'add') {
if ($groupType) {
AND v.description = %2
";
$queryParams = array(
- 1 => array($optionGroupID, 'Integer'),
+ 1 => array($optionGroupID, 'Integer'),
2 => array($params['source'], 'String'),
);
$dao->id = CRM_Core_DAO::singleValueQuery($query, $queryParams);
$dao->find(TRUE);
$dao->entity_table = 'civicrm_acl_role';
- $dao->entity_id = $params['acl_role_id'];
- $dao->operation = 'Edit';
+ $dao->entity_id = $params['acl_role_id'];
+ $dao->operation = 'Edit';
$dao->is_active = TRUE;
$dao->save();
if (isset($params['groups']) && !empty($params['groups']['include']) && is_array($params['groups']['include'])) {
foreach ($params['groups']['include'] as $entityId) {
- $dao = new CRM_Campaign_DAO_CampaignGroup();
- $dao->campaign_id = $campaign->id;
+ $dao = new CRM_Campaign_DAO_CampaignGroup();
+ $dao->campaign_id = $campaign->id;
$dao->entity_table = $groupTableName;
- $dao->entity_id = $entityId;
- $dao->group_type = 'Include';
+ $dao->entity_id = $entityId;
+ $dao->group_type = 'Include';
$dao->save();
$dao->free();
}
static $campaigns;
$cacheKey = 0;
$cacheKeyParams = array(
- 'includeId', 'excludeId', 'onlyActive',
- 'onlyCurrent', 'appendDatesToTitle', 'forceAll',
+ 'includeId',
+ 'excludeId',
+ 'onlyActive',
+ 'onlyCurrent',
+ 'appendDatesToTitle',
+ 'forceAll',
);
foreach ($cacheKeyParams as $param) {
$cacheParam = $$param;
) {
$cacheKey = 0;
$cachekeyParams = array(
- 'includeId', 'excludeId', 'onlyActive', 'onlyCurrent',
- 'appendDatesToTitle', 'doCheckForComponent', 'doCheckForPermissions', 'forceAll',
+ 'includeId',
+ 'excludeId',
+ 'onlyActive',
+ 'onlyCurrent',
+ 'appendDatesToTitle',
+ 'doCheckForComponent',
+ 'doCheckForPermissions',
+ 'forceAll',
);
foreach ($cachekeyParams as $param) {
$cacheKeyParam = $$param;
if (!isset($validCampaigns[$cacheKey])) {
$isValid = TRUE;
$campaigns = array(
- 'campaigns' => array(),
+ 'campaigns' => array(),
'hasAccessCampaign' => FALSE,
'isCampaignEnabled' => FALSE,
);
$queryParams[3] = array('%' . trim($params['title']) . '%', 'String');
}
if (!empty($params['start_date'])) {
- $startDate = CRM_Utils_Date::processDate($params['start_date']);
- $where[] = "( campaign.start_date >= %4 OR campaign.start_date IS NULL )";
+ $startDate = CRM_Utils_Date::processDate($params['start_date']);
+ $where[] = "( campaign.start_date >= %4 OR campaign.start_date IS NULL )";
$queryParams[4] = array($startDate, 'String');
}
if (!empty($params['end_date'])) {
- $endDate = CRM_Utils_Date::processDate($params['end_date'], '235959');
- $where[] = "( campaign.end_date <= %5 OR campaign.end_date IS NULL )";
+ $endDate = CRM_Utils_Date::processDate($params['end_date'], '235959');
+ $where[] = "( campaign.end_date <= %5 OR campaign.end_date IS NULL )";
$queryParams[5] = array($endDate, 'String');
}
if (!empty($params['description'])) {
* @param string $elementName
*/
public static function addCampaignInComponentSearch(&$form, $elementName = 'campaign_id') {
- $campaignInfo = array();
+ $campaignInfo = array();
$campaignDetails = self::getPermissionedCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
- $fields = array('campaigns', 'hasAccessCampaign', 'isCampaignEnabled');
+ $fields = array('campaigns', 'hasAccessCampaign', 'isCampaignEnabled');
foreach ($fields as $fld) {
$$fld = CRM_Utils_Array::value($fld, $campaignDetails);
}
if ($isCampaignEnabled && $hasAccessCampaign && !empty($campaigns)) {
//get the current campaign only.
$currentCampaigns = self::getCampaigns(NULL, NULL, FALSE);
- $pastCampaigns = array_diff($campaigns, $currentCampaigns);
- $allCampaigns = array();
+ $pastCampaigns = array_diff($campaigns, $currentCampaigns);
+ $allCampaigns = array();
if (!empty($currentCampaigns)) {
$allCampaigns = array('crm_optgroup_current_campaign' => ts('Current Campaigns')) + $currentCampaigns;
}
// CRM-13810 Translate campaign_id to label for search builder
// CRM-14238 Only translate when we are in contact mode
// Other modes need the untranslated data for export and other functions
- if (is_array($query->_select) && $query->_mode == CRM_Contact_BAO_Query::MODE_CONTACTS) {
+ if (is_array($query->_select) && $query->_mode == CRM_Contact_BAO_Query::MODE_CONTACTS) {
foreach ($query->_select as $field => $queryString) {
if (substr($field, -11) == 'campaign_id') {
$query->_pseudoConstantsSelect[$field] = array(
case self::CIVICRM_ACTIVITY:
$surveyActivityTypes = CRM_Campaign_PseudoConstant::activityType();
- $surveyKeys = "(" . implode(',', array_keys($surveyActivityTypes)) . ")";
- $from = " INNER JOIN civicrm_activity ON ( civicrm_activity.id = civicrm_activity_target.activity_id
+ $surveyKeys = "(" . implode(',', array_keys($surveyActivityTypes)) . ")";
+ $from = " INNER JOIN civicrm_activity ON ( civicrm_activity.id = civicrm_activity_target.activity_id
AND civicrm_activity.activity_type_id IN $surveyKeys ) ";
break;
$customSearchFields = array();
while ($dao->fetch()) {
foreach (array(
- 'ward', 'precinct') as $name) {
+ 'ward',
+ 'precinct'
+ ) as $name) {
if (stripos($name, $dao->label) !== FALSE) {
$fieldId = $dao->id;
$fieldName = 'custom_' . $dao->id;
if (!is_array($params) || empty($params)) {
return $voterClause;
}
- $surveyId = CRM_Utils_Array::value('campaign_survey_id', $params);
+ $surveyId = CRM_Utils_Array::value('campaign_survey_id', $params);
$searchVoterFor = CRM_Utils_Array::value('campaign_search_voter_for', $params);
//get the survey activities.
$values['status_id'] == $completedStatusId
) {
$recontactIntSeconds = $numOfDays * 24 * 3600;
- $actDateTimeSeconds = CRM_Utils_Date::unixTime($values['activity_date_time']);
- $totalSeconds = $recontactIntSeconds + $actDateTimeSeconds;
+ $actDateTimeSeconds = CRM_Utils_Date::unixTime($values['activity_date_time']);
+ $totalSeconds = $recontactIntSeconds + $actDateTimeSeconds;
//don't consider completed survey activity
//unless it fulfill recontact interval criteria.
if ($totalSeconds <= time()) {
*
**/
public static function componentSearchClause(&$params, &$query) {
- $op = CRM_Utils_Array::value('op', $params, '=');
- $campaign = CRM_Utils_Array::value('campaign', $params);
+ $op = CRM_Utils_Array::value('op', $params, '=');
+ $campaign = CRM_Utils_Array::value('campaign', $params);
$tableName = CRM_Utils_Array::value('tableName', $params);
- $grouping = CRM_Utils_Array::value('grouping', $params);
+ $grouping = CRM_Utils_Array::value('grouping', $params);
if (CRM_Utils_System::isNull($campaign) || empty($tableName)) {
return;
}
// an integer, not an array
if (is_array($campaign)) {
foreach (array(
- 'current_campaign', 'past_campaign') as $ignore) {
+ 'current_campaign',
+ 'past_campaign'
+ ) as $ignore) {
$index = array_search($ignore, $campaign);
if ($index !== FALSE) {
unset($campaign[$index]);
}
}
$query->_qill[$grouping][] = ts('Campaigns %1',
- array(1 => $op)
- ) . ' ' . implode(' ' . ts('or') . ' ', $campaignTitles);
+ array(1 => $op)
+ ) . ' ' . implode(' ' . ts('or') . ' ', $campaignTitles);
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("{$tableName}.campaign_id",
$op,
$campaignIds,
$surveys = array();
$properties = array(
- 'id', 'title', 'campaign_id', 'is_active', 'is_default', 'result_id', 'activity_type_id',
- 'release_frequency', 'max_number_of_contacts', 'default_number_of_contacts',
+ 'id',
+ 'title',
+ 'campaign_id',
+ 'is_active',
+ 'is_default',
+ 'result_id',
+ 'activity_type_id',
+ 'release_frequency',
+ 'max_number_of_contacts',
+ 'default_number_of_contacts',
);
$survey = CRM_Core_DAO::executeQuery($query, $queryParams);
'contact_autocomplete_options'
);
$returnProperties = array_fill_keys(array_merge(array(
- 'contact_type',
- 'contact_sub_type',
- 'sort_name',
- ),
- array_keys($autocompleteContactSearch)
- ), 1);
+ 'contact_type',
+ 'contact_sub_type',
+ 'sort_name',
+ ),
+ array_keys($autocompleteContactSearch)
+ ), 1);
}
$select = $from = array();
foreach ($returnProperties as $property => $ignore) {
$value = (in_array($property, array(
- 'city', 'street_address'))) ? 'address' : $property;
+ 'city',
+ 'street_address'
+ ))) ? 'address' : $property;
switch ($property) {
case 'sort_name':
case 'contact_type':
//finally retrieve contact details.
if (!empty($select) && !empty($from)) {
- $fromClause = implode(' ', $from);
+ $fromClause = implode(' ', $from);
$selectClause = implode(', ', $select);
- $whereClause = "contact.id IN (" . implode(',', $voterIds) . ')';
+ $whereClause = "contact.id IN (" . implode(',', $voterIds) . ')';
$query = "
SELECT contact.id as contactId, $selectClause
*/
static function voterActivityDetails(
$surveyId, $voterIds, $interviewerId = NULL,
- $statusIds = array()) {
+ $statusIds = array()) {
$activityDetails = array();
if (!$surveyId ||
!is_array($voterIds) || empty($voterIds)
$whereClause";
$params = array(
- 1 => array($surveyId, 'Integer'),
+ 1 => array($surveyId, 'Integer'),
2 => array($actTypeId, 'Integer'),
);
$resultSets = array();
$valueColumnName = CRM_Utils_Type::escape($valueColumnName, 'String');
- $query = "SELECT id, {$valueColumnName} FROM civicrm_option_group WHERE name LIKE 'civicrm_survey_%' AND is_active=1";
- $dao = CRM_Core_DAO::executeQuery($query);
+ $query = "SELECT id, {$valueColumnName} FROM civicrm_option_group WHERE name LIKE 'civicrm_survey_%' AND is_active=1";
+ $dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$resultSets[$dao->id] = $dao->$valueColumnName;
}
if ($reportID) {
$voterLinks['report'] =
array(
- 'name' => 'report',
- 'url' => "civicrm/report/instance/{$reportID}",
- 'qs' => 'reset=1',
- 'title' => ts('View Survey Report'),
- );
+ 'name' => 'report',
+ 'url' => "civicrm/report/instance/{$reportID}",
+ 'qs' => 'reset=1',
+ 'title' => ts('View Survey Report'),
+ );
}
}
* @see CRM_Core_DAO::buildOptions
*
* @param string $fieldName
- * @param string $context: @see CRM_Core_DAO::buildOptionsContext
- * @param array $props: whatever is known about this dao object
+ * @param string $context : @see CRM_Core_DAO::buildOptionsContext
+ * @param array $props : whatever is known about this dao object
*
* @return array|bool
*/
* $Id$
*
*/
-class CRM_Campaign_Config extends CRM_Core_Component_Config {}
+class CRM_Campaign_Config extends CRM_Core_Component_Config {
+}
if (isset($defaults['start_date'])) {
list($defaults['start_date'],
$defaults['start_date_time']
- ) = CRM_Utils_Date::setDateDefaults($defaults['start_date'],
+ ) = CRM_Utils_Date::setDateDefaults($defaults['start_date'],
'activityDateTime'
);
}
else {
list($defaults['start_date'],
$defaults['start_date_time']
- ) = CRM_Utils_Date::setDateDefaults();
+ ) = CRM_Utils_Date::setDateDefaults();
}
if (isset($defaults['end_date'])) {
list($defaults['end_date'],
$defaults['end_date_time']
- ) = CRM_Utils_Date::setDateDefaults($defaults['end_date'],
+ ) = CRM_Utils_Date::setDateDefaults($defaults['end_date'],
'activityDateTime'
);
}
$this->addWysiwyg('goal_general', ts('Campaign Goals'), array('rows' => 2, 'cols' => 40));
$this->add('text', 'goal_revenue', ts('Revenue Goal'), array('size' => 8, 'maxlength' => 12));
$this->addRule('goal_revenue', ts('Please enter a valid money value (e.g. %1).',
- array(1 => CRM_Utils_Money::format('99.99', ' '))
- ), 'money');
+ array(1 => CRM_Utils_Money::format('99.99', ' '))
+ ), 'money');
// is this Campaign active
$this->addElement('checkbox', 'is_active', ts('Is Active?'));
$params['groups'] = $groups;
// delete previous includes/excludes, if campaign already existed
- $groupTableName = CRM_Contact_BAO_Group::getTableName();
- $dao = new CRM_Campaign_DAO_CampaignGroup();
- $dao->campaign_id = $this->_campaignId;
+ $groupTableName = CRM_Contact_BAO_Group::getTableName();
+ $dao = new CRM_Campaign_DAO_CampaignGroup();
+ $dao->campaign_id = $this->_campaignId;
$dao->entity_table = $groupTableName;
$dao->find();
while ($dao->fetch()) {
* This class generates form components for adding a petition
*
*/
-
class CRM_Campaign_Form_Petition extends CRM_Core_Form {
/**
// custom group id
$this->add('select', 'contact_profile_id', ts('Contact Profile'),
array(
- '' => ts('- select -')) + $customContactProfiles, TRUE
+ '' => ts('- select -')
+ ) + $customContactProfiles, TRUE
);
$customProfiles = CRM_Core_BAO_UFGroup::getProfiles(array('Activity'));
/**
* The contact type
*
- * @var string ("Individual"/"Household"/"Organization"). Never been tested for something else than Individual
+ * @var string ("Individual"/"Household"/"Organization"). Never been tested for something else than Individual
*/
protected $_ctype = 'Individual';
$ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, $params['contact_type']);
}
- $petition_params['id'] = $this->_surveyId;
- $petition = array();
- CRM_Campaign_BAO_Survey::retrieve($petition_params, $petition);
+ $petition_params['id'] = $this->_surveyId;
+ $petition = array();
+ CRM_Campaign_BAO_Survey::retrieve($petition_params, $petition);
switch (count($ids)) {
case 0:
$params['statusId'] = 2;
}
else {
- $this->_sendEmailMode = self::EMAIL_CONFIRM;
+ $this->_sendEmailMode = self::EMAIL_CONFIRM;
- // Set status for signature activity to scheduled until email is verified
- $params['statusId'] = 1;
+ // Set status for signature activity to scheduled until email is verified
+ $params['statusId'] = 1;
}
break;
// dedupe matched single contact, check for 'unconfirmed' tag
if ($tag_name) {
- $tag = new CRM_Core_DAO_EntityTag();
+ $tag = new CRM_Core_DAO_EntityTag();
$tag->entity_id = $this->_contactId;
- $tag->tag_id = $this->_tagId;
+ $tag->tag_id = $this->_tagId;
if (!($tag->find())) {
// send thank you email directly, the user is known and validated
}
if ($tag_name) {
- $tag = new CRM_Core_DAO_EntityTag();
+ $tag = new CRM_Core_DAO_EntityTag();
$tag->entity_id = $this->_contactId;
- $tag->tag_id = $this->_tagId;
+ $tag->tag_id = $this->_tagId;
if (!($tag->find())) {
// send thank you email
}
-
$transaction = new CRM_Core_Transaction();
$addToGroupID = isset($this->_addToGroupID) ? $this->_addToGroupID : NULL;
if (isset($this->thankyou)) {
return ('CRM/Campaign/Page/Petition/ThankYou.tpl');
}
- else {}
+ else {
+ }
return parent::getTemplateFileName();
}
//we allow the controller to set force/reset externally,
//useful when we are being driven by the wizard framework
- $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
+ $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
+ $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'search');
- $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
+ $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
//operation for state machine.
$this->_operation = CRM_Utils_Request::retrieve('op', 'String', $this, FALSE, 'reserve');
//validate operation.
if (!in_array($this->_operation, array(
- 'reserve', 'release', 'interview'))) {
+ 'reserve',
+ 'release',
+ 'interview'
+ ))
+ ) {
$this->_operation = 'reserve';
$this->set('op', $this->_operation);
}
$taskValue = array(
$currentTaskValue => ts('Record %1 Responses',
array(1 => $activityTypes[$surveyTypeId])
- ));
+ )
+ );
}
$this->addTaskMenu($taskValue);
//apply filter of survey contact type for search.
$contactType = CRM_Campaign_BAO_Survey::getSurveyContactType(CRM_Utils_Array::value('campaign_survey_id', $this->_formValues));
if ($contactType && in_array($this->_operation, array(
- 'reserve', 'interview'))) {
+ 'reserve',
+ 'interview'
+ ))
+ ) {
$this->_formValues['contact_type'][$contactType] = 1;
}
$groups = CRM_Utils_Array::value('group', $this->_formValues);
if ($campaignId && CRM_Utils_System::isNull($groups)) {
$campGroups = CRM_Campaign_BAO_Campaign::getCampaignGroups($campaignId);
- foreach ($campGroups as $id => $title) $this->_formValues['group'][$id] = 1;
+ foreach ($campGroups as $id => $title) {
+ $this->_formValues['group'][$id] = 1;
+ }
}
//carry servey id w/ this.
* @return void
*/
function preProcess() {
- $this->_search = CRM_Utils_Array::value('search', $_GET);
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE, FALSE);
+ $this->_search = CRM_Utils_Array::value('search', $_GET);
+ $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE, FALSE);
$this->_searchTab = CRM_Utils_Request::retrieve('type', 'String', $this, FALSE, 'campaign');
//when we do load tab, lets load the default objects.
$campaignTypes = CRM_Campaign_PseudoConstant::campaignType();
$this->add('select', 'campaign_type_id', ts('Campaign Type'),
array(
- '' => ts('- select -')) + $campaignTypes
+ '' => ts('- select -')
+ ) + $campaignTypes
);
$this->set('campaignTypes', $campaignTypes);
$campaignStatus = CRM_Campaign_PseudoConstant::campaignStatus();
$this->addElement('select', 'status_id', ts('Campaign Status'),
array(
- '' => ts('- select -')) + $campaignStatus
+ '' => ts('- select -')
+ ) + $campaignStatus
);
$this->set('campaignStatus', $campaignStatus);
$this->assign('campaignStatus', json_encode($campaignStatus));
* @return void
*/
function preProcess() {
- $this->_search = CRM_Utils_Array::value('search', $_GET);
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE, FALSE);
+ $this->_search = CRM_Utils_Array::value('search', $_GET);
+ $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE, FALSE);
$this->_searchTab = CRM_Utils_Request::retrieve('type', 'String', $this, FALSE, 'petition');
//when we do load tab, lets load the default objects.
* @return void
*/
function preProcess() {
- $this->_search = CRM_Utils_Array::value('search', $_GET);
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE, FALSE);
+ $this->_search = CRM_Utils_Array::value('search', $_GET);
+ $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE, FALSE);
$this->_searchTab = CRM_Utils_Request::retrieve('type', 'String', $this, FALSE, 'survey');
//when we do load tab, lets load the default objects.
$surveyTypes = CRM_Campaign_BAO_Survey::getSurveyActivityType();
$this->add('select', 'activity_type_id',
ts('Activity Type'), array(
- '' => ts('- select -')) + $surveyTypes
+ '' => ts('- select -')
+ ) + $surveyTypes
);
$this->set('surveyTypes', $surveyTypes);
$this->assign('surveyTypes', json_encode($surveyTypes));
CRM_Utils_System::permissionDenied();
}
- $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add', 'REQUEST');
+ $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add', 'REQUEST');
$this->_surveyId = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
if ($this->_surveyId) {
}
$buttons[] =
array(
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- );
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ );
$this->addButtons($buttons);
$url = CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey');
if ($tabTitle == 'Main') {
$tabTitle = 'Main settings';
}
- $subPage = strtolower($className);
+ $subPage = strtolower($className);
CRM_Core_Session::setStatus(ts("'%1' have been saved.", array(1 => $tabTitle)), ts('Saved'), 'success');
$this->postProcessHook();
if ($this->_action & CRM_Core_Action::ADD)
CRM_Utils_System::redirect(CRM_Utils_System::url("civicrm/survey/configure/questions",
- "action=update&reset=1&id={$this->_surveyId}"));
+ "action=update&reset=1&id={$this->_surveyId}"));
if ($this->controller->getButtonName('submit') == "_qf_{$className}_upload_done") {
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey'));
elseif ($this->controller->getButtonName('submit') == "_qf_{$className}_upload_next") {
$subPage = CRM_Campaign_Form_Survey_TabHeader::getNextTab($this);
CRM_Utils_System::redirect(CRM_Utils_System::url("civicrm/survey/configure/{$subPage}",
- "action=update&reset=1&id={$this->_surveyId}"));
+ "action=update&reset=1&id={$this->_surveyId}"));
}
else {
CRM_Utils_System::redirect(CRM_Utils_System::url("civicrm/survey/configure/{$subPage}",
- "action=update&reset=1&id={$this->_surveyId}"));
+ "action=update&reset=1&id={$this->_surveyId}"));
}
}
}
if (!empty($this->_values['result_id'])) {
$query = "SELECT COUNT(*) FROM civicrm_survey WHERE result_id = %1";
- $countSurvey = (int)CRM_Core_DAO::singleValueQuery($query,
+ $countSurvey = (int) CRM_Core_DAO::singleValueQuery($query,
array(
- 1 => array($this->_values['result_id'],
+ 1 => array(
+ $this->_values['result_id'],
'Positive',
- ))
+ )
+ )
);
// delete option group if no any survey is using it.
if (!$countSurvey) {
// also update the ProfileModule tables
$ufJoinParams = array(
'is_active' => 1,
- 'module' => 'CiviCampaign',
+ 'module' => 'CiviCampaign',
'entity_table' => 'civicrm_survey',
- 'entity_id' => $this->_surveyId,
+ 'entity_id' => $this->_surveyId,
);
// first delete all past entries
}
$this->addFormRule(array(
- 'CRM_Campaign_Form_Survey_Results',
- 'formRule',
- ), $this);
+ 'CRM_Campaign_Form_Survey_Results',
+ 'formRule',
+ ), $this);
parent::buildQuickForm();
}
$query = "SELECT MAX(id) FROM civicrm_report_instance WHERE name = %1";
$reportID = CRM_Core_DAO::singleValueQuery($query, array(
- 1 => array(
- "survey_{$survey->id}",
- 'String',
- ),
- ));
+ 1 => array(
+ "survey_{$survey->id}",
+ 'String',
+ ),
+ ));
if ($reportID) {
$url = CRM_Utils_System::url("civicrm/report/instance/{$reportID}", 'reset=1');
$status = ts("A Survey Detail Report <a href='%1'>%2</a> has been created.",
),
);
- $surveyID = $form->getVar('_surveyId');
- $class = $form->getVar('_name');
- $class = CRM_Utils_String::getClassName($class);
- $class = strtolower($class);
+ $surveyID = $form->getVar('_surveyId');
+ $class = $form->getVar('_name');
+ $class = CRM_Utils_String::getClassName($class);
+ $class = strtolower($class);
if (array_key_exists($class, $tabs)) {
$tabs[$class]['current'] = TRUE;
$this->assign('id', $this->_id);
$this->_BAOName = 'CRM_Core_BAO_OptionValue';
- $this->_gName = 'activity_type';
- $this->_gid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $this->_gName, 'id', 'name');
+ $this->_gName = 'activity_type';
+ $this->_gid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $this->_gName, 'id', 'name');
$session = CRM_Core_Session::singleton();
$url = CRM_Utils_System::url('civicrm/admin/campaign/surveyType', 'reset=1');
function preProcess() {
$values = $this->controller->exportValues('Search');
- $this->_task = $values['task'];
+ $this->_task = $values['task'];
$campaignTasks = CRM_Campaign_Task::tasks();
- $taskName = CRM_Utils_Array::value($this->_task, $campaignTasks);
+ $taskName = CRM_Utils_Array::value($this->_task, $campaignTasks);
$this->assign('taskName', $taskName);
$ids = array();
}
}
else {
- $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
+ $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
$cacheKey = "civicrm search {$qfKey}";
- $allCids = CRM_Core_BAO_PrevNextCache::getSelection($cacheKey, "getall");
+ $allCids = CRM_Core_BAO_PrevNextCache::getSelection($cacheKey, "getall");
$ids = array_keys($allCids[$cacheKey]);
$this->assign('totalSelectedVoters', count($ids));
}
$this->assign('totalSelectedContacts', count($this->_contactIds));
//set the context for redirection for any task actions
- $session = CRM_Core_Session::singleton();
- $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
+ $session = CRM_Core_Session::singleton();
+ $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
$urlParams = 'force=1';
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= '&qfKey=' . $qfKey;
if ($this->_reserveToInterview || $this->_votingTab) {
//user came from voting tab / reserve form.
foreach (array(
- 'surveyId', 'contactIds', 'interviewerId') as $fld) {
+ 'surveyId',
+ 'contactIds',
+ 'interviewerId'
+ ) as $fld) {
$this->{"_$fld"} = $this->get($fld);
}
//get the target voter ids.
}
$orderClause = FALSE;
- $buttonName = $this->controller->getButtonName();
+ $buttonName = $this->controller->getButtonName();
if ($buttonName == '_qf_Interview_submit_orderBy' && !empty($_POST['order_bys'])) {
$orderByParams = CRM_Utils_Array::value('order_bys', $_POST);
}
array(
1 => array(
'column' => 'civicrm_address.street_name',
- 'order' => 'ASC',
+ 'order' => 'ASC',
),
2 => array(
'column' => 'civicrm_address.street_number%2',
$this->_contactIds = array_unique($this->_contactIds);
if (!empty($this->_contactIds) && $orderClause) {
$clause = 'contact_a.id IN ( ' . implode(',', $this->_contactIds) . ' ) ';
- $sql = "
+ $sql = "
SELECT contact_a.id
FROM civicrm_contact contact_a
LEFT JOIN civicrm_address ON contact_a.id = civicrm_address.contact_id
$activityIds = array();
foreach ($this->_contactIds as $key => $voterId) {
- $actVals = CRM_Utils_Array::value($voterId, $this->_surveyActivityIds);
- $statusId = CRM_Utils_Array::value('status_id', $actVals);
+ $actVals = CRM_Utils_Array::value($voterId, $this->_surveyActivityIds);
+ $statusId = CRM_Utils_Array::value('status_id', $actVals);
$activityId = CRM_Utils_Array::value('activity_id', $actVals);
if ($activityId &&
$statusId &&
public function validateIds() {
$required = array(
- 'surveyId' => ts('Could not find Survey.'),
+ 'surveyId' => ts('Could not find Survey.'),
'interviewerId' => ts('Could not find Interviewer.'),
'contactIds' => ts('No respondents are currently reserved for you to interview.'),
'resultOptions' => ts('Oops. It looks like there is no response option configured.'),
$options =
array(
- '' => ' - none - ',
- 'civicrm_address.street_name' => 'Street Name',
+ '' => ' - none - ',
+ 'civicrm_address.street_name' => 'Street Name',
'civicrm_address.street_number%2' => 'Odd / Even Street Number',
- 'civicrm_address.street_number' => 'Street Number',
- 'contact_a.sort_name' => 'Respondent Name',
+ 'civicrm_address.street_number' => 'Street Number',
+ 'contact_a.sort_name' => 'Respondent Name',
);
for ($i = 1; $i < count($options); $i++) {
$this->addElement('select', "order_bys[{$i}][column]", ts('Order by Column'), $options);
- $this->addElement('select', "order_bys[{$i}][order]", ts('Order by Order'), array('ASC' => 'Ascending', 'DESC' => 'Descending'));
+ $this->addElement('select', "order_bys[{$i}][order]", ts('Order by Order'), array(
+ 'ASC' => 'Ascending',
+ 'DESC' => 'Descending'
+ ));
}
//pickup the uf fields.
if (!empty($this->_resultOptions)) {
$this->add('select', "field[$contactId][result]", ts('Result'),
array(
- '' => ts('- select -')) +
- array_combine($this->_resultOptions, $this->_resultOptions)
+ '' => ts('- select -')
+ ) +
+ array_combine($this->_resultOptions, $this->_resultOptions)
);
}
$buttons = array(
array(
- 'type' => 'cancel',
+ 'type' => 'cancel',
'name' => ts('Done'),
'subName' => 'interview',
'isDefault' => TRUE,
- ));
+ )
+ );
$buttons[] = array(
'type' => 'submit',
array(
1 => array(
'column' => 'civicrm_address.street_name',
- 'order' => 'ASC',
+ 'order' => 'ASC',
),
2 => array(
'column' => 'civicrm_address.street_number%2',
$defaults['order_bys'] =
array(
1 =>
- array(
- 'column' => 'contact_a.sort_name',
- 'order' => 'ASC',
- ),
+ array(
+ 'column' => 'contact_a.sort_name',
+ 'order' => 'ASC',
+ ),
);
}
return $defaults;
elseif ($buttonName == '_qf_Interview_next_interviewToRelease') {
//get ready to jump to release form.
foreach (array(
- 'surveyId', 'contactIds', 'interviewerId') as $fld) {
+ 'surveyId',
+ 'contactIds',
+ 'interviewerId'
+ ) as $fld) {
$this->controller->set($fld, $this->{"_$fld"});
}
$this->controller->set('interviewToRelease', TRUE);
}
if (!$this->_surveyId) {
// use default survey id
- $dao = new CRM_Campaign_DAO_Survey();
- $dao->is_active = 1;
+ $dao = new CRM_Campaign_DAO_Survey();
+ $dao->is_active = 1;
$dao->is_default = 1;
$dao->find(TRUE);
$this->_surveyId = $dao->id;
if ($this->_interviewToRelease) {
//user came from interview form.
foreach (array(
- 'surveyId', 'contactIds', 'interviewerId') as $fld) {
+ 'surveyId',
+ 'contactIds',
+ 'interviewerId'
+ ) as $fld) {
$this->{"_$fld"} = $this->get($fld);
}
$activityStatus = CRM_Core_PseudoConstant::activityStatus('name');
$statusIds = array();
foreach (array(
- 'Scheduled') as $name) {
+ 'Scheduled'
+ ) as $name) {
if ($statusId = array_search($name, $activityStatus)) {
$statusIds[] = $statusId;
}
$activityStatus = CRM_Core_PseudoConstant::activityStatus('name');
$statusIds = array();
foreach (array(
- 'Scheduled') as $name) {
+ 'Scheduled'
+ ) as $name) {
if ($statusId = array_search($name, $activityStatus)) {
$statusIds[] = $statusId;
}
$buttons = array(
array(
- 'type' => 'done',
+ 'type' => 'done',
'name' => ts('Reserve'),
'subName' => 'reserve',
'isDefault' => TRUE,
- ));
+ )
+ );
if (CRM_Core_Permission::check('manage campaign') ||
CRM_Core_Permission::check('administer CiviCampaign') ||
$errors = array();
$invalidGroupName = FALSE;
if (!empty($fields['newGroupName'])) {
- $title = trim($fields['newGroupName']);
- $name = CRM_Utils_String::titleToVar($title);
- $query = 'select count(*) from civicrm_group where name like %1 OR title like %2';
+ $title = trim($fields['newGroupName']);
+ $name = CRM_Utils_String::titleToVar($title);
+ $query = 'select count(*) from civicrm_group where name like %1 OR title like %2';
$grpCnt = CRM_Core_DAO::singleValueQuery($query, array(
- 1 => array($name, 'String'),
- 2 => array($title, 'String'),
- ));
+ 1 => array($name, 'String'),
+ 2 => array($title, 'String'),
+ ));
if ($grpCnt) {
$invalidGroupName = TRUE;
$errors['newGroupName'] = ts('Group \'%1\' already exists.', array(1 => $fields['newGroupName']));
*/
public function postProcess() {
//add reservation.
- $countVoters = 0;
- $maxVoters = CRM_Utils_Array::value('max_number_of_contacts', $this->_surveyDetails);
+ $countVoters = 0;
+ $maxVoters = CRM_Utils_Array::value('max_number_of_contacts', $this->_surveyDetails);
$activityStatus = CRM_Core_PseudoConstant::activityStatus('name');
- $statusHeld = array_search('Scheduled', $activityStatus);
+ $statusHeld = array_search('Scheduled', $activityStatus);
$reservedVoterIds = array();
foreach ($this->_contactIds as $cid) {
- $subject = ts('%1', array(1 => $this->_surveyDetails['title'])) . ' - ' . ts('Respondent Reservation');
- $session = CRM_Core_Session::singleton();
+ $subject = ts('%1', array(1 => $this->_surveyDetails['title'])) . ' - ' . ts('Respondent Reservation');
+ $session = CRM_Core_Session::singleton();
$activityParams = array(
- 'source_contact_id' => $session->get('userID'),
+ 'source_contact_id' => $session->get('userID'),
'assignee_contact_id' => array($this->_interviewerId),
'target_contact_id' => array($cid),
'source_record_id' => $this->_surveyId,
$status = '<p>' . ts("%1 Contact(s) have been reserved.", array(1 => $countVoters)) . '</p>';
if ($groupAdditions) {
$status .= '<p>' . ts('Respondent(s) has been added to %1 group(s).',
- array(1 => implode(', ', $groupAdditions))
- ) . '</p>';
+ array(1 => implode(', ', $groupAdditions))
+ ) . '</p>';
}
CRM_Core_Session::setStatus($status, ts('Reservation Added'), 'success');
}
return $groupAdditions;
}
- $params = $this->controller->exportValues($this->_name);
- $groups = CRM_Utils_Array::value('groups', $params, array());
+ $params = $this->controller->exportValues($this->_name);
+ $groups = CRM_Utils_Array::value('groups', $params, array());
$newGroupName = CRM_Utils_Array::value('newGroupName', $params);
$newGroupDesc = CRM_Utils_Array::value('newGroupDesc', $params);
) {
$shortCuts = array_merge($shortCuts, array(
array(
- 'path' => 'civicrm/campaign/add',
- 'query' => "reset=1&action=add",
- 'ref' => 'new-campaign',
- 'title' => ts('Campaign'),
- ),
- array(
- 'path' => 'civicrm/survey/add',
- 'query' => "reset=1&action=add",
- 'ref' => 'new-survey',
- 'title' => ts('Survey'),
- ),
- ));
+ 'path' => 'civicrm/campaign/add',
+ 'query' => "reset=1&action=add",
+ 'ref' => 'new-campaign',
+ 'title' => ts('Campaign'),
+ ),
+ array(
+ 'path' => 'civicrm/survey/add',
+ 'query' => "reset=1&action=add",
+ 'ref' => 'new-survey',
+ 'title' => ts('Survey'),
+ ),
+ ));
}
}
}
$params[$fld] = CRM_Utils_Array::value($fld, $_POST);
}
$params['details'] = CRM_Utils_Array::value('note', $_POST);
- $voterId = $params['voter_id'];
- $activityId = $params['activity_id'];
+ $voterId = $params['voter_id'];
+ $activityId = $params['activity_id'];
$customKey = "field_{$voterId}_custom";
foreach ($_POST as $key => $value) {
public static function loadOptionGroupDetails() {
- $id = CRM_Utils_Array::value('option_group_id', $_POST);
- $status = 'fail';
+ $id = CRM_Utils_Array::value('option_group_id', $_POST);
+ $status = 'fail';
$opValues = array();
if ($id) {
$surveyId = CRM_Utils_Array::value('survey_id', $_POST);
if ($surveyId) {
- $survey = new CRM_Campaign_DAO_Survey();
- $survey->id = $surveyId;
+ $survey = new CRM_Campaign_DAO_Survey();
+ $survey->id = $surveyId;
$survey->result_id = $id;
if ($survey->find(TRUE)) {
if ($survey->recontact_interval) {
//format multi-select group and contact types.
foreach (array(
- 'group', 'contact_type') as $param) {
+ 'group',
+ 'contact_type'
+ ) as $param) {
$paramValue = CRM_Utils_Array::value($param, $params);
if ($paramValue) {
unset($params[$param]);
$voterClauseParams = array();
foreach (array(
- 'campaign_survey_id', 'survey_interviewer_id', 'campaign_search_voter_for') as $fld) {
+ 'campaign_survey_id',
+ 'survey_interviewer_id',
+ 'campaign_search_voter_for'
+ ) as $fld) {
$voterClauseParams[$fld] = CRM_Utils_Array::value($fld, $params);
}
// get the data table params.
$dataTableParams = array(
'sEcho' => array(
- 'name' => 'sEcho',
+ 'name' => 'sEcho',
'type' => 'Integer',
'default' => 0,
),
$iTotal = $searchCount;
$selectorCols = array(
- 'contact_type', 'sort_name', 'street_address',
- 'street_name', 'street_number', 'street_unit',
+ 'contact_type',
+ 'sort_name',
+ 'street_address',
+ 'street_name',
+ 'street_number',
+ 'street_unit',
);
$extraVoterColName = 'is_interview_conducted';
$voterExtraColHtml .= " <span id='success_msg_{$contactID}' class='ok' style='display:none;'>$msg</span>";
}
elseif ($searchVoterFor == 'gotv') {
- $surveyActId = $result->survey_activity_id;
+ $surveyActId = $result->survey_activity_id;
$voterExtraColHtml = '<input type="checkbox" id="survey_activity[' . $surveyActId . ']" name="survey_activity[' . $surveyActId . ']" value=' . $surveyActId . ' onClick="processVoterData( this, \'gotv\' );" />';
- $msg = ts('Vote Recorded.');
+ $msg = ts('Vote Recorded.');
$voterExtraColHtml .= " <span id='success_msg_{$surveyActId}' class='ok' style='display:none;'>$msg</span>";
}
else {
- $surveyActId = $result->survey_activity_id;
+ $surveyActId = $result->survey_activity_id;
$voterExtraColHtml = '<input type="checkbox" id="survey_activity[' . $surveyActId . ']" name="survey_activity[' . $surveyActId . ']" value=' . $surveyActId . ' onClick="processVoterData( this, \'release\' );" />';
- $msg = ts('Vote Recorded.');
+ $msg = ts('Vote Recorded.');
$voterExtraColHtml .= " <span id='success_msg_{$surveyActId}' class='ok' style='display:none;'>$msg</span>";
}
$searchRows[$contactID][$extraVoterColName] = $voterExtraColHtml;
}
}
if ($createActivity) {
- $isReserved = CRM_Utils_String::strtoboolstr(CRM_Utils_Type::escape($_POST['isReserved'], 'String'));
- $activityStatus = CRM_Core_PseudoConstant::activityStatus('name');
+ $isReserved = CRM_Utils_String::strtoboolstr(CRM_Utils_Type::escape($_POST['isReserved'], 'String'));
+ $activityStatus = CRM_Core_PseudoConstant::activityStatus('name');
$scheduledStatusId = array_search('Scheduled', $activityStatus);
if ($isReserved) {
$surveyValues = array();
public function allActiveCampaigns() {
$currentCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns();
- $campaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
- $options = array(
+ $campaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
+ $options = array(
array(
- 'value' => '',
+ 'value' => '',
'title' => ts('- select -'),
- ));
+ )
+ );
foreach ($campaigns as $value => $title) {
$class = NULL;
if (!array_key_exists($value, $currentCampaigns)) {
}
$groups = array(
array(
- 'value' => '',
+ 'value' => '',
'title' => ts('- select -'),
- ));
+ )
+ );
foreach ($campGroups as $grpId => $title) {
$groups[] = array(
'value' => $grpId,
// get the data table params.
$dataTableParams = array(
'sEcho' => array(
- 'name' => 'sEcho',
+ 'name' => 'sEcho',
'type' => 'Integer',
'default' => 0,
),
}
}
foreach (array(
- 'sort', 'offset', 'rowCount', 'sortOrder') as $sortParam) {
+ 'sort',
+ 'offset',
+ 'rowCount',
+ 'sortOrder'
+ ) as $sortParam) {
$params[$sortParam] = $$sortParam;
}
$searchCount = CRM_Campaign_BAO_Campaign::getCampaignSummary($params, TRUE);
- $campaigns = CRM_Campaign_Page_DashBoard::getCampaignSummary($params);
- $iTotal = $searchCount;
+ $campaigns = CRM_Campaign_Page_DashBoard::getCampaignSummary($params);
+ $iTotal = $searchCount;
if ($searchCount > 0) {
if ($searchCount < $offset) {
// get the data table params.
$dataTableParams = array(
'sEcho' => array(
- 'name' => 'sEcho',
+ 'name' => 'sEcho',
'type' => 'Integer',
'default' => 0,
),
}
}
foreach (array(
- 'sort', 'offset', 'rowCount', 'sortOrder') as $sortParam) {
+ 'sort',
+ 'offset',
+ 'rowCount',
+ 'sortOrder'
+ ) as $sortParam) {
$params[$sortParam] = $$sortParam;
}
- $surveys = CRM_Campaign_Page_DashBoard::getSurveySummary($params);
+ $surveys = CRM_Campaign_Page_DashBoard::getSurveySummary($params);
$searchCount = CRM_Campaign_BAO_Survey::getSurveySummary($params, TRUE);
- $iTotal = $searchCount;
+ $iTotal = $searchCount;
if ($searchCount > 0) {
if ($searchCount < $offset) {
// get the data table params.
$dataTableParams = array(
'sEcho' => array(
- 'name' => 'sEcho',
+ 'name' => 'sEcho',
'type' => 'Integer',
'default' => 0,
),
}
}
foreach (array(
- 'sort', 'offset', 'rowCount', 'sortOrder') as $sortParam) {
+ 'sort',
+ 'offset',
+ 'rowCount',
+ 'sortOrder'
+ ) as $sortParam) {
$params[$sortParam] = $$sortParam;
}
- $petitions = CRM_Campaign_Page_DashBoard::getPetitionSummary($params);
+ $petitions = CRM_Campaign_Page_DashBoard::getPetitionSummary($params);
$searchCount = CRM_Campaign_BAO_Petition::getPetitionSummary($params, TRUE);
- $iTotal = $searchCount;
+ $iTotal = $searchCount;
if ($searchCount > 0) {
if ($searchCount < $offset) {
'qs' => 'sid=%%id%%&reset=1',
'title' => ts('Sign Petition'),
'fe' => TRUE,
- //CRM_Core_Action::PROFILE is used because there isn't a specific action for sign
+ //CRM_Core_Action::PROFILE is used because there isn't a specific action for sign
);
self::$_petitionActionLinks[CRM_Core_Action::BROWSE] = array(
'name' => ts('Signatures'),
'url' => 'civicrm/activity/search',
'qs' => 'survey=%%id%%&force=1',
'title' => ts('List the signatures'),
- //CRM_Core_Action::PROFILE is used because there isn't a specific action for sign
+ //CRM_Core_Action::PROFILE is used because there isn't a specific action for sign
);
}
//get the campaigns.
$campaigns = CRM_Campaign_BAO_Campaign::getCampaignSummary($params);
if (!empty($campaigns)) {
- $config = CRM_Core_Config::singleton();
- $campaignType = CRM_Campaign_PseudoConstant::campaignType();
+ $config = CRM_Core_Config::singleton();
+ $campaignType = CRM_Campaign_PseudoConstant::campaignType();
$campaignStatus = CRM_Campaign_PseudoConstant::campaignStatus();
- $properties = array(
- 'id', 'name', 'title', 'status_id', 'description',
- 'campaign_type_id', 'is_active', 'start_date', 'end_date',
+ $properties = array(
+ 'id',
+ 'name',
+ 'title',
+ 'status_id',
+ 'description',
+ 'campaign_type_id',
+ 'is_active',
+ 'start_date',
+ 'end_date',
);
foreach ($campaigns as $cmpid => $campaign) {
foreach ($properties as $prop) {
CRM_Core_Resources::singleton()
->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
->addSetting(array(
- 'tabSettings' => array(
- 'active' => strtolower(CRM_Utils_Array::value('subPage', $_GET, 'campaign')),
- )));
+ 'tabSettings' => array(
+ 'active' => strtolower(CRM_Utils_Array::value('subPage', $_GET, 'campaign')),
+ )
+ ));
}
/**
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);
+ $contact_id = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
$subscribe_id = CRM_Utils_Request::retrieve('sid', 'Integer', CRM_Core_DAO::$_nullObject);
- $hash = CRM_Utils_Request::retrieve('h', 'String', CRM_Core_DAO::$_nullObject);
- $activity_id = CRM_Utils_Request::retrieve('a', 'String', CRM_Core_DAO::$_nullObject);
- $petition_id = CRM_Utils_Request::retrieve('pid', 'String', CRM_Core_DAO::$_nullObject);
+ $hash = CRM_Utils_Request::retrieve('h', 'String', CRM_Core_DAO::$_nullObject);
+ $activity_id = CRM_Utils_Request::retrieve('a', 'String', CRM_Core_DAO::$_nullObject);
+ $petition_id = CRM_Utils_Request::retrieve('pid', 'String', CRM_Core_DAO::$_nullObject);
if (!$petition_id) {
- $petition_id = CRM_Utils_Request::retrieve('p', 'String', CRM_Core_DAO::$_nullObject);
+ $petition_id = CRM_Utils_Request::retrieve('p', 'String', CRM_Core_DAO::$_nullObject);
}
if (!$contact_id ||
$this->assign('survey_id', $petition_id);
- $pparams['id'] = $petition_id;
+ $pparams['id'] = $petition_id;
$this->petition = array();
CRM_Campaign_BAO_Survey::retrieve($pparams, $this->petition);
$this->assign('is_share', CRM_Utils_Array::value('is_share', $this->petition));
* @return string
*/
public function run() {
- $id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
- $petition_id = CRM_Utils_Request::retrieve('pid', 'Positive', $this);
- $params['id'] = $petition_id;
+ $id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
+ $petition_id = CRM_Utils_Request::retrieve('pid', 'Positive', $this);
+ $params['id'] = $petition_id;
$this->petition = array();
CRM_Campaign_BAO_Survey::retrieve($params, $this->petition);
$this->assign('petitionTitle', $this->petition['title']);
if (!empty($surveys)) {
- $surveyType = CRM_Campaign_BAO_Survey::getSurveyActivityType();
- $campaigns = CRM_Campaign_BAO_Campaign::getAllCampaign();
+ $surveyType = CRM_Campaign_BAO_Survey::getSurveyActivityType();
+ $campaigns = CRM_Campaign_BAO_Campaign::getAllCampaign();
$activityTypes = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, FALSE, 'name');
foreach ($surveys as $sid => $survey) {
$surveys[$sid]['campaign_id'] = $campaigns[$survey['campaign_id']];
*/
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');
+ $groupParams = array('name' => $this->_gName);
+ $optionValues = CRM_Core_OptionValue::getRows($groupParams, $this->links(), 'component_id,weight');
foreach ($optionValues as $key => $optionValue) {
if (CRM_Utils_Array::value('component_id', $optionValue) != $campaingCompId) {
public function browse() {
$this->_tabs = array(
- 'reserve' => ts('Reserve Respondents'),
+ 'reserve' => ts('Reserve Respondents'),
'interview' => ts('Interview Respondents'),
);
CRM_Core_Resources::singleton()
->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
->addSetting(array(
- 'tabSettings' => array(
- 'active' => strtolower(CRM_Utils_Array::value('subPage', $_GET, 'reserve')),
- )));
+ 'tabSettings' => array(
+ 'active' => strtolower(CRM_Utils_Array::value('subPage', $_GET, 'reserve')),
+ )
+ ));
}
/**
$allTabs = array();
foreach ($this->_tabs as $name => $title) {
// check for required permissions.
- if (!CRM_Core_Permission::check(array(array('manage campaign', 'administer CiviCampaign', "{$name} campaign contacts")))) {
+ if (!CRM_Core_Permission::check(array(
+ array(
+ 'manage campaign',
+ 'administer CiviCampaign',
+ "{$name} campaign contacts"
+ )
+ ))
+ ) {
continue;
}
public static function flush($name = 'cache') {
if (isset(self::$$name)) {
self::$$name = NULL;
- }
+ }
}
}
// submitted form values
$this->_queryParams = &$queryParams;
- $this->_single = $single;
- $this->_limit = $limit;
+ $this->_single = $single;
+ $this->_limit = $limit;
$this->_context = $context;
$this->_campaignClause = $surveyClause;
if (!$this->_single) {
$contactDetails = array(
array(
- 'name' => ts('Contact Name'),
+ 'name' => ts('Contact Name'),
'sort' => 'sort_name',
'direction' => CRM_Utils_Sort::ASCENDING,
),
array(
- 'name' => ts('Street Number'),
+ 'name' => ts('Street Number'),
'sort' => 'street_number',
),
array(
- 'name' => ts('Street Name'),
+ 'name' => ts('Street Name'),
'sort' => 'street_name',
),
array('name' => ts('Street Address')),
array(
- 'name' => ts('City'),
+ 'name' => ts('City'),
'sort' => 'city',
),
array(
- 'name' => ts('Postal Code'),
+ 'name' => ts('Postal Code'),
'sort' => 'postal_code',
),
array(
- 'name' => ts('State'),
+ 'name' => ts('State'),
'sort' => 'state_province_name',
),
array('name' => ts('Country')),
public static function &tasks() {
if (!(self::$_tasks)) {
self::$_tasks = array(
- 1 => array(
- 'title' => ts('Record Respondents Interview'),
+ 1 => array(
+ 'title' => ts('Record Respondents Interview'),
'class' => array(
'CRM_Campaign_Form_Task_Interview',
'CRM_Campaign_Form_Task_Release',
$ifBlankReplacements = array();
- $completed = FALSE;
+ $completed = FALSE;
$sortValues = array('1970-01-01');
- $category = '';
+ $category = '';
$fieldindex = 1;
- $fields = $activity->getElementsByTagName("Field");
+ $fields = $activity->getElementsByTagName("Field");
foreach ($fields as $field) {
$datatype_elements = $field->getElementsByTagName("Type");
$datatype = $datatype_elements->item(0)->nodeValue;
//CRM-4570
if ($printReport) {
if (!in_array($label, array(
- 'Activity Type', 'Status'))) {
+ 'Activity Type',
+ 'Status'
+ ))
+ ) {
$caseActivities[$activityindex][$fieldindex] = array();
$caseActivities[$activityindex][$fieldindex]['label'] = $label;
$caseActivities[$activityindex][$fieldindex]['datatype'] = $datatype;
}
if ($aval < $bval) {
- return - 1;
+ return -1;
}
elseif ($aval > $bval) {
return 1;
case 'case_relationship':
$session = CRM_Core_Session::singleton();
- $userID = $session->get('userID');
- $from .= " $side JOIN civicrm_relationship case_relationship ON ( case_relationship.contact_id_a = civicrm_case_contact.contact_id AND case_relationship.contact_id_b = {$userID} AND case_relationship.case_id = civicrm_case.id )";
+ $userID = $session->get('userID');
+ $from .= " $side JOIN civicrm_relationship case_relationship ON ( case_relationship.contact_id_a = civicrm_case_contact.contact_id AND case_relationship.contact_id_b = {$userID} AND case_relationship.case_id = civicrm_case.id )";
break;
case 'case_relation_type':
* $Id$
*
*/
-class CRM_Case_Config extends CRM_Core_Component_Config {}
+class CRM_Case_Config extends CRM_Core_Component_Config {
+}
if ($activityInst[$this->_activityTypeName] == 1) {
$atArray = array('activity_type_id' => $this->_activityTypeId);
$activities = CRM_Case_BAO_Case::getCaseActivity($caseId,
- $atArray,
- $this->_currentUserId
+ $atArray,
+ $this->_currentUserId
);
$activities = array_keys($activities);
$activities = $activities[0];
if ($followupActivity) {
$caseParams = array(
- 'activity_id' => $followupActivity->id,
- 'case_id' => $vval['case_id'],
+ 'activity_id' => $followupActivity->id,
+ 'case_id' => $vval['case_id'],
);
CRM_Case_BAO_Case::processCaseActivity($caseParams);
$followupStatus = ts("A followup activity has been scheduled.");
// 1. save activity subject with new start date
$currentStartDate = CRM_Utils_Date::customFormat(CRM_Core_DAO::getFieldValue('CRM_Case_DAO_Case',
- $caseId, 'start_date'
- ), $config->dateformatFull);
- $newStartDate = CRM_Utils_Date::customFormat(CRM_Utils_Date::mysqlToIso($params['start_date']), $config->dateformatFull);
- $subject = 'Change Case Start Date from ' . $currentStartDate . ' to ' . $newStartDate;
+ $caseId, 'start_date'
+ ), $config->dateformatFull);
+ $newStartDate = CRM_Utils_Date::customFormat(CRM_Utils_Date::mysqlToIso($params['start_date']), $config->dateformatFull);
+ $subject = 'Change Case Start Date from ' . $currentStartDate . ' to ' . $newStartDate;
$activity->subject = $subject;
$activity->save();
// 2. initiate xml processor
// Multiple steps since revisioned
if ($form->openCaseActivityId) {
- $abao = new CRM_Activity_BAO_Activity();
- $oldParams = array('id' => $form->openCaseActivityId);
+ $abao = new CRM_Activity_BAO_Activity();
+ $oldParams = array('id' => $form->openCaseActivityId);
$oldActivityDefaults = array();
- $oldActivity = $abao->retrieve($oldParams, $oldActivityDefaults);
+ $oldActivity = $abao->retrieve($oldParams, $oldActivityDefaults);
// save the old values
require_once 'api/v3/utils.php';
$query = 'UPDATE civicrm_relationship SET end_date=%2 WHERE id=%1';
foreach ($rels as $relId => $relData) {
$relParams = array(
- 1 => array($relId, 'Integer'),
+ 1 => array($relId, 'Integer'),
2 => array($params['end_date'], 'Timestamp'),
);
CRM_Core_DAO::executeQuery($query, $relParams);
if ($activity->subject == 'null') {
$activity->subject = ts('Case type changed from %1 to %2',
array(
- 1 => CRM_Utils_Array::value($form->_defaults['case_type_id'], $allCaseTypes),
+ 1 => CRM_Utils_Array::value($form->_defaults['case_type_id'], $allCaseTypes),
2 => CRM_Utils_Array::value($params['case_type_id'], $allCaseTypes),
)
);
return;
}
if ($form->_context == 'standalone') {
- $form->addEntityRef('client_id', ts('Client'), array('create' => TRUE, 'multiple' => $form->_allowMultiClient), TRUE);
+ $form->addEntityRef('client_id', ts('Client'), array(
+ 'create' => TRUE,
+ 'multiple' => $form->_allowMultiClient
+ ), TRUE);
}
$caseTypes = CRM_Case_PseudoConstant::caseType();
if ($buttonName == $form->getButtonName('upload', 'new')) {
if ($form->_context == 'standalone') {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/case/add',
- 'reset=1&action=add&context=standalone'
- ));
+ 'reset=1&action=add&context=standalone'
+ ));
}
else {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view/case',
- "reset=1&action=add&context=case&cid={$form->_contactID}"
- ));
+ "reset=1&action=add&context=case&cid={$form->_contactID}"
+ ));
}
}
}
* @return void
*/
public function preProcess() {
- $contactID = CRM_Utils_Request::retrieve('cid', 'Integer', $this, TRUE);
- $activityID = CRM_Utils_Request::retrieve('aid', 'Integer', $this, TRUE);
- $revs = CRM_Utils_Request::retrieve('revs', 'Boolean', CRM_Core_DAO::$_nullObject);
- $caseID = CRM_Utils_Request::retrieve('caseID', 'Boolean', CRM_Core_DAO::$_nullObject);
+ $contactID = CRM_Utils_Request::retrieve('cid', 'Integer', $this, TRUE);
+ $activityID = CRM_Utils_Request::retrieve('aid', 'Integer', $this, TRUE);
+ $revs = CRM_Utils_Request::retrieve('revs', 'Boolean', CRM_Core_DAO::$_nullObject);
+ $caseID = CRM_Utils_Request::retrieve('caseID', 'Boolean', CRM_Core_DAO::$_nullObject);
$activitySubject = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity',
$activityID,
'subject'
if (!$this->_caseId) {
$caseAttributes = array(
- 'case_type' => CRM_Case_PseudoConstant::caseType(),
+ 'case_type' => CRM_Case_PseudoConstant::caseType(),
'case_status' => CRM_Case_PseudoConstant::caseStatus(),
'encounter_medium' => CRM_Case_PseudoConstant::encounterMedium(),
);
foreach ($caseAttributes as $key => $values) {
if (empty($values)) {
CRM_Core_Error::fatal(ts('You do not have any active %1',
- array(1 => str_replace('_', ' ', $key))
- ));
+ array(1 => str_replace('_', ' ', $key))
+ ));
break;
}
}
}
$this->add('text', 'activity_subject', ts('Subject'),
array_merge($s, array(
- 'maxlength' => '128')), TRUE
+ 'maxlength' => '128'
+ )), TRUE
);
CRM_Core_BAO_Tag::getTags('civicrm_case', $tags, NULL,
if ($this->_showRelatedCases) {
$relatedCases = $this->get('relatedCases');
if (!isset($relatedCases)) {
- $cId = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
- $caseId = CRM_Utils_Request::retrieve('id', 'Integer', CRM_Core_DAO::$_nullObject);
+ $cId = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
+ $caseId = CRM_Utils_Request::retrieve('id', 'Integer', CRM_Core_DAO::$_nullObject);
$relatedCases = CRM_Case_BAO_Case::getRelatedCases($caseId, $cId);
}
$this->assign('relatedCases', $relatedCases);
//validate case id.
$this->_userCases = array();
- $session = CRM_Core_Session::singleton();
- $userID = $session->get('userID');
+ $session = CRM_Core_Session::singleton();
+ $userID = $session->get('userID');
if (!$this->_hasAccessToAllCases) {
$this->_userCases = CRM_Case_BAO_Case::getCases(FALSE, $userID, 'any');
if (!array_key_exists($this->_caseID, $this->_userCases)) {
$returnProperties = array('case_type_id', 'subject', 'status_id', 'start_date');
CRM_Core_DAO::commonRetrieve('CRM_Case_BAO_Case', $params, $values, $returnProperties);
- $statuses = CRM_Case_PseudoConstant::caseStatus('label', FALSE);
+ $statuses = CRM_Case_PseudoConstant::caseStatus('label', FALSE);
$caseTypeName = CRM_Case_BAO_Case::getCaseType($this->_caseID, 'name');
- $caseType = CRM_Case_BAO_Case::getCaseType($this->_caseID);
+ $caseType = CRM_Case_BAO_Case::getCaseType($this->_caseID);
$this->_caseDetails = array(
'case_type' => $caseType,
}
$this->assign('hasRelatedCases', (bool) $relatedCases);
if ($relatedCases) {
- $this->assign('relatedCaseLabel', ts('%1 Related Case', array('count' => count($relatedCases), 'plural' => '%1 Related Cases')));
+ $this->assign('relatedCaseLabel', ts('%1 Related Case', array(
+ 'count' => count($relatedCases),
+ 'plural' => '%1 Related Cases'
+ )));
$this->assign('relatedCaseUrl', CRM_Utils_System::url('civicrm/contact/view/case', array(
'id' => $this->_caseID,
'cid' => $this->_contactID,
->addScriptFile('civicrm', 'templates/CRM/Case/Form/CaseView.js', 2, 'html-header');
$xmlProcessor = new CRM_Case_XMLProcessor_Process();
- $caseRoles = $xmlProcessor->get($this->_caseType, 'CaseRoles');
- $reports = $xmlProcessor->get($this->_caseType, 'ActivitySets');
+ $caseRoles = $xmlProcessor->get($this->_caseType, 'CaseRoles');
+ $reports = $xmlProcessor->get($this->_caseType, 'ActivitySets');
//adding case manager.CRM-4510.
$managerRoleId = $xmlProcessor->getCaseManagerRoleId($this->_caseType);
$this->add('select', 'merge_case_id',
ts('Select Case for Merge'),
array(
- '' => ts('- select case -')) + $otherCases,
+ '' => ts('- select case -')
+ ) + $otherCases,
FALSE,
array('class' => 'crm-select2 huge')
);
$this->assign('globalGroupInfo', $globalGroupInfo);
// List of relationship types
- $baoRel = new CRM_Contact_BAO_Relationship();
- $relType = $baoRel->getRelationType('Individual');
+ $baoRel = new CRM_Contact_BAO_Relationship();
+ $relType = $baoRel->getRelationType('Individual');
$roleTypes = array();
foreach ($relType as $k => $v) {
$roleTypes[substr($k, 0, strpos($k, '_'))] = $v;
$session->pushUserContext($url);
if (!empty($params['timeline_id']) && !empty($_POST['_qf_CaseView_next'])) {
- $session = CRM_Core_Session::singleton();
- $this->_uid = $session->get('userID');
- $xmlProcessor = new CRM_Case_XMLProcessor_Process();
+ $session = CRM_Core_Session::singleton();
+ $this->_uid = $session->get('userID');
+ $xmlProcessor = new CRM_Case_XMLProcessor_Process();
$xmlProcessorParams = array(
'clientID' => $this->_contactID,
'creatorID' => $this->_uid,
$reports = $xmlProcessor->get($this->_caseType, 'ActivitySets');
CRM_Core_Session::setStatus(ts('Activities from the %1 activity set have been added to this case.',
- array(1 => $reports[$params['timeline_id']])
+ array(1 => $reports[$params['timeline_id']])
), ts('Done'), 'success');
}
elseif ($this->_mergeCases &&
* @return void
*/
public function preProcess() {
- $this->_groupID = CRM_Utils_Request::retrieve('groupID', 'Positive', $this, TRUE);
- $this->_entityID = CRM_Utils_Request::retrieve('entityID', 'Positive', $this, TRUE);
+ $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);
$this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&id={$this->_entityID}&cid={$this->_contactID}&action=view"));
- $session = CRM_Core_Session::singleton();
+ $session = CRM_Core_Session::singleton();
$activityTypeID = CRM_Core_OptionGroup::getValue('activity_type', 'Change Custom Data', 'name');
$activityParams = array(
'activity_type_id' => $activityTypeID,
$url = CRM_Utils_System::url('civicrm/case', 'reset=1');
}
elseif (in_array($context, array(
- 'dashlet', 'dashletFullscreen'))) {
+ 'dashlet',
+ 'dashletFullscreen'
+ ))) {
$url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
}
$session = CRM_Core_Session::singleton();
}
$includeActivites = array(
- 1 => ts('All Activities'),
+ 1 => ts('All Activities'),
2 => ts('Exclude Completed Activities'),
);
$includeActivitesGroup = $this->addRadio('include_activities',
* driven by the wizard framework
*/
- $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
- $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
+ $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
+ $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
+ $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'search');
$this->assign('context', $this->_context);
}
else {
$session->replaceUserContext(CRM_Utils_System::url("civicrm/contact/search/$searchFormName",
- $urlParams
- ));
+ $urlParams
+ ));
}
}
parent::preProcess();
$rows = array();
// display name and email of all contact ids
- $caseIDs = implode(',', $this->_caseIds);
+ $caseIDs = implode(',', $this->_caseIds);
$statusId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'case_status', 'id', 'name');
- $query = "
+ $query = "
SELECT ct.display_name as display_name,
cs.start_date as start_date,
ov.label as status
*/
public function registerTab() {
return array(
- 'title' => ts('Cases'),
+ 'title' => ts('Cases'),
'url' => 'case',
'weight' => 50,
);
*/
public function registerAdvancedSearchPane() {
return array(
- 'title' => ts('Cases'),
+ 'title' => ts('Cases'),
'weight' => 50,
);
}
if ($atype) {
$shortCuts = array_merge($shortCuts, array(
array(
- 'path' => 'civicrm/case/add',
- 'query' => "reset=1&action=add&atype=$atype&context=standalone",
- 'ref' => 'new-case',
- 'title' => ts('Case'),
- )));
+ 'path' => 'civicrm/case/add',
+ 'query' => "reset=1&action=add&atype=$atype&context=standalone",
+ 'ref' => 'new-case',
+ 'title' => ts('Case'),
+ )
+ ));
}
}
}
CRM_Utils_System::permissionDenied();
}
- $sql = "SELECT civicrm_case.*, civicrm_case_type.title as case_type
+ $sql = "SELECT civicrm_case.*, civicrm_case_type.title as case_type
FROM civicrm_case
INNER JOIN civicrm_case_type ON civicrm_case.case_type_id = civicrm_case_type.id
WHERE civicrm_case.id = %1";
- $dao = CRM_Core_DAO::executeQuery($sql, array(1 => array($caseId, 'Integer')));
+ $dao = CRM_Core_DAO::executeQuery($sql, array(1 => array($caseId, 'Integer')));
if ($dao->fetch()) {
$caseStatuses = CRM_Case_PseudoConstant::caseStatus();
- $cs = $caseStatuses[$dao->status_id];
- $caseDetails = "<table><tr><td>" . ts('Case Subject') . "</td><td>{$dao->subject}</td></tr>
+ $cs = $caseStatuses[$dao->status_id];
+ $caseDetails = "<table><tr><td>" . ts('Case Subject') . "</td><td>{$dao->subject}</td></tr>
<tr><td>" . ts('Case Type') . "</td><td>{$dao->case_type}</td></tr>
<tr><td>" . ts('Case Status') . "</td><td>{$cs}</td></tr>
<tr><td>" . ts('Case Start Date') . "</td><td>" . CRM_Utils_Date::customFormat($dao->start_date) . "</td></tr>
* Delete relationships specific to case and relationship type
*/
public static function deleteCaseRoles() {
- $caseId = CRM_Utils_Type::escape($_POST['case_id'], 'Positive');
+ $caseId = CRM_Utils_Type::escape($_POST['case_id'], 'Positive');
$relType = CRM_Utils_Type::escape($_POST['rel_type'], 'Positive');
if (!$relType || !CRM_Case_BAO_Case::accessCase($caseId)) {
* return null
*/
public function run() {
- $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
+ $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);
+ $type = CRM_Utils_Request::retrieve('type', 'String', CRM_Core_DAO::$_nullObject);
$this->assign('action', $this->_action);
$this->assign('context', $this->_context);
) {
$this->assign('newClient', TRUE);
}
- $summary = CRM_Case_BAO_Case::getCasesSummary($allCases, $userID);
+ $summary = CRM_Case_BAO_Case::getCasesSummary($allCases, $userID);
$upcoming = CRM_Case_BAO_Case::getCases($allCases, $userID, 'upcoming');
- $recent = CRM_Case_BAO_Case::getCases($allCases, $userID, 'recent');
+ $recent = CRM_Case_BAO_Case::getCases($allCases, $userID, 'recent');
foreach ($upcoming as $key => $value) {
if (strtotime($value['case_scheduled_activity_date']) < time()) {
$controller->run();
$this->assign('caseId', $this->_id);
- $output = CRM_Core_Selector_Controller::SESSION;
- $selector = new CRM_Activity_Selector_Activity($this->_contactId, $this->_permission, FALSE, 'case');
+ $output = CRM_Core_Selector_Controller::SESSION;
+ $selector = new CRM_Activity_Selector_Activity($this->_contactId, $this->_permission, FALSE, 'case');
$controller =
new CRM_Core_Selector_Controller(
$selector,
break;
case 'fulltext':
- $action = CRM_Utils_Request::retrieve('action', 'String', $this);
+ $action = CRM_Utils_Request::retrieve('action', 'String', $this);
$urlParams = 'force=1';
$urlString = 'civicrm/contact/search/custom';
if ($action == CRM_Core_Action::RENEW) {
// submitted form values
$this->_queryParams = &$queryParams;
- $this->_single = $single;
- $this->_limit = $limit;
+ $this->_single = $single;
+ $this->_limit = $limit;
$this->_context = $context;
$this->_additionalClause = $additionalClause;
if ($xml === FALSE) {
$docLink = CRM_Utils_System::docURL2("user/case-management/setup");
CRM_Core_Error::fatal(ts("Configuration file could not be retrieved for case type = '%1' %2.",
- array(1 => $caseType, 2 => $docLink)
- ));
+ array(1 => $caseType, 2 => $docLink)
+ ));
return FALSE;
}
if ($xml === FALSE) {
$docLink = CRM_Utils_System::docURL2("user/case-management/setup");
CRM_Core_Error::fatal(ts("Unable to load configuration file for the referenced case type: '%1' %2.",
- array(1 => $caseType, 2 => $docLink)
- ));
+ array(1 => $caseType, 2 => $docLink)
+ ));
return FALSE;
}
*/
public function process($xml, &$params) {
$standardTimeline = CRM_Utils_Array::value('standardTimeline', $params);
- $activitySetName = CRM_Utils_Array::value('activitySetName', $params);
+ $activitySetName = CRM_Utils_Array::value('activitySetName', $params);
$activityTypeName = CRM_Utils_Array::value('activityTypeName', $params);
if ('Open Case' == CRM_Utils_Array::value('activityTypeName', $params)) {
foreach ($caseRoleXML->RelationshipType as $relationshipTypeXML) {
if ((int ) $relationshipTypeXML->creator == 1) {
if (!$this->createRelationships((string ) $relationshipTypeXML->name,
- $params
- )) {
+ $params
+ )
+ ) {
CRM_Core_Error::fatal();
return FALSE;
}
*/
public function processStandardTimeline($activitySetXML, &$params) {
if ('Change Case Type' == CRM_Utils_Array::value('activityTypeName', $params)
- && CRM_Utils_Array::value('resetTimeline', $params, TRUE)) {
+ && CRM_Utils_Array::value('resetTimeline', $params, TRUE)
+ ) {
// delete all existing activities which are non-empty
$this->deleteEmptyActivity($params);
}
if ($relationshipTypeID === FALSE) {
$docLink = CRM_Utils_System::docURL2("user/case-management/setup");
CRM_Core_Error::fatal(ts('Relationship type %1, found in case configuration file, is not present in the database %2',
- array(1 => $relationshipTypeName, 2 => $docLink)
- ));
+ array(1 => $relationshipTypeName, 2 => $docLink)
+ ));
return FALSE;
}
foreach ($activityTypesXML as $activityTypeXML) {
foreach ($activityTypeXML as $recordXML) {
$activityTypeName = (string ) $recordXML->name;
- $maxInstances = (string ) $recordXML->max_instances;
+ $maxInstances = (string ) $recordXML->max_instances;
$activityTypeInfo = CRM_Utils_Array::value($activityTypeName, $activityTypes);
if ($activityTypeInfo['id']) {
";
$sqlParams = array(
- 1 => array($params['activityTypeID'], 'Integer'),
+ 1 => array($params['activityTypeID'], 'Integer'),
2 => array($params['caseID'], 'Integer'),
);
$count = CRM_Core_DAO::singleValueQuery($query, $sqlParams);
*/
public function createActivity($activityTypeXML, &$params) {
$activityTypeName = (string) $activityTypeXML->name;
- $activityTypes = &$this->allActivityTypes(TRUE, TRUE);
+ $activityTypes = &$this->allActivityTypes(TRUE, TRUE);
$activityTypeInfo = CRM_Utils_Array::value($activityTypeName, $activityTypes);
if (!$activityTypeInfo) {
$docLink = CRM_Utils_System::docURL2("user/case-management/setup");
CRM_Core_Error::fatal(ts('Activity type %1, found in case configuration file, is not present in the database %2',
- array(1 => $activityTypeName, 2 => $docLink)
- ));
+ array(1 => $activityTypeName, 2 => $docLink)
+ ));
return FALSE;
}
public function &getRedactionRules() {
foreach (array(
- 'redactionStringRules', 'redactionRegexRules') as $key => $rule) {
+ 'redactionStringRules',
+ 'redactionRegexRules'
+ ) as $key => $rule) {
$$rule = CRM_Case_PseudoConstant::redactionRule($key);
if (!empty($$rule)) {
$dao = new CRM_Case_DAO_Case();
$dao->id = $caseID;
if ($dao->find(TRUE)) {
- $case['subject'] = $dao->subject;
+ $case['subject'] = $dao->subject;
$case['start_date'] = $dao->start_date;
- $case['end_date'] = $dao->end_date;
+ $case['end_date'] = $dao->end_date;
// FIXME: when we resolve if case_type_is single or multi-select
if (strpos($dao->case_type_id, CRM_Core_DAO::VALUE_SEPARATOR) !== FALSE) {
$caseTypeID = substr($dao->case_type_id, 1, -1);
if ($clientID) {
$clientID = CRM_Utils_Type::escape($clientID, 'Integer');
if (!in_array($activityTypeInfo['name'], array(
- 'Email', 'Inbound Email'))) {
+ 'Email',
+ 'Inbound Email'
+ ))
+ ) {
$activity['editURL'] = CRM_Utils_System::url('civicrm/case/activity',
"reset=1&cid={$clientID}&caseid={$activityDAO->caseID}&action=update&atype={$activityDAO->activity_type_id}&id={$activityDAO->id}"
);
if (!empty($activityDAO->targetID)) {
// Re-lookup the target ID since the DAO only has the first recipient if there are multiple.
// Maybe not the best solution.
- $targetNames = CRM_Activity_BAO_ActivityContact::getNames($activityDAO->id, $targetID);
+ $targetNames = CRM_Activity_BAO_ActivityContact::getNames($activityDAO->id, $targetID);
$processTarget = FALSE;
- $label = ts('With Contact(s)');
+ $label = ts('With Contact(s)');
if (in_array($activityTypeInfo['name'], array('Email', 'Inbound Email'))) {
$processTarget = TRUE;
$label = ts('Recipient');
);
$reporterSortName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
- $source_contact_id,
+ $source_contact_id,
'sort_name'
);
if (!array_key_exists($reporterSortName, $this->_redactionStringRules)) {
}
$query .= "ORDER BY cg.weight, cf.weight";
$params = array(
- 1 => array($activityTypeID,
+ 1 => array(
+ $activityTypeID,
'Integer',
- ));
+ )
+ );
$dao = CRM_Core_DAO::executeQuery($query, $params);
$result = $options = $sql = $groupTitle = array();
// next get activity set Informtion
$activitySet = array(
- 'label' => $form->getActivitySetLabel($xml, $activitySetName),
+ 'label' => $form->getActivitySetLabel($xml, $activitySetName),
'includeActivities' => 'All',
'redact' => 'false',
);
}
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);
- $isRedact = CRM_Utils_Request::retrieve('redact', 'Boolean', CRM_Core_DAO::$_nullObject);
+ $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);
+ $isRedact = CRM_Utils_Request::retrieve('redact', 'Boolean', CRM_Core_DAO::$_nullObject);
$includeActivities = CRM_Utils_Request::retrieve('all', 'Positive', CRM_Core_DAO::$_nullObject);
- $params = $otherRelationships = $globalGroupInfo = array();
- $report = new CRM_Case_XMLProcessor_Report($isRedact);
+ $params = $otherRelationships = $globalGroupInfo = array();
+ $report = new CRM_Case_XMLProcessor_Report($isRedact);
if ($includeActivities) {
$params['include_activities'] = 1;
}
}
/**
- * @param array<String,SimpleXMLElement> $xml
+ * @param array <String,SimpleXMLElement> $xml
*/
public function __construct($allCaseTypes = NULL, $xml = array()) {
$this->allCaseTypes = $allCaseTypes;
$location['url'] = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $dao->contact_id);
$location['location_type'] = $dao->location_type;
$location['image'] = CRM_Contact_BAO_Contact_Utils::getImage(isset($dao->contact_sub_type) ?
- $dao->contact_sub_type : $dao->contact_type, $imageUrlOnly, $dao->contact_id
+ $dao->contact_sub_type : $dao->contact_type, $imageUrlOnly, $dao->contact_id
);
$locations[] = $location;
}
$old = $new = array();
foreach ($oldWebsiteValues as $idx => $value) {
- if (! empty($value['url'])) {
+ if (!empty($value['url'])) {
$oldEmpty = FALSE;
$old[] = array('website_type_id' => $value['website_type_id'], 'url' => $value['url']);
}
}
foreach ($newWebsiteValues as $idx => $value) {
- if (! empty($value['url'])) {
+ if (!empty($value['url'])) {
$newEmpty = FALSE;
$new[] = array('website_type_id' => $value['website_type_id'], 'url' => $value['url']);
}
unset($new[$newID]);
break;
}
- if (! $found) {
+ if (!$found) {
return;
}
}
$old = $new = array();
foreach ($oldEmailValues as $idx => $value) {
- if (! empty($value['email'])) {
+ if (!empty($value['email'])) {
$oldEmpty = FALSE;
$old[] = array(
- 'email' => $value['email'],
+ 'email' => $value['email'],
'location_type_id' => $value['location_type_id'],
- 'on_hold' => $value['on_hold'] ? 1 : 0,
- 'is_primary' => $value['is_primary'] ? 1 : 0,
- 'is_bulkmail' => $value['is_bulkmail'] ? 1 : 0,
- 'signature_text' => $value['signature_text'] ? $value['signature_text'] : '',
- 'signature_html' => $value['signature_html'] ? $value['signature_html'] : '',
+ 'on_hold' => $value['on_hold'] ? 1 : 0,
+ 'is_primary' => $value['is_primary'] ? 1 : 0,
+ 'is_bulkmail' => $value['is_bulkmail'] ? 1 : 0,
+ 'signature_text' => $value['signature_text'] ? $value['signature_text'] : '',
+ 'signature_html' => $value['signature_html'] ? $value['signature_html'] : '',
);
}
}
foreach ($newEmailValues as $idx => $value) {
- if (! empty($value['email'])) {
+ if (!empty($value['email'])) {
$newEmpty = FALSE;
$new[] = array(
- 'email' => $value['email'],
+ 'email' => $value['email'],
'location_type_id' => $value['location_type_id'],
- 'on_hold' => $value['on_hold'] ? 1 : 0,
- 'is_primary' => $value['is_primary'] ? 1 : 0,
- 'is_bulkmail' => $value['is_bulkmail'] ? 1 : 0,
- 'signature_text' => $value['signature_text'] ? $value['signature_text'] : '',
- 'signature_html' => $value['signature_html'] ? $value['signature_html'] : '',
+ 'on_hold' => $value['on_hold'] ? 1 : 0,
+ 'is_primary' => $value['is_primary'] ? 1 : 0,
+ 'is_bulkmail' => $value['is_bulkmail'] ? 1 : 0,
+ 'signature_text' => $value['signature_text'] ? $value['signature_text'] : '',
+ 'signature_html' => $value['signature_html'] ? $value['signature_html'] : '',
);
}
}
unset($new[$newID]);
break;
}
- if (! $found) {
+ if (!$found) {
return;
}
}
";
}
$params = array(
- 1 => array($contactID, 'Integer'),
+ 1 => array($contactID, 'Integer'),
2 => array($selectedContactID, 'Integer'),
);
return CRM_Core_DAO::singleValueQuery($query, $params);
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)
- )) {
+ CRM_Utils_Request::retrieve('cs', 'String', $form, FALSE)
+ )
+ ) {
if ($redirect) {
// also set a message in the UF framework
$message = ts('You do not have permission to edit this contact record. Contact the site administrator if you need assistance.');
);
list($valid, $invalid, $duplicate,
$saved, $relationshipIds
- ) = CRM_Contact_BAO_Relationship::createMultiple($relationshipParams, $cid);
+ ) = CRM_Contact_BAO_Relationship::createMultiple($relationshipParams, $cid);
// In case we change employer, clean previous employer related records.
break;
case 'Household':
- $form->add('text', 'household_name', ts('Household Name'), $attributes['household_name']);
+ $form->add('text', 'household_name', ts('Household Name'), $attributes['household_name']);
break;
default:
// check permission on acl basis.
if (in_array($task, array(
- 'view', 'edit'))) {
+ 'view',
+ 'edit'
+ ))) {
$aclPermission = CRM_Core_Permission::VIEW;
if ($task == 'edit') {
$aclPermission = CRM_Core_Permission::EDIT;
}
}
if (!empty($originalId) && array_key_exists('merge', $hasPermissions)) {
- $rgBao = new CRM_Dedupe_BAO_RuleGroup();
+ $rgBao = new CRM_Dedupe_BAO_RuleGroup();
$rgBao->contact_type = $dao->contact_type;
- $rgBao->used = 'Supervised';
+ $rgBao->used = 'Supervised';
if ($rgBao->find(TRUE)) {
$rgid = $rgBao->id;
}
'contact_autocomplete_options'
);
$returnProperties = array_fill_keys(array_merge(array('sort_name'),
- array_keys($autocompleteContactSearch)
- ), 1);
+ array_keys($autocompleteContactSearch)
+ ), 1);
}
$compTable = NULL;
$select = $from = array();
foreach ($returnProperties as $property => $ignore) {
$value = (in_array($property, array(
- 'city', 'street_address'))) ? 'address' : $property;
+ 'city',
+ 'street_address'
+ ))) ? 'address' : $property;
switch ($property) {
case 'sort_name':
if ($componentName == 'Activity') {
//finally retrieve contact details.
if (!empty($select) && !empty($from)) {
- $fromClause = implode(' ', $from);
+ $fromClause = implode(' ', $from);
$selectClause = implode(', ', $select);
- $whereClause = "{$compTable}.id IN (" . implode(',', $componentIds) . ')';
+ $whereClause = "{$compTable}.id IN (" . implode(',', $componentIds) . ')';
$query = "
SELECT contact.id as contactId, $compTable.id as componentId, $selectClause
foreach ($values as $field => $submittedValue) {
if (!in_array($field, $skipFields)) {
if (isset($masterAddress->$field)) {
- $values[$field] = $masterAddress->$field;
+ $values[$field] = $masterAddress->$field;
}
else {
$values[$field] = '';
+ }
}
}
}
}
- }
/**
* Get the list of contact name give address associated array
*/
public static function updateGreeting($params) {
$contactType = $params['ct'];
- $greeting = $params['gt'];
- $valueID = $id = CRM_Utils_Array::value('id', $params);
- $force = CRM_Utils_Array::value('force', $params);
- $limit = CRM_Utils_Array::value('limit', $params);
+ $greeting = $params['gt'];
+ $valueID = $id = CRM_Utils_Array::value('id', $params);
+ $force = CRM_Utils_Array::value('force', $params);
+ $limit = CRM_Utils_Array::value('limit', $params);
// if valueID is not passed use default value
if (!$valueID) {
$dao = CRM_Core_DAO::executeQuery($sql);
while ($dao->fetch()) {
if (!empty($dao->parent_id)) {
- $key = $isSeparator ? $dao->parent_name . $separator . $dao->child_name : $dao->child_name;
+ $key = $isSeparator ? $dao->parent_name . $separator . $dao->child_name : $dao->child_name;
$label = "- {$dao->child_label}";
$pName = $dao->parent_name;
}
else {
- $key = $dao->child_name;
+ $key = $dao->child_name;
$label = $dao->child_label;
$pName = $dao->child_name;
}
/**
* Retrieve the basic contact type associated with given subType.
*
- * @param array/string $subType contact subType.
+ * @param array /string $subType contact subType.
* @return array/string of basicTypes.
* @static
*/
$contactType->save();
if ($contactType->find(TRUE)) {
$contactName = $contactType->name;
- $contact = ucfirst($contactType->label);
- $active = $contactType->is_active;
+ $contact = ucfirst($contactType->label);
+ $active = $contactType->is_active;
}
if (!empty($params['id'])) {
public static function hasRelationships($contactId, $contactType) {
$subTypeClause = NULL;
if (self::isaSubType($contactType)) {
- $subType = $contactType;
- $contactType = self::getBasicType($subType);
+ $subType = $contactType;
+ $contactType = self::getBasicType($subType);
$subTypeClause = " AND ( ( crt.contact_type_a = '{$contactType}' AND crt.contact_sub_type_a = '{$subType}') OR
( crt.contact_type_b = '{$contactType}' AND crt.contact_sub_type_b = '{$subType}') ) ";
}
$customSet = $subTypeClause = array();
foreach ($subtypeSet as $subtype) {
- $subtype = CRM_Utils_Type::escape($subtype, 'String');
- $subType = CRM_Core_DAO::VALUE_SEPARATOR . $subtype . CRM_Core_DAO::VALUE_SEPARATOR;
+ $subtype = CRM_Utils_Type::escape($subtype, 'String');
+ $subType = CRM_Core_DAO::VALUE_SEPARATOR . $subtype . CRM_Core_DAO::VALUE_SEPARATOR;
$subTypeClause[] = "extends_entity_column_value LIKE '%{$subtype}%' ";
}
$query = "SELECT table_name
<?php
- /*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
- */
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.6 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+*/
- /**
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
- * $Id$
- */
+/**
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2014
+ * $Id$
+ */
class CRM_Contact_BAO_DashboardContact extends CRM_Contact_DAO_DashboardContact {
}
CRM_Core_DAO::executeQuery($query, $params);
if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME,
- 'is_enabled'
- )) {
+ 'is_enabled'
+ )
+ ) {
// clear any descendant groups cache if exists
CRM_Core_BAO_Cache::deleteGroup('descendant groups for an org');
}
if (isset($params['group_type'])) {
if (is_array($params['group_type'])) {
$params['group_type'] = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
- array_keys($params['group_type'])
- ) . CRM_Core_DAO::VALUE_SEPARATOR;
+ array_keys($params['group_type'])
+ ) . CRM_Core_DAO::VALUE_SEPARATOR;
}
}
else {
// we need the $params one to be in it's original form & we are not sure what test coverage we have on that
if (isset($group->parents) && is_array($group->parents)) {
$group->parents = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
- array_keys($group->parents)
- ) . CRM_Core_DAO::VALUE_SEPARATOR;
+ array_keys($group->parents)
+ ) . CRM_Core_DAO::VALUE_SEPARATOR;
}
if (empty($params['id']) &&
!$nameParam
//save the mapping for search builder
if (!$ssId) {
//save record in mapping table
- $temp = array();
+ $temp = array();
$mappingParams = array('mapping_type' => 'Search Builder');
- $mapping = CRM_Core_BAO_Mapping::add($mappingParams, $temp);
- $mappingId = $mapping->id;
+ $mapping = CRM_Core_BAO_Mapping::add($mappingParams, $temp);
+ $mappingId = $mapping->id;
}
else {
//get the mapping id from saved search
*/
static public function getGroupListSelector(&$params) {
// format the params
- $params['offset'] = ($params['page'] - 1) * $params['rp'];
+ $params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['rowCount'] = $params['rp'];
- $params['sort'] = CRM_Utils_Array::value('sortBy', $params);
+ $params['sort'] = CRM_Utils_Array::value('sortBy', $params);
// get groups
$groups = CRM_Contact_BAO_Group::getGroupList($params);
if ($groupType) {
$types = explode(',', $groupType);
if (!empty($types)) {
- $clauses[] = 'groups.group_type LIKE %2';
+ $clauses[] = 'groups.group_type LIKE %2';
$typeString = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, $types) . CRM_Core_DAO::VALUE_SEPARATOR;
- $params[2] = array($typeString, 'String', TRUE);
+ $params[2] = array($typeString, 'String', TRUE);
}
}
list($numContactsAdded,
$numContactsNotAdded
- ) = self::bulkAddContactsToGroup($contactIds,
+ ) = self::bulkAddContactsToGroup($contactIds,
$groupId,
$method,
$status,
* Check to see if we have cache entries for this group
* if not, regenerate, else return
*
- * @param int/array $groupID groupID of group that we are checking against
+ * @param int /array $groupID groupID of group that we are checking against
* if empty, all groups are checked
* @param int $limit
* Limits the number of groups we evaluate.
if (!empty($refreshGroupIDs)) {
$refreshGroupIDString = CRM_Core_DAO::escapeString(implode(', ', $refreshGroupIDs));
- $time = CRM_Utils_Date::getUTCTime(self::smartGroupCacheTimeout() * 60);
+ $time = CRM_Utils_Date::getUTCTime(self::smartGroupCacheTimeout() * 60);
$query = "
UPDATE civicrm_group g
SET g.refresh_date = $time
// to avoid long strings, lets do BULK_INSERT_COUNT values at a time
while (!empty($values)) {
$processed = TRUE;
- $input = array_splice($values, 0, CRM_Core_DAO::BULK_INSERT_COUNT);
- $str = implode(',', $input);
- $sql = "INSERT IGNORE INTO civicrm_group_contact_cache (group_id,contact_id) VALUES $str;";
+ $input = array_splice($values, 0, CRM_Core_DAO::BULK_INSERT_COUNT);
+ $str = implode(',', $input);
+ $sql = "INSERT IGNORE INTO civicrm_group_contact_cache (group_id,contact_id) VALUES $str;";
CRM_Core_DAO::executeQuery($sql);
}
self::updateCacheTime($groupID, $processed);
if ($processed) {
// also update the group with cache date information
//make sure to give original timezone settings again.
- $now = CRM_Utils_Date::getUTCTime();
+ $now = CRM_Utils_Date::getUTCTime();
$refresh = 'null';
}
else {
- $now = 'null';
+ $now = 'null';
$refresh = 'null';
}
}
$refresh = NULL;
- $params = array();
+ $params = array();
$smartGroupCacheTimeout = self::smartGroupCacheTimeout();
- $now = CRM_Utils_Date::getUTCTime();
+ $now = CRM_Utils_Date::getUTCTime();
$refreshTime = CRM_Utils_Date::getUTCTime($smartGroupCacheTimeout * 60);
if (!isset($groupID)) {
return;
}
- $sql = NULL;
- $idName = 'id';
+ $sql = NULL;
+ $idName = 'id';
$customClass = NULL;
if ($savedSearchID) {
$ssParams = CRM_Contact_BAO_SavedSearch::getSearchParams($savedSearchID);
FALSE,
CRM_Utils_Array::value('display_relationship_type', $formValues),
CRM_Utils_Array::value('operator', $formValues, 'AND')
- );
+ );
$query->_useDistinct = FALSE;
- $query->_useGroupBy = FALSE;
- $searchSQL =
+ $query->_useGroupBy = FALSE;
+ $searchSQL =
$query->searchQuery(
0, 0, NULL,
- FALSE, FALSE,
- FALSE, TRUE,
- TRUE,
- NULL, NULL, NULL,
- TRUE
- );
+ FALSE, FALSE,
+ FALSE, TRUE,
+ TRUE,
+ NULL, NULL, NULL,
+ TRUE
+ );
}
$groupID = CRM_Utils_Type::escape($groupID, 'Integer');
$sql = $searchSQL . " AND contact_a.id NOT IN (
$groupIDs = array($groupID);
self::remove($groupIDs);
$processed = FALSE;
- $tempTable = 'civicrm_temp_group_contact_cache' . rand(0,2000);
+ $tempTable = 'civicrm_temp_group_contact_cache' . rand(0, 2000);
foreach (array($sql, $sqlB) as $selectSql) {
if (!$selectSql) {
continue;
if (
isset($config->smartGroupCacheTimeout) &&
is_numeric($config->smartGroupCacheTimeout) &&
- $config->smartGroupCacheTimeout > 0) {
+ $config->smartGroupCacheTimeout > 0
+ ) {
return $config->smartGroupCacheTimeout;
}
$this->valid() &&
!$this->_alreadyStyled
) {
- $styledGroup = clone($this->_current);
+ $styledGroup = clone($this->_current);
$nestingLevel = $this->getCurrentNestingLevel();
- $indent = '';
+ $indent = '';
while ($nestingLevel--) {
$indent .= $this->_styleIndent;
}
$nextGroup = $this->_getNextSiblingGroup($currentGroup);
if (!$nextGroup) {
// no sibling, find an ancestor w/ a sibling
- for (;;) {
+ for (; ;) {
// since we pop this array everytime, we should be
// reasonably safe from infinite loops, I think :)
$ancestor = array_pop($this->_parentStack);
*/
public function _getNextParentlessGroup(&$group = NULL) {
$lastParentlessGroup = $this->_lastParentlessGroup;
- $nextGroup = new CRM_Contact_BAO_Group();
+ $nextGroup = new CRM_Contact_BAO_Group();
$nextGroup->order_by = 'title ' . self::$_sortOrder;
$nextGroup->find();
if ($group == NULL) {
$values = array();
foreach (array_keys($tree) as $id) {
- $parents = implode(',', $tree[$id]['parents']);
+ $parents = implode(',', $tree[$id]['parents']);
$children = implode(',', $tree[$id]['children']);
- $parents = $parents == NULL ? 'null' : "'$parents'";
+ $parents = $parents == NULL ? 'null' : "'$parents'";
$children = $children == NULL ? 'null' : "'$children'";
- $sql = "
+ $sql = "
UPDATE civicrm_group
SET parents = $parents ,
children = $children
}
}
- $sortName = $displayName = '';
- $firstName = CRM_Utils_Array::value('first_name', $params, '');
+ $sortName = $displayName = '';
+ $firstName = CRM_Utils_Array::value('first_name', $params, '');
$middleName = CRM_Utils_Array::value('middle_name', $params, '');
- $lastName = CRM_Utils_Array::value('last_name', $params, '');
- $nickName = CRM_Utils_Array::value('nick_name', $params, '');
- $prefix_id = CRM_Utils_Array::value('prefix_id', $params, '');
- $suffix_id = CRM_Utils_Array::value('suffix_id', $params, '');
+ $lastName = CRM_Utils_Array::value('last_name', $params, '');
+ $nickName = CRM_Utils_Array::value('nick_name', $params, '');
+ $prefix_id = CRM_Utils_Array::value('prefix_id', $params, '');
+ $suffix_id = CRM_Utils_Array::value('suffix_id', $params, '');
$formalTitle = CRM_Utils_Array::value('formal_title', $params, '');
// get prefix and suffix names
foreach (array('last', 'middle', 'first', 'nick') as $name) {
$phpName = "{$name}Name";
- $dbName = "{$name}_name";
- $value = $individual->$dbName;
+ $dbName = "{$name}_name";
+ $value = $individual->$dbName;
if (in_array($name, $useDBNames)) {
- $params[$dbName] = $value;
+ $params[$dbName] = $value;
$contact->$dbName = $value;
- $$phpName = $value;
+ $$phpName = $value;
}
elseif (array_key_exists($dbName, $params)) {
$$phpName = $params[$dbName];
}
foreach (array('prefix', 'suffix') as $name) {
- $dbName = "{$name}_id";
+ $dbName = "{$name}_id";
$value = $individual->$dbName;
if (in_array($name, $useDBNames)) {
if (in_array('formal_title', $useDBNames)) {
$params['formal_title'] = $individual->formal_title;
- $contact->formal_title = $individual->formal_title;
- $formalTitle = $individual->formal_title;
+ $contact->formal_title = $individual->formal_title;
+ $formalTitle = $individual->formal_title;
}
elseif (array_key_exists('formal_title', $params)) {
$formalTitle = $params['formal_title'];
$format = CRM_Utils_Date::getDateFormat('birth');
if ($date = CRM_Utils_Array::value('birth_date', $params)) {
if (in_array($format, array(
- 'dd-mm', 'mm/dd'))) {
+ 'dd-mm',
+ 'mm/dd'
+ ))) {
$separator = '/';
if ($format == 'dd-mm') {
$separator = '-';
$date = $date . $separator . '1902';
}
elseif (in_array($format, array(
- 'yy-mm'))) {
+ 'yy-mm'
+ ))) {
$date = $date . '-01';
}
elseif (in_array($format, array(
- 'M yy'))) {
+ 'M yy'
+ ))) {
$date = $date . '-01';
}
elseif (in_array($format, array(
- 'yy'))) {
+ 'yy'
+ ))) {
$date = $date . '-01-01';
}
$contact->birth_date = CRM_Utils_Date::processDate($date);
if ($date = CRM_Utils_Array::value('deceased_date', $params)) {
if (in_array($format, array(
- 'dd-mm', 'mm/dd'))) {
+ 'dd-mm',
+ 'mm/dd'
+ ))) {
$separator = '/';
if ($format == 'dd-mm') {
$separator = '-';
$date = $date . $separator . '1902';
}
elseif (in_array($format, array(
- 'yy-mm'))) {
+ 'yy-mm'
+ ))) {
$date = $date . '-01';
}
elseif (in_array($format, array(
- 'M yy'))) {
+ 'M yy'
+ ))) {
$date = $date . '-01';
}
elseif (in_array($format, array(
- 'yy'))) {
+ 'yy'
+ ))) {
$date = $date . '-01-01';
}
}
// query for the affected individuals
- $fieldValue = CRM_Utils_Type::escape($fieldValue, 'Integer');
- $contact = new CRM_Contact_BAO_Contact();
+ $fieldValue = CRM_Utils_Type::escape($fieldValue, 'Integer');
+ $contact = new CRM_Contact_BAO_Contact();
$contact->$fieldName = $fieldValue;
$contact->find();
* All function arguments and return values measure distances in metres
* and angles in degrees. The ellipsoid model is from the WGS-84 datum.
* Ka-Ping Yee, 2003-08-11
-
* earth_radius_semimajor = 6378137.0;
* earth_flattening = 1/298.257223563;
* earth_radius_semiminor = $earth_radius_semimajor * (1 - $earth_flattening);
* earth_eccentricity_sq = 2*$earth_flattening - pow($earth_flattening, 2);
-
* This library is an implementation of UCB CS graduate student, Ka-Ping Yee (http://www.zesty.ca).
* This version has been taken from Drupal's location module: http://drupal.org/project/location
**/
$lat = deg2rad($latitude);
$cosLong = cos($long);
- $cosLat = cos($lat);
+ $cosLat = cos($lat);
$sinLong = sin($long);
- $sinLat = sin($lat);
+ $sinLat = sin($lat);
$radius = self::$_earthRadiusSemiMajor / sqrt(1 - self::$_earthEccentricitySQ * $sinLat * $sinLat);
* Estimate the min and max longitudes within $distance of a given location.
*/
public static function earthLongitudeRange($longitude, $latitude, $distance) {
- $long = deg2rad($longitude);
- $lat = deg2rad($latitude);
+ $long = deg2rad($longitude);
+ $lat = deg2rad($latitude);
$radius = self::earthRadius($latitude);
- $angle = $distance / $radius;
- $diff = asin(sin($angle) / cos($lat));
+ $angle = $distance / $radius;
+ $diff = asin(sin($angle) / cos($lat));
$minLong = $long - $diff;
$maxLong = $long + $diff;
- if ($minLong < - pi()) {
+ if ($minLong < -pi()) {
$minLong = $minLong + pi() * 2;
}
$maxLong = $maxLong - pi() * 2;
}
- return array(rad2deg($minLong),
+ return array(
+ rad2deg($minLong),
rad2deg($maxLong),
);
}
* Estimate the min and max latitudes within $distance of a given location.
*/
public static function earthLatitudeRange($longitude, $latitude, $distance) {
- $long = deg2rad($longitude);
- $lat = deg2rad($latitude);
+ $long = deg2rad($longitude);
+ $lat = deg2rad($latitude);
$radius = self::earthRadius($latitude);
- $angle = $distance / $radius;
- $minLat = $lat - $angle;
- $maxLat = $lat + $angle;
+ $angle = $distance / $radius;
+ $minLat = $lat - $angle;
+ $maxLat = $lat + $angle;
$rightangle = pi() / 2.0;
// wrapped around the south pole
- if ($minLat < - $rightangle) {
+ if ($minLat < -$rightangle) {
$overshoot = -$minLat - $rightangle;
$minLat = -$rightangle + $overshoot;
if ($minLat > $maxLat) {
$maxLat = $rightangle;
}
- return array(rad2deg($minLat),
+ return array(
+ rad2deg($minLat),
rad2deg($maxLat),
);
}
return $singleton;
}
- /**
- * Get or build the list of search objects (via hook)
- *
- * @return array
+ /**
+ * Get or build the list of search objects (via hook)
+ *
+ * @return array
* of CRM_Contact_BAO_Query_Interface objects
- */
+ */
public function getSearchQueryObjects() {
if ($this->_queryObjects === NULL) {
$this->_queryObjects = array();
//let's load the missing ids here since other things tend to rely on them.
$fieldsToFill = array('contact_id_a', 'contact_id_b', 'relationship_type_id');
$result = CRM_Core_DAO::executeQuery("SELECT " . implode(',', $fieldsToFill) . " FROM civicrm_relationship WHERE id = %1", array(
- 1 => array(
- $params['id'],
- 'Integer',
- ),
- ));
+ 1 => array(
+ $params['id'],
+ 'Integer',
+ ),
+ ));
while ($result->fetch()) {
foreach ($fieldsToFill as $field) {
$params[$field] = !empty($params[$field]) ? $params[$field] : $result->$field;
*/
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',
- ));
+ 'id' => $params['membership_type_id'],
+ 'return' => 'relationship_type_id, relationship_direction',
+ ));
$relationshipTypes = $membershipType['relationship_type_id'];
if (empty($relationshipTypes)) {
return;
SET relationship_type_id = NULL
WHERE relationship_type_id = %1
";
- $params = array(1 => array(CRM_Core_DAO::VALUE_SEPARATOR . $relationshipTypeId . CRM_Core_DAO::VALUE_SEPARATOR, 'String'));
+ $params = array(
+ 1 => array(
+ CRM_Core_DAO::VALUE_SEPARATOR . $relationshipTypeId . CRM_Core_DAO::VALUE_SEPARATOR,
+ 'String'
+ )
+ );
CRM_Core_DAO::executeQuery($query, $params);
//fixed for CRM-3323
// this has not yet been implemented
}
else {
- return CRM_Contact_BAO_Query::getWhereClause($params, NULL, $tables, $whereTables);
- }
+ return CRM_Contact_BAO_Query::getWhereClause($params, NULL, $tables, $whereTables);
+ }
}
return NULL;
}
}
else {
$tables = $whereTables = array('civicrm_contact' => 1, 'civicrm_email' => 1);
- $where = CRM_Contact_BAO_SavedSearch::whereClause($id, $tables, $whereTables);
- $from = CRM_Contact_BAO_Query::fromClause($whereTables);
+ $where = CRM_Contact_BAO_SavedSearch::whereClause($id, $tables, $whereTables);
+ $from = CRM_Contact_BAO_Query::fromClause($whereTables);
return array($from, $where);
}
}
if (!$ext->isExtensionKey($customSearchClass)) {
$customSearchFile = str_replace('_',
- DIRECTORY_SEPARATOR,
- $customSearchClass
- ) . '.php';
+ DIRECTORY_SEPARATOR,
+ $customSearchClass
+ ) . '.php';
}
else {
$customSearchFile = $ext->keyToPath($customSearchClass);
// see if we can figure out the url and redirect to the right search form
// note that this happens really early on, so we cant use any of the form or controller
// variables
- $config = CRM_Core_Config::singleton();
+ $config = CRM_Core_Config::singleton();
$qString = $_GET[$config->userFrameworkURLVar];
$args = "reset=1";
$path = 'civicrm/contact/search/advanced';
$file = self::$_prefix[$type] . $className;
$class = str_replace('/', '_', $file);
- require_once ($file . self::$_suffix);
+ require_once($file . self::$_suffix);
if ($type == 'singleton') {
$newObj = $class::singleton();
$this, TRUE, NULL, 'REQUEST'
);
if (!in_array($this->_contactType,
- array('Individual', 'Household', 'Organization')
- )) {
+ array('Individual', 'Household', 'Organization')
+ )
+ ) {
CRM_Core_Error::statusBounce(ts('Could not get a contact id and/or contact type'));
}
if (
$this->_contactSubType &&
- !(CRM_Contact_BAO_ContactType::isExtendsContactType($this->_contactSubType, $this->_contactType, TRUE))) {
+ !(CRM_Contact_BAO_ContactType::isExtendsContactType($this->_contactSubType, $this->_contactType, TRUE))
+ ) {
CRM_Core_Error::statusBounce(ts("Could not get a valid contact subtype for contact type '%1'", array(1 => $this->_contactType)));
}
FALSE, NULL, 'GET'
);
$typeLabel = CRM_Contact_BAO_ContactType::contactTypePairs(TRUE, $this->_contactSubType ?
- $this->_contactSubType : $this->_contactType
+ $this->_contactSubType : $this->_contactType
);
$typeLabel = implode(' / ', $typeLabel);
}
if ($this->_contactId) {
- $defaults = array();
- $params = array('id' => $this->_contactId);
+ $defaults = array();
+ $params = array('id' => $this->_contactId);
$returnProperities = array('id', 'contact_type', 'contact_sub_type', 'modified_date');
CRM_Core_DAO::commonRetrieve('CRM_Contact_DAO_Contact', $params, $defaults, $returnProperities);
// get default phone and im provider id.
$defPhoneTypeId = key(CRM_Core_OptionGroup::values('phone_type', FALSE, FALSE, FALSE, ' AND is_default = 1'));
$defIMProviderId = key(CRM_Core_OptionGroup::values('instant_messenger_service',
- FALSE, FALSE, FALSE, ' AND is_default = 1'
- ));
+ FALSE, FALSE, FALSE, ' AND is_default = 1'
+ ));
$defWebsiteTypeId = key(CRM_Core_OptionGroup::values('website_type',
FALSE, FALSE, FALSE, ' AND is_default = 1'
));
$hasPrimary[] = $instance;
if (!$primaryID &&
in_array($name, array(
- 'email', 'openid')) && !empty($blockValues[$name])) {
+ 'email',
+ 'openid'
+ )) && !empty($blockValues[$name])
+ ) {
$primaryID = $blockValues[$name];
}
}
}
if ($name == 'openid' && !empty($blockValues[$name])) {
- $oid = new CRM_Core_DAO_OpenID();
+ $oid = new CRM_Core_DAO_OpenID();
$oid->openid = $openIds[$instance] = CRM_Utils_Array::value($name, $blockValues);
- $cid = isset($contactId) ? $contactId : 0;
+ $cid = isset($contactId) ? $contactId : 0;
if ($oid->find(TRUE) && ($oid->contact_id != $cid)) {
$errors["{$name}[$instance][openid]"] = ts('%1 already exist.', array(1 => $blocks['OpenID']));
}
if (!empty($invalidStreetNumbers)) {
$first = $invalidStreetNumbers[0];
- foreach ($invalidStreetNumbers as & $num) $num = CRM_Contact_Form_Contact::ordinalNumber($num);
+ foreach ($invalidStreetNumbers as & $num) {
+ $num = CRM_Contact_Form_Contact::ordinalNumber($num);
+ }
$errors["address[$first][street_number]"] = ts('The street number you entered for the %1 address block(s) is not in an expected format. Street numbers may include numeric digit(s) followed by other characters. You can still enter the complete street address (unparsed) by clicking "Edit Complete Street Address".', array(1 => implode(', ', $invalidStreetNumbers)));
}
}
$deleteExtra = ts('Are you sure you want to delete contact image.');
$deleteURL = array(
CRM_Core_Action::DELETE =>
- array(
- 'name' => ts('Delete Contact Image'),
- 'url' => 'civicrm/contact/image',
- 'qs' => 'reset=1&cid=%%id%%&action=delete',
- 'extra' =>
- 'onclick = "if (confirm( \'' . $deleteExtra . '\' ) ) this.href+=\'&confirmed=1\'; else return false;"',
- ),
+ array(
+ 'name' => ts('Delete Contact Image'),
+ 'url' => 'civicrm/contact/image',
+ 'qs' => 'reset=1&cid=%%id%%&action=delete',
+ 'extra' =>
+ 'onclick = "if (confirm( \'' . $deleteExtra . '\' ) ) this.href+=\'&confirmed=1\'; else return false;"',
+ ),
);
$deleteURL = CRM_Core_Action::formLink($deleteURL,
CRM_Core_Action::DELETE,
return FALSE;
}
- static $skipFields = array('location_type_id', 'is_primary', 'phone_type_id', 'provider_id', 'country_id', 'website_type_id', 'master_id');
+ static $skipFields = array(
+ 'location_type_id',
+ 'is_primary',
+ 'phone_type_id',
+ 'provider_id',
+ 'country_id',
+ 'website_type_id',
+ 'master_id'
+ );
foreach ($fields as $name => $value) {
$skipField = FALSE;
foreach ($skipFields as $skip) {
$contactLinks = CRM_Contact_BAO_Contact_Utils::formatContactIDSToLinks($ids, TRUE, TRUE, $contactID);
$duplicateContactsLinks = '<div class="matching-contacts-found">';
- $duplicateContactsLinks .= ts('One matching contact was found. ', array('count' => count($contactLinks['rows']), 'plural' => '%count matching contacts were found.<br />'));
+ $duplicateContactsLinks .= ts('One matching contact was found. ', array(
+ 'count' => count($contactLinks['rows']),
+ 'plural' => '%count matching contacts were found.<br />'
+ ));
if ($contactLinks['msg'] == 'view') {
- $duplicateContactsLinks .= ts('You can View the existing contact', array('count' => count($contactLinks['rows']), 'plural' => 'You can View the existing contacts'));
+ $duplicateContactsLinks .= ts('You can View the existing contact', array(
+ 'count' => count($contactLinks['rows']),
+ 'plural' => 'You can View the existing contacts'
+ ));
}
else {
- $duplicateContactsLinks .= ts('You can View or Edit the existing contact', array('count' => count($contactLinks['rows']), 'plural' => 'You can View or Edit the existing contacts'));
+ $duplicateContactsLinks .= ts('You can View or Edit the existing contact', array(
+ 'count' => count($contactLinks['rows']),
+ 'plural' => 'You can View or Edit the existing contacts'
+ ));
}
if ($contactLinks['msg'] == 'merge') {
// We should also get a merge link if this is for an existing contact
$errors['_qf_default'] = $duplicateContactsLinks;
-
// let smarty know that there are duplicates
$template = CRM_Core_Smarty::singleton();
$template->assign('isDuplicate', 1);
$buildStreetAddress = FALSE;
$parseFieldName = 'street_address';
foreach (array(
- 'street_number', 'street_name', 'street_unit') as $fld) {
+ 'street_number',
+ 'street_name',
+ 'street_unit'
+ ) as $fld) {
if (!empty($address[$fld])) {
$parseFieldName = 'street_number';
$buildStreetAddress = TRUE;
$streetAddress = NULL;
foreach (array(
- 'street_number', 'street_number_suffix', 'street_name', 'street_unit') as $fld) {
+ 'street_number',
+ 'street_number_suffix',
+ 'street_name',
+ 'street_unit'
+ ) as $fld) {
if (in_array($fld, array(
- 'street_name', 'street_unit'))) {
+ 'street_name',
+ 'street_unit'
+ ))) {
$streetAddress .= ' ';
}
$streetAddress .= CRM_Utils_Array::value($fld, $address);
*/
public function updateMembershipStatus($deceasedParams) {
$updateMembershipMsg = NULL;
- $contactId = CRM_Utils_Array::value('contact_id', $deceasedParams);
- $deceasedDate = CRM_Utils_Array::value('deceased_date', $deceasedParams);
+ $contactId = CRM_Utils_Array::value('contact_id', $deceasedParams);
+ $deceasedDate = CRM_Utils_Array::value('deceased_date', $deceasedParams);
// process to set membership status to deceased for both active/inactive membership
if ($contactId &&
- $this->_contactType == 'Individual' && !empty($deceasedParams['is_deceased'])) {
+ $this->_contactType == 'Individual' && !empty($deceasedParams['is_deceased'])
+ ) {
$session = CRM_Core_Session::singleton();
$userId = $session->get('userID');
$dao->whereAdd("status_id != $deceasedStatusId");
$dao->find();
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name');
- $allStatus = CRM_Member_PseudoConstant::membershipStatus();
+ $allStatus = CRM_Member_PseudoConstant::membershipStatus();
$memCount = 0;
while ($dao->fetch()) {
// update status to deceased (for both active/inactive membership )
public $_multiRecordDisplay;
public $_copyValueId;
+
/**
* Pre processing work done here.
*
$cgcount += 1;
$buttonName = $this->controller->getButtonName();
if ($buttonName == $this->getButtonName('upload', 'new')) {
- CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/contact/view/cd/edit', "reset=1&type={$this->_contactType}&groupID={$this->_groupID}&entityID={$this->_tableID}&cgcount={$cgcount}&multiRecordDisplay=single&mode=add"));
+ CRM_Core_Session::singleton()
+ ->pushUserContext(CRM_Utils_System::url('civicrm/contact/view/cd/edit', "reset=1&type={$this->_contactType}&groupID={$this->_groupID}&entityID={$this->_tableID}&cgcount={$cgcount}&multiRecordDisplay=single&mode=add"));
}
// reset the group contact cache for this group
CRM_Contact_BAO_GroupContactCache::remove();
$rgDao->id = $this->_rgid;
}
- $rgDao->title = $values['title'];
- $rgDao->is_reserved = CRM_Utils_Array::value('is_reserved', $values, FALSE);
- $rgDao->used = $values['used'];
+ $rgDao->title = $values['title'];
+ $rgDao->is_reserved = CRM_Utils_Array::value('is_reserved', $values, FALSE);
+ $rgDao->used = $values['used'];
$rgDao->contact_type = $this->_contactType;
- $rgDao->threshold = $values['threshold'];
+ $rgDao->threshold = $values['threshold'];
$rgDao->save();
// make sure name is set only during insert
if ($dao->fetch()) {
// set the length to null for all the fields where prefix length is not supported. eg. int,tinyint,date,enum etc dataTypes.
- if ($dao->COLUMN_NAME == $field && !in_array($dao->DATA_TYPE, array('char', 'varchar', 'binary', 'varbinary', 'text', 'blob'))) {
+ if ($dao->COLUMN_NAME == $field && !in_array($dao->DATA_TYPE, array(
+ 'char',
+ 'varchar',
+ 'binary',
+ 'varbinary',
+ 'text',
+ 'blob'
+ ))
+ ) {
$length = NULL;
}
elseif ($dao->COLUMN_NAME == $field && !empty($dao->CHARACTER_MAXIMUM_LENGTH) && ($length > $dao->CHARACTER_MAXIMUM_LENGTH)) {
* @return array
*/
public function setDefaultValues() {
- $defaults = array();
- $params = array();
+ $defaults = array();
+ $params = array();
if (isset($this->_id)) {
$params['id'] = $this->_id;
CRM_Contact_Form_Location::buildQuickForm($this);
$this->addButtons(array(
- array(
- 'type' => 'next',
- 'name' => ts('Save'),
- 'subName' => 'view',
- 'isDefault' => TRUE,
- ),
- array(
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ),
- ));
+ array(
+ 'type' => 'next',
+ 'name' => ts('Save'),
+ 'subName' => 'view',
+ 'isDefault' => TRUE,
+ ),
+ array(
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ),
+ ));
if ($this->_action & CRM_Core_Action::VIEW) {
$this->freeze();
$params += array('contact_id' => $this->_contactId);
$contactParams = array(
- 'sort_name' => $domain->name,
+ 'sort_name' => $domain->name,
'display_name' => $domain->name,
- 'legal_name' => $domain->name,
+ 'legal_name' => $domain->name,
'organization_name' => $domain->name,
'contact_id' => $this->_contactId,
'contact_type' => 'Organization',
}
//make location type required for inline edit
- $form->addSelect("address[$blockId][location_type_id]", array('entity' => 'address', 'class' => 'eight') + $js, $inlineEdit);
+ $form->addSelect("address[$blockId][location_type_id]", array(
+ 'entity' => 'address',
+ 'class' => 'eight'
+ ) + $js, $inlineEdit);
if (!$inlineEdit) {
$js = array('id' => 'Address_' . $blockId . '_IsPrimary', 'onClick' => 'singleSelect( this.id );');
'supplemental_address_1' => array(ts('Supplemental Address 1'), $attributes['supplemental_address_1'], NULL),
'supplemental_address_2' => array(ts('Supplemental Address 2'), $attributes['supplemental_address_2'], NULL),
'city' => array(ts('City'), $attributes['city'], NULL),
- 'postal_code' => array(ts('Zip / Postal Code'), array_merge($attributes['postal_code'], array('class' => 'crm_postal_code')), NULL),
- 'postal_code_suffix' => array(ts('Postal Code Suffix'), array('size' => 4, 'maxlength' => 12, 'class' => 'crm_postal_code_suffix'), NULL),
+ 'postal_code' => array(
+ ts('Zip / Postal Code'),
+ array_merge($attributes['postal_code'], array('class' => 'crm_postal_code')),
+ NULL
+ ),
+ 'postal_code_suffix' => array(
+ ts('Postal Code Suffix'),
+ array('size' => 4, 'maxlength' => 12, 'class' => 'crm_postal_code_suffix'),
+ NULL
+ ),
'country_id' => array(ts('Country'), $attributes['country_id'], 'country'),
'state_province_id' => array(ts('State/Province'), $attributes['state_province_id'], NULL),
'county_id' => array(ts('County'), $attributes['county_id'], NULL),
if (empty($addressOptions[$nameWithoutID])) {
$continue = TRUE;
if (in_array($nameWithoutID, array(
- 'street_number', 'street_name', 'street_unit')) && !empty($addressOptions['street_address_parsing'])) {
+ 'street_number',
+ 'street_name',
+ 'street_unit'
+ )) && !empty($addressOptions['street_address_parsing'])
+ ) {
$continue = FALSE;
}
if ($continue) {
CRM_Contact_Form_Edit_Address::storeRequiredCustomDataInfo($form, $groupTree);
}
- $template = CRM_Core_Smarty::singleton();
+ $template = CRM_Core_Smarty::singleton();
$tplGroupTree = $template->get_template_vars('address_groupTree');
$tplGroupTree = empty($tplGroupTree) ? array() : $tplGroupTree;
$form->addElement('checkbox', "address[$blockId][use_shared_address]", NULL, ts('Use another contact\'s address'));
// Override the default profile links to add address form
- $profileLinks = CRM_Core_BAO_UFGroup::getCreateLinks(array('new_individual', 'new_organization', 'new_household'), 'shared_address');
+ $profileLinks = CRM_Core_BAO_UFGroup::getCreateLinks(array(
+ 'new_individual',
+ 'new_organization',
+ 'new_household'
+ ), 'shared_address');
$form->addEntityRef("address[$blockId][master_contact_id]", ts('Share With'), array('create' => $profileLinks));
}
}
$sharedAddresses[$key]['shared_address_display'] = array(
'address' => $addressValue['display'],
'name' => $shareAddressContactNames[$addressValue['master_id']]['name'],
- 'options' => CRM_Core_BAO_Address::getValues(array('entity_id' => $master_cid, 'contact_id' => $master_cid)),
+ 'options' => CRM_Core_BAO_Address::getValues(array(
+ 'entity_id' => $master_cid,
+ 'contact_id' => $master_cid
+ )),
'master_id' => $addressValue['master_id'],
);
$defaults['address'][$key]['master_contact_id'] = $master_cid;
foreach ($defaults['address'] as $cnt => & $address) {
$streetAddress = NULL;
foreach (array(
- 'street_number', 'street_number_suffix', 'street_name', 'street_unit') as $fld) {
+ 'street_number',
+ 'street_number_suffix',
+ 'street_name',
+ 'street_unit'
+ ) as $fld) {
if (in_array($fld, array(
- 'street_name', 'street_unit'))) {
+ 'street_name',
+ 'street_unit'
+ ))) {
$streetAddress .= ' ';
}
$streetAddress .= CRM_Utils_Array::value($fld, $address);
if (!empty($greetingTokens)) {
$form->addElement('select', $fields['field'], $fields['label'],
array(
- '' => ts('- select -')) + $greetingTokens
+ '' => ts('- select -')
+ ) + $greetingTokens
);
//custom addressee
$form->addElement('text', $fields['customField'], $fields['customLabel'],
$form->addRule("email[$blockId][email]", ts('Email is not valid.'), 'email');
if (isset($form->_contactType) || $blockEdit) {
//Block type
- $form->addSelect("email[$blockId][location_type_id]", array('entity' => 'email', 'class' => 'eight', 'placeholder' => NULL));
+ $form->addSelect("email[$blockId][location_type_id]", array(
+ 'entity' => 'email',
+ 'class' => 'eight',
+ 'placeholder' => NULL
+ ));
$multipleBulk = CRM_Core_BAO_Email::isMultipleBulkMail();
$form->addSelect("im[$blockId][provider_id]", array('entity' => 'im', 'class' => 'eight', 'placeholder' => NULL));
//Block type select
- $form->addSelect("im[$blockId][location_type_id]", array('entity' => 'im', 'class' => 'eight', 'placeholder' => NULL));
+ $form->addSelect("im[$blockId][location_type_id]", array(
+ 'entity' => 'im',
+ 'class' => 'eight',
+ 'placeholder' => NULL
+ ));
//IM box
$form->addElement('text', "im[$blockId][name]", ts('Instant Messenger'),
*/
class CRM_Contact_Form_Edit_Organization {
- /**
+ /**
* This function provides the HTML form elements that are specific
* to the Organization Contact Type
*
$form->applyFilter('__ALL__', 'trim');
//phone type select
- $form->addSelect("phone[$blockId][phone_type_id]", array('entity' => 'phone', 'class' => 'eight', 'placeholder' => NULL));
+ $form->addSelect("phone[$blockId][phone_type_id]", array(
+ 'entity' => 'phone',
+ 'class' => 'eight',
+ 'placeholder' => NULL
+ ));
//main phone number with crm_phone class
$form->add('text', "phone[$blockId][phone]", ts('Phone'), array_merge(CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone'), array('class' => 'crm_phone twelve')));
if (isset($form->_contactType) || $blockEdit) {
//Block type select
- $form->addSelect("phone[$blockId][location_type_id]", array('entity' => 'phone', 'class' => 'eight', 'placeholder' => NULL));
+ $form->addSelect("phone[$blockId][location_type_id]", array(
+ 'entity' => 'phone',
+ 'class' => 'eight',
+ 'placeholder' => NULL
+ ));
//is_Primary radio
$js = array('id' => 'Phone_' . $blockId . '_IsPrimary', 'onClick' => 'singleSelect( this.id );');
public static function climbtree($form, $tree, &$elements) {
foreach ($tree as $tagID => $varValue) {
$tagAttribute = array(
- 'onclick' => "return changeRowColor(\"rowidtag_$tagID\")",
- 'id' => "tag_{$tagID}",
+ 'onclick' => "return changeRowColor(\"rowidtag_$tagID\")",
+ 'id' => "tag_{$tagID}",
);
$elements[$tagID] = $form->createElement('checkbox', $tagID, '', '', $tagAttribute);
$msg = ts('Add to a group');
}
- $this->add('select', 'group_id', '', $groupSelect, TRUE, array('class' => 'crm-select2 crm-action-menu action-icon-plus', 'placeholder' => $msg));
+ $this->add('select', 'group_id', '', $groupSelect, TRUE, array(
+ 'class' => 'crm-select2 crm-action-menu action-icon-plus',
+ 'placeholder' => $msg
+ ));
$this->addButtons(array(
array(
*/
public function postProcess() {
$contactID = array($this->_contactId);
- $groupId = $this->controller->exportValue('GroupContact', 'group_id');
- $method = ($this->_context == 'user') ? 'Web' : 'Admin';
+ $groupId = $this->controller->exportValue('GroupContact', 'group_id');
+ $method = ($this->_context == 'user') ? 'Web' : 'Admin';
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID');
$this->ajaxResponse = array_merge(
array(
'changeLog' => array(
- 'count' => CRM_Contact_BAO_Contact::getCountComponent('log', $this->_contactId),
- 'markup' => $smarty->fetch('CRM/common/contactFooter.tpl'),
+ 'count' => CRM_Contact_BAO_Contact::getCountComponent('log', $this->_contactId),
+ 'markup' => $smarty->fetch('CRM/common/contactFooter.tpl'),
),
),
$this->ajaxResponse,
// Process / save contact info
$params['contact_type'] = $this->_contactType;
- $params['contact_id'] = $this->_contactId;
+ $params['contact_id'] = $this->_contactId;
if (!empty($this->_contactSubType)) {
$params['contact_sub_type'] = $this->_contactSubType;
// Process / save contact info
$params['contact_type'] = $this->_contactType;
- $params['contact_id'] = $this->_contactId;
+ $params['contact_id'] = $this->_contactId;
if (!empty($this->_contactSubType)) {
$params['contact_sub_type'] = $this->_contactSubType;
if (count($this->_emails) > 1) {
$actualBlockCount = $totalBlocks = count($this->_emails);
if ($totalBlocks < $this->_blockCount) {
- $additionalBlocks = $this->_blockCount - $totalBlocks;
- $totalBlocks += $additionalBlocks;
- }
+ $additionalBlocks = $this->_blockCount - $totalBlocks;
+ $totalBlocks += $additionalBlocks;
+ }
else {
$actualBlockCount++;
$totalBlocks++;
$hasData[] = $instance;
if (!empty($blockValues['is_primary'])) {
$hasPrimary[] = $instance;
- }
}
}
+ }
if (empty($hasPrimary) && !empty($hasData)) {
if (!empty($blockValues['is_primary'])) {
$hasPrimary[] = $instance;
if (!$primaryID && !empty($blockValues['im'])) {
- $primaryID = $blockValues['im'];
+ $primaryID = $blockValues['im'];
}
}
}
if (!empty($blockValues['is_primary'])) {
$hasPrimary[] = $instance;
if (!$primaryID && !empty($blockValues['openid'])) {
- $primaryID = $blockValues['openid'];
+ $primaryID = $blockValues['openid'];
}
}
}
if (count($this->_phones) > 1) {
$actualBlockCount = $totalBlocks = count($this->_phones);
if ($totalBlocks < $this->_blockCount) {
- $additionalBlocks = $this->_blockCount - $totalBlocks;
- $totalBlocks += $additionalBlocks;
- }
+ $additionalBlocks = $this->_blockCount - $totalBlocks;
+ $totalBlocks += $additionalBlocks;
+ }
else {
$actualBlockCount++;
$totalBlocks++;
if (!empty($blockValues['is_primary'])) {
$hasPrimary[] = $instance;
if (!$primaryID && !empty($blockValues['phone'])) {
- $primaryID = $blockValues['phone'];
+ $primaryID = $blockValues['phone'];
}
}
}
$className = CRM_Utils_System::getClassName($form);
if (in_array($className, array(
- 'CRM_Event_Form_ManageEvent_Location', 'CRM_Contact_Form_Domain'))) {
+ 'CRM_Event_Form_ManageEvent_Location',
+ 'CRM_Contact_Form_Domain'
+ ))) {
$form->_blocks = array(
'Address' => ts('Address'),
'Email' => ts('Email'),
}
$rows = array();
- $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
- $oid = CRM_Utils_Request::retrieve('oid', 'Positive', $this, TRUE);
+ $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
+ $oid = CRM_Utils_Request::retrieve('oid', 'Positive', $this, TRUE);
$flip = CRM_Utils_Request::retrieve('flip', 'Positive', $this, FALSE);
- $this->_rgid = $rgid = CRM_Utils_Request::retrieve('rgid', 'Positive', $this, FALSE);
- $this->_gid = $gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, FALSE);
+ $this->_rgid = $rgid = CRM_Utils_Request::retrieve('rgid', 'Positive', $this, FALSE);
+ $this->_gid = $gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, FALSE);
$this->_mergeId = CRM_Utils_Request::retrieve('mergeId', 'Positive', $this, FALSE);
// Sanity check
// Block access if user does not have EDIT permissions for both contacts.
if (!(CRM_Contact_BAO_Contact_Permission::allow($cid, CRM_Core_Permission::EDIT) &&
- CRM_Contact_BAO_Contact_Permission::allow($oid, CRM_Core_Permission::EDIT)
- )) {
+ CRM_Contact_BAO_Contact_Permission::allow($oid, CRM_Core_Permission::EDIT)
+ )
+ ) {
CRM_Utils_System::permissionDenied();
}
$this->prev = $this->next = NULL;
foreach (array(
- 'prev', 'next') as $position) {
+ 'prev',
+ 'next'
+ ) as $position) {
if (!empty($pos[$position])) {
if ($pos[$position]['id1'] && $pos[$position]['id2']) {
$urlParam = "reset=1&cid={$pos[$position]['id1']}&oid={$pos[$position]['id2']}&mergeId={$pos[$position]['mergeId']}&action=update";
$this->assign('other_cid', $other['contact_id']);
$this->assign('rgid', $rgid);
- $this->_cid = $cid;
- $this->_oid = $oid;
- $this->_rgid = $rgid;
+ $this->_cid = $cid;
+ $this->_oid = $oid;
+ $this->_rgid = $rgid;
$this->_contactType = $main['contact_type'];
$this->addElement('checkbox', 'toggleSelect', NULL, NULL, array('class' => 'select-rows'));
);
CRM_Utils_System::redirect($lisitingURL);
}
- if (!empty($formValues['_qf_Merge_done'])) {
+ if (!empty($formValues['_qf_Merge_done'])) {
CRM_Utils_System::redirect($url);
}
$prefix = 'honor';
$honoreeProfileFields = CRM_Core_BAO_UFGroup::getFields($form->_honoreeProfileId, FALSE, NULL,
- NULL, NULL,
- FALSE, NULL,
- TRUE, NULL,
- CRM_Core_Permission::CREATE
- );
+ NULL, NULL,
+ FALSE, NULL,
+ TRUE, NULL,
+ CRM_Core_Permission::CREATE
+ );
$form->addElement('hidden', 'honoree_profile_id', $form->_honoreeProfileId);
$form->assign('honoreeProfileFields', $honoreeProfileFields);
);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
- $rcid = CRM_Utils_Request::retrieve('rcid', 'Positive', $this);
- $rcid = $rcid ? "&id={$rcid}" : '';
+ $rcid = CRM_Utils_Request::retrieve('rcid', 'Positive', $this);
+ $rcid = $rcid ? "&id={$rcid}" : '';
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/user', "reset=1{$rcid}"));
* @return void
*/
public function buildQuickForm() {
- $params = array();
+ $params = array();
$params['id'] = $params['contact_id'] = $this->_contactId;
- $contact = CRM_Contact_BAO_Contact::retrieve($params, $this->_defaults);
+ $contact = CRM_Contact_BAO_Contact::retrieve($params, $this->_defaults);
$countryID = '';
$stateID = '';
);
$this->addButtons(array(
- array(
- 'type' => 'next',
- 'name' => ts('Save'),
- 'isDefault' => TRUE,
- ),
- array(
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ),
- ));
+ array(
+ 'type' => 'next',
+ 'name' => ts('Save'),
+ 'isDefault' => TRUE,
+ ),
+ array(
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ),
+ ));
}
/**
$locType = CRM_Core_BAO_LocationType::getDefault();
foreach (array(
- 'phone', 'email', 'address') as $locFld) {
+ 'phone',
+ 'email',
+ 'address'
+ ) as $locFld) {
if (!empty($this->_defaults[$locFld]) && $this->_defaults[$locFld][1]['location_type_id']) {
$params[$locFld][1]['is_primary'] = $this->_defaults[$locFld][1]['is_primary'];
$params[$locFld][1]['location_type_id'] = $this->_defaults[$locFld][1]['location_type_id'];
);
$label = $this->_action & CRM_Core_Action::ADD ? ts('Contact(s)') : ts('Contact');
- $contactField = $this->addEntityRef('related_contact_id', $label, array('multiple' => TRUE, 'create' => TRUE), TRUE);
+ $contactField = $this->addEntityRef('related_contact_id', $label, array(
+ 'multiple' => TRUE,
+ 'create' => TRUE
+ ), TRUE);
// This field cannot be updated
if ($this->_action & CRM_Core_Action::UPDATE) {
$contactField->freeze();
}
if ($valid) {
- CRM_Core_Session::setStatus(ts('Relationship created.', array('count' => $valid, 'plural' => '%count relationships created.')), ts('Saved'), 'success');
+ CRM_Core_Session::setStatus(ts('Relationship created.', array(
+ 'count' => $valid,
+ 'plural' => '%count relationships created.'
+ )), ts('Saved'), 'success');
}
if ($invalid) {
- CRM_Core_Session::setStatus(ts('%count relationship record was not created due to an invalid contact type.', array('count' => $invalid, 'plural' => '%count relationship records were not created due to invalid contact types.')), ts('%count invalid relationship record', array('count' => $invalid, 'plural' => '%count invalid relationship records')));
+ CRM_Core_Session::setStatus(ts('%count relationship record was not created due to an invalid contact type.', array(
+ 'count' => $invalid,
+ 'plural' => '%count relationship records were not created due to invalid contact types.'
+ )), ts('%count invalid relationship record', array(
+ 'count' => $invalid,
+ 'plural' => '%count invalid relationship records'
+ )));
}
if ($duplicate) {
- CRM_Core_Session::setStatus(ts('One relationship was not created because it already exists.', array('count' => $duplicate, 'plural' => '%count relationships were not created because they already exist.')), ts('%count duplicate relationship', array('count' => $duplicate, 'plural' => '%count duplicate relationships')));
+ CRM_Core_Session::setStatus(ts('One relationship was not created because it already exists.', array(
+ 'count' => $duplicate,
+ 'plural' => '%count relationships were not created because they already exist.'
+ )), ts('%count duplicate relationship', array(
+ 'count' => $duplicate,
+ 'plural' => '%count duplicate relationships'
+ )));
}
if ($saved) {
CRM_Core_Session::setStatus(ts('Relationship record has been updated.'), ts('Saved'), 'success');
// add the go button for the action form, note it is of type 'next' rather than of type 'submit'
if ($this->_context === 'amtg') {
- // check if _groupID exists, it might not if
- // we are displaying a hidden group
+ // check if _groupID exists, it might not if
+ // we are displaying a hidden group
if (!isset($this->_group[$this->_amtgID])) {
$this->assign('permissionedForGroup', FALSE);
$this->_group[$this->_amtgID] =
// FIXME: we should generalise in a way that components could inject url-filters
// just like they build their own form elements
foreach (array(
- 'mailing_id', 'mailing_delivery_status', 'mailing_open_status',
- 'mailing_click_status', 'mailing_reply_status', 'mailing_optout',
- 'mailing_forward', 'mailing_unsubscribe', 'mailing_date_low',
- 'mailing_date_high',
- ) as $mailingFilter) {
+ 'mailing_id',
+ 'mailing_delivery_status',
+ 'mailing_open_status',
+ 'mailing_click_status',
+ 'mailing_reply_status',
+ 'mailing_optout',
+ 'mailing_forward',
+ 'mailing_unsubscribe',
+ 'mailing_date_low',
+ 'mailing_date_high',
+ ) as $mailingFilter) {
$type = 'String';
if ($mailingFilter == 'mailing_id' &&
$filterVal = CRM_Utils_Request::retrieve('mailing_id', 'Positive', $this)
$crmPID = CRM_Utils_Request::retrieve('crmPID', 'Integer', CRM_Core_DAO::$_nullObject);
if (array_key_exists($this->_searchButtonName, $_POST) ||
- ($this->_force && !$crmPID)) {
+ ($this->_force && !$crmPID)
+ ) {
//reset the cache table for new search
$cacheKey = "civicrm search {$this->controller->_key}";
CRM_Core_BAO_PrevNextCache::deleteItem(NULL, $cacheKey);
// FIXME: so leaving this as a dependency for now
if (array_key_exists('contribution_amount_low', $this->_formValues)) {
foreach (array(
- 'contribution_amount_low', 'contribution_amount_high') as $f) {
+ 'contribution_amount_low',
+ 'contribution_amount_high'
+ ) as $f) {
$this->_formValues[$f] = CRM_Utils_Rule::cleanMoney($this->_formValues[$f]);
}
}
!$this->_force
) {
foreach (array(
- 'case_type_id', 'case_status_id', 'case_deleted', 'case_tags') as $caseCriteria) {
+ 'case_type_id',
+ 'case_status_id',
+ 'case_deleted',
+ 'case_tags'
+ ) as $caseCriteria) {
if (!empty($this->_formValues[$caseCriteria])) {
$allCases = TRUE;
$this->_formValues['case_owner'] = 1;
// add select for groups
if (!empty($searchOptions['groups'])) {
- $this->addSelect('group', array('entity' => 'group_contact', 'label' => ts('in'), 'context' => 'search', 'placeholder' => ts('- any group -')));
+ $this->addSelect('group', array(
+ 'entity' => 'group_contact',
+ 'label' => ts('in'),
+ 'context' => 'search',
+ 'placeholder' => ts('- any group -')
+ ));
}
if (!empty($searchOptions['tags'])) {
// tag criteria
if (!empty($this->_tag)) {
- $this->addSelect('tag', array('entity' => 'entity_tag', 'label' => ts('with'), 'context' => 'search', 'placeholder' => ts('- any tag -')));
+ $this->addSelect('tag', array(
+ 'entity' => 'entity_tag',
+ 'label' => ts('with'),
+ 'context' => 'search',
+ 'placeholder' => ts('- any tag -')
+ ));
}
}
$v[2] = self::checkArrayKeyEmpty($v[2]);
if (in_array($v[1], array('IS NULL', 'IS NOT NULL', 'IS EMPTY', 'IS NOT EMPTY')) &&
- !empty($v[2])) {
+ !empty($v[2])
+ ) {
$errorMsg["value[$v[3]][$v[4]]"] = ts('Please clear your value if you want to use %1 operator.', array(1 => $v[1]));
}
elseif (($v[0] == 'group' || $v[0] == 'tag') && !empty($v[2])) {
// hack to handle custom data of type state and country
if (in_array($type, array(
- 'Country', 'StateProvince'))) {
+ 'Country',
+ 'StateProvince'
+ ))) {
$type = "Integer";
}
}
$type = CRM_Utils_Type::typeToString($fldType);
// Check Empty values for Integer Or Boolean Or Date type For operators other than IS NULL and IS NOT NULL.
if (!in_array($v[1],
- array('IS NULL', 'IS NOT NULL', 'IS EMPTY', 'IS NOT EMPTY'))) {
+ array('IS NULL', 'IS NOT NULL', 'IS EMPTY', 'IS NOT EMPTY'))
+ ) {
if ((($type == 'Int' || $type == 'Boolean') && !is_array($v[2]) && !trim($v[2])) && $v[2] != '0') {
$errorMsg["value[$v[3]][$v[4]]"] = ts("Please enter a value.");
}
$addMore = CRM_Utils_Array::value('addMore', $params);
for ($x = 1; $x <= $this->_blockCount; $x++) {
if (!empty($addMore[$x])) {
- $this->set('newBlock', $x);
+ $this->set('newBlock', $x);
$this->_columnCount[$x] = $this->_columnCount[$x] + 5;
$this->set('columnCount', $this->_columnCount);
$this->set('showSearchForm', TRUE);
'member_is_pay_later' => 'yesno',
'is_override' => 'yesno',
);
- $entities = array('contact', 'address', 'activity', 'participant', 'pledge', 'member', 'contribution', 'case', 'grant');
+ $entities = array(
+ 'contact',
+ 'address',
+ 'activity',
+ 'participant',
+ 'pledge',
+ 'member',
+ 'contribution',
+ 'case',
+ 'grant'
+ );
CRM_Contact_BAO_Query_Hook::singleton()->alterSearchBuilderOptions($entities, $options);
foreach ($entities as $entity) {
$fields = civicrm_api3($entity, 'getfields');
elseif (!empty($info['data_type']) && in_array($info['data_type'], array('StateProvince', 'Country'))) {
$options[$field] = $entity;
}
- elseif (in_array(substr($field, 0, 3), array('is_', 'do_')) || CRM_Utils_Array::value('data_type', $info) == 'Boolean') {
+ elseif (in_array(substr($field, 0, 3), array(
+ 'is_',
+ 'do_'
+ )) || CRM_Utils_Array::value('data_type', $info) == 'Boolean'
+ ) {
$options[$field] = 'yesno';
if ($entity != 'contact') {
$options[$entity . '_' . $field] = 'yesno';
$form->add('select', 'group_type', ts('Group Types'), $groupOptions, FALSE,
array('id' => 'group_type', 'multiple' => 'multiple', 'class' => 'crm-select2')
);
- $form->add('hidden','group_search_selected','group');
+ $form->add('hidden', 'group_search_selected', 'group');
}
}
$tagTypesText = implode(" or ", $tagsTypes);
if ($showAllTagTypes) {
$form->add('checkbox', 'all_tag_types', ts('Include tags used for %1', array(1 => $tagTypesText)));
- $form->add('hidden','tag_types_text', $tagTypesText);
+ $form->add('hidden', 'tag_types_text', $tagTypesText);
}
}
'uf_group_id',
ts('Search Views'),
array(
- '0' => ts('- default view -')) + $searchProfiles
+ '0' => ts('- default view -')
+ ) + $searchProfiles
);
$componentModes = CRM_Contact_Form_Search::getModeSelect();
list($title, $attributes, $select, $multiSelect) = $v;
if (in_array($name,
- array('street_number', 'street_name', 'street_unit')
- )) {
+ array('street_number', 'street_name', 'street_unit')
+ )) {
if (!$parseStreetAddress) {
continue;
}
$this->_customSearchID,
$this->_customSearchClass,
$formValues
- ) = CRM_Contact_BAO_SearchCustom::details($csID, $ssID, $gID);
+ ) = CRM_Contact_BAO_SearchCustom::details($csID, $ssID, $gID);
if (!$this->_customSearchID) {
CRM_Core_Error::fatal('Could not get details for custom search.');
}
// set breadcrumb to return to Custom Search listings page
- $breadCrumb = array(array(
+ $breadCrumb = array(
+ array(
'title' => ts('Custom Searches'),
'url' => CRM_Utils_System::url('civicrm/contact/search/custom/list',
'reset=1'
),
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadCrumb);
// use the custom selector
// CRM-12747
if (isset($this->_customClass->_permissionedComponent) &&
- !self::isPermissioned($this->_customClass->_permissionedComponent)) {
+ !self::isPermissioned($this->_customClass->_permissionedComponent)
+ ) {
CRM_Utils_System::permissionDenied();
}
}
* for the search form.
*/
$form->assign('elements', array(
- 'contact_type', 'activity_subject', 'activity_type_id',
- 'activity_status_id', 'start_date', 'end_date', 'sort_name',
- ));
+ 'contact_type',
+ 'activity_subject',
+ 'activity_type_id',
+ 'activity_status_id',
+ 'start_date',
+ 'end_date',
+ 'sort_name',
+ ));
}
/**
// add contact name search; search on primary name, source contact, assignee
$contactname = $this->_formValues['sort_name'];
if (!empty($contactname)) {
- $dao = new CRM_Core_DAO();
+ $dao = new CRM_Core_DAO();
$contactname = $dao->escape($contactname);
- $clauses[] = "(contact_a.sort_name LIKE '%{$contactname}%' OR
+ $clauses[] = "(contact_a.sort_name LIKE '%{$contactname}%' OR
contact_b.sort_name LIKE '%{$contactname}%' OR
contact_c.display_name LIKE '%{$contactname}%')";
}
}
if (!empty($subject)) {
- $dao = new CRM_Core_DAO();
- $subject = $dao->escape($subject);
+ $dao = new CRM_Core_DAO();
+ $subject = $dao->escape($subject);
$clauses[] = "activity.subject LIKE '%{$subject}%'";
}
foreach ($includeStrings as $string) {
if (stripos($sql, $string) === FALSE) {
CRM_Core_Error::fatal(ts('Could not find \'%1\' string in SQL clause.',
- array(1 => $string)
- ));
+ array(1 => $string)
+ ));
}
}
foreach ($excludeStrings as $string) {
if (preg_match('/(\s' . $string . ')|(' . $string . '\s)/i', $sql)) {
CRM_Core_Error::fatal(ts('Found illegal \'%1\' string in SQL clause.',
- array(1 => $string)
- ));
+ array(1 => $string)
+ ));
}
}
}
foreach ($this->_columns as $name => $field) {
if (in_array($field, array(
- 'street_address', 'city', 'state_province', 'postal_code', 'country')) && empty($addressOptions[$field])) {
+ 'street_address',
+ 'city',
+ 'state_province',
+ 'postal_code',
+ 'country'
+ )) && empty($addressOptions[$field])
+ ) {
unset($this->_columns[$name]);
continue;
}
// CRM-6356
if ($this->_groups) {
//block for Group search
- $smartGroup = array();
- $group = new CRM_Contact_DAO_Group();
+ $smartGroup = array();
+ $group = new CRM_Contact_DAO_Group();
$group->is_active = 1;
$group->find();
while ($group->fetch()) {
* If you are using the sample template, this array tells the template fields to render
* for the search form.
*/
- $form->assign('elements', array('paid_online', 'start_date', 'end_date', 'show_payees', 'event_type_id', 'event_id'));
+ $form->assign('elements', array(
+ 'paid_online',
+ 'start_date',
+ 'end_date',
+ 'show_payees',
+ 'event_type_id',
+ 'event_id'
+ ));
}
/**
$clauses[] = "civicrm_participant.status_id in ( 1 )";
$clauses[] = "civicrm_contribution.is_test = 0";
- $onLine = CRM_Utils_Array::value('paid_online',
+ $onLine = CRM_Utils_Array::value('paid_online',
$this->_formValues
);
if ($onLine) {
'membership_end_date' => 'datetime',
'membership_source' => 'varchar(255)',
'membership_status' => 'varchar(255)',
-
// We may have multiple files to list on one record.
// The temporary-table approach can't store full details for all of them
'file_ids' => 'varchar(255)', // comma-separate id listing
}
$query = $tableValues + array(
- 'text' => CRM_Utils_QueryFormatter::singleton()
- ->format($queryText, CRM_Utils_QueryFormatter::LANG_SOLR),
- );
+ 'text' => CRM_Utils_QueryFormatter::singleton()
+ ->format($queryText, CRM_Utils_QueryFormatter::LANG_SOLR),
+ );
list($intLimit, $intOffset) = $this->parseLimitOffset($limit);
$files = $searcher->search($query, $intLimit, $intOffset);
$matches = array();
public function isActive() {
$config = CRM_Core_Config::singleton();
return in_array('CiviContribute', $config->enableComponents) &&
- CRM_Core_Permission::check('access CiviContribute');
+ CRM_Core_Permission::check('access CiviContribute');
}
/**
public function isActive() {
$config = CRM_Core_Config::singleton();
return in_array('CiviMember', $config->enableComponents) &&
- CRM_Core_Permission::check('access CiviMember');
+ CRM_Core_Permission::check('access CiviMember');
}
/**
public function isActive() {
$config = CRM_Core_Config::singleton();
return in_array('CiviEvent', $config->enableComponents) &&
- CRM_Core_Permission::check('view event participants');
+ CRM_Core_Permission::check('view event participants');
}
/**
//define variables
$this->_allSearch = FALSE;
- $this->_groups = FALSE;
- $this->_tags = FALSE;
- $this->_andOr = CRM_Utils_Array::value('andOr', $this->_formValues);
+ $this->_groups = FALSE;
+ $this->_tags = FALSE;
+ $this->_andOr = CRM_Utils_Array::value('andOr', $this->_formValues);
//make easy to check conditions for groups and tags are
* @return string
*/
public function where($includeContactIDs = FALSE) {
- $count = 1;
+ $count = 1;
$clause = array();
$params = array();
- $name = CRM_Utils_Array::value('sort_name',
+ $name = CRM_Utils_Array::value('sort_name',
$this->_formValues
);
if ($name != NULL) {
foreach ($this->_options as $fieldID => $values) {
$customVal = $valueSeparatedArray = array();
if (in_array($values['attributes']['html_type'],
- array('Radio', 'Select', 'Autocomplete-Select')
- )) {
+ array('Radio', 'Select', 'Autocomplete-Select')
+ )) {
if ($values['attributes']['data_type'] == 'ContactReference' && $row["custom_{$fieldID}"]) {
- $row["custom_{$fieldID}"] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', (int)$row["custom_{$fieldID}"], 'display_name');
+ $row["custom_{$fieldID}"] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', (int) $row["custom_{$fieldID}"], 'display_name');
}
elseif ($row["custom_{$fieldID}"] &&
array_key_exists($row["custom_{$fieldID}"],
}
}
elseif (in_array($values['attributes']['html_type'],
- array('CheckBox', 'Multi-Select', 'AdvMulti-Select')
- )) {
+ array('CheckBox', 'Multi-Select', 'AdvMulti-Select')
+ )) {
$valueSeparatedArray = array_filter(explode(CRM_Core_DAO::VALUE_SEPARATOR, $row["custom_{$fieldID}"]));
foreach ($valueSeparatedArray as $val) {
$customVal[] = $values[$val];
$row["custom_{$fieldID}"] = implode(', ', $customVal);
}
elseif (in_array($values['attributes']['html_type'],
- array('Multi-Select State/Province', 'Select State/Province')
- )) {
+ array('Multi-Select State/Province', 'Select State/Province')
+ )) {
$valueSeparatedArray = array_filter(explode(CRM_Core_DAO::VALUE_SEPARATOR, $row["custom_{$fieldID}"]));
$stateName = CRM_Core_PseudoConstant::stateProvince();
foreach ($valueSeparatedArray as $val) {
$row["custom_{$fieldID}"] = implode(', ', $customVal);
}
elseif (in_array($values['attributes']['html_type'],
- array('Multi-Select Country', 'Select Country')
- )) {
+ array('Multi-Select Country', 'Select Country')
+ )) {
$valueSeparatedArray = array_filter(explode(CRM_Core_DAO::VALUE_SEPARATOR, $row["custom_{$fieldID}"]));
CRM_Core_PseudoConstant::populate($countryNames, 'CRM_Core_DAO_Country',
TRUE, 'name', 'is_active'
public function where($includeContactIDs = FALSE) {
$params = array();
- $count = 1;
- $clause = array();
+ $count = 1;
+ $clause = array();
$groupID = CRM_Utils_Array::value('group_id',
$this->_formValues
);
}
public function buildTempTable() {
- $randomNum = md5(uniqid());
+ $randomNum = md5(uniqid());
$this->_tableName = "civicrm_temp_custom_{$randomNum}";
- $sql = "
+ $sql = "
CREATE TEMPORARY TABLE {$this->_tableName} (
id int unsigned NOT NULL AUTO_INCREMENT,
contact_id int unsigned NOT NULL,
foreach ($this->_columns as $dontCare => $fieldName) {
if (in_array($fieldName, array(
'contact_id',
- 'participant_id',
- 'display_name',
- ))) {
+ 'participant_id',
+ 'display_name',
+ ))) {
continue;
}
$sql .= "{$fieldName} int default 0,\n";
foreach ($this->_columns as $dontCare => $fieldName) {
if (in_array($fieldName, array(
- 'contact_id',
- 'display_name',
- ))) {
+ 'contact_id',
+ 'display_name',
+ ))) {
continue;
}
$selectClause .= ",\ntempTable.{$fieldName} as {$fieldName}";
*/
$form->assign('elements', array(
'distance',
- 'prox_distance_unit',
- 'street_address',
- 'city',
- 'postal_code',
- 'country_id',
- 'state_province_id',
- 'group',
- 'tag',
- ));
+ 'prox_distance_unit',
+ 'street_address',
+ 'city',
+ 'postal_code',
+ 'country_id',
+ 'state_province_id',
+ 'group',
+ 'tag',
+ ));
}
/**
$this->_tableName = "civicrm_temp_custom_{$randomNum}";
//block for Group search
- $smartGroup = array();
- $group = new CRM_Contact_DAO_Group();
+ $smartGroup = array();
+ $group = new CRM_Contact_DAO_Group();
$group->is_active = 1;
$group->find();
while ($group->fetch()) {
if (substr($this->_segmentSize, -1) == '%') {
$countSql = "SELECT DISTINCT contact_a.id $from $fromTail
WHERE " . $this->where();
- $dao = CRM_Core_DAO::executeQuery($countSql);
- $totalSize = $dao->N;
+ $dao = CRM_Core_DAO::executeQuery($countSql);
+ $totalSize = $dao->N;
$multiplier = substr($this->_segmentSize, 0, strlen($this->_segmentSize) - 1);
$multiplier /= 100;
$this->_segmentSize = round($totalSize * $multiplier);
$params = array();
$where = "contact_a.contact_type = 'Household'";
- $count = 1;
+ $count = 1;
$clause = array();
- $name = CRM_Utils_Array::value('household_name',
+ $name = CRM_Utils_Array::value('household_name',
$this->_formValues
);
if ($name != NULL) {
$where = "ROUND(address.postal_code) >= %1 AND ROUND(address.postal_code) <= %2";
$params = array(
- 1 => array(trim($low), 'Integer'),
+ 1 => array(trim($low), 'Integer'),
2 => array(trim($high), 'Integer'),
);
}
// Find related households.
- $relationSelect = "SELECT contact_household.id as household_id, {$contactA} as refContact ";
+ $relationSelect = "SELECT contact_household.id as household_id, {$contactA} as refContact ";
$relationFrom = " FROM civicrm_contact contact_household
INNER JOIN civicrm_relationship crel ON crel.{$contactB} = contact_household.id AND crel.relationship_type_id = {$id} ";
// Check for active relationship status only.
- $today = date('Ymd');
- $relationActive = " AND (crel.is_active = 1 AND ( crel.end_date is NULL OR crel.end_date >= {$today} ) )";
- $relationWhere = " WHERE contact_household.is_deleted = 0 AND crel.{$contactA} IN ( {$relID} ) {$relationActive}";
- $relationGroupBy = " GROUP BY crel.{$contactA}";
+ $today = date('Ymd');
+ $relationActive = " AND (crel.is_active = 1 AND ( crel.end_date is NULL OR crel.end_date >= {$today} ) )";
+ $relationWhere = " WHERE contact_household.is_deleted = 0 AND crel.{$contactA} IN ( {$relID} ) {$relationActive}";
+ $relationGroupBy = " GROUP BY crel.{$contactA}";
$relationQueryString = "$relationSelect $relationFrom $relationWhere $relationGroupBy";
$householdsDAO = CRM_Core_DAO::executeQuery($relationQueryString);
$groupParams['visibility'] = "User and User Admin Only";
if (array_key_exists('group_type', $params) && is_array($params['group_type'])) {
$groupParams['group_type'] = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
- array_keys($params['group_type'])
- ) . CRM_Core_DAO::VALUE_SEPARATOR;
+ array_keys($params['group_type'])
+ ) . CRM_Core_DAO::VALUE_SEPARATOR;
}
else {
$groupParams['group_type'] = '';
$groupParams['is_active'] = 1;
$createdGroup = CRM_Contact_BAO_Group::create($groupParams);
- $groupID = $createdGroup->id;
- $groupName = $groupParams['title'];
+ $groupID = $createdGroup->id;
+ $groupName = $groupParams['title'];
}
else {
- $groupID = $params['group_id'];
- $group = CRM_Core_PseudoConstant::group();
+ $groupID = $params['group_id'];
+ $group = CRM_Core_PseudoConstant::group();
$groupName = $group[$groupID];
}
list($total, $added, $notAdded) = CRM_Contact_BAO_GroupContact::addContactsToGroup($this->_contactIds, $groupID);
- $status = array(ts('%count contact added to group', array('count' => $added, 'plural' => '%count contacts added to group')));
+ $status = array(
+ ts('%count contact added to group', array(
+ 'count' => $added,
+ 'plural' => '%count contacts added to group'
+ ))
+ );
if ($notAdded) {
- $status[] = ts('%count contact was already in group', array('count' => $notAdded, 'plural' => '%count contacts were already in group'));
+ $status[] = ts('%count contact was already in group', array(
+ 'count' => $notAdded,
+ 'plural' => '%count contacts were already in group'
+ ));
}
$status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
- CRM_Core_Session::setStatus($status, ts('Added Contact to %1', array(1 => $groupName, 'count' => $added, 'plural' => 'Added Contacts to %1')), 'success', array('expires' => 0));
+ CRM_Core_Session::setStatus($status, ts('Added Contact to %1', array(
+ 1 => $groupName,
+ 'count' => $added,
+ 'plural' => 'Added Contacts to %1'
+ )), 'success', array('expires' => 0));
if ($this->_context === 'amtg') {
- CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/group/search', "reset=1&force=1&context=smog&gid=$groupID"));
+ CRM_Core_Session::singleton()
+ ->pushUserContext(CRM_Utils_System::url('civicrm/group/search', "reset=1&force=1&context=smog&gid=$groupID"));
}
}
}
$this->add('select', 'relationship_type_id', ts('Relationship Type'),
array(
- '' => ts('- select -')) +
+ '' => ts('- select -')
+ ) +
CRM_Contact_BAO_Relationship::getRelationType("Household"), TRUE
);
}
if (CRM_Contact_BAO_Relationship::checkDuplicateRelationship($params,
- CRM_Utils_Array::value('contact', $ids),
- // step 2
- $params['contact_check']
- )) {
+ CRM_Utils_Array::value('contact', $ids),
+ // step 2
+ $params['contact_check']
+ )
+ ) {
$duplicate++;
continue;
}
list($rtype, $a_b) = explode('_', $data['relationship_type_id'], 2);
$relationship = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $rtype, "label_$a_b");
- $status = array(ts('%count %2 %3 relationship created', array('count' => $valid, 'plural' => '%count %2 %3 relationships created', 2 => $relationship, 3 => $house)));
+ $status = array(
+ ts('%count %2 %3 relationship created', array(
+ 'count' => $valid,
+ 'plural' => '%count %2 %3 relationships created',
+ 2 => $relationship,
+ 3 => $house
+ ))
+ );
if ($duplicate) {
- $status[] = ts('%count was skipped because the contact is already %2 %3', array('count' => $duplicate, 'plural' => '%count were skipped because the contacts are already %2 %3', 2 => $relationship, 3 => $house));
+ $status[] = ts('%count was skipped because the contact is already %2 %3', array(
+ 'count' => $duplicate,
+ 'plural' => '%count were skipped because the contacts are already %2 %3',
+ 2 => $relationship,
+ 3 => $house
+ ));
}
if ($invalid) {
- $status[] = ts('%count relationship was not created because the contact is not of the right type for this relationship', array('count' => $invalid, 'plural' => '%count relationships were not created because the contact is not of the right type for this relationship'));
+ $status[] = ts('%count relationship was not created because the contact is not of the right type for this relationship', array(
+ 'count' => $invalid,
+ 'plural' => '%count relationships were not created because the contact is not of the right type for this relationship'
+ ));
}
$status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
- CRM_Core_Session::setStatus($status, ts('Relationship created.', array('count' => $valid, 'plural' => 'Relationships created.')), 'success', array('expires' => 0));
+ CRM_Core_Session::setStatus($status, ts('Relationship created.', array(
+ 'count' => $valid,
+ 'plural' => 'Relationships created.'
+ )), 'success', array('expires' => 0));
}
}
}
// get the count of contact
- $contactBAO = new CRM_Contact_BAO_Contact();
- $query = new CRM_Contact_BAO_Query($searchValues);
+ $contactBAO = new CRM_Contact_BAO_Contact();
+ $query = new CRM_Contact_BAO_Query($searchValues);
$searchCount = $query->searchQuery(0, 0, NULL, TRUE);
$form->set('searchCount', $searchCount);
if ($searchCount <= 50) {
$contact_type = '<img src="' . $config->resourceBase . 'i/contact_';
$searchRows[$contactID]['type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ?
- $result->contact_sub_type : $result->contact_type
+ $result->contact_sub_type : $result->contact_type
);
}
'relationship_type_id',
ts('Relationship Type'),
array(
- '' => ts('- select -')) +
+ '' => ts('- select -')
+ ) +
CRM_Contact_BAO_Relationship::getRelationType("Organization"), TRUE
);
}
if (CRM_Contact_BAO_Relationship::checkDuplicateRelationship($params,
- CRM_Utils_Array::value('contact', $ids),
- // step 2
- $params['contact_check']
- )) {
+ CRM_Utils_Array::value('contact', $ids),
+ // step 2
+ $params['contact_check']
+ )
+ ) {
$duplicate++;
continue;
}
list($rtype, $a_b) = explode('_', $data['relationship_type_id'], 2);
$relationship = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $rtype, "label_$a_b");
- $status = array(ts('%count %2 %3 relationship created', array('count' => $valid, 'plural' => '%count %2 %3 relationships created', 2 => $relationship, 3 => $org)));
+ $status = array(
+ ts('%count %2 %3 relationship created', array(
+ 'count' => $valid,
+ 'plural' => '%count %2 %3 relationships created',
+ 2 => $relationship,
+ 3 => $org
+ ))
+ );
if ($duplicate) {
- $status[] = ts('%count was skipped because the contact is already %2 %3', array('count' => $duplicate, 'plural' => '%count were skipped because the contacts are already %2 %3', 2 => $relationship, 3 => $org));
+ $status[] = ts('%count was skipped because the contact is already %2 %3', array(
+ 'count' => $duplicate,
+ 'plural' => '%count were skipped because the contacts are already %2 %3',
+ 2 => $relationship,
+ 3 => $org
+ ));
}
if ($invalid) {
- $status[] = ts('%count relationship was not created because the contact is not of the right type for this relationship', array('count' => $invalid, 'plural' => '%count relationships were not created because the contact is not of the right type for this relationship'));
+ $status[] = ts('%count relationship was not created because the contact is not of the right type for this relationship', array(
+ 'count' => $invalid,
+ 'plural' => '%count relationships were not created because the contact is not of the right type for this relationship'
+ ));
}
$status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
- CRM_Core_Session::setStatus($status, ts('Relationship created.', array('count' => $valid, 'plural' => 'Relationships created.')), 'success', array('expires' => 0));
+ CRM_Core_Session::setStatus($status, ts('Relationship created.', array(
+ 'count' => $valid,
+ 'plural' => 'Relationships created.'
+ )), 'success', array('expires' => 0));
}
}
$status = array(ts('%count contact tagged', array('count' => $added, 'plural' => '%count contacts tagged')));
if ($notAdded) {
- $status[] = ts('%count contact already had this tag', array('count' => $notAdded, 'plural' => '%count contacts already had this tag'));
+ $status[] = ts('%count contact already had this tag', array(
+ 'count' => $notAdded,
+ 'plural' => '%count contacts already had this tag'
+ ));
}
$status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
CRM_Core_Session::setStatus($status, ts("Added Tag <em>%1</em>", array(1 => $this->_tags[$key])), 'success', array('expires' => 0));
*
* @return void
*/
- public function buildQuickForm() {
+ public function buildQuickForm() {
// add select for preferences
$options = array(ts('Add Selected Options'), ts('Remove selected options'));
// if below fields are missing we should not reset sort name / display name
// CRM-6794
$preserveDefaultsArray = array(
- 'first_name', 'last_name', 'middle_name',
- 'organization_name', 'prefix_id', 'suffix_id',
+ 'first_name',
+ 'last_name',
+ 'middle_name',
+ 'organization_name',
+ 'prefix_id',
+ 'suffix_id',
'household_name',
);
public function postProcess() {
$params = $this->exportValues();
- $ufGroupId = $this->get('ufGroupId');
- $notify = NULL;
+ $ufGroupId = $this->get('ufGroupId');
+ $notify = NULL;
$inValidSubtypeCnt = 0;
//send profile notification email if 'notify' field is set
$notify = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $ufGroupId, 'notify');
CRM_Core_Session::setStatus('', ts("Updates Saved"), 'success');
if ($inValidSubtypeCnt) {
- CRM_Core_Session::setStatus(ts('Contact Subtype field of 1 contact has not been updated.', array('plural' => 'Contact Subtype field of %count contacts has not been updated.', 'count' => $inValidSubtypeCnt)), ts('Invalid Subtype'));
+ CRM_Core_Session::setStatus(ts('Contact Subtype field of 1 contact has not been updated.', array(
+ 'plural' => 'Contact Subtype field of %count contacts has not been updated.',
+ 'count' => $inValidSubtypeCnt
+ )), ts('Invalid Subtype'));
}
}
$this->_searchKey = CRM_Utils_Request::retrieve('key', 'String', $this);
// sort out whether it’s a delete-to-trash, delete-into-oblivion or restore (and let the template know)
- $values = $this->controller->exportValues();
+ $values = $this->controller->exportValues();
$this->_skipUndelete = (CRM_Core_Permission::check('access deleted contacts') and (CRM_Utils_Request::retrieve('skip_undelete', 'Boolean', $this) or CRM_Utils_Array::value('task', $values) == CRM_Contact_Task::DELETE_PERMANENTLY));
- $this->_restore = (CRM_Utils_Request::retrieve('restore', 'Boolean', $this) or CRM_Utils_Array::value('task', $values) == CRM_Contact_Task::RESTORE);
+ $this->_restore = (CRM_Utils_Request::retrieve('restore', 'Boolean', $this) or CRM_Utils_Array::value('task', $values) == CRM_Contact_Task::RESTORE);
if ($this->_restore && !CRM_Core_Permission::check('access deleted contacts')) {
CRM_Core_Error::fatal(ts('You do not have permission to access this contact.'));
if ($sharedAddressCount > 0) {
if (count($this->_contactIds) > 1) {
// more than one contact deleted
- $message = ts('One of the selected contacts has an address record that is shared with 1 other contact.', array('plural' => 'One or more selected contacts have address records which are shared with %count other contacts.', 'count' => $sharedAddressCount));
+ $message = ts('One of the selected contacts has an address record that is shared with 1 other contact.', array(
+ 'plural' => 'One or more selected contacts have address records which are shared with %count other contacts.',
+ 'count' => $sharedAddressCount
+ ));
}
else {
// only one contact deleted
- $message = ts('This contact has an address record which is shared with 1 other contact.', array('plural' => 'This contact has an address record which is shared with %count other contacts.', 'count' => $sharedAddressCount));
+ $message = ts('This contact has an address record which is shared with 1 other contact.', array(
+ 'plural' => 'This contact has an address record which is shared with %count other contacts.',
+ 'count' => $sharedAddressCount
+ ));
}
CRM_Core_Session::setStatus($message . ' ' . ts('Shared addresses will not be removed or altered but will no longer be shared.'), ts('Shared Addesses Owner'));
}
$session = CRM_Core_Session::singleton();
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view',
- 'reset=1&cid=' . $this->_contactIds[0] . $urlParams
- ));
+ 'reset=1&cid=' . $this->_contactIds[0] . $urlParams
+ ));
$this->addDefaultButtons($label, 'done', 'cancel');
}
else {
$session = CRM_Core_Session::singleton();
$currentUserId = $session->get('userID');
- $context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'basic');
+ $context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'basic');
$urlParams = 'force=1';
$urlString = "civicrm/contact/search/$context";
$title = ts('Deleted');
if ($this->_restore) {
$title = ts('Restored');
- $status = ts('%1 has been restored from the trash.', array(1 => $name, 'plural' => '%count contacts restored from trash.', 'count' => $deleted));
+ $status = ts('%1 has been restored from the trash.', array(
+ 1 => $name,
+ 'plural' => '%count contacts restored from trash.',
+ 'count' => $deleted
+ ));
}
elseif ($this->_skipUndelete) {
- $status = ts('%1 has been permanently deleted.', array(1 => $name, 'plural' => '%count contacts permanently deleted.', 'count' => $deleted));
+ $status = ts('%1 has been permanently deleted.', array(
+ 1 => $name,
+ 'plural' => '%count contacts permanently deleted.',
+ 'count' => $deleted
+ ));
}
else {
- $status = ts('%1 has been moved to the trash.', array(1 => $name, 'plural' => '%count contacts moved to trash.', 'count' => $deleted));
+ $status = ts('%1 has been moved to the trash.', array(
+ 1 => $name,
+ 'plural' => '%count contacts moved to trash.',
+ 'count' => $deleted
+ ));
}
$session->setStatus($status, $title, 'success');
}
}
if ($cid) {
- $cid = explode(',',$cid);
+ $cid = explode(',', $cid);
$displayName = array();
foreach ($cid as $val) {
$emailAttributes = array(
'class' => 'huge',
);
- $to = $form->add('text', 'to', ts('To'), $emailAttributes, TRUE);
- $cc = $form->add('text', 'cc_id', ts('CC'), $emailAttributes);
+ $to = $form->add('text', 'to', ts('To'), $emailAttributes, TRUE);
+ $cc = $form->add('text', 'cc_id', ts('CC'), $emailAttributes);
$bcc = $form->add('text', 'bcc_id', ts('BCC'), $emailAttributes);
$setDefaults = TRUE;
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)
- ));
+ array(1 => self::MAX_EMAILS_KILL_SWITCH)
+ ));
}
// check and ensure that
$formValues = $form->controller->exportValues($form->getName());
$fromEmail = $formValues['fromEmailAddress'];
- $from = CRM_Utils_Array::value($fromEmail, $form->_emails);
- $subject = $formValues['subject'];
+ $from = CRM_Utils_Array::value($fromEmail, $form->_emails);
+ $subject = $formValues['subject'];
// CRM-13378: Append CC and BCC information at the end of Activity Details and format cc and bcc fields
$elements = array('cc_id', 'bcc_id');
// we should allow same emails for different contacts
$emailKey = "{$contactId}::{$email}";
if (!in_array($emailKey, $tempEmails)) {
- $tempEmails[] = $emailKey;
- $details = $form->_contactDetails[$contactId];
+ $tempEmails[] = $emailKey;
+ $details = $form->_contactDetails[$contactId];
$details['email'] = $email;
unset($details['email_id']);
$formattedContactDetails[] = $details;
if ($sent) {
$count_success = count($form->_toContactDetails);
- CRM_Core_Session::setStatus(ts('One message was sent successfully.', array('plural' => '%count messages were sent successfully.', 'count' => $count_success)), ts('Message Sent', array('plural' => 'Messages Sent', 'count' => $count_success)), 'success');
+ CRM_Core_Session::setStatus(ts('One message was sent successfully.', array(
+ 'plural' => '%count messages were sent successfully.',
+ 'count' => $count_success
+ )), ts('Message Sent', array('plural' => 'Messages Sent', 'count' => $count_success)), 'success');
}
// Display the name and number of contacts for those email is not sent.
if ($emailsNotSent) {
$not_sent = array();
foreach ($emailsNotSent as $contactId => $values) {
- $displayName = $values['display_name'];
- $email = $values['email'];
+ $displayName = $values['display_name'];
+ $email = $values['email'];
$contactViewUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid=$contactId");
$not_sent[] = "<a href='$contactViewUrl' title='$email'>$displayName</a>" . ($values['on_hold'] ? '(' . ts('on hold') . ')' : '');
}
$status = '(' . ts('because no email address on file or communication preferences specify DO NOT EMAIL or Contact is deceased or Primary email address is On Hold') . ')<ul><li>' . implode('</li><li>', $not_sent) . '</li></ul>';
- CRM_Core_Session::setStatus($status, ts('One Message Not Sent', array('count' => count($emailsNotSent), 'plural' => '%count Messages Not Sent')), 'info');
+ CRM_Core_Session::setStatus($status, ts('One Message Not Sent', array(
+ 'count' => count($emailsNotSent),
+ 'plural' => '%count Messages Not Sent'
+ )), 'info');
}
if (isset($form->_caseId)) {
// add select for Location Type
$this->addElement('select', 'location_type_id', ts('Select Location'),
array(
- '' => ts('Primary')) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'), TRUE
+ '' => ts('Primary')
+ ) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'), TRUE
);
// checkbox for SKIP contacts with Do Not Mail privacy option
* @return void
*/
public function postProcess() {
- $fv = $this->controller->exportValues($this->_name);
- $config = CRM_Core_Config::singleton();
+ $fv = $this->controller->exportValues($this->_name);
+ $config = CRM_Core_Config::singleton();
$locName = NULL;
//get the address format sequence from the config file
$mailingFormat = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
//get the contacts information
$params = array();
if (!empty($fv['location_type_id'])) {
- $locType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
- $locName = $locType[$fv['location_type_id']];
- $location = array('location' => array("{$locName}" => $address));
+ $locType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
+ $locName = $locType[$fv['location_type_id']];
+ $location = array('location' => array("{$locName}" => $address));
$returnProperties = array_merge($returnProperties, $location);
- $params[] = array('location_type', '=', array($fv['location_type_id'] => 1), 0, 0);
+ $params[] = array('location_type', '=', array($fv['location_type_id'] => 1), 0, 0);
}
else {
$returnProperties = array_merge($returnProperties, $address);
foreach ($this->_contactIds as $key => $contactID) {
$params[] = array(
CRM_Core_Form::CB_PREFIX . $contactID,
- '=', 1, 0, 0,
+ '=',
+ 1,
+ 0,
+ 0,
);
}
//get the total number of contacts to fetch from database.
$numberofContacts = count($this->_contactIds);
- $query = new CRM_Contact_BAO_Query($params, $returnProperties);
- $details = $query->apiQuery($params, $returnProperties, NULL, NULL, 0, $numberofContacts);
+ $query = new CRM_Contact_BAO_Query($params, $returnProperties);
+ $details = $query->apiQuery($params, $returnProperties, NULL, NULL, 0, $numberofContacts);
$messageToken = CRM_Utils_Token::getTokens($mailingFormat);
$valuesothers = CRM_Core_BAO_Location::getValues($paramsothers, $valuesothers);
if (!empty($fv['location_type_id'])) {
foreach ($valuesothers as $vals) {
- if (CRM_Utils_Array::value('location_type_id', $vals) ==
- CRM_Utils_Array::value('location_type_id', $fv)) {
+ if (CRM_Utils_Array::value('location_type_id', $vals) ==
+ CRM_Utils_Array::value('location_type_id', $fv)
+ ) {
foreach ($vals as $k => $v) {
if (in_array($k, array(
- 'email', 'phone', 'im', 'openid'))) {
+ 'email',
+ 'phone',
+ 'im',
+ 'openid'
+ ))) {
if ($k == 'im') {
$rows[$value][$k] = $v['1']['name'];
}
// format the addresses according to CIVICRM_ADDRESS_FORMAT (CRM-1327)
foreach ($rows as $id => $row) {
if ($commMethods = CRM_Utils_Array::value('preferred_communication_method', $row)) {
- $val = array_filter(explode(CRM_Core_DAO::VALUE_SEPARATOR, $commMethods));
+ $val = array_filter(explode(CRM_Core_DAO::VALUE_SEPARATOR, $commMethods));
$comm = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method');
$temp = array();
foreach ($val as $vals) {
public static 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])) {
+ if ($key != 'addressee' && !empty($contact[$key])) {
return TRUE;
}
}
return FALSE;
}
+
/**
* Create labels (pdf)
*
foreach ($contactIDs as $key => $contactID) {
$params[] = array(
CRM_Core_Form::CB_PREFIX . $contactID,
- '=', 1, 0, 0,
+ '=',
+ 1,
+ 0,
+ 0,
);
}
$params[] = array('is_deceased', '=', 0, 0, 0);
if ($locationTypeID) {
- $locType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
- $locName = $locType[$locationTypeID];
- $location = array('location' => array("{$locName}" => $addressReturnProperties));
+ $locType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
+ $locName = $locType[$locationTypeID];
+ $location = array('location' => array("{$locName}" => $addressReturnProperties));
$returnProperties = array_merge($returnProperties, $location);
- $params[] = array('location_type', '=', array($locationTypeID => 1), 0, 0);
+ $params[] = array('location_type', '=', array($locationTypeID => 1), 0, 0);
}
else {
$returnProperties = array_merge($returnProperties, $addressReturnProperties);
$numberofContacts = count($contactIDs);
//this does the same as calling civicrm_api3('contact, get, array('id' => array('IN' => $this->_contactIds)
// except it also handles multiple locations
- $query = new CRM_Contact_BAO_Query($params, $returnProperties);
- $details = $query->apiQuery($params, $returnProperties, NULL, NULL, 0, $numberofContacts);
+ $query = new CRM_Contact_BAO_Query($params, $returnProperties);
+ $details = $query->apiQuery($params, $returnProperties, NULL, NULL, 0, $numberofContacts);
$messageToken = CRM_Utils_Token::getTokens($mailingFormat);
$details = $details[0];
if ($locationTypeID) {
foreach ($valuesothers as $vals) {
if (CRM_Utils_Array::value('location_type_id', $vals) ==
- $locationTypeID) {
+ $locationTypeID
+ ) {
foreach ($vals as $k => $v) {
if (in_array($k, array(
- 'email', 'phone', 'im', 'openid'))) {
+ 'email',
+ 'phone',
+ 'im',
+ 'openid'
+ ))) {
if ($k == 'im') {
$rows[$value][$k] = $v['1']['name'];
}
NULL,
$messageToken,
'CRM_Contact_Form_Task_LabelCommon'
- );
+ );
CRM_Utils_Hook::tokens($tokens);
# exclude individuals belonging to selected households
foreach ($households as $household_id => $row) {
- $dao = new CRM_Contact_DAO_Relationship();
- $dao->contact_id_b = $household_id;
- $dao->find();
- while ($dao->fetch()) {
- $individual_id = $dao->contact_id_a;
- if (array_key_exists($individual_id, $individuals)) {
- unset($individuals[$individual_id]);
- }
- }
+ $dao = new CRM_Contact_DAO_Relationship();
+ $dao->contact_id_b = $household_id;
+ $dao->find();
+ while ($dao->fetch()) {
+ $individual_id = $dao->contact_id_a;
+ if (array_key_exists($individual_id, $individuals)) {
+ unset($individuals[$individual_id]);
+ }
+ }
}
# merge back individuals and households
$rows = array_merge($individuals, $households);
return $rows;
- }
+ }
}
$sumLat = $sumLng = 0;
$maxLat = $maxLng = -400;
- $minLat = $minLng = + 400;
+ $minLat = $minLng = 400;
foreach ($locations as $location) {
$sumLat += $location['lat'];
$sumLng += $location['lng'];
'lng' => (float ) $sumLng / count($locations),
);
$span = array(
- 'lat' => (float )($maxLat - $minLat),
- 'lng' => (float )($maxLng - $minLng),
+ 'lat' => (float ) ($maxLat - $minLat),
+ 'lng' => (float ) ($maxLng - $minLng),
);
$page->assign_by_ref('center', $center);
$page->assign_by_ref('span', $span);
while ($contact->fetch()) {
$contactTypes[$contact->contact_type] = TRUE;
if (count($contactTypes) > 1)
- break;
+ break;
}
if (count($contactTypes) > 1) {
$statusMsg = ts('Selected records must all be the same contact type (i.e. all Individuals).');
* @return void
*/
public static function preProcess(&$form) {
- $messageText = array();
+ $messageText = array();
$messageSubject = array();
- $dao = new CRM_Core_BAO_MessageTemplate();
+ $dao = new CRM_Core_BAO_MessageTemplate();
$dao->is_active = 1;
$dao->find();
while ($dao->fetch()) {
*/
public static function createActivities($form, $html_message, $contactIds) {
//Added for CRM-12682: Add activity subject and campaign fields
- $formValues = $form->controller->exportValues($form->getName());
+ $formValues = $form->controller->exportValues($form->getName());
- $session = CRM_Core_Session::singleton();
- $userID = $session->get('userID');
+ $session = CRM_Core_Session::singleton();
+ $userID = $session->get('userID');
$activityTypeID = CRM_Core_OptionGroup::getValue(
'activity_type',
'Print PDF Letter',
$matches = array();
if (preg_match('/^( )+/', $msg, $matches)) {
$spaceLen = strlen($matches[0]) / 6;
- $trimMsg = ltrim($msg, ' ');
- $charLen = strlen($trimMsg);
+ $trimMsg = ltrim($msg, ' ');
+ $charLen = strlen($trimMsg);
$totalLen = $charLen + $spaceLen;
if ($totalLen > 100) {
$spacesCount = 10;
$validate = FALSE;
//validations
if (count($this->_contactIds) > $this->_maxContacts) {
- CRM_Core_Session::setStatus(ts("The maximum number of contacts you can select for Batch Update is %1. You have selected %2. Please select fewer contacts from your search results and try again.", array(1 => $this->_maxContacts, 2 => count($this->_contactIds))), ts('Maximum Exceeded'), 'error');
+ CRM_Core_Session::setStatus(ts("The maximum number of contacts you can select for Batch Update is %1. You have selected %2. Please select fewer contacts from your search results and try again.", array(
+ 1 => $this->_maxContacts,
+ 2 => count($this->_contactIds)
+ )), ts('Maximum Exceeded'), 'error');
$validate = TRUE;
}
if (!empty($this->_contactIds)) {
//using _contactIds field for creating params for query so that multiple selections on multiple pages
//can be printed.
- foreach ($this->_contactIds as $contactId) {
+ foreach ($this->_contactIds as $contactId) {
$params[] = array(
CRM_Core_Form::CB_PREFIX . $contactId,
'=',
- 1, 0, 0);
- }
+ 1,
+ 0,
+ 0
+ );
+ }
}
// create the selector, controller and run - store results in session
$returnP = isset($returnPropeties) ? $returnPropeties : "";
$customSearchClass = $this->get('customSearchClass');
- $selector = new $selectorName($customSearchClass,
- $fv,
- $params,
- $returnP,
- $this->_action,
- $includeContactIds
- );
+ $selector = new $selectorName($customSearchClass,
+ $fv,
+ $params,
+ $returnP,
+ $this->_action,
+ $includeContactIds
+ );
$controller = new CRM_Core_Selector_Controller($selector,
NULL,
$sortID,
* the default array reference
*/
public function setDefaultValues($form) {
- $defaults = array();
- $config = CRM_Core_Config::singleton();
+ $defaults = array();
+ $config = CRM_Core_Config::singleton();
$countryDefault = $config->defaultContactCountry;
if ($countryDefault) {
list($total, $removed, $notRemoved) = CRM_Contact_BAO_GroupContact::removeContactsFromGroup($this->_contactIds, $groupId);
- $status = array(ts("%count contact removed from '%2'", array('count' => $removed, 'plural' => "%count contacts removed from '%2'", 2 => $group[$groupId])));
+ $status = array(
+ ts("%count contact removed from '%2'", array(
+ 'count' => $removed,
+ 'plural' => "%count contacts removed from '%2'",
+ 2 => $group[$groupId]
+ ))
+ );
if ($notRemoved) {
- $status[] = ts('1 contact was already not in this group', array('count' => $notRemoved, 'plural' => '%count contacts were already not in this group'));
+ $status[] = ts('1 contact was already not in this group', array(
+ 'count' => $notRemoved,
+ 'plural' => '%count contacts were already not in this group'
+ ));
}
$status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
- CRM_Core_Session::setStatus($status, ts("Removed Contact From Group", array('plural' => "Removed Contacts From Group", 'count' => $removed)), 'success', array('expires' => 0));
+ CRM_Core_Session::setStatus($status, ts("Removed Contact From Group", array(
+ 'plural' => "Removed Contacts From Group",
+ 'count' => $removed
+ )), 'success', array('expires' => 0));
}
}
list($total, $removed, $notRemoved) = CRM_Core_BAO_EntityTag::removeEntitiesFromTag($this->_contactIds, $key);
- $status = array(ts('%count contact un-tagged', array('count' => $removed, 'plural' => '%count contacts un-tagged')));
+ $status = array(
+ ts('%count contact un-tagged', array(
+ 'count' => $removed,
+ 'plural' => '%count contacts un-tagged'
+ ))
+ );
if ($notRemoved) {
- $status[] = ts('1 contact already did not have this tag', array('count' => $notRemoved, 'plural' => '%count contacts already did not have this tag'));
+ $status[] = ts('1 contact already did not have this tag', array(
+ 'count' => $notRemoved,
+ 'plural' => '%count contacts already did not have this tag'
+ ));
}
$status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
CRM_Core_Session::setStatus($status, ts("Removed Tag <em>%1</em>", array(1 => $this->_tags[$key])), 'success', array('expires' => 0));
$context = $this->get('context');
if (in_array($context, array(
- 'smog', 'amtg'))) {
+ 'smog',
+ 'amtg'
+ ))) {
$urlParams = 'reset=1&force=1&context=smog&gid=';
$urlParams .= ($context == 'smog') ? $this->get('gid') : $this->get('amtgID');
$session->replaceUserContext(CRM_Utils_System::url('civicrm/group/search', $urlParams));
}
if ($activityCheck == count($form->_activityHolderIds)) {
CRM_Core_Error::statusBounce(ts("The Reply SMS Could only be sent for activities with '%1' subject.",
- array(1 => self::RECIEVED_SMS_ACTIVITY_SUBJECT)
- ));
+ array(1 => self::RECIEVED_SMS_ACTIVITY_SUBJECT)
+ ));
}
}
}
$errorMess = "";
if ($extendTargetContacts) {
$errorMess = ts('One selected activity consists of more than one target contact.', array(
- 'count' => $extendTargetContacts,
- 'plural' => '%count selected activities consist of more than one target contact.'));
+ 'count' => $extendTargetContacts,
+ 'plural' => '%count selected activities consist of more than one target contact.'
+ ));
}
if ($invalidActivity) {
$errorMess = ($errorMess ? ' ' : '');
$errorMess .= ts('The selected activity is invalid.', array(
- 'count' => $invalidActivity,
- 'plural' => '%count selected activities are invalid.'));
+ 'count' => $invalidActivity,
+ 'plural' => '%count selected activities are invalid.'
+ ));
}
CRM_Core_Error::statusBounce(ts("%1: SMS Reply will not be sent.", array(1 => $errorMess)));
}
//if phone is not primary check if non-primary phone is "Mobile"
if (!empty($value['phone'])
- && $value['phone_type_id'] != CRM_Utils_Array::value('Mobile', $phoneTypes) && empty($value['is_deceased'])) {
+ && $value['phone_type_id'] != CRM_Utils_Array::value('Mobile', $phoneTypes) && empty($value['is_deceased'])
+ ) {
$filter = array('do_not_sms' => 0);
$contactPhones = CRM_Core_BAO_Phone::allPhones($contactId, FALSE, 'Mobile', $filter);
if (count($contactPhones) > 0) {
$mobilePhone = CRM_Utils_Array::retrieveValueRecursive($contactPhones, 'phone');
- $form->_contactDetails[$contactId]['phone_id'] = CRM_Utils_Array::retrieveValueRecursive($contactPhones, 'id');
+ $form->_contactDetails[$contactId]['phone_id'] = CRM_Utils_Array::retrieveValueRecursive($contactPhones, 'id');
$form->_contactDetails[$contactId]['phone'] = $mobilePhone;
$form->_contactDetails[$contactId]['phone_type_id'] = CRM_Utils_Array::value('Mobile', $phoneTypes);
}
);
if ($countSuccess > 0) {
- CRM_Core_Session::setStatus(ts('One message was sent successfully.', array('plural' => '%count messages were sent successfully.', 'count' => $countSuccess)), ts('Message Sent', array('plural' => 'Messages Sent', 'count' => $countSuccess)), 'success');
+ CRM_Core_Session::setStatus(ts('One message was sent successfully.', array(
+ 'plural' => '%count messages were sent successfully.',
+ 'count' => $countSuccess
+ )), ts('Message Sent', array('plural' => 'Messages Sent', 'count' => $countSuccess)), 'success');
}
if (is_array($sent)) {
$status .= '<li>' . $errMsg . '</li>';
}
$status .= '</ul>';
- CRM_Core_Session::setStatus($status, ts('One Message Not Sent', array('count' => count($sent), 'plural' => '%count Messages Not Sent')), 'info');
+ CRM_Core_Session::setStatus($status, ts('One Message Not Sent', array(
+ 'count' => count($sent),
+ 'plural' => '%count Messages Not Sent'
+ )), 'info');
}
else {
//Display the name and number of contacts for those sms is not sent.
if (!empty($smsNotSent)) {
$not_sent = array();
foreach ($smsNotSent as $index => $contactId) {
- $displayName = $form->_allContactDetails[$contactId]['display_name'];
- $phone = $form->_allContactDetails[$contactId]['phone'];
+ $displayName = $form->_allContactDetails[$contactId]['display_name'];
+ $phone = $form->_allContactDetails[$contactId]['phone'];
$contactViewUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid=$contactId");
$not_sent[] = "<a href='$contactViewUrl' title='$phone'>$displayName</a>";
}
$status .= ' ' . ts("or the contact is not part of the activity '%1'", array(1 => self::RECIEVED_SMS_ACTIVITY_SUBJECT));
}
$status .= ')<ul><li>' . implode('</li><li>', $not_sent) . '</li></ul>';
- CRM_Core_Session::setStatus($status, ts('One Message Not Sent', array('count' => count($smsNotSent), 'plural' => '%count Messages Not Sent')), 'info');
+ CRM_Core_Session::setStatus($status, ts('One Message Not Sent', array(
+ 'count' => count($smsNotSent),
+ 'plural' => '%count Messages Not Sent'
+ )), 'info');
}
}
}
if (!$this->_id) {
//save record in mapping table
$mappingParams = array('mapping_type' => 'Search Builder');
- $temp = array();
- $mapping = CRM_Core_BAO_Mapping::add($mappingParams, $temp);
- $mappingId = $mapping->id;
+ $temp = array();
+ $mapping = CRM_Core_BAO_Mapping::add($mappingParams, $temp);
+ $mappingId = $mapping->id;
}
else {
//get the mapping id from saved search
is_array($formValues['group_type'])
) {
$params['group_type'] = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
- array_keys($formValues['group_type'])
- ) . CRM_Core_DAO::VALUE_SEPARATOR;
+ array_keys($formValues['group_type'])
+ ) . CRM_Core_DAO::VALUE_SEPARATOR;
}
else {
$params['group_type'] = '';
$sql = "SELECT ROW_COUNT( )";
$result = CRM_Core_DAO::singleValueQuery($sql);
if ($result) {
- CRM_Core_Session::setStatus(ts('%count email was found on hold and updated.', array('count' => $result, 'plural' => '%count emails were found on hold and updated.')), ts('Emails Restored'), 'success');
+ CRM_Core_Session::setStatus(ts('%count email was found on hold and updated.', array(
+ 'count' => $result,
+ 'plural' => '%count emails were found on hold and updated.'
+ )), ts('Emails Restored'), 'success');
}
else {
- CRM_Core_Session::setStatus(ts('The selected contact does not have an email on hold.', array('count' => $result, 'plural' => 'None of the selected contacts have an email on hold.')), ts('No Emails to Restore'), 'info');
+ CRM_Core_Session::setStatus(ts('The selected contact does not have an email on hold.', array(
+ 'count' => $result,
+ 'plural' => 'None of the selected contacts have an email on hold.'
+ )), ts('No Emails to Restore'), 'info');
}
}
else {
public function preProcess() {
$params = $defaults = $ids = array();
- $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
- $params['id'] = $params['contact_id'] = $this->_contactId;
- $contact = CRM_Contact_BAO_Contact::retrieve($params, $defaults, $ids);
+ $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
+ $params['id'] = $params['contact_id'] = $this->_contactId;
+ $contact = CRM_Contact_BAO_Contact::retrieve($params, $defaults, $ids);
$this->_displayName = $contact->display_name;
- $this->_email = $contact->email;
+ $this->_email = $contact->email;
CRM_Utils_System::setTitle(ts('Create User Record for %1', array(1 => $this->_displayName)));
}
CRM_Core_Error::fatal(ts('Database Configuration Error: Insufficient permissions. Import requires that the CiviCRM database user has permission to create temporary tables. Contact your site administrator for assistance.'));
}
- $results = array();
- $config = CRM_Core_Config::singleton();
- $handler = opendir($config->uploadDir);
+ $results = array();
+ $config = CRM_Core_Config::singleton();
+ $handler = opendir($config->uploadDir);
$errorFiles = array('sqlImport.errors', 'sqlImport.conflicts', 'sqlImport.duplicates', 'sqlImport.mismatch');
// check for post max size avoid when called twice
}
closedir($handler);
if (!empty($results)) {
- CRM_Core_Error::fatal(ts('<b>%1</b> file(s) in %2 directory are not writable. Listed file(s) might be used during the import to log the errors occurred during Import process. Contact your site administrator for assistance.', array(1 => implode(', ', $results), 2 => $config->uploadDir)));
+ CRM_Core_Error::fatal(ts('<b>%1</b> file(s) in %2 directory are not writable. Listed file(s) might be used during the import to log the errors occurred during Import process. Contact your site administrator for assistance.', array(
+ 1 => implode(', ', $results),
+ 2 => $config->uploadDir
+ )));
}
$this->_dataSourceIsValid = FALSE;
);
$mappingArray = CRM_Core_BAO_Mapping::getMappings(CRM_Core_OptionGroup::getValue('mapping_type',
- 'Import Contact',
- 'name'
- ));
+ 'Import Contact',
+ 'name'
+ ));
$this->assign('savedMapping', $mappingArray);
$this->addElement('select', 'savedMapping', ts('Mapping Option'), array('' => ts('- select -')) + $mappingArray);
*/
private function _getDataSources() {
// Open the data source dir and scan it for class files
- $config = CRM_Core_Config::singleton();
+ $config = CRM_Core_Config::singleton();
$dataSourceDir = $config->importDataSourceDir;
- $dataSources = array();
+ $dataSources = array();
if (!is_dir($dataSourceDir)) {
CRM_Core_Error::fatal("Import DataSource directory $dataSourceDir does not exist");
}
$dataSourceClass = "CRM_Import_DataSource_" . $matches[1];
require_once $dataSourceDir . DIRECTORY_SEPARATOR . $dataSourceFile;
$object = new $dataSourceClass;
- $info = $object->getInfo();
+ $info = $object->getInfo();
$dataSources[$dataSourceClass] = $info['title'];
}
}
// We should have the data in the DB now, parse it
$importTableName = $this->get('importTableName');
- $fieldNames = $this->_prepareImportTable($db, $importTableName);
- $mapper = array();
+ $fieldNames = $this->_prepareImportTable($db, $importTableName);
+ $mapper = array();
$parser = new CRM_Contact_Import_Parser_Contact($mapper);
$parser->setMaxLinesToProcess(100);
//format custom field names, CRM-2676
switch ($this->get('contactType')) {
case CRM_Import_Parser::CONTACT_INDIVIDUAL:
- $contactType = 'Individual';
+ $contactType = 'Individual';
$highlightedFields[] = 'first_name';
$highlightedFields[] = 'last_name';
break;
if ($this->_onDuplicate != CRM_Import_Parser::DUPLICATE_NOCHECK) {
//Mark Dedupe Rule Fields as required, since it's used in matching contact
foreach (array(
- 'Individual', 'Household', 'Organization') as $cType) {
+ 'Individual',
+ 'Household',
+ 'Organization'
+ ) as $cType) {
$ruleParams = array(
'contact_type' => $cType,
- 'used' => 'Unsupervised',
+ 'used' => 'Unsupervised',
);
$this->_dedupeFields[$cType] = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
}
list($mappingName, $mappingContactType, $mappingLocation, $mappingPhoneType, $mappingImProvider, $mappingRelation, $mappingOperator, $mappingValue, $mappingWebsiteType) = CRM_Core_BAO_Mapping::getMappingFields($savedMapping);
//get loaded Mapping Fields
- $mappingName = CRM_Utils_Array::value(1, $mappingName);
+ $mappingName = CRM_Utils_Array::value(1, $mappingName);
$mappingContactType = CRM_Utils_Array::value(1, $mappingContactType);
- $mappingLocation = CRM_Utils_Array::value(1, $mappingLocation);
- $mappingPhoneType = CRM_Utils_Array::value(1, $mappingPhoneType);
- $mappingImProvider = CRM_Utils_Array::value(1, $mappingImProvider);
- $mappingRelation = CRM_Utils_Array::value(1, $mappingRelation);
+ $mappingLocation = CRM_Utils_Array::value(1, $mappingLocation);
+ $mappingPhoneType = CRM_Utils_Array::value(1, $mappingPhoneType);
+ $mappingImProvider = CRM_Utils_Array::value(1, $mappingImProvider);
+ $mappingRelation = CRM_Utils_Array::value(1, $mappingRelation);
$mappingWebsiteType = CRM_Utils_Array::value(1, $mappingWebsiteType);
$this->assign('loadedMapping', $savedMapping);
$this->set('loadedMapping', $savedMapping);
- $params = array('id' => $savedMapping);
- $temp = array();
+ $params = array('id' => $savedMapping);
+ $temp = array();
$mappingDetails = CRM_Core_BAO_Mapping::retrieve($params, $temp);
$this->assign('savedName', $mappingDetails->name);
//-------- end of saved mapping stuff ---------
- $defaults = array();
- $mapperKeys = array_keys($this->_mapperFields);
- $hasColumnNames = !empty($this->_columnNames);
- $columnPatterns = $this->get('columnPatterns');
- $dataPatterns = $this->get('dataPatterns');
+ $defaults = array();
+ $mapperKeys = array_keys($this->_mapperFields);
+ $hasColumnNames = !empty($this->_columnNames);
+ $columnPatterns = $this->get('columnPatterns');
+ $dataPatterns = $this->get('dataPatterns');
$hasLocationTypes = $this->get('fieldTypes');
$this->_location_types = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
$sel1 = $this->_mapperFields;
$sel2[''] = NULL;
- $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
- $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id');
+ $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
+ $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id');
$websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
foreach ($this->_location_types as $key => $value) {
}
$contactDetails = strtolower(str_replace(" ", "_", $mappingName[$i]));
- $websiteTypeId = isset($mappingWebsiteType[$i]) ? $mappingWebsiteType[$i] : NULL;
- $locationId = isset($mappingLocation[$i]) ? $mappingLocation[$i] : 0;
- $phoneType = isset($mappingPhoneType[$i]) ? $mappingPhoneType[$i] : NULL;
+ $websiteTypeId = isset($mappingWebsiteType[$i]) ? $mappingWebsiteType[$i] : NULL;
+ $locationId = isset($mappingLocation[$i]) ? $mappingLocation[$i] : 0;
+ $phoneType = isset($mappingPhoneType[$i]) ? $mappingPhoneType[$i] : NULL;
//get provider id from saved mappings
$imProvider = isset($mappingImProvider[$i]) ? $mappingImProvider[$i] : NULL;
else {
$mappingHeader = array_keys($this->_mapperFields, $mappingName[$i]);
$websiteTypeId = isset($mappingWebsiteType[$i]) ? $mappingWebsiteType[$i] : NULL;
- $locationId = isset($mappingLocation[$i]) ? $mappingLocation[$i] : 0;
- $phoneType = isset($mappingPhoneType[$i]) ? $mappingPhoneType[$i] : NULL;
+ $locationId = isset($mappingLocation[$i]) ? $mappingLocation[$i] : 0;
+ $phoneType = isset($mappingPhoneType[$i]) ? $mappingPhoneType[$i] : NULL;
// get IM service provider id
$imProvider = isset($mappingImProvider[$i]) ? $mappingImProvider[$i] : NULL;
$this->setDefaults($defaults);
$this->addButtons(array(
- array(
- 'type' => 'back',
- 'name' => ts('Previous'),
- ),
- array(
- 'type' => 'next',
- 'name' => ts('Continue'),
- 'spacing' => ' ',
- 'isDefault' => TRUE,
- ),
- array(
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ),
+ array(
+ 'type' => 'back',
+ 'name' => ts('Previous'),
+ ),
+ array(
+ 'type' => 'next',
+ 'name' => ts('Continue'),
+ 'spacing' => ' ',
+ 'isDefault' => TRUE,
+ ),
+ array(
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ),
)
);
}
return;
}
- $mapper = array();
- $mapperKeys = array();
- $mapperKeys = $this->controller->exportValue($this->_name, 'mapper');
+ $mapper = array();
+ $mapperKeys = array();
+ $mapperKeys = $this->controller->exportValue($this->_name, 'mapper');
$mapperKeysMain = array();
- $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
- $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id');
- $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
+ $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
+ $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id');
+ $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
//these mapper params need to set key as array and val as null.
$$mapperParam = NULL;
}
- $fldName = CRM_Utils_Array::value(0, $mapperKeys[$i]);
- $selOne = CRM_Utils_Array::value(1, $mapperKeys[$i]);
- $selTwo = CRM_Utils_Array::value(2, $mapperKeys[$i]);
- $selThree = CRM_Utils_Array::value(3, $mapperKeys[$i]);
- $mapper[$i] = $this->_mapperFields[$mapperKeys[$i][0]];
+ $fldName = CRM_Utils_Array::value(0, $mapperKeys[$i]);
+ $selOne = CRM_Utils_Array::value(1, $mapperKeys[$i]);
+ $selTwo = CRM_Utils_Array::value(2, $mapperKeys[$i]);
+ $selThree = CRM_Utils_Array::value(3, $mapperKeys[$i]);
+ $mapper[$i] = $this->_mapperFields[$mapperKeys[$i][0]];
$mapperKeysMain[$i] = $fldName;
//need to differentiate non location elements.
//set related contact propeties.
$relProperties = array(
- 'related', 'relatedContactType', 'relatedContactDetails',
- 'relatedContactLocType', 'relatedContactPhoneType', 'relatedContactImProvider',
+ 'related',
+ 'relatedContactType',
+ 'relatedContactDetails',
+ 'relatedContactLocType',
+ 'relatedContactPhoneType',
+ 'relatedContactImProvider',
'relatedContactWebsiteType',
);
foreach ($relProperties as $relProperty) {
$updateMappingFields->column_number = $i;
$mapperKeyParts = explode('_', $mapperKeys[$i][0], 3);
- $id = isset($mapperKeyParts[0]) ? $mapperKeyParts[0] : NULL;
- $first = isset($mapperKeyParts[1]) ? $mapperKeyParts[1] : NULL;
- $second = isset($mapperKeyParts[2]) ? $mapperKeyParts[2] : NULL;
+ $id = isset($mapperKeyParts[0]) ? $mapperKeyParts[0] : NULL;
+ $first = isset($mapperKeyParts[1]) ? $mapperKeyParts[1] : NULL;
+ $second = isset($mapperKeyParts[2]) ? $mapperKeyParts[2] : NULL;
if (($first == 'a' && $second == 'b') || ($first == 'b' && $second == 'a')) {
$updateMappingFields->relationship_type_id = $id;
$updateMappingFields->relationship_direction = "{$first}_{$second}";
$saveMappingFields->column_number = $i;
$mapperKeyParts = explode('_', $mapperKeys[$i][0], 3);
- $id = isset($mapperKeyParts[0]) ? $mapperKeyParts[0] : NULL;
- $first = isset($mapperKeyParts[1]) ? $mapperKeyParts[1] : NULL;
- $second = isset($mapperKeyParts[2]) ? $mapperKeyParts[2] : NULL;
+ $id = isset($mapperKeyParts[0]) ? $mapperKeyParts[0] : NULL;
+ $first = isset($mapperKeyParts[1]) ? $mapperKeyParts[1] : NULL;
+ $second = isset($mapperKeyParts[2]) ? $mapperKeyParts[2] : NULL;
if (($first == 'a' && $second == 'b') || ($first == 'b' && $second == 'a')) {
$saveMappingFields->name = ucwords(str_replace("_", " ", $mapperKeys[$i][1]));
$saveMappingFields->relationship_type_id = $id;
*/
public function preProcess() {
//get the data from the session
- $dataValues = $this->get('dataValues');
- $mapper = $this->get('mapper');
- $invalidRowCount = $this->get('invalidRowCount');
+ $dataValues = $this->get('dataValues');
+ $mapper = $this->get('mapper');
+ $invalidRowCount = $this->get('invalidRowCount');
$conflictRowCount = $this->get('conflictRowCount');
- $mismatchCount = $this->get('unMatchCount');
- $columnNames = $this->get('columnNames');
+ $mismatchCount = $this->get('unMatchCount');
+ $columnNames = $this->get('columnNames');
//assign column names
$this->assign('columnNames', $columnNames);
}
$properties = array(
- 'mapper', 'locations', 'phones', 'ims',
- 'dataValues', 'columnCount',
- 'totalRowCount', 'validRowCount',
- 'invalidRowCount', 'conflictRowCount',
+ 'mapper',
+ 'locations',
+ 'phones',
+ 'ims',
+ 'dataValues',
+ 'columnCount',
+ 'totalRowCount',
+ 'validRowCount',
+ 'invalidRowCount',
+ 'conflictRowCount',
'downloadErrorRecordsUrl',
'downloadConflictRecordsUrl',
'downloadMismatchRecordsUrl',
- 'related', 'relatedContactDetails', 'relatedContactLocType',
- 'relatedContactPhoneType', 'relatedContactImProvider', 'websites',
+ 'related',
+ 'relatedContactDetails',
+ 'relatedContactLocType',
+ 'relatedContactPhoneType',
+ 'relatedContactImProvider',
+ 'websites',
'relatedContactWebsiteType',
);
$groups = $this->get('groups');
if (!empty($groups)) {
- $this->addElement('select', 'groups', ts('Add imported records to existing group(s)'), $groups, array('multiple' => "multiple", 'class' => 'crm-select2'));
+ $this->addElement('select', 'groups', ts('Add imported records to existing group(s)'), $groups, array(
+ 'multiple' => "multiple",
+ 'class' => 'crm-select2'
+ ));
}
//display new tag
if (!empty($fields['newTagName'])) {
if (!CRM_Utils_Rule::objectExists(trim($fields['newTagName']),
- array('CRM_Core_DAO_Tag')
- )) {
+ array('CRM_Core_DAO_Tag')
+ )
+ ) {
$errors['newTagName'] = ts('Tag \'%1\' already exists.',
array(1 => $fields['newTagName'])
);
}
if (!empty($fields['newGroupName'])) {
- $title = trim($fields['newGroupName']);
- $name = CRM_Utils_String::titleToVar($title);
- $query = 'select count(*) from civicrm_group where name like %1 OR title like %2';
+ $title = trim($fields['newGroupName']);
+ $name = CRM_Utils_String::titleToVar($title);
+ $query = 'select count(*) from civicrm_group where name like %1 OR title like %2';
$grpCnt = CRM_Core_DAO::singleValueQuery(
$query,
array(
public function postProcessOld() {
$doGeocodeAddress = $this->controller->exportValue('DataSource', 'doGeocodeAddress');
- $invalidRowCount = $this->get('invalidRowCount');
+ $invalidRowCount = $this->get('invalidRowCount');
$conflictRowCount = $this->get('conflictRowCount');
- $onDuplicate = $this->get('onDuplicate');
- $newGroupName = $this->controller->exportValue($this->_name, 'newGroupName');
- $newGroupDesc = $this->controller->exportValue($this->_name, 'newGroupDesc');
- $groups = $this->controller->exportValue($this->_name, 'groups');
- $allGroups = $this->get('groups');
- $newTagName = $this->controller->exportValue($this->_name, 'newTagName');
- $newTagDesc = $this->controller->exportValue($this->_name, 'newTagDesc');
- $tag = $this->controller->exportValue($this->_name, 'tag');
- $allTags = $this->get('tag');
+ $onDuplicate = $this->get('onDuplicate');
+ $newGroupName = $this->controller->exportValue($this->_name, 'newGroupName');
+ $newGroupDesc = $this->controller->exportValue($this->_name, 'newGroupDesc');
+ $groups = $this->controller->exportValue($this->_name, 'groups');
+ $allGroups = $this->get('groups');
+ $newTagName = $this->controller->exportValue($this->_name, 'newTagName');
+ $newTagDesc = $this->controller->exportValue($this->_name, 'newTagDesc');
+ $tag = $this->controller->exportValue($this->_name, 'tag');
+ $allTags = $this->get('tag');
$mapper = $this->controller->exportValue('MapField', 'mapper');
'description' => $newTagDesc,
'is_active' => TRUE,
);
- $id = array();
- $addedTag = CRM_Core_BAO_Tag::add($tagParams, $id);
+ $id = array();
+ $addedTag = CRM_Core_BAO_Tag::add($tagParams, $id);
$tag[$addedTag->id] = 1;
}
//add Tag to Import
$this->assign('dupeActionString', $dupeActionString);
- $properties = array('totalRowCount', 'validRowCount', 'invalidRowCount', 'conflictRowCount', 'downloadConflictRecordsUrl', 'downloadErrorRecordsUrl', 'duplicateRowCount', 'downloadDuplicateRecordsUrl', 'downloadMismatchRecordsUrl', 'groupAdditions', 'tagAdditions', 'unMatchCount', 'unparsedAddressCount');
+ $properties = array(
+ 'totalRowCount',
+ 'validRowCount',
+ 'invalidRowCount',
+ 'conflictRowCount',
+ 'downloadConflictRecordsUrl',
+ 'downloadErrorRecordsUrl',
+ 'duplicateRowCount',
+ 'downloadDuplicateRecordsUrl',
+ 'downloadMismatchRecordsUrl',
+ 'groupAdditions',
+ 'tagAdditions',
+ 'unMatchCount',
+ 'unparsedAddressCount'
+ );
foreach ($properties as $property) {
$this->assign($property, $this->get($property));
}
* @param int $timeout
*/
public function runImport(&$form, $timeout = 55) {
- $mapper = $this->_mapper;
- $mapperFields = array();
- $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
- $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id');
- $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
+ $mapper = $this->_mapper;
+ $mapperFields = array();
+ $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
+ $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id');
+ $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
//initialize mapper perperty value.
}
$fldNameParts = explode('_', $fldName, 3);
- $id = $fldNameParts[0];
- $first = isset($fldNameParts[1]) ? $fldNameParts[1] : NULL;
- $second = isset($fldNameParts[2]) ? $fldNameParts[2] : NULL;
+ $id = $fldNameParts[0];
+ $first = isset($fldNameParts[1]) ? $fldNameParts[1] : NULL;
+ $second = isset($fldNameParts[2]) ? $fldNameParts[2] : NULL;
if (($first == 'a' && $second == 'b') ||
($first == 'b' && $second == 'a')
) {
* @return array
*/
public static function getIncompleteImportTables() {
- $dao = new CRM_Core_DAO();
+ $dao = new CRM_Core_DAO();
$database = $dao->database();
- $query = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA
+ $query = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA
WHERE TABLE_SCHEMA = ? AND
TABLE_NAME LIKE 'civicrm_import_job_%'
ORDER BY TABLE_NAME";
* $Id$
*
*/
-
-
abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
protected $_tableName;
if ($this->_invalidRowCount) {
// removed view url for invlaid contacts
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('Reason'),
),
$customHeaders
self::exportCSV($this->_errorFileName, $headers, $this->_errors);
}
if ($this->_conflictCount) {
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('Reason'),
),
$customHeaders
self::exportCSV($this->_conflictFileName, $headers, $this->_conflicts);
}
if ($this->_duplicateCount) {
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('View Contact URL'),
),
$customHeaders
self::exportCSV($this->_duplicateFileName, $headers, $this->_duplicates);
}
if ($this->_unMatchCount) {
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('Reason'),
),
$customHeaders
self::exportCSV($this->_misMatchFilemName, $headers, $this->_unMatch);
}
if ($this->_unparsedAddressCount) {
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('Contact Edit URL'),
),
$customHeaders
$value = array(
$this->_activeFields[$i]->_name =>
- $this->_activeFields[$i]->_value,
+ $this->_activeFields[$i]->_value,
'location_type_id' =>
- $this->_activeFields[$i]->_hasLocationType,
+ $this->_activeFields[$i]->_hasLocationType,
);
if (isset($this->_activeFields[$i]->_phoneType)) {
if (isset($this->_activeFields[$i]->_relatedContactLocType) && !empty($this->_activeFields[$i]->_value)) {
if (!empty($params[$this->_activeFields[$i]->_related][$this->_activeFields[$i]->_relatedContactDetails]) &&
- !is_array($params[$this->_activeFields[$i]->_related][$this->_activeFields[$i]->_relatedContactDetails])) {
+ !is_array($params[$this->_activeFields[$i]->_related][$this->_activeFields[$i]->_relatedContactDetails])
+ ) {
$params[$this->_activeFields[$i]->_related][$this->_activeFields[$i]->_relatedContactDetails] = array();
}
$value = array(
}
$list = array_keys(CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
- 'contact_reference_options'
- ), '1');
+ 'contact_reference_options'
+ ), '1');
$return = array_unique(array_merge(array('sort_name'), $list));
}
if (!empty($action)) {
- $excludeGet = array('reset', 'key', 'className', 'fnName', 'json', 'reset', 'context', 'timestamp', 'limit', 'id', 's', 'q', 'action');
+ $excludeGet = array(
+ 'reset',
+ 'key',
+ 'className',
+ 'fnName',
+ 'json',
+ 'reset',
+ 'context',
+ 'timestamp',
+ 'limit',
+ 'id',
+ 's',
+ 'q',
+ 'action'
+ );
foreach ($_GET as $param => $val) {
if (empty($val) ||
in_array($param, $excludeGet) ||
* Fetch PCP ID by PCP Supporter sort_name, also displays PCP title and associated Contribution Page title
*/
public static function getPCPList() {
- $name = CRM_Utils_Array::value('s', $_GET);
- $name = CRM_Utils_Type::escape($name, 'String');
+ $name = CRM_Utils_Array::value('s', $_GET);
+ $name = CRM_Utils_Type::escape($name, 'String');
$limit = '10';
$where = ' AND pcp.page_id = cp.id AND pcp.contact_id = cc.id';
* Fetch the custom field help
*/
public static function customField() {
- $fieldId = CRM_Utils_Type::escape($_REQUEST['id'], 'Integer');
- $params = array('id' => $fieldId);
+ $fieldId = CRM_Utils_Type::escape($_REQUEST['id'], 'Integer');
+ $params = array('id' => $fieldId);
$returnProperties = array('help_pre', 'help_post');
- $values = array();
+ $values = array();
CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $params, $values, $returnProperties);
CRM_Utils_JSON::output($values);
$relType = NULL;
if (isset($_GET['rel'])) {
$relation = explode('_', $_GET['rel']);
- $relType = CRM_Utils_Type::escape($relation[0], 'Integer');
- $rel = CRM_Utils_Type::escape($relation[2], 'String');
+ $relType = CRM_Utils_Type::escape($relation[0], 'Integer');
+ $rel = CRM_Utils_Type::escape($relation[2], 'String');
}
//shared household info
$splitName = explode(' :: ', $name);
if ($splitName) {
$contactName = trim(CRM_Utils_Array::value('0', $splitName));
- $street = trim(CRM_Utils_Array::value('1', $splitName));
- $city = trim(CRM_Utils_Array::value('2', $splitName));
+ $street = trim(CRM_Utils_Array::value('1', $splitName));
+ $city = trim(CRM_Utils_Array::value('2', $splitName));
}
else {
$contactName = $name;
while ($dao->fetch()) {
if ($json) {
$elements[] = array(
- 'name' => addslashes($dao->sort_name),
+ 'name' => addslashes($dao->sort_name),
'id' => $dao->id,
);
}
* Perform enable / disable actions on record.
*/
public static function enableDisable() {
- $op = CRM_Utils_Type::escape($_REQUEST['op'], 'String');
- $recordID = CRM_Utils_Type::escape($_REQUEST['recordID'], 'Positive');
+ $op = CRM_Utils_Type::escape($_REQUEST['op'], 'String');
+ $recordID = CRM_Utils_Type::escape($_REQUEST['recordID'], 'Positive');
$recordBAO = CRM_Utils_Type::escape($_REQUEST['recordBAO'], 'String');
$isActive = NULL;
}
list($displayName,
$userEmail
- ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID);
+ ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID);
if ($userEmail) {
echo $userEmail;
}
*/
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);
+ $query = "SELECT signature_text, signature_html FROM civicrm_email WHERE id = {$emailID}";
+ $dao = CRM_Core_DAO::executeQuery($query);
$signatures = array();
while ($dao->fetch()) {
*/
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');
+ $cid = CRM_Utils_Type::escape($_REQUEST['cid'], 'Positive');
+ $oid = CRM_Utils_Type::escape($_REQUEST['oid'], 'Positive');
if (!$oper || !$cid || !$oid) {
return;
public static function getDedupes() {
- $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
- $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
- $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
- $sort = 'sort_name';
+ $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
+ $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
+ $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
+ $sort = 'sort_name';
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
- $gid = isset($_REQUEST['gid']) ? CRM_Utils_Type::escape($_REQUEST['gid'], 'Integer') : 0;
- $rgid = isset($_REQUEST['rgid']) ? CRM_Utils_Type::escape($_REQUEST['rgid'], 'Integer') : 0;
+ $gid = isset($_REQUEST['gid']) ? CRM_Utils_Type::escape($_REQUEST['gid'], 'Integer') : 0;
+ $rgid = isset($_REQUEST['rgid']) ? CRM_Utils_Type::escape($_REQUEST['rgid'], 'Integer') : 0;
$contactType = '';
if ($rgid) {
$contactType = CRM_Core_DAO::getFieldValue('CRM_Dedupe_DAO_RuleGroup', $rgid, 'contact_type');
}
- $cacheKeyString = "merge {$contactType}_{$rgid}_{$gid}";
- $searchRows = array();
+ $cacheKeyString = "merge {$contactType}_{$rgid}_{$gid}";
+ $searchRows = array();
$selectorElements = array('src', 'dst', 'weight', 'actions');
$join = "LEFT JOIN civicrm_dedupe_exception de ON ( pn.entity_id1 = de.contact_id1 AND
}
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');
+ $name = CRM_Utils_Array::value('name', $_REQUEST);
+ $cacheKey = CRM_Utils_Array::value('qfKey', $_REQUEST);
+ $state = CRM_Utils_Array::value('state', $_REQUEST, 'checked');
$variableType = CRM_Utils_Array::value('variableType', $_REQUEST, 'single');
$actionToPerform = CRM_Utils_Array::value('action', $_REQUEST, 'select');
10 => '',
);
- $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
- $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
- $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
- $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
+ $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
+ $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
+ $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
+ $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
$params = $_POST;
}
//check that default FROM email address, owner (domain) organization name and default mailbox are configured.
- $fromEmailOK = TRUE;
- $ownerOrgOK = TRUE;
+ $fromEmailOK = TRUE;
+ $ownerOrgOK = TRUE;
$defaultMailboxOK = TRUE;
// Don't put up notices if user doesn't have administer CiviCRM permission
$contactIds[$exception->contact_id1] = $exception->contact_id1;
$contactIds[$exception->contact_id2] = $exception->contact_id2;
$dedupeExceptions[$key] = array(
- 'main' => array('id' => $exception->contact_id1),
+ 'main' => array('id' => $exception->contact_id1),
'other' => array('id' => $exception->contact_id2),
);
}
//get the dupe contacts display names.
if (!empty($dedupeExceptions)) {
- $sql = 'select id, display_name from civicrm_contact where id IN ( ' . implode(', ', $contactIds) . ' )';
- $contact = CRM_Core_DAO::executeQuery($sql);
+ $sql = 'select id, display_name from civicrm_contact where id IN ( ' . implode(', ', $contactIds) . ' )';
+ $contact = CRM_Core_DAO::executeQuery($sql);
$displayNames = array();
while ($contact->fetch()) {
$displayNames[$contact->id] = $contact->display_name;
* @return void
*/
public function run() {
- $gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, FALSE, 0);
- $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 0);
+ $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);
$session = CRM_Core_Session::singleton();
$skippedCount = CRM_Utils_Request::retrieve('skipped', 'Positive', $this, FALSE, 0);
$skippedCount = $skippedCount + count($result['skipped']);
- $mergedCount = CRM_Utils_Request::retrieve('merged', 'Positive', $this, FALSE, 0);
- $mergedCount = $mergedCount + count($result['merged']);
+ $mergedCount = CRM_Utils_Request::retrieve('merged', 'Positive', $this, FALSE, 0);
+ $mergedCount = $mergedCount + count($result['merged']);
if (empty($result['merged']) && empty($result['skipped'])) {
$message = '';
if ($action & CRM_Core_Action::UPDATE ||
$action & CRM_Core_Action::BROWSE
) {
- $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE, 0);
- $rgid = CRM_Utils_Request::retrieve('rgid', 'Positive', $this, FALSE, 0);
+ $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE, 0);
+ $rgid = CRM_Utils_Request::retrieve('rgid', 'Positive', $this, FALSE, 0);
$this->action = CRM_Core_Action::UPDATE;
//calculate the $contactType
$cids[$dupe[1]] = 1;
}
$cidString = implode(', ', array_keys($cids));
- $sql = "SELECT id, display_name FROM civicrm_contact WHERE id IN ($cidString) ORDER BY sort_name";
- $dao = new CRM_Core_DAO();
+ $sql = "SELECT id, display_name FROM civicrm_contact WHERE id IN ($cidString) ORDER BY sort_name";
+ $dao = new CRM_Core_DAO();
$dao->query($sql);
$displayNames = array();
while ($dao->fetch()) {
// (also, consider sorting by dupe count first)
// lobo - change the sort to by threshold value
// so the more likely dupes are sorted first
- $session = CRM_Core_Session::singleton();
- $userId = $session->get('userID');
+ $session = CRM_Core_Session::singleton();
+ $userId = $session->get('userID');
$mainContacts = $permission = array();
foreach ($foundDupes as $dupes) {
* Eliminate this since it introduces 3 queries PER merge row
* and hence is very expensive
* CRM-8822
- if ( !array_key_exists( $srcID, $permission ) ) {
- $permission[$srcID] = CRM_Contact_BAO_Contact_Permission::allow( $srcID, CRM_Core_Permission::EDIT );
- }
- if ( !array_key_exists( $dstID, $permission ) ) {
- $permission[$dstID] = CRM_Contact_BAO_Contact_Permission::allow( $dstID, CRM_Core_Permission::EDIT );
- }
-
- $canMerge = ( $permission[$dstID] && $permission[$srcID] );
+ * if ( !array_key_exists( $srcID, $permission ) ) {
+ * $permission[$srcID] = CRM_Contact_BAO_Contact_Permission::allow( $srcID, CRM_Core_Permission::EDIT );
+ * }
+ * if ( !array_key_exists( $dstID, $permission ) ) {
+ * $permission[$dstID] = CRM_Contact_BAO_Contact_Permission::allow( $dstID, CRM_Core_Permission::EDIT );
+ * }
+ *
+ * $canMerge = ( $permission[$dstID] && $permission[$srcID] );
*
*/
$session = CRM_Core_Session::singleton();
if ($this->_cid) {
$session->pushUserContext(CRM_Utils_System::url('civicrm/contact/deduperules',
- "action=update&rgid={$this->_rgid}&gid={$this->_gid}&cid={$this->_cid}"
- ));
+ "action=update&rgid={$this->_rgid}&gid={$this->_gid}&cid={$this->_cid}"
+ ));
}
else {
$session->pushUserContext(CRM_Utils_System::url('civicrm/contact/dedupefind',
- "reset=1&action=update&rgid={$this->_rgid}"
- ));
+ "reset=1&action=update&rgid={$this->_rgid}"
+ ));
}
}
}
$cgcount = CRM_Utils_Request::retrieve('cgcount', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1, $_REQUEST);
//custom groups Inline
- $entityType = CRM_Contact_BAO_Contact::getContactType($contactId);
+ $entityType = CRM_Contact_BAO_Contact::getContactType($contactId);
$entitySubType = CRM_Contact_BAO_Contact::getContactSubType($contactId);
- $groupTree = &CRM_Core_BAO_CustomGroup::getTree($entityType, $this, $contactId,
+ $groupTree = &CRM_Core_BAO_CustomGroup::getTree($entityType, $this, $contactId,
$cgId, $entitySubType
- );
+ );
$details = CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
//get the fields of single custom group record
if ($customRecId == 1) {
$websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
- $params = array('contact_id' => $contactId);
+ $params = array('contact_id' => $contactId);
$websites = CRM_Core_BAO_Website::getValues($params, CRM_Core_DAO::$_nullArray);
if (!empty($websites)) {
foreach ($websites as $key => & $value) {
$row['name'] = $group->title;
$row['description'] = $group->description;
- $row['id'] = $savedSearch->id;
- $formValues = unserialize($savedSearch->form_values);
- $query = new CRM_Contact_BAO_Query($formValues);
+ $row['id'] = $savedSearch->id;
+ $formValues = unserialize($savedSearch->form_values);
+ $query = new CRM_Contact_BAO_Query($formValues);
$row['query_detail'] = $query->qill();
- $action = array_sum(array_keys(self::links()));
- $action = $action & CRM_Core_Action::mask($permissions);
+ $action = array_sum(array_keys(self::links()));
+ $action = $action & CRM_Core_Action::mask($permissions);
$row['action'] = CRM_Core_Action::formLink(
self::links(),
$action,
list($displayName, $contactImage,
$contactType, $contactSubtype, $contactImageUrl
- ) = self::getContactDetails($this->_contactId);
+ ) = self::getContactDetails($this->_contactId);
$this->assign('displayName', $displayName);
$this->set('contactType', $contactType);
$contactType,
$contactSubtype,
$contactImageUrl
- ) = CRM_Contact_BAO_Contact::getDisplayAndImage($contactId,
+ ) = CRM_Contact_BAO_Contact::getDisplayAndImage($contactId,
TRUE,
TRUE
);
if ($this->_action == CRM_Core_Action::BROWSE) {
//Custom Groups Inline
- $entityType = CRM_Contact_BAO_Contact::getContactType($this->_contactId);
+ $entityType = CRM_Contact_BAO_Contact::getContactType($this->_contactId);
$entitySubType = CRM_Contact_BAO_Contact::getContactSubType($this->_contactId);
- $groupTree = &CRM_Core_BAO_CustomGroup::getTree($entityType, $this, $this->_contactId,
+ $groupTree = &CRM_Core_BAO_CustomGroup::getTree($entityType, $this, $this->_contactId,
$this->_groupId, $entitySubType
);
$count = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, NULL, NULL, TRUE);
- $in = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Added');
+ $in = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Added');
$pending = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Pending');
- $out = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Removed');
+ $out = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Removed');
// keep track of all 'added' contact groups so we can remove them from the smart group
// section
if ($loggingReport) {
$this->assign('instanceUrl',
- CRM_Utils_System::url("civicrm/report/instance/{$loggingReport}",
- "reset=1&force=1&snippet=4§ion=2&altered_contact_id_op=eq&altered_contact_id_value={$this->_contactId}&cid={$this->_contactId}", FALSE, NULL, FALSE));
+ CRM_Utils_System::url("civicrm/report/instance/{$loggingReport}",
+ "reset=1&force=1&snippet=4§ion=2&altered_contact_id_op=eq&altered_contact_id_value={$this->_contactId}&cid={$this->_contactId}", FALSE, NULL, FALSE));
return;
}
* return null
*/
public function browse() {
- $note = new CRM_Core_DAO_Note();
+ $note = new CRM_Core_DAO_Note();
$note->entity_table = 'civicrm_contact';
- $note->entity_id = $this->_contactId;
+ $note->entity_id = $this->_contactId;
$note->orderBy('modified_date desc');
$mask = CRM_Core_Action::mask($permissions);
$values = array();
- $links = self::links();
+ $links = self::links();
$action = array_sum(array_keys($links)) & $mask;
$note->find();
$session->pushUserContext($url);
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean',
- CRM_Core_DAO::$_nullObject
- )) {
+ CRM_Core_DAO::$_nullObject
+ )
+ ) {
CRM_Core_BAO_Note::del($this->_id);
CRM_Utils_System::redirect($url);
}
* @return void
*/
public function view() {
- $params = array();
+ $params = array();
$defaults = array();
- $ids = array();
+ $ids = array();
$params['id'] = $params['contact_id'] = $this->_contactId;
$contact = CRM_Contact_BAO_Contact::retrieve($params, $defaults, $ids);
$session->pushUserContext($url);
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean',
- CRM_Core_DAO::$_nullObject
- )) {
+ CRM_Core_DAO::$_nullObject
+ )
+ ) {
if ($this->_caseId) {
//create an activity for case role removal.CRM-4480
CRM_Case_BAO_Case::createCaseRoleActivity($this->_caseId, $this->_id);
$url = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $this->_contactId);
$session->pushUserContext($url);
- $params = array();
+ $params = array();
$defaults = array();
- $ids = array();
+ $ids = array();
$params['id'] = $params['contact_id'] = $this->_contactId;
$params['noRelationships'] = $params['noNotes'] = $params['noGroups'] = TRUE;
foreach ($rest as $k => $v) {
if ($accessCiviCRM && !empty($this->_viewOptions[$k])) {
$allTabs[] = $v + array(
- 'id' => $k,
- 'url' => CRM_Utils_System::url(
- "civicrm/contact/view/$k",
- "reset=1&cid={$this->_contactId}"
- ),
- 'weight' => $weight,
- 'count' => CRM_Contact_BAO_Contact::getCountComponent($k, $this->_contactId),
- );
+ 'id' => $k,
+ 'url' => CRM_Utils_System::url(
+ "civicrm/contact/view/$k",
+ "reset=1&cid={$this->_contactId}"
+ ),
+ 'weight' => $weight,
+ 'count' => CRM_Contact_BAO_Contact::getCountComponent($k, $this->_contactId),
+ );
$weight += 10;
}
}
if (CRM_Core_Permission::check('access CiviCRM')) {
self::$_links = array_merge(self::$_links, array(
CRM_Core_Action::DISABLE => array(
- 'name' => ts('Disable'),
- 'url' => 'civicrm/contact/view/rel',
- 'qs' => 'action=disable&reset=1&cid=%%cid%%&id=%%id%%&rtype=%%rtype%%&selectedChild=rel&context=dashboard',
- 'extra' => 'onclick = "return confirm(\'' . $disableExtra . '\');"',
- 'title' => ts('Disable Relationship'),
- ),
- ));
+ 'name' => ts('Disable'),
+ 'url' => 'civicrm/contact/view/rel',
+ 'qs' => 'action=disable&reset=1&cid=%%cid%%&id=%%id%%&rtype=%%rtype%%&selectedChild=rel&context=dashboard',
+ 'extra' => 'onclick = "return confirm(\'' . $disableExtra . '\');"',
+ 'title' => ts('Disable Relationship'),
+ ),
+ ));
}
}
public function run() {
$this->preProcess();
- $params = array();
+ $params = array();
$defaults = array();
- $ids = array();
+ $ids = array();
$params['id'] = $params['contact_id'] = $this->_contactId;
$contact = CRM_Contact_BAO_Contact::retrieve($params, $defaults, $ids);
if (!empty($location['supplemental_address_2'])) {
$extend .= ', ' . $location['supplemental_address_2'];
}
- $street = CRM_Utils_Array::value('street_address', $location);
+ $street = CRM_Utils_Array::value('street_address', $location);
$locality = CRM_Utils_Array::value('city', $location);
- $region = NULL;
+ $region = NULL;
if (!empty($location['state_province_id'])) {
$region = $stateProvices[CRM_Utils_Array::value('state_province_id', $location)];
}
* @static
*/
static $_properties = array(
- 'contact_id', 'contact_type', 'contact_sub_type',
- 'sort_name', 'street_address',
- 'city', 'state_province', 'postal_code', 'country',
- 'geo_code_1', 'geo_code_2', 'is_deceased',
- 'email', 'on_hold', 'phone', 'status',
- 'do_not_email', 'do_not_phone', 'do_not_mail',
+ 'contact_id',
+ 'contact_type',
+ 'contact_sub_type',
+ 'sort_name',
+ 'street_address',
+ 'city',
+ 'state_province',
+ 'postal_code',
+ 'country',
+ 'geo_code_1',
+ 'geo_code_2',
+ 'is_deceased',
+ 'email',
+ 'on_hold',
+ 'phone',
+ 'status',
+ 'do_not_email',
+ 'do_not_phone',
+ 'do_not_mail',
);
/**
* @param array $params
*/
public function getPagerParams($action, &$params) {
- $params['status'] = ts('Contact %%StatusMessage%%');
+ $params['status'] = ts('Contact %%StatusMessage%%');
$params['csvString'] = NULL;
- $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
+ $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
$params['buttonTop'] = 'PagerTopButton';
$params['buttonBottom'] = 'PagerBottomButton';
$direction = CRM_Utils_Sort::ASCENDING;
$empty = TRUE;
if (!self::$_columnHeaders) {
- self::$_columnHeaders = array(array('name' => ''),
+ self::$_columnHeaders = array(
+ array('name' => ''),
array(
'name' => ts('Name'),
'sort' => 'sort_name',
}
if (in_array($fieldName, array(
- 'phone', 'im', 'email'))) {
+ 'phone',
+ 'im',
+ 'email'
+ ))) {
if ($type) {
$name = "`$locationTypeName-$fieldName-$type`";
}
$headers = self::$_columnHeaders;
}
elseif (!empty($this->_returnProperties)) {
- self::$_columnHeaders = array(array('name' => ''),
+ self::$_columnHeaders = array(
+ array('name' => ''),
array(
'name' => ts('Name'),
'sort' => 'sort_name',
$locationTypeName = str_replace(' ', '_', $locationTypeName);
if (in_array($fieldName, array(
- 'phone', 'im', 'email'))) {
+ 'phone',
+ 'im',
+ 'email'
+ ))) {
if ($type) {
$names[] = "{$locationTypeName}-{$fieldName}-{$type}";
}
elseif (strpos($property, '-im')) {
$row[$property] = $result->$property;
if (!empty($result->$property)) {
- $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id');
- $providerId = $property . "-provider_id";
- $providerName = $imProviders[$result->$providerId];
+ $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id');
+ $providerId = $property . "-provider_id";
+ $providerName = $imProviders[$result->$providerId];
$row[$property] = $result->$property . " ({$providerName})";
}
}
elseif (in_array($property, array(
- 'addressee', 'email_greeting', 'postal_greeting'))) {
+ 'addressee',
+ 'email_greeting',
+ 'postal_greeting'
+ ))) {
$greeting = $property . '_display';
$row[$property] = $result->$greeting;
}
$websiteFld = $websiteKey . '-' . array_pop($propertyArray);
if (!empty($result->$websiteFld)) {
$websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
- $websiteType = $websiteTypes[$result->{"$websiteKey-website_type_id"}];
+ $websiteType = $websiteTypes[$result->{"$websiteKey-website_type_id"}];
$websiteValue = $result->$websiteFld;
- $websiteUrl = "<a href=\"{$websiteValue}\">{$websiteValue} ({$websiteType})</a>";
+ $websiteUrl = "<a href=\"{$websiteValue}\">{$websiteValue} ({$websiteType})</a>";
}
$row[$property] = $websiteUrl;
}
);
$row['contact_type_orig'] = $result->contact_sub_type ? $result->contact_sub_type : $result->contact_type;
- $row['contact_sub_type'] = $result->contact_sub_type ? CRM_Contact_BAO_ContactType::contactTypePairs(FALSE, $result->contact_sub_type, ', ') : $result->contact_sub_type;
+ $row['contact_sub_type'] = $result->contact_sub_type ? CRM_Contact_BAO_ContactType::contactTypePairs(FALSE, $result->contact_sub_type, ', ') : $result->contact_sub_type;
$row['contact_id'] = $result->contact_id;
$row['sort_name'] = $result->sort_name;
if (array_key_exists('id', $row)) {
* Given the current formValues, gets the query in local
* language
*
- * @param array(
- reference) $formValues submitted formValues
+ * @param array (
+ * reference) $formValues submitted formValues
*
* @return array
* which contains an array of strings
* @param array $params
*/
public function getPagerParams($action, &$params) {
- $params['status'] = ts('Contact %%StatusMessage%%');
+ $params['status'] = ts('Contact %%StatusMessage%%');
$params['csvString'] = NULL;
- $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
+ $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
$params['buttonTop'] = 'PagerTopButton';
$params['buttonBottom'] = 'PagerBottomButton';
// contact query object used for creating $sql
$contactQueryObj = NULL;
if (method_exists($this->_search, 'getQueryObj') &&
- is_a($this->_search->getQueryObj(), 'CRM_Contact_BAO_Query')) {
+ is_a($this->_search->getQueryObj(), 'CRM_Contact_BAO_Query')
+ ) {
$contactQueryObj = $this->_search->getQueryObj();
}
$dao = CRM_Core_DAO::executeQuery($sql, CRM_Core_DAO::$_nullArray);
- $columns = $this->_search->columns();
+ $columns = $this->_search->columns();
$columnNames = array_values($columns);
- $links = self::links($this->_key);
+ $links = self::links($this->_key);
$permissions = array(CRM_Core_Permission::getPermission());
if (CRM_Core_Permission::check('delete contacts')) {
$alterRow = FALSE;
if (method_exists($this->_customSearchClass,
- 'alterRow'
- )) {
+ 'alterRow'
+ )) {
$alterRow = TRUE;
}
$image = FALSE;
* Given the current formValues, gets the query in local
* language
*
- * @param array(
- reference) $formValues submitted formValues
+ * @param array (
+ * reference) $formValues submitted formValues
*
* @return array
* which contains an array of strings
if (!in_array($contributionStatuses[$fields['contribution_status_id']], $checkStatus[$contributionStatuses[$values['contribution_status_id']]])) {
$errors['contribution_status_id'] = ts("Cannot change contribution status from %1 to %2.", array(
- 1 => $contributionStatuses[$values['contribution_status_id']],
- 2 => $contributionStatuses[$fields['contribution_status_id']],
- ));
+ 1 => $contributionStatuses[$values['contribution_status_id']],
+ 2 => $contributionStatuses[$fields['contribution_status_id']],
+ ));
}
}
if ($component !== 'membership') {
CRM_Core_Error::displaySessionError($result);
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/transact',
- "_qf_Main_display=true&qfKey={$form->_params['qfKey']}"
- ));
+ "_qf_Main_display=true&qfKey={$form->_params['qfKey']}"
+ ));
}
$membershipResult[1] = $result;
}
$form->_values['contribution_id'] = $contribution->id;
CRM_Contribute_BAO_ContributionPage::sendMail($contactID,
$form->_values, $contribution->is_test,
- FALSE, $fieldTypes
+ FALSE, $fieldTypes
);
}
}
return FALSE;
}
+
/**
* Get the contribution details by month
* of the year
if (!CRM_Utils_System::isNull($params['email'])) {
$params['email'] = array(
1 => array(
- 'email' => $params['email'],
+ 'email' => $params['email'],
'location_type_id' => $billingLocTypeId,
- ));
+ )
+ );
}
if (isset($transaction['trxn_id'])) {
$type = strtolower($type);
if (!in_array($type, array(
- 'paypal', 'google', 'csv'))) {
+ 'paypal',
+ 'google',
+ 'csv'
+ ))
+ ) {
// return the params as is
return $apiParams;
}
),
);
$copy = &CRM_Core_DAO::copyGeneric('CRM_Contribute_DAO_ContributionPage', array(
- 'id' => $id,
- ), NULL, $fieldsFix);
+ 'id' => $id,
+ ), NULL, $fieldsFix);
//copying all the blocks pertaining to the contribution page
$copyPledgeBlock = &CRM_Core_DAO::copyGeneric('CRM_Pledge_DAO_PledgeBlock', array(
- 'entity_id' => $id,
- 'entity_table' => 'civicrm_contribution_page',
- ), array(
- 'entity_id' => $copy->id,
- ));
+ 'entity_id' => $id,
+ 'entity_table' => 'civicrm_contribution_page',
+ ), array(
+ 'entity_id' => $copy->id,
+ ));
$copyMembershipBlock = &CRM_Core_DAO::copyGeneric('CRM_Member_DAO_MembershipBlock', array(
- 'entity_id' => $id,
- 'entity_table' => 'civicrm_contribution_page',
- ), array(
- 'entity_id' => $copy->id,
- ));
+ 'entity_id' => $id,
+ 'entity_table' => 'civicrm_contribution_page',
+ ), array(
+ 'entity_id' => $copy->id,
+ ));
$copyUFJoin = &CRM_Core_DAO::copyGeneric('CRM_Core_DAO_UFJoin', array(
- 'entity_id' => $id,
- 'entity_table' => 'civicrm_contribution_page',
- ), array(
- 'entity_id' => $copy->id,
- ));
+ 'entity_id' => $id,
+ 'entity_table' => 'civicrm_contribution_page',
+ ), array(
+ 'entity_id' => $copy->id,
+ ));
$copyWidget = &CRM_Core_DAO::copyGeneric('CRM_Contribute_DAO_Widget', array(
- 'contribution_page_id' => $id,
- ), array(
- 'contribution_page_id' => $copy->id,
- ));
+ 'contribution_page_id' => $id,
+ ), array(
+ 'contribution_page_id' => $copy->id,
+ ));
//copy price sets
CRM_Price_BAO_PriceSet::copyPriceSet('civicrm_contribution_page', $id, $copy->id);
$copyTellFriend = &CRM_Core_DAO::copyGeneric('CRM_Friend_DAO_Friend', array(
- 'entity_id' => $id,
- 'entity_table' => 'civicrm_contribution_page',
- ), array(
- 'entity_id' => $copy->id,
- ));
+ 'entity_id' => $id,
+ 'entity_table' => 'civicrm_contribution_page',
+ ), array(
+ 'entity_id' => $copy->id,
+ ));
$copyPersonalCampaignPages = &CRM_Core_DAO::copyGeneric('CRM_PCP_DAO_PCPBlock', array(
- 'entity_id' => $id,
- 'entity_table' => 'civicrm_contribution_page',
- ), array(
- 'entity_id' => $copy->id,
- ));
+ 'entity_id' => $id,
+ 'entity_table' => 'civicrm_contribution_page',
+ ), array(
+ 'entity_id' => $copy->id,
+ ));
$copyPremium = &CRM_Core_DAO::copyGeneric('CRM_Contribute_DAO_Premium', array(
- 'entity_id' => $id,
- 'entity_table' => 'civicrm_contribution_page',
- ), array(
- 'entity_id' => $copy->id,
- ));
+ 'entity_id' => $id,
+ 'entity_table' => 'civicrm_contribution_page',
+ ), array(
+ 'entity_id' => $copy->id,
+ ));
$premiumQuery = "
SELECT id
FROM civicrm_premiums
$premiumDao = CRM_Core_DAO::executeQuery($premiumQuery, CRM_Core_DAO::$_nullArray);
while ($premiumDao->fetch()) {
if ($premiumDao->id) {
- $copyPremiumProduct = & CRM_Core_DAO::copyGeneric('CRM_Contribute_DAO_PremiumsProduct', array(
+ $copyPremiumProduct = &CRM_Core_DAO::copyGeneric('CRM_Contribute_DAO_PremiumsProduct', array(
'premiums_id' => $premiumDao->id,
), array(
'premiums_id' => $copyPremium->id,
* @see CRM_Core_DAO::buildOptions
*
* @param string $fieldName
- * @param string $context: @see CRM_Core_DAO::buildOptionsContext
- * @param array $props: whatever is known about this dao object
+ * @param string $context : @see CRM_Core_DAO::buildOptionsContext
+ * @param array $props : whatever is known about this dao object
*
* @return array|bool
*/
// Fixme - this is going to ignore context, better to get conditions, add params, and call PseudoConstant::get
return CRM_Financial_BAO_FinancialType::getIncomeFinancialType();
- break;
+ break;
}
return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
}
/**
* Get or Set multilingually affected honor params for processing module_data or setting default values.
*
- * @param string $params:
- * @param bool $setDefault: If yes then returns array to used for setting default value afterward
+ * @param string $params :
+ * @param bool $setDefault : If yes then returns array to used for setting default value afterward
*
* @return array|string
*/
* isSeparateMembershipPayment
*/
public static function getIsMembershipPayment($id) {
- $membershipBlocks = civicrm_api3('membership_block', 'get', array('entity_table' => 'civicrm_contribution_page', 'entity_id' => $id, 'sequential' => TRUE));
+ $membershipBlocks = civicrm_api3('membership_block', 'get', array(
+ 'entity_table' => 'civicrm_contribution_page',
+ 'entity_id' => $id,
+ 'sequential' => TRUE
+ ));
if (!$membershipBlocks['count']) {
return FALSE;
}
* static
*/
public static function checkDuplicate($params, &$duplicates) {
- $id = CRM_Utils_Array::value('id', $params);
- $trxn_id = CRM_Utils_Array::value('trxn_id', $params);
+ $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);
$clause = array();
$params[3] = array($id, 'Integer');
}
- $query = "SELECT id FROM civicrm_contribution_recur WHERE $clause";
- $dao = CRM_Core_DAO::executeQuery($query, $params);
+ $query = "SELECT id FROM civicrm_contribution_recur WHERE $clause";
+ $dao = CRM_Core_DAO::executeQuery($query, $params);
$result = FALSE;
while ($dao->fetch()) {
$duplicates[] = $dao->id;
return $result;
}
- $recur = new CRM_Contribute_DAO_ContributionRecur();
+ $recur = new CRM_Contribute_DAO_ContributionRecur();
$recur->id = $recurId;
- $result = $recur->delete();
+ $result = $recur->delete();
return $result;
}
}
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
- $canceledId = array_search('Cancelled', $contributionStatus);
- $recur = new CRM_Contribute_DAO_ContributionRecur();
- $recur->id = $recurId;
+ $canceledId = array_search('Cancelled', $contributionStatus);
+ $recur = new CRM_Contribute_DAO_ContributionRecur();
+ $recur->id = $recurId;
$recur->whereAdd("contribution_status_id != $canceledId");
if ($recur->find(TRUE)) {
if ($dao->auto_renew && $dao->membership_id) {
// its auto-renewal membership mode
$membershipTypes = CRM_Member_PseudoConstant::membershipType();
- $membershipType = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $dao->membership_id, 'membership_type_id');
- $membershipType = CRM_Utils_Array::value($membershipType, $membershipTypes);
+ $membershipType = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $dao->membership_id, 'membership_type_id');
+ $membershipType = CRM_Utils_Array::value($membershipType, $membershipTypes);
$details .= '
<br/>' . ts('Automatic renewal of %1 membership cancelled.', array(1 => $membershipType));
}
else {
$details .= '
<br/>' . ts('The recurring contribution of %1, every %2 %3 has been cancelled.', array(
- 1 => $dao->amount,
+ 1 => $dao->amount,
2 => $dao->frequency_interval,
3 => $dao->frequency_unit,
));
GROUP BY currency';
$params = array(
- 1 => array($contact_id, 'Integer'),
- 2 => array($isTest, 'Integer'));
+ 1 => array($contact_id, 'Integer'),
+ 2 => array($isTest, 'Integer')
+ );
$cs = CRM_Core_DAO::executeQuery($query, $params);
// get financial_type
if (!empty($query->_returnProperties['financial_type'])) {
- $query->_select['financial_type'] = "civicrm_financial_type.name as financial_type";
+ $query->_select['financial_type'] = "civicrm_financial_type.name as financial_type";
$query->_element['financial_type'] = 1;
$query->_tables['civicrm_contribution'] = 1;
$query->_tables['civicrm_financial_type'] = 1;
// get accounting code
if (!empty($query->_returnProperties['accounting_code'])) {
- $query->_select['accounting_code'] = "civicrm_financial_account.accounting_code as accounting_code";
+ $query->_select['accounting_code'] = "civicrm_financial_account.accounting_code as accounting_code";
$query->_element['accounting_code'] = 1;
$query->_tables['civicrm_accounting_code'] = 1;
$query->_tables['civicrm_financial_account'] = 1;
$query->_element['contribution_soft_credit_name'] = 1;
// also include contact id. Will help build hyperlinks
- $query->_select['contribution_soft_credit_contact_id'] = "civicrm_contact_d.id as contribution_soft_credit_contact_id";
+ $query->_select['contribution_soft_credit_contact_id'] = "civicrm_contact_d.id as contribution_soft_credit_contact_id";
$query->_element['contribution_soft_credit_contact_id'] = 1;
$query->_tables['civicrm_contribution'] = 1;
$scTypes = $value;
$names[] = $softCreditTypes[$value];
}
- $query->_qill[$grouping][] = ts('Soft Credit Type %1', array(1 => $op)) . " '" . implode("' " . ts('or') . " '", $names) . "'";
+ $query->_qill[$grouping][] = ts('Soft Credit Type %1', array(1 => $op)) . " '" . implode("' " . ts('or') . " '", $names) . "'";
$query->_where[$grouping][] =
CRM_Contact_BAO_Query::buildClause(
"civicrm_contribution_soft.soft_credit_type_id",
default:
//all other elements are handle in this case
- $fldName = substr($name, 13);
+ $fldName = substr($name, 13);
if (!isset($fields[$fldName])) {
// CRM-12597
CRM_Core_Session::setStatus(ts(
return;
}
$whereTable = $fields[$fldName];
- $value = trim($value);
+ $value = trim($value);
//contribution fields (decimal fields) which don't require a quote in where clause.
$moneyFields = array('non_deductible_amount', 'fee_amount', 'net_amount');
public static function from($name, $mode, $side) {
$from = NULL;
switch ($name) {
- case 'civicrm_contribution':
- $from = " $side JOIN civicrm_contribution ON civicrm_contribution.contact_id = contact_a.id ";
- if (in_array(self::$_contribOrSoftCredit, array("only_scredits", "both_related", "both"))) {
- // switch the from table if its only soft credit search
- $from = " $side JOIN contribution_search_scredit_combined ON contribution_search_scredit_combined.contact_id = contact_a.id ";
- $from .= " $side JOIN civicrm_contribution ON civicrm_contribution.id = contribution_search_scredit_combined.id ";
- $from .= " $side JOIN civicrm_contribution_soft ON civicrm_contribution_soft.id = contribution_search_scredit_combined.scredit_id";
- }
- break;
+ case 'civicrm_contribution':
+ $from = " $side JOIN civicrm_contribution ON civicrm_contribution.contact_id = contact_a.id ";
+ if (in_array(self::$_contribOrSoftCredit, array("only_scredits", "both_related", "both"))) {
+ // switch the from table if its only soft credit search
+ $from = " $side JOIN contribution_search_scredit_combined ON contribution_search_scredit_combined.contact_id = contact_a.id ";
+ $from .= " $side JOIN civicrm_contribution ON civicrm_contribution.id = contribution_search_scredit_combined.id ";
+ $from .= " $side JOIN civicrm_contribution_soft ON civicrm_contribution_soft.id = contribution_search_scredit_combined.scredit_id";
+ }
+ break;
case 'civicrm_contribution_recur':
if ($mode == 1) {
break;
case 'contribution_softcredit_type':
- $from = " $side JOIN civicrm_option_group option_group_contribution_softcredit_type ON
+ $from = " $side JOIN civicrm_option_group option_group_contribution_softcredit_type ON
(option_group_contribution_softcredit_type.name = 'soft_credit_type')";
$from .= " $side JOIN civicrm_option_value contribution_softcredit_type ON
( civicrm_contribution_soft.soft_credit_type_id = contribution_softcredit_type.value
}
if (in_array(self::$_contribOrSoftCredit,
array("only_scredits", "both_related", "both"))) {
- if (!$tempTableFilled) {
- // build a temp table which is union of contributions and soft credits
- // note: group-by in first part ensures uniqueness in counts
- $tempQuery = "
+ if (!$tempTableFilled) {
+ // build a temp table which is union of contributions and soft credits
+ // note: group-by in first part ensures uniqueness in counts
+ $tempQuery = "
CREATE TEMPORARY TABLE IF NOT EXISTS contribution_search_scredit_combined AS
SELECT con.id as id, con.contact_id, cso.id as filter_id, NULL as scredit_id
FROM civicrm_contribution con
UNION ALL
SELECT scredit.contribution_id as id, scredit.contact_id, scredit.id as filter_id, scredit.id as scredit_id
FROM civicrm_contribution_soft as scredit";
- CRM_Core_DAO::executeQuery($tempQuery);
- $tempTableFilled = TRUE;
- }
- return TRUE;
+ CRM_Core_DAO::executeQuery($tempQuery);
+ $tempTableFilled = TRUE;
}
+ return TRUE;
+ }
return FALSE;
}
*
* @return array
*/
- public static function softCreditReturnProperties($isExportMode = False) {
+ public static function softCreditReturnProperties($isExportMode = FALSE) {
$properties = array(
- 'contribution_soft_credit_name' => 1,
+ 'contribution_soft_credit_name' => 1,
'contribution_soft_credit_amount' => 1,
- 'contribution_soft_credit_type' => 1,
+ 'contribution_soft_credit_type' => 1,
);
if ($isExportMode) {
$properties['contribution_soft_credit_contribution_id'] = 1;
$form->add('select', 'contribution_currency_type',
ts('Currency Type'),
array(
- '' => ts('- any -')) +
+ '' => ts('- any -')
+ ) +
CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', array('labelColumn' => 'name')),
FALSE, array('class' => 'crm-select2')
);
$form->add('select', 'contribution_page_id',
ts('Contribution Page'),
array(
- '' => ts('- any -')) +
+ '' => ts('- any -')
+ ) +
CRM_Contribute_PseudoConstant::contributionPage(),
FALSE, array('class' => 'crm-select2')
);
$form->add('select', 'contribution_payment_instrument_id',
ts('Payment Instrument'),
array(
- '' => ts('- any -')) +
+ '' => ts('- any -')
+ ) +
CRM_Contribute_PseudoConstant::paymentInstrument(),
FALSE, array('class' => 'crm-select2')
);
$form->add('select', 'contribution_pcp_made_through_id',
ts('Personal Campaign Page'),
array(
- '' => ts('- any -')) +
+ '' => ts('- any -')
+ ) +
CRM_Contribute_PseudoConstant::pcPage(),
FALSE, array('class' => 'crm-select2')
);
$options = array(
'only_contribs' => ts('Contributions Only'),
'only_scredits' => ts('Soft Credits Only'),
- 'both_related' => ts('Soft Credits with related Hard Credit'),
- 'both' => ts('Both'),
+ 'both_related' => ts('Soft Credits with related Hard Credit'),
+ 'both' => ts('Both'),
);
$form->add('select', 'contribution_or_softcredits', ts('Contributions OR Soft Credits?'), $options, FALSE, array('class' => "crm-select2"));
$form->addSelect(
'contribution_soft_credit_type_id',
array(
- 'entity' => 'contribution_soft',
- 'field' => 'soft_credit_type_id',
- 'multiple' => TRUE,
- 'context' => 'search',
+ 'entity' => 'contribution_soft',
+ 'field' => 'soft_credit_type_id',
+ 'multiple' => TRUE,
+ 'context' => 'search',
)
);
$params = array(1 => array($contributionPageID, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($query, $params);
if ($dao->fetch()) {
- $data['num_donors'] = (int)$dao->count;
- $data['money_raised'] = (int)$dao->amount;
+ $data['num_donors'] = (int) $dao->count;
+ $data['money_raised'] = (int) $dao->amount;
}
else {
$data['num_donors'] = $data['money_raised'] = $data->money_raised = 0;
$data['campaign_start'] = '';
$startDate = NULL;
if ($dao->fetch()) {
- $data['money_target'] = (int)$dao->goal_amount;
+ $data['money_target'] = (int) $dao->goal_amount;
// conditions that needs to be handled
// 1. Campaign is not active - no text
$data['is_active'] = FALSE;
$data['campaign_start'] = ts('Campaign starts on %1', array(
1 => CRM_Utils_Date::customFormat($dao->start_date,
- $config->dateformatFull
- )));
+ $config->dateformatFull
+ )
+ ));
}
}
$data['is_active'] = FALSE;
$data['campaign_start'] = ts('Campaign ended on %1', array(
1 => CRM_Utils_Date::customFormat($dao->end_date,
- $config->dateformatFull
- )));
+ $config->dateformatFull
+ )
+ ));
}
elseif ($startDate >= $now) {
$data['campaign_start'] = ts('Campaign starts on %1', array(
1 => CRM_Utils_Date::customFormat($dao->start_date,
- $config->dateformatFull
- )));
+ $config->dateformatFull
+ )
+ ));
}
else {
$data['campaign_start'] = ts('Campaign ends on %1', array(
1 => CRM_Utils_Date::customFormat($dao->end_date,
- $config->dateformatFull
- )));
+ $config->dateformatFull
+ )
+ ));
}
}
}
$percent = $data['money_raised'] / $data['money_target'];
$data['money_raised_percentage'] = (round($percent, 2)) * 100 . "%";
$data['money_target_display'] = CRM_Utils_Money::format($data['money_target']);
- $data['money_raised'] = ts('Raised %1 of %2', array(1 => CRM_Utils_Money::format($data['money_raised']), 2 => $data['money_target_display']));
+ $data['money_raised'] = ts('Raised %1 of %2', array(
+ 1 => CRM_Utils_Money::format($data['money_raised']),
+ 2 => $data['money_target_display']
+ ));
}
else {
$data['money_raised'] = ts('Raised %1', array(1 => CRM_Utils_Money::format($data['money_raised'])));
}
- $data['money_low'] = 0;
+ $data['money_low'] = 0;
$data['num_donors'] = $data['num_donors'] . " " . ts('Donors');
- $data['home_url'] = "<a href='{$config->userFrameworkBaseURL}' class='crm-home-url' style='color:" . $widget->color_homepage_link . "'>" . ts('Learn more.') . "</a>";
+ $data['home_url'] = "<a href='{$config->userFrameworkBaseURL}' class='crm-home-url' style='color:" . $widget->color_homepage_link . "'>" . ts('Learn more.') . "</a>";
// if is_active is false, show this link and hide the contribute button
$data['homepage_link'] = $widget->url_homepage;
* $Id$
*
*/
-class CRM_Contribute_Config extends CRM_Core_Component_Config {}
+class CRM_Contribute_Config extends CRM_Core_Component_Config {
+}
<?php
+
/**
* Created by PhpStorm.
* User: eileen
*/
class CRM_Contribute_Exception_InactiveContributionPageException extends Exception {
private $id;
+
public function __construct($message, $id) {
parent::__construct(ts($message));
$this->id = $id;
$endDate = CRM_Utils_Array::value('membership_end_date', $updateResult);
if ($endDate) {
$statusMsg .= "<br />" . ts("Membership for %1 has been updated. The membership End Date is %2.",
- array(
- 1 => $userDisplayName,
- 2 => $endDate,
- )
- );
+ array(
+ 1 => $userDisplayName,
+ 2 => $endDate,
+ )
+ );
}
}
}
if (empty($this->_paymentProcessors)) {
throw new CRM_Core_Exception(ts('You will need to configure the %1 settings for your Payment Processor before you can submit a credit card transactions.', array(1 => $this->_mode)));
}
- $this->_processors = array();
+ $this->_processors = array();
foreach ($this->_paymentProcessors as $id => $processor) {
$this->_processors[$id] = ts($processor['name']);
}
}
$form->_options = $sel2;
$form->assign('mincontribution', $min_amount);
- $sel = & $form->addElement('hierselect', "product_name", ts('Premium'), 'onclick="showMinContrib();"');
+ $sel = &$form->addElement('hierselect', "product_name", ts('Premium'), 'onclick="showMinContrib();"');
$js = "<script type='text/javascript'>\n";
$formName = 'document.forms.' . $form->getName();
$form->addDateTime('thankyou_date', ts('Thank-you Sent'), FALSE, array('formatType' => 'activityDateTime'));
// add various amounts
- $nonDeductAmount = & $form->add('text', 'non_deductible_amount', ts('Non-deductible Amount'),
- $attributes['non_deductible_amount']
+ $nonDeductAmount = &$form->add('text', 'non_deductible_amount', ts('Non-deductible Amount'),
+ $attributes['non_deductible_amount']
);
$form->addRule('non_deductible_amount', ts('Please enter a valid monetary value for Non-deductible Amount.'), 'money');
if ($form->_online) {
$nonDeductAmount->freeze();
}
- $feeAmount = & $form->add('text', 'fee_amount', ts('Fee Amount'),
- $attributes['fee_amount']
+ $feeAmount = &$form->add('text', 'fee_amount', ts('Fee Amount'),
+ $attributes['fee_amount']
);
$form->addRule('fee_amount', ts('Please enter a valid monetary value for Fee Amount.'), 'money');
if ($form->_online) {
$feeAmount->freeze();
}
- $netAmount = & $form->add('text', 'net_amount', ts('Net Amount'),
- $attributes['net_amount']
+ $netAmount = &$form->add('text', 'net_amount', ts('Net Amount'),
+ $attributes['net_amount']
);
$form->addRule('net_amount', ts('Please enter a valid monetary value for Net Amount.'), 'money');
if ($form->_online) {
$netAmount->freeze();
}
- $element = & $form->add('text', 'invoice_id', ts('Invoice ID'),
- $attributes['invoice_id']
+ $element = &$form->add('text', 'invoice_id', ts('Invoice ID'),
+ $attributes['invoice_id']
);
if ($form->_online) {
$element->freeze();
$dao->contribution_id = $contributionID;
$dao->product_id = $params['product_name'][0];
$dao->fulfilled_date = CRM_Utils_Date::processDate($params['fulfilled_date'], NULL, TRUE);
- $isDeleted = False;
+ $isDeleted = FALSE;
//CRM-11106
$premiumParams = array(
'id' => $params['product_name'][0],
$form->assign('receive_date', CRM_Utils_Date::processDate($params['receive_date']));
}
- $template = CRM_Core_Smarty::singleton();
- $taxAmt = $template->get_template_vars('dataArray');
- $eventTaxAmt = $template->get_template_vars('totalTaxAmount');
- $prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
- $invoicing = CRM_Utils_Array::value('invoicing', $prefixValue);
- if ((!empty($taxAmt) || isset($eventTaxAmt)) && (isset($invoicing) && isset($prefixValue['is_email_pdf']))) {
- $isEmailPdf = True;
- }
- else {
- $isEmailPdf = False;
- }
+ $template = CRM_Core_Smarty::singleton();
+ $taxAmt = $template->get_template_vars('dataArray');
+ $eventTaxAmt = $template->get_template_vars('totalTaxAmount');
+ $prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
+ $invoicing = CRM_Utils_Array::value('invoicing', $prefixValue);
+ if ((!empty($taxAmt) || isset($eventTaxAmt)) && (isset($invoicing) && isset($prefixValue['is_email_pdf']))) {
+ $isEmailPdf = TRUE;
+ }
+ else {
+ $isEmailPdf = FALSE;
+ }
list($sendReceipt, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate(
array(
if (empty($defaults['trxn_date']) && empty($defaults['trxn_date_time'])) {
list($defaults['trxn_date'],
$defaults['trxn_date_time']
- ) = CRM_Utils_Date::setDateDefaults(
+ ) = CRM_Utils_Date::setDateDefaults(
CRM_Utils_Array::value('register_date', $defaults), 'activityDateTime'
);
}
$session = CRM_Core_Session::singleton();
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view',
- "reset=1&cid={$this->_contactId}&selectedChild=participant"
- ));
+ "reset=1&cid={$this->_contactId}&selectedChild=participant"
+ ));
}
}
//get the payment processor id as per mode.
//@todo unclear relevance of mode - seems like a lot of duplicated params here!
$this->_params['payment_processor'] = $params['payment_processor_id'] =
- $this->_params['payment_processor_id'] = $submittedValues['payment_processor_id'] = $this->_paymentProcessor['id'];
+ $this->_params['payment_processor_id'] = $submittedValues['payment_processor_id'] = $this->_paymentProcessor['id'];
$now = date('YmdHis');
$fields = array();
if ($this->_context == 'standalone' && !empty($submittedValues['is_email_receipt'])) {
list($this->userDisplayName,
$this->userEmail
- ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId);
+ ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId);
$this->assign('displayName', $this->userDisplayName);
}
CRM_Core_Session::setStatus($statusMsg, ts('Complete'), 'success');
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view',
- "reset=1&cid={$this->_contactId}&selectedChild=participant"
- ));
+ "reset=1&cid={$this->_contactId}&selectedChild=participant"
+ ));
}
}
* @return void
*/
public function preProcess() {
- $this->_mid = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE);
+ $this->_mid = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE);
$this->_crid = CRM_Utils_Request::retrieve('crid', 'Integer', $this, FALSE);
if ($this->_crid) {
// Determine if we can cancel recurring contribution via API with this processor
$cancelSupported = $this->_paymentProcessorObj->isSupported('cancelSubscription');
if ($cancelSupported) {
- $searchRange = array();
+ $searchRange = array();
$searchRange[] = $this->createElement('radio', NULL, NULL, ts('Yes'), '1');
$searchRange[] = $this->createElement('radio', NULL, NULL, ts('No'), '0');
* @return void
*/
public function postProcess() {
- $status = $message = NULL;
+ $status = $message = NULL;
$cancelSubscription = TRUE;
- $params = $this->controller->exportValues($this->_name);
+ $params = $this->controller->exportValues($this->_name);
if ($this->_selfService) {
// for self service force sending-request & notify
// send notification
$sendTemplateParams =
array(
- 'groupName' => $this->_mode == 'auto_renew' ? 'msg_tpl_workflow_membership' : 'msg_tpl_workflow_contribution',
- 'valueName' => $this->_mode == 'auto_renew' ? 'membership_autorenew_cancelled' : 'contribution_recurring_cancelled',
- 'contactId' => $this->_subscriptionDetails->contact_id,
- 'tplParams' => $tplParams,
- //'isTest' => $isTest, set this from _objects
- 'PDFFilename' => 'receipt.pdf',
- 'from' => $receiptFrom,
- 'toName' => $this->_donorDisplayName,
- 'toEmail' => $this->_donorEmail,
- );
+ 'groupName' => $this->_mode == 'auto_renew' ? 'msg_tpl_workflow_membership' : 'msg_tpl_workflow_contribution',
+ 'valueName' => $this->_mode == 'auto_renew' ? 'membership_autorenew_cancelled' : 'contribution_recurring_cancelled',
+ 'contactId' => $this->_subscriptionDetails->contact_id,
+ 'tplParams' => $tplParams,
+ //'isTest' => $isTest, set this from _objects
+ 'PDFFilename' => 'receipt.pdf',
+ 'from' => $receiptFrom,
+ 'toName' => $this->_donorDisplayName,
+ 'toEmail' => $this->_donorEmail,
+ );
list($sent) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
}
}
}
$session = CRM_Core_Session::singleton();
- $userID = $session->get('userID');
+ $userID = $session->get('userID');
if ($userID && $status) {
$session->setStatus($status, $msgTitle, $msgType);
}
CRM_Utils_System::setUFMessage($status);
// keep result as 1, since we not displaying anything on the redirected page anyway
return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/subscriptionstatus',
- "reset=1&task=cancel&result=1"));
+ "reset=1&task=cancel&result=1"));
}
}
}
*
* @var array
*/
- public $_paymentFields = array();
+ public $_paymentFields = array();
/**
* Logged in user's email
* @var string
* @var string
*/
public $userDisplayName;
+
/**
* Set variables up before form is built
*
// build price set form.
$buildPriceSet = FALSE;
- $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings');
+ $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);
$this->assign('entityID', $this->_id);
if ($this->_context == 'standalone') {
- $this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE, 'api' => array('extra' => array('email'))), TRUE);
+ $this->addEntityRef('contact_id', ts('Contact'), array(
+ 'create' => TRUE,
+ 'api' => array('extra' => array('email'))
+ ), TRUE);
}
$attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution');
}
//FIXME FOR NEW DATA FLOW http://wiki.civicrm.org/confluence/display/CRM/CiviAccounts+4.3+Data+Flow
- if (!empty($fields['fee_amount']) && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($fields['financial_type_id'])) {
+ if (!empty($fields['fee_amount']) && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($fields['financial_type_id'])) {
$errors['financial_type_id'] = ts("Financial Account of account relationship of 'Expense Account is' is not configured for Financial Type : ") . $financialType;
}
$queryParams = array(1 => array($fields['trxn_id'], 'String'));
$query = 'select count(*) from civicrm_contribution where trxn_id = %1';
if ($self->_id) {
- $queryParams[2] = array((int)$self->_id, 'Integer');
+ $queryParams[2] = array((int) $self->_id, 'Integer');
$query .= ' and id !=%2';
}
$tCnt = CRM_Core_DAO::singleValueQuery($query, $queryParams);
// assign tax calculation for contribution receipts
$taxRate = array();
$getTaxDetails = FALSE;
- $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings');
+ $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
if ($invoicing) {
if ($this->_action & CRM_Core_Action::ADD) {
$updatePledgePaymentStatus = TRUE;
}
elseif ($this->_action & CRM_Core_Action::UPDATE && (($this->_defaults['contribution_status_id'] != $formValues['contribution_status_id']) ||
- ($this->_defaults['total_amount'] != $formValues['total_amount']))
+ ($this->_defaults['total_amount'] != $formValues['total_amount']))
) {
$updatePledgePaymentStatus = TRUE;
}
// make sure we have right permission to edit this user
$csContactID = $this->getContactID();
- $reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
+ $reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
$mainDisplay = CRM_Utils_Request::retrieve('_qf_Main_display', 'Boolean', CRM_Core_DAO::$_nullObject);
if ($reset) {
if ($onBehalfProfileID) {
$onBehalfProfile = CRM_Core_BAO_UFGroup::profileGroups($onBehalfProfileID);
foreach (array(
- 'Individual', 'Organization', 'Household') as $contactType) {
+ 'Individual',
+ 'Organization',
+ 'Household'
+ ) as $contactType) {
if (in_array($contactType, $onBehalfProfile) &&
(in_array('Membership', $onBehalfProfile) ||
in_array('Contribution', $onBehalfProfile)
if ($postID = CRM_Utils_Array::value('custom_post_id', $this->_values)) {
$postProfile = CRM_Core_BAO_UFGroup::profileGroups($postID);
foreach (array(
- 'Individual', 'Organization', 'Household') as $contactType) {
+ 'Individual',
+ 'Organization',
+ 'Household'
+ ) as $contactType) {
if (in_array($contactType, $postProfile) &&
(in_array('Membership', $postProfile) ||
in_array('Contribution', $postProfile)
$this->set('priceSetId', $this->_priceSetId);
CRM_Price_BAO_PriceSet::buildPriceSet($this);
if ($this->_values['is_monetary'] &&
- $this->_values['is_recur'] && empty($this->_values['pledge_id'])) {
+ $this->_values['is_recur'] && empty($this->_values['pledge_id'])
+ ) {
self::buildRecur($this);
}
}
array('onclick' => "showHideByValue('pcp_display_in_roll','','nameID|nickID|personalNoteID','block','radio',false); pcpAnonymous( );")
);
$extraOption = array('onclick' => "return pcpAnonymous( );");
- $elements = array();
- $elements[] = &$this->createElement('radio', NULL, '', ts('Include my name and message'), 0, $extraOption);
- $elements[] = &$this->createElement('radio', NULL, '', ts('List my contribution anonymously'), 1, $extraOption);
+ $elements = array();
+ $elements[] = &$this->createElement('radio', NULL, '', ts('Include my name and message'), 0, $extraOption);
+ $elements[] = &$this->createElement('radio', NULL, '', ts('List my contribution anonymously'), 1, $extraOption);
$this->addGroup($elements, 'pcp_is_anonymous', NULL, ' ');
$this->setDefaults(array('pcp_display_in_roll' => 1));
$this->setDefaults(array('pcp_is_anonymous' => 1));
}
if ($priceField->name == 'other_amount') {
if ($self->_quickConfig && empty($fields["price_{$priceField->id}"]) &&
- array_key_exists("price_{$previousId}", $fields) && isset($fields["price_{$previousId}"]) && $self->_values['fee'][$previousId]['name'] == 'contribution_amount' && empty($fields["price_{$previousId}"])) {
+ array_key_exists("price_{$previousId}", $fields) && isset($fields["price_{$previousId}"]) && $self->_values['fee'][$previousId]['name'] == 'contribution_amount' && empty($fields["price_{$previousId}"])
+ ) {
$otherAmount = $priceField->id;
}
elseif (!empty($fields["price_{$priceField->id}"])) {
$otherAmountVal = CRM_Utils_Rule::cleanMoney($fields["price_{$priceField->id}"]);
- $min = CRM_Utils_Array::value('min_amount', $self->_values);
- $max = CRM_Utils_Array::value('max_amount', $self->_values);
+ $min = CRM_Utils_Array::value('min_amount', $self->_values);
+ $max = CRM_Utils_Array::value('max_amount', $self->_values);
if ($min && $otherAmountVal < $min) {
$errors["price_{$priceField->id}"] = ts('Contribution amount must be at least %1',
- array(1 => $min)
+ array(1 => $min)
);
}
if ($max && $otherAmountVal > $max) {
$errors["price_{$priceField->id}"] = ts('Contribution amount cannot be more than %1.',
- array(1 => $max)
+ array(1 => $max)
);
}
}
}
if (!empty($fields["price_{$priceField->id}"]) || ($previousId == $priceField->id && isset($fields["price_{$previousId}"])
- && empty($fields["price_{$previousId}"]))) {
+ && empty($fields["price_{$previousId}"]))
+ ) {
$check[] = $priceField->id;
}
}
if ($fieldValue['html_type'] != 'Text' && CRM_Utils_Array::value('price_' . $fieldKey, $fields)) {
if (!is_array($fields['price_' . $fieldKey])) {
if (array_key_exists('membership_type_id', $fieldValue['options'][$fields['price_' . $fieldKey]])
- && in_array($fieldValue['options'][$fields['price_' . $fieldKey]]['membership_type_id'], $currentMemberships)) {
+ && in_array($fieldValue['options'][$fields['price_' . $fieldKey]]['membership_type_id'], $currentMemberships)
+ ) {
$errors['price_' . $fieldKey] = ts($errorText, array(1 => CRM_Member_PseudoConstant::membershipType($fieldValue['options'][$fields['price_' . $fieldKey]]['membership_type_id'])));
}
}
else {
foreach ($fields['price_' . $fieldKey] as $key => $ignore) {
if (array_key_exists('membership_type_id', $fieldValue['options'][$key])
- && in_array($fieldValue['options'][$key]['membership_type_id'], $currentMemberships)) {
+ && in_array($fieldValue['options'][$key]['membership_type_id'], $currentMemberships)
+ ) {
$errors['price_' . $fieldKey] = ts($errorText, array(1 => CRM_Member_PseudoConstant::membershipType($fieldValue['options'][$key]['membership_type_id'])));
}
}
// CRM-12233
if ($membershipIsActive && !$self->_membershipBlock['is_required']
- && $self->_values['amount_block_is_active']) {
+ && $self->_values['amount_block_is_active']
+ ) {
$membershipFieldId = $contributionFieldId = $errorKey = $otherFieldId = NULL;
foreach ($self->_values['fee'] as $fieldKey => $fieldValue) {
// if 'No thank you' membership is selected then set $membershipFieldId
}
if (isset($fields['selectProduct']) &&
- $fields['selectProduct'] != 'no_thanks') {
+ $fields['selectProduct'] != 'no_thanks'
+ ) {
$productDAO = new CRM_Contribute_DAO_Product();
$productDAO->id = $fields['selectProduct'];
$productDAO->find(TRUE);
}
if (!empty($fields['is_recur']) &&
- CRM_Utils_Array::value('payment_processor', $fields) == 0) {
+ CRM_Utils_Array::value('payment_processor', $fields) == 0
+ ) {
$errors['_qf_default'] = ts('You cannot set up a recurring contribution if you are not paying online by credit card.');
}
$customizedValue = CRM_Core_OptionGroup::getValue($greeting, 'Customized', 'name');
if ($customizedValue == $greetingType && empty($fielse[$greeting . '_custom'])) {
$errors[$greeting . '_custom'] = ts('Custom %1 is a required field if %1 is of type Customized.',
- array(1 => ucwords(str_replace('_', " ", $greeting)))
+ array(1 => ucwords(str_replace('_', " ", $greeting)))
);
}
}
if (($this->_values['is_pay_later'] &&
empty($this->_paymentProcessor) &&
!array_key_exists('hidden_processor', $params)) ||
- (!empty($params['payment_processor']) && $params['payment_processor'] == 0)) {
+ (!empty($params['payment_processor']) && $params['payment_processor'] == 0)
+ ) {
$params['is_pay_later'] = 1;
}
else {
if ($is_quick_config) {
foreach ($this->_priceSet['fields'] as $fieldKey => $fieldVal) {
if ($fieldVal['name'] == 'membership_amount' && !empty($params['price_' . $fieldKey])) {
- $fieldId = $fieldVal['id'];
+ $fieldId = $fieldVal['id'];
$fieldOption = $params['price_' . $fieldId];
$proceFieldAmount += $fieldVal['options'][$this->_submitValues['price_' . $fieldId]]['amount'];
- $memPresent = TRUE;
+ $memPresent = TRUE;
}
else {
if (!empty($params['price_' . $fieldKey]) && $memPresent && ($fieldVal['name'] == 'other_amount' || $fieldVal['name'] == 'contribution_amount')) {
$is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config');
if ($is_quick_config) {
foreach ($this->_values['fee'] as $key => & $val) {
- if ($val['name'] == 'other_amount' && $val['html_type'] == 'Text' && array_key_exists('price_'.$key, $params) ) {
+ if ($val['name'] == 'other_amount' && $val['html_type'] == 'Text' && array_key_exists('price_' . $key, $params)) {
$params['price_' . $key] = CRM_Utils_Rule::cleanMoney($params['price_' . $key]); //Clean out any currency symbols
- if ($params['price_'.$key] != 0) {
+ if ($params['price_' . $key] != 0) {
foreach ($val['options'] as $optionKey => & $options) {
- $options['amount'] = CRM_Utils_Array::value('price_'.$key, $params);
+ $options['amount'] = CRM_Utils_Array::value('price_' . $key, $params);
break;
}
}
$buttonName = $this->controller->getButtonName();
if (in_array($buttonName,
array($this->_expressButtonName, $this->_expressButtonName . '_x', $this->_expressButtonName . '_y')
- ) && empty($params['is_pay_later'])) {
+ ) && empty($params['is_pay_later'])
+ ) {
$this->set('contributeMode', 'express');
- $donateURL = CRM_Utils_System::url('civicrm/contribute', '_qf_Contribute_display=1');
+ $donateURL = CRM_Utils_System::url('civicrm/contribute', '_qf_Contribute_display=1');
$params['cancelURL'] = CRM_Utils_System::url('civicrm/contribute/transact', "_qf_Main_display=1&qfKey={$params['qfKey']}", TRUE, NULL, FALSE);
$params['returnURL'] = CRM_Utils_System::url('civicrm/contribute/transact', "_qf_Confirm_display=1&rfp=1&qfKey={$params['qfKey']}", TRUE, NULL, FALSE);
$params['invoiceID'] = $invoiceID;
NULL, FALSE, NULL, FALSE, NULL,
CRM_Core_Permission::CREATE, NULL
);
- $fieldTypes = array('Contact', 'Organization');
+ $fieldTypes = array('Contact', 'Organization');
$contactSubType = CRM_Contact_BAO_ContactType::subTypes('Organization');
- $fieldTypes = array_merge($fieldTypes, $contactSubType);
+ $fieldTypes = array_merge($fieldTypes, $contactSubType);
if (is_array($form->_membershipBlock) && !empty($form->_membershipBlock)) {
$fieldTypes = array_merge($fieldTypes, array('Membership'));
public function preProcess() {
parent::preProcess();
- $this->_params = $this->get('params');
+ $this->_params = $this->get('params');
$this->_lineItem = $this->get('lineItem');
- $is_deductible = $this->get('is_deductible');
+ $is_deductible = $this->get('is_deductible');
$this->assign('is_deductible', $is_deductible);
$this->assign('thankyou_title', CRM_Utils_Array::value('thankyou_title', $this->_values));
$this->assign('thankyou_text', CRM_Utils_Array::value('thankyou_text', $this->_values));
*/
public function buildQuickForm() {
$this->assignToTemplate();
- $productID = $this->get('productID');
- $option = $this->get('option');
+ $productID = $this->get('productID');
+ $option = $this->get('option');
$membershipTypeID = $this->get('membershipTypeID');
$this->assign('receiptFromEmail', CRM_Utils_Array::value('receipt_from_email', $this->_values));
CRM_Contribute_BAO_ContributionSoft::formatHonoreeProfileFields($this, $params['honor'], $params['honoree_profile_id']);
$fieldTypes = array('Contact');
- $fieldTypes[] = CRM_Core_BAO_UFGroup::getContactType($params['honoree_profile_id']);
+ $fieldTypes[] = CRM_Core_BAO_UFGroup::getContactType($params['honoree_profile_id']);
$this->buildCustom($params['honoree_profile_id'], 'honoreeProfileFields', TRUE, 'honor', $fieldTypes);
}
$qParams .= "&pcpId={$this->_pcpId}";
$this->assign('pcpBlock', TRUE);
foreach (array(
- 'pcp_display_in_roll', 'pcp_is_anonymous', 'pcp_roll_nickname', 'pcp_personal_note') as $val) {
+ 'pcp_display_in_roll',
+ 'pcp_is_anonymous',
+ 'pcp_roll_nickname',
+ 'pcp_personal_note'
+ ) as $val) {
if (!empty($this->_params[$val])) {
$this->assign($val, $this->_params[$val]);
}
$this->assign('qParams', $qParams);
if ($membershipTypeID) {
- $transactionID = $this->get('membership_trx_id');
+ $transactionID = $this->get('membership_trx_id');
$membershipAmount = $this->get('membership_amount');
- $renewalMode = $this->get('renewal_mode');
+ $renewalMode = $this->get('renewal_mode');
$this->assign('membership_trx_id', $transactionID);
$this->assign('membership_amount', $membershipAmount);
$this->assign('renewal_mode', $renewalMode);
$OnBehalfProfile = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
$profileId = $OnBehalfProfile[0];
- $fieldTypes = array('Contact', 'Organization');
+ $fieldTypes = array('Contact', 'Organization');
$contactSubType = CRM_Contact_BAO_ContactType::subTypes('Organization');
- $fieldTypes = array_merge($fieldTypes, $contactSubType);
+ $fieldTypes = array_merge($fieldTypes, $contactSubType);
if (is_array($this->_membershipBlock) && !empty($this->_membershipBlock)) {
$fieldTypes = array_merge($fieldTypes, array('Membership'));
}
$defaults[$timeField] = $contact[$timeField];
}
}
- elseif (in_array($name, array('addressee', 'email_greeting', 'postal_greeting')) && !empty($contact[$name . '_custom'])) {
+ elseif (in_array($name, array(
+ 'addressee',
+ 'email_greeting',
+ 'postal_greeting'
+ )) && !empty($contact[$name . '_custom'])
+ ) {
$defaults[$name . '_custom'] = $contact[$name . '_custom'];
}
}
public $_action;
/**
- * Is honor block is enabled for this contribution?
- *
- * @var boolean
- */
+ * Is honor block is enabled for this contribution?
+ *
+ * @var boolean
+ */
public $_honor_block_is_active = FALSE;
/**
public $_useForMember;
public $_isBillingAddressRequiredForPayLater;
+
/**
* Set variables up before form is built
*
// Handle PCP
$pcpId = CRM_Utils_Request::retrieve('pcpId', 'Positive', $this);
if ($pcpId) {
- $pcp = CRM_PCP_BAO_PCP::handlePcp($pcpId, 'contribute', $this->_values);
- $this->_pcpId = $pcp['pcpId'];
+ $pcp = CRM_PCP_BAO_PCP::handlePcp($pcpId, 'contribute', $this->_values);
+ $this->_pcpId = $pcp['pcpId'];
$this->_pcpBlock = $pcp['pcpBlock'];
- $this->_pcpInfo = $pcp['pcpInfo'];
+ $this->_pcpInfo = $pcp['pcpInfo'];
}
// Link (button) for users to create their own Personal Campaign page
$this->assign('paymentProcessor', $this->_paymentProcessor);
$vars = array(
- 'amount', 'currencyID',
- 'credit_card_type', 'trxn_id', 'amount_level',
+ 'amount',
+ 'currencyID',
+ 'credit_card_type',
+ 'trxn_id',
+ 'amount_level',
);
$config = CRM_Core_Config::singleton();
if (isset($this->_values['is_recur']) && !empty($this->_paymentProcessor['is_recur'])) {
$this->assign('is_recur_enabled', 1);
$vars = array_merge($vars, array(
- 'is_recur', 'frequency_interval', 'frequency_unit',
- 'installments',
- ));
+ 'is_recur',
+ 'frequency_interval',
+ 'frequency_unit',
+ 'installments',
+ ));
}
if (in_array('CiviPledge', $config->enableComponents) &&
$vars = array_merge($vars, array(
'is_pledge',
- 'pledge_frequency_interval',
- 'pledge_frequency_unit',
- 'pledge_installments',
- ));
+ 'pledge_frequency_interval',
+ 'pledge_frequency_unit',
+ 'pledge_installments',
+ ));
}
if (isset($this->_params['amount_other']) || isset($this->_params['selectMembership'])) {
$date = CRM_Utils_Date::mysqlToIso($date);
$this->assign('credit_card_exp_date', $date);
$this->assign('credit_card_number',
- CRM_Utils_System::mungeCreditCard(CRM_Utils_array::value('credit_card_number', $this->_params))
+ CRM_Utils_System::mungeCreditCard(CRM_Utils_array::value('credit_card_number', $this->_params))
);
}
}
if ($profileContactType) {
//Since we are showing honoree name separately so we are removing it from honoree profile just for display
- $honoreeNamefields = array('prefix_id', 'first_name', 'last_name', 'suffix_id', 'organization_name', 'household_name');
+ $honoreeNamefields = array(
+ 'prefix_id',
+ 'first_name',
+ 'last_name',
+ 'suffix_id',
+ 'organization_name',
+ 'household_name'
+ );
if ($profileContactType == 'honor' && in_array($field['name'], $honoreeNamefields)) {
unset($fields[$field['name']]);
continue;
$contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
//get pledge status and contact id
- $pledgeValues = array();
- $pledgeParams = array('id' => $this->_values['pledge_id']);
+ $pledgeValues = array();
+ $pledgeParams = array('id' => $this->_values['pledge_id']);
$returnProperties = array('contact_id', 'status_id');
CRM_Core_DAO::commonRetrieve('CRM_Pledge_DAO_Pledge', $pledgeParams, $pledgeValues, $returnProperties);
//get all status
$allStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
- $validStatus = array(array_search('Pending', $allStatus),
+ $validStatus = array(
+ array_search('Pending', $allStatus),
array_search('In Progress', $allStatus),
array_search('Overdue', $allStatus),
);
$this->addElement('select', 'select_year', ts('Select Year (for monthly breakdown)'), $years);
$this->setDefaults(array(
'select_year' => ($this->_year) ? $this->_year : $currentYear,
- ));
+ ));
}
/**
$urlParams = NULL;
if ($chartKey == 'by_month') {
$monthPosition = array_search($index, $abbrMonthNames);
- $startDate = CRM_Utils_Date::format(array('Y' => $selectedYear, 'M' => $monthPosition));
- $endDate = date('Ymd', mktime(0, 0, 0, $monthPosition + 1, 0, $selectedYear));
- $urlParams = "reset=1&force=1&status=1&start={$startDate}&end={$endDate}&test=0";
+ $startDate = CRM_Utils_Date::format(array('Y' => $selectedYear, 'M' => $monthPosition));
+ $endDate = date('Ymd', mktime(0, 0, 0, $monthPosition + 1, 0, $selectedYear));
+ $urlParams = "reset=1&force=1&status=1&start={$startDate}&end={$endDate}&test=0";
}
elseif ($chartKey == 'by_year') {
if (!empty($config->fiscalYearStart) && ($config->fiscalYearStart['M'] != 1 || $config->fiscalYearStart['d'] != 1)) {
$startDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], substr($index, 0, 4)));
- $endDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], (substr($index, 0, 4)) + 1));
+ $endDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], (substr($index, 0, 4)) + 1));
}
else {
$startDate = CRM_Utils_Date::format(array('Y' => substr($index, 0, 4)));
- $endDate = date('Ymd', mktime(0, 0, 0, 13, 0, substr($index, 0, 4)));
+ $endDate = date('Ymd', mktime(0, 0, 0, 13, 0, substr($index, 0, 4)));
}
$urlParams = "reset=1&force=1&status=1&start={$startDate}&end={$endDate}&test=0";
}
$defaults['is_pledge_active'] = TRUE;
}
$pledgeBlock = array(
- 'is_pledge_interval', 'max_reminders',
- 'initial_reminder_day', 'additional_reminder_day',
+ 'is_pledge_interval',
+ 'max_reminders',
+ 'initial_reminder_day',
+ 'additional_reminder_day',
);
foreach ($pledgeBlock as $key) {
$defaults[$key] = CRM_Utils_Array::value($key, $pledgeBlockDefaults);
}
if (!empty($pledgeBlockDefaults['pledge_frequency_unit'])) {
$defaults['pledge_frequency_unit'] = array_fill_keys(explode(CRM_Core_DAO::VALUE_SEPARATOR,
- $pledgeBlockDefaults['pledge_frequency_unit']
- ), '1');
+ $pledgeBlockDefaults['pledge_frequency_unit']
+ ), '1');
}
// fix the display of the monetary value, CRM-4038
if (!empty($defaults['recur_frequency_unit'])) {
$defaults['recur_frequency_unit'] = array_fill_keys(explode(CRM_Core_DAO::VALUE_SEPARATOR,
- $defaults['recur_frequency_unit']
- ), '1');
+ $defaults['recur_frequency_unit']
+ ), '1');
}
else {
# CRM 10860
//this is quite painful because StateMachine is full of protected variables
//so we have to retrieve all pages, find current page, and then retrieve next
$stateMachine = new CRM_Contribute_StateMachine_ContributionPage($this);
- $states = $stateMachine->getStates();
- $statesList = array_keys($states);
- $currKey = array_search($className, $statesList);
- $nextPage = (array_key_exists($currKey + 1, $statesList)) ? $statesList[$currKey + 1] : '';
+ $states = $stateMachine->getStates();
+ $statesList = array_keys($states);
+ $currKey = array_search($className, $statesList);
+ $nextPage = (array_key_exists($currKey + 1, $statesList)) ? $statesList[$currKey + 1] : '';
//unfortunately, some classes don't map to subpage names, so we alter the exceptions
switch ($className) {
case 'Contribute':
- $attributes = $this->getVar('_attributes');
- $subPage = strtolower(basename(CRM_Utils_Array::value('action', $attributes)));
+ $attributes = $this->getVar('_attributes');
+ $subPage = strtolower(basename(CRM_Utils_Array::value('action', $attributes)));
$subPageName = ucfirst($subPage);
if ($subPage == 'friend') {
$nextPage = 'custom';
break;
case 'MembershipBlock':
- $subPage = 'membership';
+ $subPage = 'membership';
$subPageName = 'MembershipBlock';
- $nextPage = 'thankyou';
+ $nextPage = 'thankyou';
break;
default:
- $subPage = strtolower($className);
+ $subPage = strtolower($className);
$subPageName = $className;
- $nextPage = strtolower($nextPage);
+ $nextPage = strtolower($nextPage);
if ($subPage == 'amount') {
$nextPage = 'membership';
}
CRM_Core_Session::setStatus(ts("'%1' information has been saved.",
- array(1 => $subPageName)
- ), ts('Saved'), 'success');
+ array(1 => $subPageName)
+ ), ts('Saved'), 'success');
$this->postProcessHook();
if ($this->controller->getButtonName('submit') == "_qf_{$className}_next") {
CRM_Utils_System::redirect(CRM_Utils_System::url("civicrm/admin/contribute/{$subPage}",
- "action=update&reset=1&id={$this->_id}"
- ));
+ "action=update&reset=1&id={$this->_id}"
+ ));
}
elseif ($this->controller->getButtonName('submit') == "_qf_{$className}_submit_savenext") {
if ($nextPage) {
CRM_Utils_System::redirect(CRM_Utils_System::url("civicrm/admin/contribute/{$nextPage}",
- "action=update&reset=1&id={$this->_id}"
- ));
+ "action=update&reset=1&id={$this->_id}"
+ ));
}
else {
CRM_Utils_System::redirect(CRM_Utils_System::url("civicrm/admin/contribute",
- "reset=1"
- ));
+ "reset=1"
+ ));
}
}
else {
$dao->id = $this->_pid;
$dao->find(TRUE);
$defaults['product_id'] = $dao->product_id;
- $defaults['financial_type_id'] = $dao->financial_type_id;
+ $defaults['financial_type_id'] = $dao->financial_type_id;
$defaults['weight'] = $dao->weight;
}
else {
$pageID = CRM_Utils_Request::retrieve('id', 'Positive',
$this, FALSE, 0
);
- $dao = new CRM_Contribute_DAO_Premium();
+ $dao = new CRM_Contribute_DAO_Premium();
$dao->entity_table = 'civicrm_contribution_page';
- $dao->entity_id = $pageID;
+ $dao->entity_id = $pageID;
$dao->find(TRUE);
$premiumID = $dao->id;
- $sql = 'SELECT max( weight ) as max_weight FROM civicrm_premiums_product WHERE premiums_id = %1';
+ $sql = 'SELECT max( weight ) as max_weight FROM civicrm_premiums_product WHERE premiums_id = %1';
$params = array(1 => array($premiumID, 'Integer'));
- $dao = CRM_Core_DAO::executeQuery($sql, $params);
+ $dao = CRM_Core_DAO::executeQuery($sql, $params);
$dao->fetch();
$defaults['weight'] = $dao->max_weight + 1;
}
$url = CRM_Utils_System::url($urlParams, 'reset=1&action=update&id=' . $this->_id);
$session->pushUserContext($url);
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean',
- CRM_Core_DAO::$_nullObject, '', '', 'GET'
- )) {
+ CRM_Core_DAO::$_nullObject, '', '', 'GET'
+ )
+ ) {
$dao = new CRM_Contribute_DAO_PremiumsProduct();
$dao->id = $this->_pid;
$dao->delete();
$urlParams = 'civicrm/admin/contribute/premium';
if ($this->_action & CRM_Core_Action::PREVIEW) {
$session = CRM_Core_Session::singleton();
- $url = CRM_Utils_System::url($urlParams, 'reset=1&action=update&id=' . $this->_id);
- $single = $session->get('singleForm');
+ $url = CRM_Utils_System::url($urlParams, 'reset=1&action=update&id=' . $this->_id);
+ $single = $session->get('singleForm');
CRM_Utils_System::redirect($url);
return;
}
if ($this->_action & CRM_Core_Action::DELETE) {
$session = CRM_Core_Session::singleton();
- $url = CRM_Utils_System::url($urlParams, 'reset=1&action=update&id=' . $this->_id);
- $dao = new CRM_Contribute_DAO_PremiumsProduct();
+ $url = CRM_Utils_System::url($urlParams, 'reset=1&action=update&id=' . $this->_id);
+ $dao = new CRM_Contribute_DAO_PremiumsProduct();
$dao->id = $this->_pid;
$dao->delete();
CRM_Core_Session::setStatus(ts('Selected Premium Product has been removed from this Contribution Page.'), ts('Saved'), 'success');
if ($this->_pid) {
$params['id'] = $this->_pid;
}
- $dao = new CRM_Contribute_DAO_Premium();
+ $dao = new CRM_Contribute_DAO_Premium();
$dao->entity_table = 'civicrm_contribution_page';
- $dao->entity_id = $this->_id;
+ $dao->entity_id = $this->_id;
$dao->find(TRUE);
$premiumID = $dao->id;
$params['premiums_id'] = $premiumID;
}
$this->add('select', 'price_set_id', ts('Price Set'),
array(
- '' => ts('- none -')) + $price,
+ '' => ts('- none -')
+ ) + $price,
NULL, array('onchange' => "showHideAmountBlock( this.value, 'price_set_id' );")
);
//CiviPledge fields.
if ($isQuick = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config')) {
$this->assign('isQuick', $isQuick);
//$priceField = CRM_Core_DAO::getFieldValue( 'CRM_Price_DAO_PriceField', $priceSetId, 'id', 'price_set_id' );
- $options = $pFIDs = array();
+ $options = $pFIDs = array();
$priceFieldParams = array('price_set_id' => $priceSetId);
- $priceFields = CRM_Core_DAO::commonRetrieveAll('CRM_Price_DAO_PriceField', 'price_set_id', $priceSetId, $pFIDs, $return = array('html_type', 'name', 'is_active', 'label'));
+ $priceFields = CRM_Core_DAO::commonRetrieveAll('CRM_Price_DAO_PriceField', 'price_set_id', $priceSetId, $pFIDs, $return = array(
+ 'html_type',
+ 'name',
+ 'is_active',
+ 'label'
+ ));
foreach ($priceFields as $priceField) {
if ($priceField['id'] && $priceField['html_type'] == 'Radio' && $priceField['name'] == 'contribution_amount') {
$defaults['price_field_id'] = $priceField['id'];
if (!empty($defaults['payment_processor'])) {
$defaults['payment_processor'] = array_fill_keys(explode(CRM_Core_DAO::VALUE_SEPARATOR,
- $defaults['payment_processor']
- ), '1');
+ $defaults['payment_processor']
+ ), '1');
}
return $defaults;
}
if (array_key_exists('payment_processor', $params)) {
if (array_key_exists(CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessor', 'AuthNet',
- 'id', 'payment_processor_type_id'
- ),
- CRM_Utils_Array::value('payment_processor', $params)
- )) {
+ 'id', 'payment_processor_type_id'
+ ),
+ CRM_Utils_Array::value('payment_processor', $params)
+ )) {
CRM_Core_Session::setStatus(ts(' Please note that the Authorize.net payment processor only allows recurring contributions and auto-renew memberships with payment intervals from 7-365 days or 1-12 months (i.e. not greater than 1 year).'), '', 'alert');
}
}
}
if (in_array($field, array(
- 'min_amount', 'max_amount'))) {
+ 'min_amount',
+ 'max_amount'
+ ))) {
$val = CRM_Utils_Rule::cleanMoney($val);
}
// process contribution amount block
$deleteAmountBlk = FALSE;
- $labels = CRM_Utils_Array::value('label', $params);
- $values = CRM_Utils_Array::value('value', $params);
+ $labels = CRM_Utils_Array::value('label', $params);
+ $values = CRM_Utils_Array::value('value', $params);
$default = CRM_Utils_Array::value('default', $params);
$options = array();
(strlen(trim($values[$i])) > 0)
) {
$options[] = array(
- 'label' => trim($labels[$i]),
+ 'label' => trim($labels[$i]),
'value' => CRM_Utils_Rule::cleanMoney(trim($values[$i])),
'weight' => $i,
'is_active' => 1,
}
if (!empty($params['is_allow_other_amount']) && empty($params['price_field_other'])) {
$editedFieldParams = array(
- 'price_set_id' => $priceSetId,
- 'name' => 'other_amount',
+ 'price_set_id' => $priceSetId,
+ 'name' => 'other_amount',
);
$editedResults = array();
$pledgeBlockParams['id'] = $this->_pledgeBlockID;
}
$pledgeBlock = array(
- 'pledge_frequency_unit', 'max_reminders',
- 'initial_reminder_day', 'additional_reminder_day',
+ 'pledge_frequency_unit',
+ 'max_reminders',
+ 'initial_reminder_day',
+ 'additional_reminder_day',
);
foreach ($pledgeBlock as $key) {
$pledgeBlockParams[$key] = CRM_Utils_Array::value($key, $params);
$allowCoreTypes[] = 'Contribution';
//CRM-15427
$allowSubTypes['ContributionType'] = array($financialTypeId);
- $entities[] = array('entity_name' => 'contribution_1', 'entity_type' => 'ContributionModel', 'entity_sub_type' => '*');
+ $entities[] = array(
+ 'entity_name' => 'contribution_1',
+ 'entity_type' => 'ContributionModel',
+ 'entity_sub_type' => '*'
+ );
// If applicable, register 'membership_1'
$member = CRM_Member_BAO_Membership::getMembershipBlock($this->_id);
if ($member && $member['is_active']) {
//CRM-15427
- $entities[] = array('entity_name' => 'membership_1', 'entity_type' => 'MembershipModel', 'entity_sub_type' => '*');
+ $entities[] = array(
+ 'entity_name' => 'membership_1',
+ 'entity_type' => 'MembershipModel',
+ 'entity_sub_type' => '*'
+ );
$allowCoreTypes[] = 'Membership';
$allowSubTypes['MembershipType'] = explode(',', $member['membership_types']);
}
$preProfileType = $postProfileType = NULL;
// for membership profile make sure Membership section is enabled
// get membership section for this contribution page
- $dao = new CRM_Member_DAO_MembershipBlock();
+ $dao = new CRM_Member_DAO_MembershipBlock();
$dao->entity_table = 'civicrm_contribution_page';
- $dao->entity_id = $contributionPageId;
+ $dao->entity_id = $contributionPageId;
$membershipEnable = FALSE;
$dao->delete();
//next delete the membership block fields
- $dao = new CRM_Member_DAO_MembershipBlock();
+ $dao = new CRM_Member_DAO_MembershipBlock();
$dao->entity_table = 'civicrm_contribution_page';
- $dao->entity_id = $this->_id;
+ $dao->entity_id = $this->_id;
$dao->delete();
//next delete the pcp block fields
- $dao = new CRM_PCP_DAO_PCPBlock();
+ $dao = new CRM_PCP_DAO_PCPBlock();
$dao->entity_table = 'civicrm_contribution_page';
- $dao->entity_id = $this->_id;
+ $dao->entity_id = $this->_id;
$dao->delete();
// need to delete premiums. CRM-4586
if (isset($this->_id)) {
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
CRM_Utils_System::setTitle(ts('Premiums') . " ($title)");
- $dao = new CRM_Contribute_DAO_Premium();
+ $dao = new CRM_Contribute_DAO_Premium();
$dao->entity_table = 'civicrm_contribution_page';
- $dao->entity_id = $this->_id;
+ $dao->entity_id = $this->_id;
$dao->find(TRUE);
CRM_Core_DAO::storeValues($dao, $defaults);
}
// we do this in case the user has hit the forward/back button
- $dao = new CRM_Contribute_DAO_Premium();
+ $dao = new CRM_Contribute_DAO_Premium();
$dao->entity_table = 'civicrm_contribution_page';
- $dao->entity_id = $this->_id;
+ $dao->entity_id = $this->_id;
$dao->find(TRUE);
$premiumID = $dao->id;
if ($premiumID) {
// is on behalf of an organization ?
$this->addElement('checkbox', 'is_organization', ts('Allow individuals to contribute and / or signup for membership on behalf of an organization?'), NULL, array('onclick' => "showHideByValue('is_organization',true,'for_org_text','table-row','radio',false);showHideByValue('is_organization',true,'for_org_option','table-row','radio',false);"));
- $allowCoreTypes = array_merge(array('Contact', 'Organization'), CRM_Contact_BAO_ContactType::subTypes('Organization'));
+ $allowCoreTypes = array_merge(array(
+ 'Contact',
+ 'Organization'
+ ), CRM_Contact_BAO_ContactType::subTypes('Organization'));
$allowSubTypes = array();
$entities = array(
array(
$this->addProfileSelector('onbehalf_profile_id', ts('Organization Profile'), $allowCoreTypes, $allowSubTypes, $entities);
- $options = array();
+ $options = array();
$options[] = $this->createElement('radio', NULL, NULL, ts('Optional'), 1);
$options[] = $this->createElement('radio', NULL, NULL, ts('Required'), 2);
$this->addGroup($options, 'is_for_organization', ts(''));
),
);
- $allowCoreTypes = array_merge(array('Contact', 'Individual', 'Organization', 'Household'), CRM_Contact_BAO_ContactType::subTypes('Individual'));
+ $allowCoreTypes = array_merge(array(
+ 'Contact',
+ 'Individual',
+ 'Organization',
+ 'Household'
+ ), CRM_Contact_BAO_ContactType::subTypes('Individual'));
$allowSubTypes = array();
$this->addProfileSelector('honoree_profile', ts('Honoree Profile'), $allowCoreTypes, $allowSubTypes, $entities);
list($contributionProfiles['custom_pre_id'],
$contributionProfiles['custom_post_id']
- ) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
+ ) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
$conProfileType = NULL;
if ($contributionProfiles['custom_pre_id']) {
if ($contributionProfiles['custom_post_id']) {
$postProfileType = CRM_Core_BAO_UFField::getProfileType($contributionProfiles['custom_post_id']);
if ($postProfileType == 'Membership') {
- $conProfileType = empty($conProfileType) ? "'Includes Profile (bottom of page)'" : "{$conProfileType} and 'Includes Profile (bottom of page)'";
+ $conProfileType = empty($conProfileType) ? "'Includes Profile (bottom of page)'" : "{$conProfileType} and 'Includes Profile (bottom of page)'";
}
}
if (!empty($conProfileType)) {
$url = 'civicrm/admin/contribute';
$urlParams = 'reset=1';
CRM_Core_Session::setStatus(ts("'%1' information has been saved.",
- array(1 => $this->getTitle())
- ), ts('Saved'), 'success');
+ array(1 => $this->getTitle())
+ ), ts('Saved'), 'success');
}
CRM_Utils_System::redirect(CRM_Utils_System::url($url, $urlParams));
CRM_Core_Resources::singleton()
->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
->addSetting(array(
- 'tabSettings' => array(
- 'active' => self::getCurrentTab($tabs),
- )));
+ 'tabSettings' => array(
+ 'active' => self::getCurrentTab($tabs),
+ )
+ ));
return $tabs;
}
$tabs = array(
'settings' => array(
- 'title' => ts('Title'),
+ 'title' => ts('Title'),
'link' => NULL,
'valid' => FALSE,
'active' => FALSE,
'current' => FALSE,
),
'amount' => array(
- 'title' => ts('Amounts'),
+ 'title' => ts('Amounts'),
'link' => NULL,
'valid' => FALSE,
'active' => FALSE,
'current' => FALSE,
),
'membership' => array(
- 'title' => ts('Memberships'),
+ 'title' => ts('Memberships'),
'link' => NULL,
'valid' => FALSE,
'active' => FALSE,
'current' => FALSE,
),
'thankyou' => array(
- 'title' => ts('Receipt'),
+ 'title' => ts('Receipt'),
'link' => NULL,
'valid' => FALSE,
'active' => FALSE,
'current' => FALSE,
),
'friend' => array(
- 'title' => ts('Tell a Friend'),
+ 'title' => ts('Tell a Friend'),
'link' => NULL,
'valid' => FALSE,
'active' => FALSE,
'current' => FALSE,
),
'custom' => array(
- 'title' => ts('Profiles'),
+ 'title' => ts('Profiles'),
'link' => NULL,
'valid' => FALSE,
'active' => FALSE,
'current' => FALSE,
),
'premium' => array(
- 'title' => ts('Premiums'),
+ 'title' => ts('Premiums'),
'link' => NULL,
'valid' => FALSE,
'active' => FALSE,
'current' => FALSE,
),
'widget' => array(
- 'title' => ts('Widgets'),
+ 'title' => ts('Widgets'),
'link' => NULL,
'valid' => FALSE,
'active' => FALSE,
'current' => FALSE,
),
'pcp' => array(
- 'title' => ts('Personal Campaigns'),
+ 'title' => ts('Personal Campaigns'),
'link' => NULL,
'valid' => FALSE,
'active' => FALSE,
);
$contribPageId = $form->getVar('_id');
- $fullName = $form->getVar('_name');
- $className = CRM_Utils_String::getClassName($fullName);
+ $fullName = $form->getVar('_name');
+ $className = CRM_Utils_String::getClassName($fullName);
// Hack for special cases.
switch ($className) {
$tabs[$key]['link'] =
CRM_Utils_System::url(
"civicrm/admin/contribute/{$key}",
- "{$reset}action=update&id={$contribPageId}{$tabs[$key]['qfKey']}"
- );
+ "{$reset}action=update&id={$contribPageId}{$tabs[$key]['qfKey']}"
+ );
$tabs[$key]['active'] = $tabs[$key]['valid'] = TRUE;
}
//get all section info.
);
$this->_fields = array(
- 'title' => array(ts('Title'),
+ 'title' => array(
+ ts('Title'),
'text',
FALSE,
$title,
),
- 'url_logo' => array(ts('URL to Logo Image'),
+ 'url_logo' => array(
+ ts('URL to Logo Image'),
'text',
FALSE,
NULL,
),
- 'button_title' => array(ts('Button Title'),
+ 'button_title' => array(
+ ts('Button Title'),
'text',
FALSE,
ts('Contribute!'),
);
$this->_colorFields = array(
- 'color_title' => array(ts('Title Text Color'),
+ 'color_title' => array(
+ ts('Title Text Color'),
'text',
FALSE,
'#2786C2',
),
- 'color_bar' => array(ts('Progress Bar Color'),
+ 'color_bar' => array(
+ ts('Progress Bar Color'),
'text',
FALSE,
'#FFFFFF',
),
- 'color_main_text' => array(ts('Additional Text Color'),
+ 'color_main_text' => array(
+ ts('Additional Text Color'),
'text',
FALSE,
'#FFFFFF',
),
- 'color_main' => array(ts('Background Color'),
+ 'color_main' => array(
+ ts('Background Color'),
'text',
FALSE,
'#96C0E7',
),
- 'color_main_bg' => array(ts('Background Color Top Area'),
+ 'color_main_bg' => array(
+ ts('Background Color Top Area'),
'text',
FALSE,
'#B7E2FF',
),
- 'color_bg' => array(ts('Border Color'),
+ 'color_bg' => array(
+ ts('Border Color'),
'text',
FALSE,
'#96C0E7',
),
- 'color_about_link' => array(ts('Button Link Color'),
+ 'color_about_link' => array(
+ ts('Button Link Color'),
'text',
FALSE,
'#556C82',
),
- 'color_button' => array(ts('Button Background Color'),
+ 'color_button' => array(
+ ts('Button Background Color'),
'text',
FALSE,
'#FFFFFF',
),
- 'color_homepage_link' => array(ts('Homepage Link Color'),
+ 'color_homepage_link' => array(
+ ts('Homepage Link Color'),
'text',
FALSE,
'#FFFFFF',
* @return void
*/
public function preProcess() {
- $id = $this->get('id');
- $values = $ids = array();
- $params = array('id' => $id);
+ $id = $this->get('id');
+ $values = $ids = array();
+ $params = array('id' => $id);
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->assign('context', $context);
}
if (!empty($values['contribution_recur_id'])) {
- $sql = "SELECT installments, frequency_interval, frequency_unit FROM civicrm_contribution_recur WHERE id = %1";
+ $sql = "SELECT installments, frequency_interval, frequency_unit FROM civicrm_contribution_recur WHERE id = %1";
$params = array(1 => array($values['contribution_recur_id'], 'Integer'));
- $dao = CRM_Core_DAO::executeQuery($sql, $params);
+ $dao = CRM_Core_DAO::executeQuery($sql, $params);
if ($dao->fetch()) {
$values['recur_installments'] = $dao->installments;
$values['recur_frequency_unit'] = $dao->frequency_unit;
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'name'), TRUE);
- $this->addRule('name', ts('A product with this name already exists. Please select another name.'), 'objectExists', array('CRM_Contribute_DAO_Product', $this->_id));
+ $this->addRule('name', ts('A product with this name already exists. Please select another name.'), 'objectExists', array(
+ 'CRM_Contribute_DAO_Product',
+ $this->_id
+ ));
$this->add('text', 'sku', ts('SKU'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'sku'));
$this->add('textarea', 'description', ts('Description'), 'rows=3, cols=60');
$this->add('textarea', 'options', ts('Options'), 'rows=3, cols=60');
- $this->add('select', 'period_type', ts('Period Type'), array('' => '- select -', 'rolling' => 'Rolling', 'fixed' => 'Fixed'));
+ $this->add('select', 'period_type', ts('Period Type'), array(
+ '' => '- select -',
+ 'rolling' => 'Rolling',
+ 'fixed' => 'Fixed'
+ ));
$this->add('text', 'fixed_period_start_day', ts('Fixed Period Start Day'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'fixed_period_start_day'));
CRM_Core_Session::setStatus(ts('Selected Premium Product type has been deleted.'), ts('Deleted'), 'info');
}
else {
- $params = $this->controller->exportValues($this->_name);
+ $params = $this->controller->exportValues($this->_name);
$imageFile = CRM_Utils_Array::value('uploadFile', $params);
$imageFile = $imageFile['name'];
// fix the money fields
foreach (array(
- 'cost', 'price', 'min_contribution') as $f) {
+ 'cost',
+ 'price',
+ 'min_contribution'
+ ) as $f) {
$params[$f] = CRM_Utils_Rule::cleanMoney($params[$f]);
}
if ($imageInfo['mime'] == 'image/gif') {
$source = imagecreatefromgif($filename);
}
- elseif($imageInfo['mime'] == 'image/png') {
+ elseif ($imageInfo['mime'] == 'image/png') {
$source = imagecreatefrompng($filename);
}
else {
* driven by the wizard framework
*/
- $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
- $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
+ $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
+ $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
+ $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'search');
$this->assign("context", $this->_context);
}
foreach (array(
- 'contribution_amount_low', 'contribution_amount_high') as $f) {
+ 'contribution_amount_low',
+ 'contribution_amount_high'
+ ) as $f) {
if (isset($this->_formValues[$f])) {
$this->_formValues[$f] = CRM_Utils_Rule::cleanMoney($this->_formValues[$f]);
}
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($this);
$this->addButtons(array(
- array(
- 'type' => 'refresh',
- 'name' => ts('Search'),
- 'isDefault' => TRUE,
- ),
- ));
+ array(
+ 'type' => 'refresh',
+ 'name' => ts('Search'),
+ 'isDefault' => TRUE,
+ ),
+ ));
}
public function postProcess() {
$form->addMoney("soft_credit_amount[{$rowNumber}]", ts('Amount'), FALSE, NULL, FALSE);
- $form->addSelect("soft_credit_type[{$rowNumber}]", array('entity' => 'contribution_soft', 'field' => 'soft_credit_type_id', 'label' => ts('Type')));
+ $form->addSelect("soft_credit_type[{$rowNumber}]", array(
+ 'entity' => 'contribution_soft',
+ 'field' => 'soft_credit_type_id',
+ 'label' => ts('Type')
+ ));
if (!empty($form->_softCreditInfo['soft_credit'][$rowNumber]['soft_credit_id'])) {
$form->add('hidden', "soft_credit_id[{$rowNumber}]",
$form->_softCreditInfo['soft_credit'][$rowNumber]['soft_credit_id']);
$errors["soft_credit_contact[$key]"] = ts('You cannot enter multiple soft credits for the same contact.');
}
if ($self->_action == CRM_Core_Action::ADD && $fields['soft_credit_amount'][$key]
- && (CRM_Utils_Rule::cleanMoney($fields['soft_credit_amount'][$key]) > CRM_Utils_Rule::cleanMoney($fields['total_amount']))) {
+ && (CRM_Utils_Rule::cleanMoney($fields['soft_credit_amount'][$key]) > CRM_Utils_Rule::cleanMoney($fields['total_amount']))
+ ) {
$errors["soft_credit_amount[$key]"] = ts('Soft credit amount cannot be more than the total amount.');
}
if (empty($fields['soft_credit_amount'][$key])) {
else {
$queryParams = $form->get('queryParams');
$sortOrder = NULL;
- if ($form->get(CRM_Utils_Sort::SORT_ORDER )) {
+ if ($form->get(CRM_Utils_Sort::SORT_ORDER)) {
$sortOrder = $form->get(CRM_Utils_Sort::SORT_ORDER);
}
}
else {
$session->replaceUserContext(CRM_Utils_System::url("civicrm/contact/search/$searchFormName",
- $urlParams
- ));
+ $urlParams
+ ));
}
}
$deletedContributions++;
}
}
- $status = ts('Deleted Contribution(s): %1 (Total Selected: %2) ', array(1 => $deletedContributions, 2 => count($this->_contributionIds)));
+ $status = ts('Deleted Contribution(s): %1 (Total Selected: %2) ', array(
+ 1 => $deletedContributions,
+ 2 => count($this->_contributionIds)
+ ));
CRM_Core_Session::setStatus($status, '', 'info');
}
}
CRM_Core_Error::fatal();
}
- $contribution = & $objects['contribution'];
+ $contribution = &$objects['contribution'];
$input['amount'] = $contribution->total_amount;
$input['invoice_id'] = $contribution->invoice_id;
$url = CRM_Utils_System::url('civicrm/contribute/search', $urlParams);
$breadCrumb = array(
array(
- 'url' => $url,
+ 'url' => $url,
'title' => ts('Search Results'),
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadCrumb);
CRM_Utils_System::setTitle(ts('Print Contribution Receipts'));
$contribution = &$objects['contribution'];
// set some fake input values so we can reuse IPN code
- $input['amount'] = $contribution->total_amount;
- $input['is_test'] = $contribution->is_test;
+ $input['amount'] = $contribution->total_amount;
+ $input['is_test'] = $contribution->is_test;
$input['fee_amount'] = $contribution->fee_amount;
$input['net_amount'] = $contribution->net_amount;
- $input['trxn_id'] = $contribution->trxn_id;
- $input['trxn_date'] = isset($contribution->trxn_date) ? $contribution->trxn_date : NULL;
+ $input['trxn_id'] = $contribution->trxn_id;
+ $input['trxn_date'] = isset($contribution->trxn_date) ? $contribution->trxn_date : NULL;
// CRM_Contribute_BAO_Contribution::composeMessageArray expects mysql formatted date
$objects['contribution']->receive_date = CRM_Utils_Date::isoToMysql($objects['contribution']->receive_date);
$pdfElements['createPdf'] = FALSE;
if (!empty($pdfElements['params']['output']) &&
- ($pdfElements['params']['output'] == "pdf_invoice" || $pdfElements['params']['output'] == "pdf_receipt")) {
+ ($pdfElements['params']['output'] == "pdf_invoice" || $pdfElements['params']['output'] == "pdf_receipt")
+ ) {
$pdfElements['createPdf'] = TRUE;
}
$excludeContactIds = array();
if (!$pdfElements['createPdf']) {
$returnProperties = array(
- 'email' => 1,
- 'do_not_email' => 1,
- 'is_deceased' => 1,
- 'on_hold' => 1,
- );
+ 'email' => 1,
+ 'do_not_email' => 1,
+ 'is_deceased' => 1,
+ 'on_hold' => 1,
+ );
list($contactDetails) = CRM_Utils_Token::getTokenDetails($contactIds, $returnProperties, FALSE, FALSE);
$pdfElements['suppressedEmails'] = 0;
if (empty($values['email']) ||
(empty($params['override_privacy']) && !empty($values['do_not_email']))
|| CRM_Utils_Array::value('is_deceased', $values)
- || !empty($values['on_hold'])) {
+ || !empty($values['on_hold'])
+ ) {
$suppressedEmails++;
$pdfElements['suppressedEmails'] = $suppressedEmails;
$excludeContactIds[] = $values['contact_id'];
'email' => ts('Send emails where possible. Generate printable PDFs for contacts who cannot receive email.'),
'both' => ts('Send emails where possible. Generate printable PDFs for all contacts.'),
);
- if (CRM_Core_Config::singleton()->doNotAttachPDFReceipt) {
+ if (CRM_Core_Config::singleton()->doNotAttachPDFReceipt) {
$emailOptions['pdfemail'] = ts('Send emails with an attached PDF where possible. Generate printable PDFs for contacts who cannot receive email.');
$emailOptions['pdfemail_both'] = ts('Send emails with an attached PDF where possible. Generate printable PDFs for all contacts.');
}
if (!empty($formValues['email_options'])) {
$returnProperties['email'] = $returnProperties['on_hold'] = $returnProperties['is_deceased'] = $returnProperties['do_not_email'] = 1;
$emailParams = array(
- 'subject' => $formValues['subject'],
+ 'subject' => $formValues['subject'],
);
// We need display_name for emailLetter() so add to returnProperties here
$returnProperties['display_name'] = 1;
}
}
// update dates ?
- $receipt_update = isset($formValues['receipt_update']) ? $formValues['receipt_update'] : FALSE;
+ $receipt_update = isset($formValues['receipt_update']) ? $formValues['receipt_update'] : FALSE;
$thankyou_update = isset($formValues['thankyou_update']) ? $formValues['thankyou_update'] : FALSE;
- $nowDate = date('YmdHis');
+ $nowDate = date('YmdHis');
$receipts = $thanks = $emailed = 0;
- $updateStatus = '';
+ $updateStatus = '';
$task = 'CRM_Contribution_Form_Task_PDFLetterCommon';
$realSeparator = ', ';
//the original thinking was mutliple options - but we are going with only 2 (comma & td) for now in case
foreach ($relevantEntities as $entity) {
if (isset($tokens[$entity]) && is_array($tokens[$entity])) {
foreach ($tokens[$entity] as $token) {
- if (!self::isHtmlTokenInTableCell($token, $entity, $html)) {;
+ if (!self::isHtmlTokenInTableCell($token, $entity, $html)) {
+ ;
return FALSE;
}
}
public static function combineContributions($existing, $contribution, $separator) {
foreach ($contribution as $field => $value) {
$existing[$field] = isset($existing[$field]) ? $existing[$field] . $separator : '';
- $existing[$field] .= $value;
+ $existing[$field] .= $value;
}
return $existing;
}
return;
}
CRM_Core_Smarty::singleton()->assign('contact_aggregate', $contact['contact_aggregate']);
- CRM_Core_Smarty::singleton()->assign('contributions', array_intersect_key($contributions, $contact['contribution_ids'][$groupBy][$groupByID]));
+ CRM_Core_Smarty::singleton()
+ ->assign('contributions', array_intersect_key($contributions, $contact['contribution_ids'][$groupBy][$groupByID]));
CRM_Core_Smarty::singleton()->assign('contribution_aggregate', $contact['aggregates'][$groupBy][$groupByID]);
}
$validate = FALSE;
//validations
if (count($this->_contributionIds) > $this->_maxContributions) {
- CRM_Core_Session::setStatus(ts("The maximum number of contributions you can select for Batch Update is %1. You have selected %2. Please select fewer contributions from your search results and try again.", array(1 => $this->_maxContributions, 2 => count($this->_contributionIds))), ts('Batch Update Error'), 'error');
+ CRM_Core_Session::setStatus(ts("The maximum number of contributions you can select for Batch Update is %1. You have selected %2. Please select fewer contributions from your search results and try again.", array(
+ 1 => $this->_maxContributions,
+ 2 => count($this->_contributionIds)
+ )), ts('Batch Update Error'), 'error');
$validate = TRUE;
}
$ufGroupElement = $this->add('select', 'uf_group_id', ts('Select Profile'),
array(
- '' => ts('- select profile -')) + $profiles, TRUE
+ '' => ts('- select profile -')
+ ) + $profiles, TRUE
);
$this->addDefaultButtons(ts('Continue'));
}
);
// build a row for each contribution id
- $this->_rows = array();
- $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution');
- $defaults = array();
- $now = date("m/d/Y");
+ $this->_rows = array();
+ $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution');
+ $defaults = array();
+ $now = date("m/d/Y");
$paidByOptions = array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument();
while ($dao->fetch()) {
// get the missing pieces for each contribution
$contribIDs = implode(',', $this->_contributionIds);
- $details = self::getDetails($contribIDs);
- $template = CRM_Core_Smarty::singleton();
+ $details = self::getDetails($contribIDs);
+ $template = CRM_Core_Smarty::singleton();
// for each contribution id, we just call the baseIPN stuff
foreach ($this->_rows as $row) {
// status is not pending
if ($contribution->contribution_status_id != array_search('Pending',
$contributionStatuses
- )) {
+ )
+ ) {
$transaction->commit();
continue;
}
if (!$this->_paymentProcessor['object']->isSupported('updateSubscriptionBillingInfo')) {
CRM_Core_Error::fatal(ts("%1 processor doesn't support updating subscription billing details.",
- array(1 => $this->_paymentProcessor['object']->_processorName)
- ));
+ array(1 => $this->_paymentProcessor['object']->_processorName)
+ ));
}
$this->assign('paymentProcessor', $this->_paymentProcessor);
$this->_defaults = array();
if ($this->_subscriptionDetails->contact_id) {
- $fields = array();
- $names = array(
- 'first_name', 'middle_name', 'last_name', "street_address-{$this->_bltID}", "city-{$this->_bltID}",
- "postal_code-{$this->_bltID}", "country_id-{$this->_bltID}", "state_province_id-{$this->_bltID}",
+ $fields = array();
+ $names = array(
+ 'first_name',
+ 'middle_name',
+ 'last_name',
+ "street_address-{$this->_bltID}",
+ "city-{$this->_bltID}",
+ "postal_code-{$this->_bltID}",
+ "country_id-{$this->_bltID}",
+ "state_province_id-{$this->_bltID}",
);
foreach ($names as $name) {
$fields[$name] = 1;
}
$session = CRM_Core_Session::singleton();
- $userID = $session->get('userID');
+ $userID = $session->get('userID');
if ($userID && $status) {
$session->setStatus($status, $msgTitle, $msgType);
}
if (isset($tplParams))
$session->set('resultParams', $tplParams);
return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/subscriptionstatus',
- "reset=1&task=billing&result={$result}"));
+ "reset=1&task=billing&result={$result}"));
}
}
}
if (!$this->_paymentProcessorObj->isSupported('changeSubscriptionAmount')) {
$userAlert = "<span class='font-red'>" . ts('Updates made using this form will change the recurring contribution information stored in your CiviCRM database, but will NOT be sent to the payment processor. You must enter the same changes using the payment processor web site.',
- array(1 => $this->_paymentProcessorObj->_processorName)) . '</span>';
+ array(1 => $this->_paymentProcessorObj->_processorName)) . '</span>';
CRM_Core_Session::setStatus($userAlert, ts('Warning'), 'alert');
}
// define the fields
$this->addMoney('amount', ts('Recurring Contribution Amount'), TRUE,
array(
- 'size' => 20), TRUE,
+ 'size' => 20
+ ), TRUE,
'currency', NULL, TRUE
);
$params['subscriptionId'] = $this->_subscriptionDetails->subscription_id;
$updateSubscription = TRUE;
if ($this->_paymentProcessorObj->isSupported('changeSubscriptionAmount')) {
- $updateSubscription = $this->_paymentProcessorObj->changeSubscriptionAmount($message, $params);
+ $updateSubscription = $this->_paymentProcessorObj->changeSubscriptionAmount($message, $params);
}
if (is_a($updateSubscription, 'CRM_Core_Error')) {
- CRM_Core_Error::displaySessionError($updateSubscription);
- $status = ts('Could not update the Recurring contribution details');
- $msgTitle = ts('Update Error');
- $msgType = 'error';
+ CRM_Core_Error::displaySessionError($updateSubscription);
+ $status = ts('Could not update the Recurring contribution details');
+ $msgTitle = ts('Update Error');
+ $msgType = 'error';
}
elseif ($updateSubscription) {
- // save the changes
- $result = CRM_Contribute_BAO_ContributionRecur::add($params);
- $status = ts('Recurring contribution has been updated to: %1, every %2 %3(s) for %4 installments.',
- array(
- 1 => CRM_Utils_Money::format($params['amount'], $this->_subscriptionDetails->currency),
- 2 => $this->_subscriptionDetails->frequency_interval,
- 3 => $this->_subscriptionDetails->frequency_unit,
- 4 => $params['installments'],
- )
- );
-
- $msgTitle = ts('Update Success');
- $msgType = 'success';
-
- $contactID = $this->_subscriptionDetails->contact_id;
-
- if ($this->_subscriptionDetails->amount != $params['amount']) {
- $message .= "<br /> " . ts("Recurring contribution amount has been updated from %1 to %2 for this subscription.",
- array(
- 1 => CRM_Utils_Money::format($this->_subscriptionDetails->amount, $this->_subscriptionDetails->currency),
- 2 => CRM_Utils_Money::format($params['amount'], $this->_subscriptionDetails->currency),
- )) . ' ';
- }
-
- if ($this->_subscriptionDetails->installments != $params['installments']) {
- $message .= "<br /> " . ts("Recurring contribution installments have been updated from %1 to %2 for this subscription.", array(1 => $this->_subscriptionDetails->installments, 2 => $params['installments'])) . ' ';
- }
+ // save the changes
+ $result = CRM_Contribute_BAO_ContributionRecur::add($params);
+ $status = ts('Recurring contribution has been updated to: %1, every %2 %3(s) for %4 installments.',
+ array(
+ 1 => CRM_Utils_Money::format($params['amount'], $this->_subscriptionDetails->currency),
+ 2 => $this->_subscriptionDetails->frequency_interval,
+ 3 => $this->_subscriptionDetails->frequency_unit,
+ 4 => $params['installments'],
+ )
+ );
+
+ $msgTitle = ts('Update Success');
+ $msgType = 'success';
+
+ $contactID = $this->_subscriptionDetails->contact_id;
+
+ if ($this->_subscriptionDetails->amount != $params['amount']) {
+ $message .= "<br /> " . ts("Recurring contribution amount has been updated from %1 to %2 for this subscription.",
+ array(
+ 1 => CRM_Utils_Money::format($this->_subscriptionDetails->amount, $this->_subscriptionDetails->currency),
+ 2 => CRM_Utils_Money::format($params['amount'], $this->_subscriptionDetails->currency),
+ )) . ' ';
+ }
- $activityParams = array(
- 'source_contact_id' => $contactID,
- 'activity_type_id' => CRM_Core_OptionGroup::getValue('activity_type',
- 'Update Recurring Contribution',
- 'name'
- ),
- 'subject' => ts('Recurring Contribution Updated'),
- 'details' => $message,
- 'activity_date_time' => date('YmdHis'),
- 'status_id' => CRM_Core_OptionGroup::getValue('activity_status',
- 'Completed',
- 'name'
- ),
- );
- $session = CRM_Core_Session::singleton();
- $cid = $session->get('userID');
+ if ($this->_subscriptionDetails->installments != $params['installments']) {
+ $message .= "<br /> " . ts("Recurring contribution installments have been updated from %1 to %2 for this subscription.", array(
+ 1 => $this->_subscriptionDetails->installments,
+ 2 => $params['installments']
+ )) . ' ';
+ }
- if ($cid) {
- $activityParams['target_contact_id'][] = $activityParams['source_contact_id'];
- $activityParams['source_contact_id'] = $cid;
- }
- CRM_Activity_BAO_Activity::create($activityParams);
-
- if (!empty($params['is_notify'])) {
- // send notification
- if ($this->_subscriptionDetails->contribution_page_id) {
- CRM_Core_DAO::commonRetrieveAll('CRM_Contribute_DAO_ContributionPage', 'id',
- $this->_subscriptionDetails->contribution_page_id, $value, array(
- 'title',
- 'receipt_from_name',
- 'receipt_from_email',
- )
- );
- $receiptFrom = '"' . CRM_Utils_Array::value('receipt_from_name', $value[$this->_subscriptionDetails->contribution_page_id]) . '" <' . $value[$this->_subscriptionDetails->contribution_page_id]['receipt_from_email'] . '>';
- }
- else {
- $domainValues = CRM_Core_BAO_Domain::getNameAndEmail();
- $receiptFrom = "$domainValues[0] <$domainValues[1]>";
- }
-
- list($donorDisplayName, $donorEmail) = CRM_Contact_BAO_Contact::getContactDetails($contactID);
-
- $tplParams = array(
- 'recur_frequency_interval' => $this->_subscriptionDetails->frequency_interval,
- 'recur_frequency_unit' => $this->_subscriptionDetails->frequency_unit,
- 'amount' => CRM_Utils_Money::format($params['amount']),
- 'installments' => $params['installments'],
- );
+ $activityParams = array(
+ 'source_contact_id' => $contactID,
+ 'activity_type_id' => CRM_Core_OptionGroup::getValue('activity_type',
+ 'Update Recurring Contribution',
+ 'name'
+ ),
+ 'subject' => ts('Recurring Contribution Updated'),
+ 'details' => $message,
+ 'activity_date_time' => date('YmdHis'),
+ 'status_id' => CRM_Core_OptionGroup::getValue('activity_status',
+ 'Completed',
+ 'name'
+ ),
+ );
+ $session = CRM_Core_Session::singleton();
+ $cid = $session->get('userID');
- $tplParams['contact'] = array('display_name' => $donorDisplayName);
- $tplParams['receipt_from_email'] = $receiptFrom;
-
- $sendTemplateParams = array(
- 'groupName' => 'msg_tpl_workflow_contribution',
- 'valueName' => 'contribution_recurring_edit',
- 'contactId' => $contactID,
- 'tplParams' => $tplParams,
- 'isTest' => $this->_subscriptionDetails->is_test,
- 'PDFFilename' => 'receipt.pdf',
- 'from' => $receiptFrom,
- 'toName' => $donorDisplayName,
- 'toEmail' => $donorEmail,
+ if ($cid) {
+ $activityParams['target_contact_id'][] = $activityParams['source_contact_id'];
+ $activityParams['source_contact_id'] = $cid;
+ }
+ CRM_Activity_BAO_Activity::create($activityParams);
+
+ if (!empty($params['is_notify'])) {
+ // send notification
+ if ($this->_subscriptionDetails->contribution_page_id) {
+ CRM_Core_DAO::commonRetrieveAll('CRM_Contribute_DAO_ContributionPage', 'id',
+ $this->_subscriptionDetails->contribution_page_id, $value, array(
+ 'title',
+ 'receipt_from_name',
+ 'receipt_from_email',
+ )
);
- list($sent) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
+ $receiptFrom = '"' . CRM_Utils_Array::value('receipt_from_name', $value[$this->_subscriptionDetails->contribution_page_id]) . '" <' . $value[$this->_subscriptionDetails->contribution_page_id]['receipt_from_email'] . '>';
+ }
+ else {
+ $domainValues = CRM_Core_BAO_Domain::getNameAndEmail();
+ $receiptFrom = "$domainValues[0] <$domainValues[1]>";
}
+
+ list($donorDisplayName, $donorEmail) = CRM_Contact_BAO_Contact::getContactDetails($contactID);
+
+ $tplParams = array(
+ 'recur_frequency_interval' => $this->_subscriptionDetails->frequency_interval,
+ 'recur_frequency_unit' => $this->_subscriptionDetails->frequency_unit,
+ 'amount' => CRM_Utils_Money::format($params['amount']),
+ 'installments' => $params['installments'],
+ );
+
+ $tplParams['contact'] = array('display_name' => $donorDisplayName);
+ $tplParams['receipt_from_email'] = $receiptFrom;
+
+ $sendTemplateParams = array(
+ 'groupName' => 'msg_tpl_workflow_contribution',
+ 'valueName' => 'contribution_recurring_edit',
+ 'contactId' => $contactID,
+ 'tplParams' => $tplParams,
+ 'isTest' => $this->_subscriptionDetails->is_test,
+ 'PDFFilename' => 'receipt.pdf',
+ 'from' => $receiptFrom,
+ 'toName' => $donorDisplayName,
+ 'toEmail' => $donorEmail,
+ );
+ list($sent) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
}
+ }
$session = CRM_Core_Session::singleton();
- $userID = $session->get('userID');
+ $userID = $session->get('userID');
if ($userID && $status) {
CRM_Core_Session::setStatus($status, $msgTitle, $msgType);
}
CRM_Utils_System::setUFMessage($status);
// keep result as 1, since we not displaying anything on the redirected page anyway
return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/subscriptionstatus',
- "reset=1&task=update&result=1"));
+ "reset=1&task=update&result=1"));
}
}
}
$this->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
$this->setMaxFileSize($uploadFileSize);
- $this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize);
+ $this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(
+ 1 => $uploadSize,
+ 2 => $uploadFileSize
+ )), 'maxfilesize', $uploadFileSize);
$this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
$this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
//get the saved mapping details
$mappingArray = CRM_Core_BAO_Mapping::getMappings(CRM_Core_OptionGroup::getValue('mapping_type',
- 'Import Contribution',
- 'name'
- ));
+ 'Import Contribution',
+ 'name'
+ ));
$this->assign('savedMapping', $mappingArray);
$this->add('select', 'savedMapping', ts('Mapping Option'), array('' => ts('- select -')) + $mappingArray);
$this->addElement('submit', 'loadMapping', ts('Load Mapping'), NULL, array('onclick' => 'checkSelect()'));
$this->setDefaults(array(
'onDuplicate' =>
CRM_Import_Parser::DUPLICATE_SKIP,
- ));
+ ));
//contact types option
$contactOptions = array();
$this->setDefaults(array(
'contactType' =>
CRM_Import_Parser::CONTACT_INDIVIDUAL,
- ));
+ ));
//build date formats
CRM_Core_Form_Date::buildAllowedDateFormats($this);
public function postProcess() {
$this->controller->resetPage('MapField');
- $fileName = $this->controller->exportValue($this->_name, 'uploadFile');
+ $fileName = $this->controller->exportValue($this->_name, 'uploadFile');
$skipColumnHeader = $this->controller->exportValue($this->_name, 'skipColumnHeader');
- $onDuplicate = $this->controller->exportValue($this->_name, 'onDuplicate');
- $contactType = $this->controller->exportValue($this->_name, 'contactType');
- $dateFormats = $this->controller->exportValue($this->_name, 'dateFormats');
- $savedMapping = $this->controller->exportValue($this->_name, 'savedMapping');
+ $onDuplicate = $this->controller->exportValue($this->_name, 'onDuplicate');
+ $contactType = $this->controller->exportValue($this->_name, 'contactType');
+ $dateFormats = $this->controller->exportValue($this->_name, 'dateFormats');
+ $savedMapping = $this->controller->exportValue($this->_name, 'savedMapping');
$this->set('onDuplicate', $onDuplicate);
$this->set('contactType', $contactType);
class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField {
-
-
/**
* Set variables up before form is built
*
//modify field title only for update mode. CRM-3245
foreach (array(
- 'contribution_id', 'invoice_id', 'trxn_id') as $key) {
+ 'contribution_id',
+ 'invoice_id',
+ 'trxn_id'
+ ) as $key) {
$this->_mapperFields[$key] .= ' (match to contribution record)';
$highlightedFields[] = $key;
}
}
elseif ($this->_onDuplicate == CRM_Import_Parser::DUPLICATE_SKIP) {
unset($this->_mapperFields['contribution_id']);
- $highlightedFieldsArray = array('contribution_contact_id', 'email', 'first_name', 'last_name', 'external_identifier');
+ $highlightedFieldsArray = array(
+ 'contribution_contact_id',
+ 'email',
+ 'first_name',
+ 'last_name',
+ 'external_identifier'
+ );
foreach ($highlightedFieldsArray as $name) {
$highlightedFields[] = $name;
}
$warning = 0;
for ($i = 0; $i < $this->_columnCount; $i++) {
- $sel = & $this->addElement('hierselect', "mapper[$i]", ts('Mapper for Field %1', array(1 => $i)), NULL);
+ $sel = &$this->addElement('hierselect', "mapper[$i]", ts('Mapper for Field %1', array(1 => $i)), NULL);
$jsSet = FALSE;
if ($this->get('savedMapping')) {
if (isset($mappingName[$i])) {
$skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
//get the data from the session
- $dataValues = $this->get('dataValues');
- $mapper = $this->get('mapper');
- $softCreditFields = $this->get('softCreditFields');
+ $dataValues = $this->get('dataValues');
+ $mapper = $this->get('mapper');
+ $softCreditFields = $this->get('softCreditFields');
$mapperSoftCreditType = $this->get('mapperSoftCreditType');
- $invalidRowCount = $this->get('invalidRowCount');
- $conflictRowCount = $this->get('conflictRowCount');
- $mismatchCount = $this->get('unMatchCount');
+ $invalidRowCount = $this->get('invalidRowCount');
+ $conflictRowCount = $this->get('conflictRowCount');
+ $mismatchCount = $this->get('unMatchCount');
//get the mapping name displayed if the mappingId is set
$mappingId = $this->get('loadMappingId');
}
$properties = array(
- 'mapper', 'softCreditFields',
+ 'mapper',
+ 'softCreditFields',
'mapperSoftCreditType',
- 'dataValues', 'columnCount',
- 'totalRowCount', 'validRowCount',
- 'invalidRowCount', 'conflictRowCount',
+ 'dataValues',
+ 'columnCount',
+ 'totalRowCount',
+ 'validRowCount',
+ 'invalidRowCount',
+ 'conflictRowCount',
'downloadErrorRecordsUrl',
'downloadConflictRecordsUrl',
'downloadMismatchRecordsUrl',
* @return void
*/
public function postProcess() {
- $fileName = $this->controller->exportValue('DataSource', 'uploadFile');
+ $fileName = $this->controller->exportValue('DataSource', 'uploadFile');
$skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
- $invalidRowCount = $this->get('invalidRowCount');
+ $invalidRowCount = $this->get('invalidRowCount');
$conflictRowCount = $this->get('conflictRowCount');
- $onDuplicate = $this->get('onDuplicate');
+ $onDuplicate = $this->get('onDuplicate');
$mapperSoftCreditType = $this->get('mapperSoftCreditType');
$config = CRM_Core_Config::singleton();
}
$this->assign('dupeActionString', $dupeActionString);
- $properties = array('totalRowCount', 'validRowCount', 'invalidRowCount', 'validSoftCreditRowCount', 'invalidSoftCreditRowCount', 'conflictRowCount', 'downloadConflictRecordsUrl', 'downloadErrorRecordsUrl', 'duplicateRowCount', 'downloadDuplicateRecordsUrl', 'downloadMismatchRecordsUrl', 'groupAdditions', 'unMatchCount', 'validPledgePaymentRowCount', 'invalidPledgePaymentRowCount', 'downloadPledgePaymentErrorRecordsUrl', 'downloadSoftCreditErrorRecordsUrl');
+ $properties = array(
+ 'totalRowCount',
+ 'validRowCount',
+ 'invalidRowCount',
+ 'validSoftCreditRowCount',
+ 'invalidSoftCreditRowCount',
+ 'conflictRowCount',
+ 'downloadConflictRecordsUrl',
+ 'downloadErrorRecordsUrl',
+ 'duplicateRowCount',
+ 'downloadDuplicateRecordsUrl',
+ 'downloadMismatchRecordsUrl',
+ 'groupAdditions',
+ 'unMatchCount',
+ 'validPledgePaymentRowCount',
+ 'invalidPledgePaymentRowCount',
+ 'downloadPledgePaymentErrorRecordsUrl',
+ 'downloadSoftCreditErrorRecordsUrl'
+ );
foreach ($properties as $property) {
$this->assign($property, $this->get($property));
}
* $Id$
*
*/
-
abstract class CRM_Contribute_Import_Parser extends CRM_Import_Parser {
/**
}
if ($this->_invalidRowCount) {
// removed view url for invlaid contacts
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('Reason'),
),
$customHeaders
if ($this->_invalidPledgePaymentRowCount) {
// removed view url for invlaid contacts
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('Reason'),
),
$customHeaders
if ($this->_invalidSoftCreditRowCount) {
// removed view url for invlaid contacts
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('Reason'),
),
$customHeaders
}
if ($this->_conflictCount) {
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('Reason'),
),
$customHeaders
self::exportCSV($this->_conflictFileName, $headers, $this->_conflicts);
}
if ($this->_duplicateCount) {
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('View Contribution URL'),
),
$customHeaders
foreach ($params as $key => $val) {
if ($val) {
switch ($key) {
- case 'receive_date':
- case 'cancel_date':
- case 'receipt_date':
- case 'thankyou_date':
- $params[$key] = CRM_Utils_Date::formatDate($params[$key], $dateType);
- break;
+ case 'receive_date':
+ case 'cancel_date':
+ case 'receipt_date':
+ case 'thankyou_date':
+ $params[$key] = CRM_Utils_Date::formatDate($params[$key], $dateType);
+ break;
- case 'pledge_payment':
- $params[$key] = CRM_Utils_String::strtobool($val);
- break;
+ case 'pledge_payment':
+ $params[$key] = CRM_Utils_String::strtobool($val);
+ break;
}
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) {
// Using new Dedupe rule.
$ruleParams = array(
'contact_type' => $this->_contactType,
- 'used' => 'Unsupervised',
+ 'used' => 'Unsupervised',
);
$fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
$disp = NULL;
*/
public function getUserDashboardElement() {
return array(
- 'name' => ts('Contributions'),
+ 'name' => ts('Contributions'),
'title' => ts('Your Contribution(s)'),
'perm' => array('make online contributions'),
'weight' => 10,
*/
public function registerTab() {
return array(
- 'title' => ts('Contributions'),
+ 'title' => ts('Contributions'),
'url' => 'contribution',
'weight' => 20,
);
);
// set breadcrumb to append to 2nd layer pages
- $breadCrumb = array(array(
- 'title' => ts('Manage Contribution Pages'),
+ $breadCrumb = array(
+ array(
+ 'title' => ts('Manage Contribution Pages'),
'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(),
'reset=1'
),
- ));
+ )
+ );
// what action to take ?
if ($action & CRM_Core_Action::ADD) {
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(),
- 'action=browse&reset=1'
- ));
+ 'action=browse&reset=1'
+ ));
$controller = new CRM_Contribute_Controller_ContributionPage(NULL, $action);
CRM_Utils_System::setTitle(ts('Manage Contribution Page'));
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(),
- 'reset=1&action=browse'
- ));
+ 'reset=1&action=browse'
+ ));
$id = CRM_Utils_Request::retrieve('id', 'Positive',
$this, FALSE, 0
*/
public function whereClause(&$params, $sortBy = TRUE) {
// @todo Unused local variable can be safely removed.
- $values = $clauses = array();
- $title = $this->get('title');
+ $values = $clauses = array();
+ $title = $this->get('title');
$createdId = $this->get('cid');
if ($createdId) {
}
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);
+ $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);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->assign('contactId', $this->_contactId);
public function preProcess() {
CRM_Utils_System::setTitle(ts('CiviContribute'));
- $status = array('Valid', 'Cancelled');
- $prefixes = array('start', 'month', 'year');
- $startDate = NULL;
+ $status = array('Valid', 'Cancelled');
+ $prefixes = array('start', 'month', 'year');
+ $startDate = NULL;
$startToDate = $monthToDate = $yearToDate = array();
//get contribution dates.
$dates = CRM_Contribute_BAO_Contribution::getContributionDates();
foreach (array(
- 'now', 'yearDate', 'monthDate') as $date) {
+ 'now',
+ 'yearDate',
+ 'monthDate'
+ ) as $date) {
$$date = $dates[$date];
}
// fiscal years end date
$chartForm->setEmbedded(TRUE);
$chartForm->process();
$chartForm->run();
- CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Contribute/Page/DashBoard.js', 1, 'html-header');
+ CRM_Core_Resources::singleton()
+ ->addScriptFile('civicrm', 'templates/CRM/Contribute/Page/DashBoard.js', 1, 'html-header');
return parent::run();
}
$dao->id
);
//Financial Type
- if (!empty($dao->financial_type_id) ) {
+ if (!empty($dao->financial_type_id)) {
require_once 'CRM/Core/DAO.php';
$premiums[$dao->id]['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $dao->financial_type_id, 'name');
}
$pageID = CRM_Utils_Request::retrieve('id', 'Positive',
$this, FALSE, 0
);
- $dao = new CRM_Contribute_DAO_Premium();
+ $dao = new CRM_Contribute_DAO_Premium();
$dao->entity_table = 'civicrm_contribution_page';
- $dao->entity_id = $pageID;
+ $dao->entity_id = $pageID;
$dao->find(TRUE);
$premiumID = $dao->id;
$this->assign('products', FALSE);
* $Id$
*
*/
-
class CRM_Contribute_Page_SubscriptionStatus extends CRM_Core_Page {
/**
* return null
*/
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);
+ $task = CRM_Utils_Request::retrieve('task', 'String', CRM_Core_DAO::$_nullObject);
+ $result = CRM_Utils_Request::retrieve('result', 'Integer', CRM_Core_DAO::$_nullObject);
$this->assign('task', $task);
$this->assign('result', $result);
if ($task == 'billing') {
- $session = CRM_Core_Session::singleton();
+ $session = CRM_Core_Session::singleton();
$tplParams = $session->get('resultParams');
foreach ($tplParams as $key => $val) {
$this->assign($key, $val);
}
if (is_object($paymentProcessorObj) && $paymentProcessorObj->isSupported('updateSubscriptionBillingInfo')) {
self::$_links[CRM_Core_Action::RENEW] = array(
- 'name' => ts('Change Billing Details'),
+ 'name' => ts('Change Billing Details'),
'title' => ts('Change Billing Details'),
'url' => 'civicrm/contribute/updatebilling',
'qs' => "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}",
list($annual['count'],
$annual['amount'],
$annual['avg']
- ) = CRM_Contribute_BAO_Contribution::annual($this->_contactId);
+ ) = CRM_Contribute_BAO_Contribution::annual($this->_contactId);
$this->assign('annual', $annual);
$controller = new CRM_Core_Controller_Simple(
list($softCreditTotals['amount'],
$softCreditTotals['avg'],
$softCreditTotals['currency']
- ) = CRM_Contribute_BAO_ContributionSoft::getSoftContributionTotals($this->_contactId, $isTest);
+ ) = CRM_Contribute_BAO_ContributionSoft::getSoftContributionTotals($this->_contactId, $isTest);
$this->assign('softCredit', TRUE);
$this->assign('softCreditRows', $softCreditList);
}
public function preProcess() {
- $context = CRM_Utils_Request::retrieve('context', 'String', $this);
+ $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);
+ $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
if ($context == 'standalone') {
$this->_action = CRM_Core_Action::ADD;
else {
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, empty($this->_id));
if (empty($this->_contactId)) {
- $this->_contactId = civicrm_api3('contribution', 'getvalue', array('id' => $this->_id, 'return' => 'contact_id'));
+ $this->_contactId = civicrm_api3('contribution', 'getvalue', array(
+ 'id' => $this->_id,
+ 'return' => 'contact_id'
+ ));
}
$this->assign('contactId', $this->_contactId);
break;
case 'fulltext':
- $keyName = '&qfKey';
+ $keyName = '&qfKey';
$urlParams = 'force=1';
$urlString = 'civicrm/contact/search/custom';
if ($this->_action == CRM_Core_Action::UPDATE) {
$this->assign('honor', TRUE);
}
- $recur = new CRM_Contribute_DAO_ContributionRecur();
+ $recur = new CRM_Contribute_DAO_ContributionRecur();
$recur->contact_id = $this->_contactId;
- $recur->is_test = 0;
+ $recur->is_test = 0;
$recur->find();
$config = CRM_Core_Config::singleton();
private static $financialAccount;
/**
- * Contribution pages
- * @var array
- * @static
- */
+ * Contribution pages
+ * @var array
+ * @static
+ */
private static $contributionPageActive = NULL;
/**
public static function flush($name = 'cache') {
if (isset(self::$$name)) {
self::$$name = NULL;
- }
+ }
}
/**
* @static
*/
public static function products($pageID = NULL) {
- $products = array();
- $dao = new CRM_Contribute_DAO_Product();
+ $products = array();
+ $dao = new CRM_Contribute_DAO_Product();
$dao->is_active = 1;
$dao->orderBy('id');
$dao->find();
$products[$dao->id] = $dao->name;
}
if ($pageID) {
- $dao = new CRM_Contribute_DAO_Premium();
+ $dao = new CRM_Contribute_DAO_Premium();
$dao->entity_table = 'civicrm_contribution_page';
- $dao->entity_id = $pageID;
+ $dao->entity_id = $pageID;
$dao->find(TRUE);
$premiumID = $dao->id;
// submitted form values
$this->_queryParams = &$queryParams;
- $this->_single = $single;
- $this->_limit = $limit;
- $this->_context = $context;
+ $this->_single = $single;
+ $this->_limit = $limit;
+ $this->_context = $context;
$this->_compContext = $compContext;
$this->_contributionClause = $contributionClause;
$qfKey = $this->_key;
$componentId = $componentContext = NULL;
if ($this->_context != 'contribute') {
- $qfKey = CRM_Utils_Request::retrieve('key', 'String', CRM_Core_DAO::$_nullObject);
- $componentId = CRM_Utils_Request::retrieve('id', 'Positive', CRM_Core_DAO::$_nullObject);
- $componentAction = CRM_Utils_Request::retrieve('action', 'String', CRM_Core_DAO::$_nullObject);
+ $qfKey = CRM_Utils_Request::retrieve('key', 'String', CRM_Core_DAO::$_nullObject);
+ $componentId = CRM_Utils_Request::retrieve('id', 'Positive', CRM_Core_DAO::$_nullObject);
+ $componentAction = CRM_Utils_Request::retrieve('action', 'String', CRM_Core_DAO::$_nullObject);
$componentContext = CRM_Utils_Request::retrieve('compContext', 'String', CRM_Core_DAO::$_nullObject);
if (!$componentContext &&
array(
array(
'name' => ts('Type'),
- 'sort' => 'financial_type',
+ 'sort' => 'financial_type',
'direction' => CRM_Utils_Sort::DONTCARE,
),
array(
RENEW = 32768,
DETACH = 65536,
REVERT = 131072,
- CLOSE = 262144,
- REOPEN = 524288,
- MAX_ACTION = 1048575;
+ CLOSE = 262144,
+ REOPEN = 524288,
+ MAX_ACTION = 1048575;
//make sure MAX_ACTION = 2^n - 1 ( n = total number of actions )
* bit manipulation operations so we can perform multiple
* actions on the same object if needed
*
- * @var array $_names type of variable name to action constant
+ * @var array $_names type of variable name to action constant
*
* @static
*/
'renew' => self::RENEW,
'detach' => self::DETACH,
'revert' => self::REVERT,
- 'close' => self::CLOSE,
- 'reopen' => self::REOPEN,
+ 'close' => self::CLOSE,
+ 'reopen' => self::REOPEN,
);
/**
public static function getSelection($id = NULL) {
$mapping = self::getMapping();
$activityStatus = CRM_Core_PseudoConstant::activityStatus();
- $activityType = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
+ $activityType = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
$participantStatus = CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label');
$event = CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
$schedule = new CRM_Core_DAO_ActionSchedule();
$schedule->id = $scheduleID;
- $domain = CRM_Core_BAO_Domain::getDomain();
- $result = NULL;
+ $domain = CRM_Core_BAO_Domain::getDomain();
+ $result = NULL;
$hookTokens = array();
if ($schedule->find(TRUE)) {
- $body_text = $schedule->body_text;
- $body_html = $schedule->body_html;
+ $body_text = $schedule->body_text;
+ $body_html = $schedule->body_html;
$sms_body_text = $schedule->sms_body_text;
$body_subject = $schedule->subject;
if (!$body_text) {
$smarty = CRM_Core_Smarty::singleton();
foreach (array(
- 'text', 'html', 'sms_text') as $elem) {
+ 'text',
+ 'html',
+ 'sms_text'
+ ) as $elem) {
$$elem = $smarty->fetch("string:{$$elem}");
}
if ($schedule->mode == 'SMS' or $schedule->mode == 'User_Preference') {
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID') ? $session->get('userID') : $contactId;
- $smsParams = array('To' => $phoneNumber, 'provider_id' => $schedule->sms_provider_id, 'activity_subject' => $messageSubject);
+ $smsParams = array(
+ 'To' => $phoneNumber,
+ 'provider_id' => $schedule->sms_provider_id,
+ 'activity_subject' => $messageSubject
+ );
$activityTypeID = CRM_Core_OptionGroup::getValue('activity_type',
'SMS',
'name'
$tokenEntity = 'activity';
$tokenFields = array('activity_id', 'activity_type', 'subject', 'details', 'activity_date_time');
$extraSelect = ', ov.label as activity_type, e.id as activity_id';
- $extraJoin = "
+ $extraJoin = "
INNER JOIN civicrm_option_group og ON og.name = 'activity_type'
INNER JOIN civicrm_option_value ov ON e.activity_type_id = ov.value AND ov.option_group_id = og.id";
$extraOn = ' AND e.is_current_revision = 1 AND e.is_deleted = 0 ';
if ($actionSchedule->limit_to == 0) {
- $extraJoin = "
+ $extraJoin = "
LEFT JOIN civicrm_option_group og ON og.name = 'activity_type'
LEFT JOIN civicrm_option_value ov ON e.activity_type_id = ov.value AND ov.option_group_id = og.id";
}
if ($mapping->entity == 'civicrm_participant') {
$tokenEntity = 'event';
- $tokenFields = array('event_type', 'title', 'event_id', 'start_date', 'end_date', 'summary', 'description', 'location', 'info_url', 'registration_url', 'fee_amount', 'contact_email', 'contact_phone', 'balance');
+ $tokenFields = array(
+ 'event_type',
+ 'title',
+ 'event_id',
+ 'start_date',
+ 'end_date',
+ 'summary',
+ 'description',
+ 'location',
+ 'info_url',
+ 'registration_url',
+ 'fee_amount',
+ 'contact_email',
+ 'contact_phone',
+ 'balance'
+ );
$extraSelect = ', ov.label as event_type, ev.title, ev.id as event_id, ev.start_date, ev.end_date, ev.summary, ev.description, address.street_address, address.city, address.state_province_id, address.postal_code, email.email as contact_email, phone.phone as contact_phone ';
- $extraJoin = "
+ $extraJoin = "
INNER JOIN civicrm_event ev ON e.event_id = ev.id
INNER JOIN civicrm_option_group og ON og.name = 'event_type'
INNER JOIN civicrm_option_value ov ON ev.event_type_id = ov.value AND ov.option_group_id = og.id
LEFT JOIN civicrm_phone phone ON phone.id = lb.phone_id
";
if ($actionSchedule->limit_to == 0) {
- $extraJoin = "
+ $extraJoin = "
LEFT JOIN civicrm_event ev ON e.event_id = ev.id
LEFT JOIN civicrm_option_group og ON og.name = 'event_type'
LEFT JOIN civicrm_option_value ov ON ev.event_type_id = ov.value AND ov.option_group_id = og.id
$tokenEntity = 'membership';
$tokenFields = array('fee', 'id', 'join_date', 'start_date', 'end_date', 'status', 'type');
$extraSelect = ', mt.minimum_fee as fee, e.id as id , e.join_date, e.start_date, e.end_date, ms.name as status, mt.name as type';
- $extraJoin = '
+ $extraJoin = '
INNER JOIN civicrm_membership_type mt ON e.membership_type_id = mt.id
INNER JOIN civicrm_membership_status ms ON e.status_id = ms.id';
if ($actionSchedule->limit_to == 0) {
- $extraJoin = '
+ $extraJoin = '
LEFT JOIN civicrm_membership_type mt ON e.membership_type_id = mt.id
LEFT JOIN civicrm_membership_status ms ON e.status_id = ms.id';
}
}
}
- $isError = 0;
+ $isError = 0;
$errorMsg = $toEmail = $toPhoneNumber = '';
if ($actionSchedule->mode == 'SMS' or $actionSchedule->mode == 'User_Preference') {
'subject' => $actionSchedule->title,
'details' => $actionSchedule->body_html,
'source_contact_id' =>
- $session->get('userID') ? $session->get('userID') : $dao->contactID,
+ $session->get('userID') ? $session->get('userID') : $dao->contactID,
'target_contact_id' => $dao->contactID,
'activity_date_time' => date('YmdHis'),
'status_id' => $activityStatusID,
$isSendToAdditionalContacts = (!is_null($limitTo) && $limitTo == 0 && (!empty($addGroup) || !empty($addWhere))) ? TRUE : FALSE;
if ($isSendToAdditionalContacts) {
$contactTable = "civicrm_contact c";
- $addSelect = "SELECT c.id as contact_id, c.id as entity_id, 'civicrm_contact' as entity_table, {$actionSchedule->id} as action_schedule_id";
+ $addSelect = "SELECT c.id as contact_id, c.id as entity_id, 'civicrm_contact' as entity_table, {$actionSchedule->id} as action_schedule_id";
$additionReminderClause = "civicrm_action_log reminder ON reminder.contact_id = c.id AND
reminder.entity_id = c.id AND
reminder.entity_table = 'civicrm_contact' AND
{$groupByClause}
{$havingClause}";
- $valsqlInsertValues = CRM_Core_DAO::executeQuery($sqlInsertValues, array(1 => array($actionSchedule->id, 'Integer')));
+ $valsqlInsertValues = CRM_Core_DAO::executeQuery($sqlInsertValues, array(
+ 1 => array(
+ $actionSchedule->id,
+ 'Integer'
+ )
+ ));
$arrValues = array();
while ($valsqlInsertValues->fetch()) {
if ($parseStreetAddress && !empty($params['street_address'])) {
foreach (array(
- 'street_number', 'street_name', 'street_unit', 'street_number_suffix') as $fld) {
+ 'street_number',
+ 'street_name',
+ 'street_unit',
+ 'street_number_suffix'
+ ) as $fld) {
unset($params[$fld]);
}
// main parse string.
$config = CRM_Core_Config::singleton();
foreach ($params as $name => $value) {
if (in_array($name, array(
- 'is_primary', 'location_type_id', 'id', 'contact_id', 'is_billing', 'display', 'master_id'))) {
+ 'is_primary',
+ 'location_type_id',
+ 'id',
+ 'contact_id',
+ 'is_billing',
+ 'display',
+ 'master_id'
+ ))) {
continue;
}
elseif (!CRM_Utils_System::isNull($value)) {
// deprecate reference.
if ($count > 1) {
foreach (array(
- 'state', 'state_name', 'country', 'world_region') as $fld) {
+ 'state',
+ 'state_name',
+ 'country',
+ 'world_region'
+ ) as $fld) {
if (isset($address->$fld)) {
unset($address->$fld);
}
$addressSequence[$key] = 'city_postal_code';
}
elseif (
- in_array($field, array('country', 'state_province', 'city', 'postal_code'))
+ in_array($field, array('country', 'state_province', 'city', 'postal_code'))
) {
unset($addressSequence[$key]);
}
$matches = array();
if (in_array($locale, array(
- 'en_CA', 'fr_CA')) && preg_match('/^([A-Za-z0-9]+)[ ]*\-[ ]*/', $streetAddress, $matches)) {
+ 'en_CA',
+ 'fr_CA'
+ )) && preg_match('/^([A-Za-z0-9]+)[ ]*\-[ ]*/', $streetAddress, $matches)
+ ) {
$parseFields['street_unit'] = $matches[1];
// unset from rest of street address
$streetAddress = preg_replace('/^([A-Za-z0-9]+)[ ]*\-[ ]*/', '', $streetAddress);
// now get the street unit.
// supportable street unit formats.
$streetUnitFormats = array(
- 'APT', 'APARTMENT', 'BSMT', 'BASEMENT', 'BLDG', 'BUILDING',
- 'DEPT', 'DEPARTMENT', 'FL', 'FLOOR', 'FRNT', 'FRONT',
- 'HNGR', 'HANGER', 'LBBY', 'LOBBY', 'LOWR', 'LOWER',
- 'OFC', 'OFFICE', 'PH', 'PENTHOUSE', 'TRLR', 'TRAILER',
- 'UPPR', 'RM', 'ROOM', 'SIDE', 'SLIP', 'KEY',
- 'LOT', 'PIER', 'REAR', 'SPC', 'SPACE',
- 'STOP', 'STE', 'SUITE', 'UNIT', '#',
+ 'APT',
+ 'APARTMENT',
+ 'BSMT',
+ 'BASEMENT',
+ 'BLDG',
+ 'BUILDING',
+ 'DEPT',
+ 'DEPARTMENT',
+ 'FL',
+ 'FLOOR',
+ 'FRNT',
+ 'FRONT',
+ 'HNGR',
+ 'HANGER',
+ 'LBBY',
+ 'LOBBY',
+ 'LOWR',
+ 'LOWER',
+ 'OFC',
+ 'OFFICE',
+ 'PH',
+ 'PENTHOUSE',
+ 'TRLR',
+ 'TRAILER',
+ 'UPPR',
+ 'RM',
+ 'ROOM',
+ 'SIDE',
+ 'SLIP',
+ 'KEY',
+ 'LOT',
+ 'PIER',
+ 'REAR',
+ 'SPC',
+ 'SPACE',
+ 'STOP',
+ 'STE',
+ 'SUITE',
+ 'UNIT',
+ '#',
);
// overwriting $streetUnitFormats for 'en_CA' and 'fr_CA' locale
if (in_array($locale, array(
- 'en_CA', 'fr_CA'))) {
+ 'en_CA',
+ 'fr_CA'
+ ))) {
$streetUnitFormats = array('APT', 'APP', 'SUITE', 'BUREAU', 'UNIT');
}
//@todo per CRM-14459 this regex picks up words with the string in them - e.g APT picks up
foreach (array_keys($rows) as $rowID) {
// load complete address as array key
$address =
- trim($rows[$rowID]['street_address']) . trim($rows[$rowID]['city']) . trim($rows[$rowID]['state_province']) . trim($rows[$rowID]['postal_code']) . trim($rows[$rowID]['country']);
+ trim($rows[$rowID]['street_address']) . trim($rows[$rowID]['city']) . trim($rows[$rowID]['state_province']) . trim($rows[$rowID]['postal_code']) . trim($rows[$rowID]['country']);
if (isset($rows[$rowID]['last_name'])) {
$name = $rows[$rowID]['last_name'];
}
list($valid, $invalid, $duplicate,
$saved, $relationshipIds
- ) = CRM_Contact_BAO_Relationship::createMultiple($relationshipParams, $cid);
+ ) = CRM_Contact_BAO_Relationship::createMultiple($relationshipParams, $cid);
}
/**
case 'world_region':
return CRM_Core_PseudoConstant::worldRegion();
- break;
+ break;
}
return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
}
$count = 1;
foreach ($blockIds as $blockId) {
$block = new $BAOString();
- $block->id = $blockId['id'];
- $getBlocks = self::retrieveBlock($block, $blockName);
+ $block->id = $blockId['id'];
+ $getBlocks = self::retrieveBlock($block, $blockName);
$blocks[$count++] = array_pop($getBlocks);
}
}
return NULL;
}
- $name = ucfirst($blockName);
- $contactId = NULL;
- $isPrimary = $isBilling = TRUE;
+ $name = ucfirst($blockName);
+ $contactId = NULL;
+ $isPrimary = $isBilling = TRUE;
$entityElements = $blocks = array();
if ($entity) {
// Build an array of rows from UF users table.
$rows = array();
if ($config->userSystem->is_drupal == '1') {
- $id = 'uid';
+ $id = 'uid';
$mail = 'mail';
$name = 'name';
}
}
elseif ($config->userFramework == 'Joomla') {
- $id = 'id';
+ $id = 'id';
$mail = 'email';
$name = 'name';
// TODO: Insert code here to populate $rows for Joomla;
set_time_limit(300);
if ($config->userSystem->is_drupal == '1') {
- $user = new StdClass();
- $uf = $config->userFramework;
- $contactCount = 0;
- $contactCreated = 0;
+ $user = new StdClass();
+ $uf = $config->userFramework;
+ $contactCount = 0;
+ $contactCreated = 0;
$contactMatching = 0;
foreach ($rows as $row) {
- $user->$id = $row[$id];
+ $user->$id = $row[$id];
$user->$mail = $row[$mail];
$user->$name = $row[$name];
$contactCount++;
$db->setQuery($query, 0, $limit);
$users = $db->loadObjectList();
- $user = new StdClass();
- $uf = $config->userFramework;
- $contactCount = 0;
- $contactCreated = 0;
+ $user = new StdClass();
+ $uf = $config->userFramework;
+ $contactCount = 0;
+ $contactCreated = 0;
$contactMatching = 0;
for ($i = 0; $i < count($users); $i++) {
- $user->$id = $users[$i]->$id;
+ $user->$id = $users[$i]->$id;
$user->$mail = $users[$i]->$mail;
$user->$name = $users[$i]->$name;
$contactCount++;
if ($match = CRM_Core_BAO_UFMatch::synchronizeUFMatch($user,
- $users[$i]->$id,
- $users[$i]->$mail,
- $uf,
- 1,
- 'Individual',
- TRUE
- )) {
+ $users[$i]->$id,
+ $users[$i]->$mail,
+ $uf,
+ 1,
+ 'Individual',
+ TRUE
+ )
+ ) {
$contactCreated++;
}
else {
}
}
elseif ($config->userFramework == 'WordPress') {
- $uf = $config->userFramework;
- $contactCount = 0;
- $contactCreated = 0;
+ $uf = $config->userFramework;
+ $contactCount = 0;
+ $contactCreated = 0;
$contactMatching = 0;
global $wpdb;
$wpUserData = get_userdata($wpUserId);
$contactCount++;
if ($match = CRM_Core_BAO_UFMatch::synchronizeUFMatch($wpUserData,
- $wpUserData->$id,
- $wpUserData->$mail,
- $uf,
- 1,
- 'Individual',
- TRUE
- )) {
+ $wpUserData->$id,
+ $wpUserData->$mail,
+ $uf,
+ 1,
+ 'Individual',
+ TRUE
+ )
+ ) {
$contactCreated++;
}
else {
if ($is_interactive) {
$status = ts('Synchronize Users to Contacts completed.');
$status .= ' ' . ts('Checked one user record.',
- array(
- 'count' => $contactCount,
- 'plural' => 'Checked %count user records.',
- )
- );
- if ($contactMatching) {
- $status .= ' ' . ts('Found one matching contact record.',
array(
- 'count' => $contactMatching,
- 'plural' => 'Found %count matching contact records.',
+ 'count' => $contactCount,
+ 'plural' => 'Checked %count user records.',
)
);
+ if ($contactMatching) {
+ $status .= ' ' . ts('Found one matching contact record.',
+ array(
+ 'count' => $contactMatching,
+ 'plural' => 'Found %count matching contact records.',
+ )
+ );
}
$status .= ' ' . ts('Created one new contact record.',
- array(
- 'count' => $contactCreated,
- 'plural' => 'Created %count new contact records.',
- )
- );
+ array(
+ 'count' => $contactCreated,
+ 'plural' => 'Created %count new contact records.',
+ )
+ );
CRM_Core_Session::setStatus($status, ts('Saved'), 'success');
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin', 'reset=1'));
}
isset($params['contactID'])
) {
// create the UF Match record
- $ufmatch['uf_id'] = $ufID;
+ $ufmatch['uf_id'] = $ufID;
$ufmatch['contact_id'] = $params['contactID'];
- $ufmatch['uf_name'] = $params[$mail];
+ $ufmatch['uf_name'] = $params[$mail];
CRM_Core_BAO_UFMatch::create($ufmatch);
}
$config = CRM_Core_Config::singleton();
$showCMS = FALSE;
- $isDrupal = $config->userSystem->is_drupal;
- $isJoomla = ucfirst($config->userFramework) == 'Joomla' ? TRUE : FALSE;
+ $isDrupal = $config->userSystem->is_drupal;
+ $isJoomla = ucfirst($config->userFramework) == 'Joomla' ? TRUE : FALSE;
$isWordPress = $config->userFramework == 'WordPress' ? TRUE : FALSE;
//if CMS is configured for not to allow creating new CMS user,
$config = CRM_Core_Config::singleton();
- $isDrupal = $config->userSystem->is_drupal;
- $isJoomla = ucfirst($config->userFramework) == 'Joomla' ? TRUE : FALSE;
+ $isDrupal = $config->userSystem->is_drupal;
+ $isJoomla = ucfirst($config->userFramework) == 'Joomla' ? TRUE : FALSE;
$isWordPress = $config->userFramework == 'WordPress' ? TRUE : FALSE;
$errors = array();
public static function userExists(&$contact) {
$config = CRM_Core_Config::singleton();
- $isDrupal = $config->userSystem->is_drupal;
- $isJoomla = ucfirst($config->userFramework) == 'Joomla' ? TRUE : FALSE;
+ $isDrupal = $config->userSystem->is_drupal;
+ $isJoomla = ucfirst($config->userFramework) == 'Joomla' ? TRUE : FALSE;
$isWordPress = $config->userFramework == 'WordPress' ? TRUE : FALSE;
if (!$isDrupal && !$isJoomla && !$isWordPress) {
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1'));
CRM_Core_Error::statusBounce(ts("Cannot connect to UF db via %1. Please check the CIVICRM_UF_DSN value in your civicrm.settings.php file",
- array(1 => $db_uf->getMessage())
- ));
+ array(1 => $db_uf->getMessage())
+ ));
}
$db_uf->query('/*!40101 SET NAMES utf8 */');
return $db_uf;
$extendsChildType = implode(CRM_Core_DAO::VALUE_SEPARATOR, $extendsChildType);
if (CRM_Utils_Array::value(0, $params['extends']) == 'Relationship') {
$extendsChildType = str_replace(array('_a_b', '_b_a'), array(
- '',
- '',
- ), $extendsChildType);
+ '',
+ '',
+ ), $extendsChildType);
}
if (substr($extendsChildType, 0, 1) != CRM_Core_DAO::VALUE_SEPARATOR) {
$extendsChildType = CRM_Core_DAO::VALUE_SEPARATOR . $extendsChildType .
$retValue = $value;
break;
}
- // note that if its not text / textarea, the code falls thru and executes
- // the below case also
+ // note that if its not text / textarea, the code falls thru and executes
+ // the below case also
case 'StateProvince':
case 'Country':
$options = array();
case 'Radio':
case 'Autocomplete-Select':
if (!in_array($dataType, array(
- 'Boolean', 'ContactReference'))) {
+ 'Boolean',
+ 'ContactReference'
+ ))
+ ) {
$options = self::valuesByID($fieldId);
}
}
$dao = CRM_Core_DAO::executeQuery($query, $params);
if ($dao->fetch()) {
if (in_array($dao->dataType,
- array('Int', 'Float', 'Money', 'Boolean')
- )) {
+ array('Int', 'Float', 'Money', 'Boolean')
+ )) {
$value = 0;
}
else {
$dataType = $dao->dataType;
}
$queryParams = array(
- 1 => array($params['value'],
+ 1 => array(
+ $params['value'],
$dataType,
),
2 => array(
case 'CheckBox':
$oldString = CRM_Core_DAO::VALUE_SEPARATOR . $oldValue . CRM_Core_DAO::VALUE_SEPARATOR;
$newString = CRM_Core_DAO::VALUE_SEPARATOR . $params['value'] . CRM_Core_DAO::VALUE_SEPARATOR;
- $query = "
+ $query = "
UPDATE {$dao->tableName}
SET {$dao->columnName} = REPLACE( {$dao->columnName}, %1, %2 )";
$queryParams = array(
- 1 => array($oldString, 'String'),
+ 1 => array($oldString, 'String'),
2 => array($newString, 'String'),
);
break;
$this->_ids = &$ids;
$this->_locationSpecificCustomFields = $locationSpecificFields;
- $this->_select = array();
- $this->_element = array();
- $this->_tables = array();
+ $this->_select = array();
+ $this->_element = array();
+ $this->_tables = array();
$this->_whereTables = array();
- $this->_where = array();
- $this->_qill = array();
- $this->_options = array();
+ $this->_where = array();
+ $this->_qill = array();
+ $this->_options = array();
$this->_fields = array();
$this->_contactSearch = $contactSearch;
// initialize the field array
$tmpArray = array_keys($this->_ids);
$idString = implode(',', $tmpArray);
- $query = "
+ $query = "
SELECT f.id, f.label, f.data_type,
f.html_type, f.is_search_range,
f.option_group_id, f.custom_group_id,
if (is_array($value) && !$field['is_search_range']) {
$isSerialized = CRM_Core_BAO_CustomField::isSerialized($field);
$wildcard = $isSerialized ? $wildcard : TRUE;
- $options = CRM_Utils_Array::value('values', civicrm_api3('contact', 'getoptions', array('field' => $name, 'context' => 'search'), array()));
+ $options = CRM_Utils_Array::value('values', civicrm_api3('contact', 'getoptions', array(
+ 'field' => $name,
+ 'context' => 'search'
+ ), array()));
$qillValue = '';
$sqlOP = $wildcard ? ' OR ' : ' AND ';
$sqlValue = array();
if ($wildcard) {
$val = $strtolower(CRM_Core_DAO::escapeString($val));
$val = "%$val%";
- $op = 'LIKE';
+ $op = 'LIKE';
}
//FIX for custom data query fired against no value(NULL/NOT NULL)
}
}
- return array(implode(' , ', $this->_select),
+ return array(
+ implode(' , ', $this->_select),
implode(' ', $this->_tables),
$whereStr,
);
$mulValues = explode(',', $value);
foreach ($mulValues as $key => $state) {
$valid = array_key_exists(strtolower(trim($state)),
- array_change_key_case(array_flip(CRM_Core_PseudoConstant::stateProvinceAbbreviation()), CASE_LOWER)
- ) || array_key_exists(strtolower(trim($state)),
- array_change_key_case(array_flip(CRM_Core_PseudoConstant::stateProvince()), CASE_LOWER)
- );
+ array_change_key_case(array_flip(CRM_Core_PseudoConstant::stateProvinceAbbreviation()), CASE_LOWER)
+ ) || array_key_exists(strtolower(trim($state)),
+ array_change_key_case(array_flip(CRM_Core_PseudoConstant::stateProvince()), CASE_LOWER)
+ );
if (!$valid) {
break;
}
$mulValues = explode(',', $value);
foreach ($mulValues as $key => $country) {
$valid = array_key_exists(strtolower(trim($country)),
- array_change_key_case(array_flip(CRM_Core_PseudoConstant::countryIsoCode()), CASE_LOWER)
- ) || array_key_exists(strtolower(trim($country)),
- array_change_key_case(array_flip(CRM_Core_PseudoConstant::country()), CASE_LOWER)
- );
+ array_change_key_case(array_flip(CRM_Core_PseudoConstant::countryIsoCode()), CASE_LOWER)
+ ) || array_key_exists(strtolower(trim($country)),
+ array_change_key_case(array_flip(CRM_Core_PseudoConstant::country()), CASE_LOWER)
+ );
if (!$valid) {
break;
}
foreach ($customParams as $tableName => $tables) {
foreach ($tables as $index => $fields) {
- $sqlOP = NULL;
- $hookID = NULL;
- $hookOP = NULL;
- $entityID = NULL;
+ $sqlOP = NULL;
+ $hookID = NULL;
+ $hookOP = NULL;
+ $entityID = NULL;
$isMultiple = FALSE;
- $set = array();
- $params = array();
- $count = 1;
+ $set = array();
+ $params = array();
+ $count = 1;
foreach ($fields as $field) {
if (!$sqlOP) {
- $entityID = $field['entity_id'];
- $hookID = $field['custom_group_id'];
+ $entityID = $field['entity_id'];
+ $hookID = $field['custom_group_id'];
$isMultiple = $field['is_multiple'];
if (array_key_exists('id', $field)) {
- $sqlOP = "UPDATE $tableName ";
- $where = " WHERE id = %{$count}";
+ $sqlOP = "UPDATE $tableName ";
+ $where = " WHERE id = %{$count}";
$params[$count] = array($field['id'], 'Integer');
$count++;
$hookOP = 'edit';
}
else {
- $sqlOP = "INSERT INTO $tableName ";
- $where = NULL;
+ $sqlOP = "INSERT INTO $tableName ";
+ $where = NULL;
$hookOP = 'create';
}
}
$params[$count] = array($entityID, 'Integer');
$count++;
- $fieldNames = implode(',', array_keys($set));
+ $fieldNames = implode(',', array_keys($set));
$fieldValues = implode(',', array_values($set));
- $query = "$sqlOP ( $fieldNames ) VALUES ( $fieldValues )";
+ $query = "$sqlOP ( $fieldNames ) VALUES ( $fieldValues )";
// for multiple values we dont do on duplicate key update
if (!$isMultiple) {
$query .= " ON DUPLICATE KEY UPDATE $setClause";
$fieldID = (int ) $customFieldInfo[0];
if (CRM_Utils_Type::escape($fieldID, 'Integer', FALSE) === NULL) {
return CRM_Core_Error::createAPIError(ts('field ID needs to be of type Integer for index %1',
- array(1 => $fieldID)
- ));
+ array(1 => $fieldID)
+ ));
}
if (!array_key_exists($fieldID, $fieldValues)) {
$fieldValues[$fieldID] = array();
// Ensure that value is of the right data type
elseif (CRM_Utils_Type::escape($fieldValue['value'], $dataType, FALSE) === NULL) {
return CRM_Core_Error::createAPIError(ts('value: %1 is not of the right field data type: %2',
- array(
- 1 => $fieldValue['value'],
- 2 => $dao->data_type,
- )
- ));
+ array(
+ 1 => $fieldValue['value'],
+ 2 => $dao->data_type,
+ )
+ ));
}
$cvParam = array(
$idx = substr($n, 7);
if (CRM_Utils_Type::escape($idx, 'Integer', FALSE) === NULL) {
return CRM_Core_Error::createAPIError(ts('field ID needs to be of type Integer for index %1',
- array(1 => $idx)
- ));
+ array(1 => $idx)
+ ));
}
$fieldIDs[] = (int ) $idx;
}
*/
public static function initializeDashlets() {
$dashlets = array();
- $getDashlets = civicrm_api3("Dashboard", "get", array('domain_id' => CRM_Core_Config::domainID(), 'option.limit' => 0));
+ $getDashlets = civicrm_api3("Dashboard", "get", array(
+ 'domain_id' => CRM_Core_Config::domainID(),
+ 'option.limit' => 0
+ ));
$contactID = CRM_Core_Session::singleton()->get('userID');
$allDashlets = CRM_Utils_Array::index(array('name'), $getDashlets['values']);
$defaultDashlets = array();
foreach ($defaultDashlets as $id => $defaultDashlet) {
$dashboard_id = $defaultDashlet['dashboard_id'];
if (!self::checkPermission($getDashlets['values'][$dashboard_id]['permission'],
- $getDashlets['values'][$dashboard_id]['permission_operator'])) {
+ $getDashlets['values'][$dashboard_id]['permission_operator'])
+ ) {
continue;
}
else {
// hack to handle case permissions
if (!$componentName && in_array($key, array(
- 'access my cases and activities', 'access all cases and activities'))) {
+ 'access my cases and activities',
+ 'access all cases and activities'
+ ))
+ ) {
$componentName = 'CiviCase';
}
// build the content
$dao = new CRM_Contact_DAO_DashboardContact();
- $session = CRM_Core_Session::singleton();
- $dao->contact_id = $session->get('userID');
+ $session = CRM_Core_Session::singleton();
+ $dao->contact_id = $session->get('userID');
$dao->dashboard_id = $dashletID;
$dao->find(TRUE);
}
return $url;
}
+
/**
* Update contact dashboard with new dashlet
*
- * @param object: $dashlet
+ * @param object : $dashlet
*
* @return void
* @static
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;
+ $discount->entity_id = $entityId;
$discount->entity_table = $entityTable;
if ($discount->delete()) {
return TRUE;
* option group Ids associated with discount
*/
public static function getOptionGroup($entityId, $entityTable) {
- $optionGroupIDs = array();
+ $optionGroupIDs = array();
$dao = new CRM_Core_DAO_Discount();
- $dao->entity_id = $entityId;
+ $dao->entity_id = $entityId;
$dao->entity_table = $entityTable;
$dao->find();
while ($dao->fetch()) {
}
$dao = new CRM_Core_DAO_Discount();
- $dao->entity_id = $entityID;
+ $dao->entity_id = $entityID;
$dao->entity_table = $entityTable;
$dao->find();
$fromEmailAddress = CRM_Core_OptionGroup::values('from_email_address', NULL, NULL, NULL, ' AND is_default = 1');
if (!empty($fromEmailAddress)) {
foreach ($fromEmailAddress as $key => $value) {
- $email = CRM_Utils_Mail::pluckEmailFromHeader($value);
+ $email = CRM_Utils_Mail::pluckEmailFromHeader($value);
$fromArray = explode('"', $value);
- $fromName = CRM_Utils_Array::value(1, $fromArray);
+ $fromName = CRM_Utils_Array::value(1, $fromArray);
break;
}
return array($fromName, $email);
);
$emails = $values = array();
- $dao = CRM_Core_DAO::executeQuery($query, $params);
- $count = 1;
+ $dao = CRM_Core_DAO::executeQuery($query, $params);
+ $count = 1;
while ($dao->fetch()) {
$values = array(
'locationType' => $dao->locationType,
";
if (CRM_Core_DAO::singleValueQuery($sql, $params)) {
//set reset date only if it is not set and if hold date is set
- $email->on_hold = FALSE;
- $email->hold_date = 'null';
+ $email->on_hold = FALSE;
+ $email->hold_date = 'null';
$email->reset_date = date('YmdHis');
}
}
* @static
*/
public static function getFromEmail() {
- $session = CRM_Core_Session::singleton();
- $contactID = $session->get('userID');
+ $session = CRM_Core_Session::singleton();
+ $contactID = $session->get('userID');
$fromEmailValues = array();
// add all configured FROM email addresses
* Name of the entity table usually 'civicrm_contact'.
*
* @return array(
- ) reference $tag array of category id's the contact belongs to.
+ * ) reference $tag array of category id's the contact belongs to.
*
* @static
*/
* @static
*/
public static function addEntitiesToTag(&$entityIds, $tagId, $entityTable = 'civicrm_contact') {
- $numEntitiesAdded = 0;
+ $numEntitiesAdded = 0;
$numEntitiesNotAdded = 0;
- $entityIdsAdded = array();
+ $entityIdsAdded = array();
foreach ($entityIds as $entityId) {
$tag = new CRM_Core_DAO_EntityTag();
- $tag->entity_id = $entityId;
- $tag->tag_id = $tagId;
+ $tag->entity_id = $entityId;
+ $tag->tag_id = $tagId;
$tag->entity_table = $entityTable;
if (!$tag->find()) {
$tag->save();
foreach ($entityIds as $entityId) {
$tag = new CRM_Core_DAO_EntityTag();
- $tag->entity_id = $entityId;
- $tag->tag_id = $tagId;
+ $tag->entity_id = $entityId;
+ $tag->tag_id = $tagId;
$tag->entity_table = $entityTable;
if ($tag->find()) {
$tag->delete();
*/
public function mergeTags($tagAId, $tagBId) {
$queryParams = array(
- 1 => array($tagBId, 'Integer'),
+ 1 => array($tagBId, 'Integer'),
2 => array($tagAId, 'Integer'),
);
// re-compute used_for field
$query = "SELECT id, name, used_for FROM civicrm_tag WHERE id IN (%1, %2)";
- $dao = CRM_Core_DAO::executeQuery($query, $queryParams);
- $tags = array();
+ $dao = CRM_Core_DAO::executeQuery($query, $queryParams);
+ $tags = array();
while ($dao->fetch()) {
$label = ($dao->id == $tagAId) ? 'tagA' : 'tagB';
$tags[$label] = $dao->name;
/**
* The $useWhere is used so that the signature matches the parent class
*
- public function delete($useWhere = FALSE) {
- list($fileID, $entityID, $fieldID) = func_get_args();
-
- self::deleteFileReferences($fileID, $entityID, $fieldID);
- } */
+ * public function delete($useWhere = FALSE) {
+ * list($fileID, $entityID, $fieldID) = func_get_args();
+ *
+ * self::deleteFileReferences($fileID, $entityID, $fieldID);
+ * } */
/**
* Delete all the files and associated object associated with this
* $Id$
*
*/
-
class CRM_Core_BAO_FinancialTrxn extends CRM_Financial_DAO_FinancialTrxn {
/**
* Class constructor
if (!empty($trxnEntityTable)) {
$entityFinancialTrxnParams['entity_table'] = $trxnEntityTable['entity_table'];
- $entityFinancialTrxnParams['entity_id'] = $trxnEntityTable['entity_id'];
+ $entityFinancialTrxnParams['entity_id'] = $trxnEntityTable['entity_id'];
}
else {
- $entityFinancialTrxnParams['entity_id'] = $params['contribution_id'];
+ $entityFinancialTrxnParams['entity_id'] = $params['contribution_id'];
}
$entityTrxn = new CRM_Financial_DAO_EntityFinancialTrxn();
WHERE lt.entity_id = %1 ";
$sqlParams = array(1 => array($entity_id, 'Integer'), 2 => array($entity_table, 'String'));
- $dao = CRM_Core_DAO::executeQuery($query, $sqlParams);
+ $dao = CRM_Core_DAO::executeQuery($query, $sqlParams);
while ($dao->fetch()) {
$result[$dao->financial_trxn_id][$dao->id] = $dao->amount;
}
$params['trxnParams']['to_financial_account_id'] = $financialAccount;
$params['trxnParams']['total_amount'] = $amount;
$params['trxnParams']['fee_amount'] =
- $params['trxnParams']['net_amount'] = 0;
- $params['trxnParams']['status_id'] = CRM_Core_OptionGroup::getValue('contribution_status','Completed','name');
+ $params['trxnParams']['net_amount'] = 0;
+ $params['trxnParams']['status_id'] = CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name');
$params['trxnParams']['contribution_id'] = $contributionId;
$trxn = self::create($params['trxnParams']);
if (empty($params['entity_id'])) {
'transaction_date' => date('YmdHis'),
'amount' => $amount,
'description' => 'Fee',
- 'status_id' => CRM_Core_OptionGroup::getValue('financial_item_status','Paid','name'),
+ 'status_id' => CRM_Core_OptionGroup::getValue('financial_item_status', 'Paid', 'name'),
'entity_table' => 'civicrm_financial_trxn',
'entity_id' => $params['entity_id'],
'currency' => $params['trxnParams']['currency'],
if ($returnType) {
$value = array();
if ($paymentVal < 0) {
- $value['refund_due'] = $paymentVal;
+ $value['refund_due'] = $paymentVal;
}
elseif ($paymentVal > 0) {
$value['amount_owed'] = $paymentVal;
civicrm_im.is_primary DESC, im_id ASC ";
$params = array(1 => array($id, 'Integer'));
- $ims = $values = array();
- $dao = CRM_Core_DAO::executeQuery($query, $params);
+ $ims = $values = array();
+ $dao = CRM_Core_DAO::executeQuery($query, $params);
$count = 1;
while ($dao->fetch()) {
$values = array(
if (array_key_exists($field, self::$optionValueFields)) {
switch (self::$optionValueFields[$field]['type']) {
case CRM_Utils_Type::T_INT:
- return (int)CRM_Utils_Array::value($field, $values, $default);
+ return (int) CRM_Utils_Array::value($field, $values, $default);
case CRM_Utils_Type::T_FLOAT:
// Round float values to three decimal places and trim trailing zeros.
$f = sprintf('%05.3f', $values[$field]);
$f = rtrim($f, '0');
$f = rtrim($f, '.');
- return (float)(empty($f) ? '0' : $f);
+ return (float) (empty($f) ? '0' : $f);
}
return CRM_Utils_Array::value($field, $values, $default);
}
}
else {
// new record
- $list = self::getList(TRUE,$groupName);
+ $list = self::getList(TRUE, $groupName);
$cnt = 1;
- while (array_key_exists("custom_$cnt", $list)) $cnt++;
+ while (array_key_exists("custom_$cnt", $list)) {
+ $cnt++;
+ }
$values['name'] = "custom_$cnt";
$values['grouping'] = self::customGroupName();
}
}
foreach (array(
- 'phone', 'email', 'im', 'address') as $loc) {
+ 'phone',
+ 'email',
+ 'im',
+ 'address'
+ ) as $loc) {
$locBlock["{$loc}_id"] = !empty($location["$loc"][0]) ? $location["$loc"][0]->id : NULL;
$locBlock["{$loc}_2_id"] = !empty($location["$loc"][1]) ? $location["$loc"][1]->id : NULL;
}
* @static
*/
public static function findExisting($entityElements) {
- $eid = $entityElements['entity_id'];
+ $eid = $entityElements['entity_id'];
$etable = $entityElements['entity_table'];
- $query = "
+ $query = "
SELECT e.loc_block_id as locId
FROM {$etable} e
WHERE e.id = %1";
//copy all location blocks (email, phone, address, etc)
foreach ($defaults as $key => $value) {
if ($key != 'id') {
- $tbl = explode("_", $key);
- $name = ucfirst($tbl[0]);
+ $tbl = explode("_", $key);
+ $name = ucfirst($tbl[0]);
$updateParams = NULL;
if ($updateId = CRM_Utils_Array::value($key, $updateValues)) {
$updateParams = array('id' => $updateId);
$nonPrimaryBlockIds = CRM_Contact_BAO_Contact::getLocBlockIds($contactId, array('is_primary' => 0));
foreach (array(
- 'Email', 'IM', 'Phone', 'Address', 'OpenID') as $block) {
+ 'Email',
+ 'IM',
+ 'Phone',
+ 'Address',
+ 'OpenID'
+ ) as $block) {
$name = strtolower($block);
if (array_key_exists($name, $primaryLocBlockIds) &&
!CRM_Utils_System::isNull($primaryLocBlockIds[$name])
// Format for js
else {
- // Option-groups for multiple categories
+ // Option-groups for multiple categories
if ($result && count($values) > 1) {
$elements[] = array(
'value' => CRM_Core_PseudoConstant::$valueType($val, FALSE),
'children' => array(),
);
- $list = & $elements[count($elements) - 1]['children'];
+ $list = &$elements[count($elements) - 1]['children'];
}
foreach ($result as $id => $name) {
$list[] = array(
$logData = "$tableName,$tableID";
if (!$log->id) {
- $log->entity_table = 'civicrm_contact';
- $log->entity_id = $contactID;
- $log->modified_id = $userID;
+ $log->entity_table = 'civicrm_contact';
+ $log->entity_id = $contactID;
+ $log->modified_id = $userID;
$log->modified_date = date("YmdHis");
- $log->data = $logData;
+ $log->data = $logData;
$log->save();
}
else {
if (empty($mailSettings[$domainID]) || $reset) {
$dao = new self;
$dao->is_default = 1;
- $dao->domain_id = $domainID;
+ $dao->domain_id = $domainID;
$dao->find(TRUE);
$mailSettings[$domainID] = $dao;
}
$results = NULL;
$transaction = new CRM_Core_Transaction();
- $mailSettings = new CRM_Core_DAO_MailSettings();
+ $mailSettings = new CRM_Core_DAO_MailSettings();
$mailSettings->id = $id;
- $results = $mailSettings->delete();
+ $results = $mailSettings->delete();
$transaction->commit();
}
return array(
- $mappingName, $mappingContactType, $mappingLocation, $mappingPhoneType,
- $mappingImProvider, $mappingRelation, $mappingOperator, $mappingValue, $mappingWebsiteType,
+ $mappingName,
+ $mappingContactType,
+ $mappingLocation,
+ $mappingPhoneType,
+ $mappingImProvider,
+ $mappingRelation,
+ $mappingOperator,
+ $mappingValue,
+ $mappingWebsiteType,
);
}
else {
$form->assign('loadedMapping', $mappingId);
- $params = array('id' => $mappingId);
- $temp = array();
+ $params = array('id' => $mappingId);
+ $temp = array();
$mappingDetails = CRM_Core_BAO_Mapping::retrieve($params, $temp);
$form->assign('savedName', $mappingDetails->name);
);
}
- $defaults = array();
+ $defaults = array();
$hasLocationTypes = array();
$hasRelationTypes = array();
- $fields = array();
+ $fields = array();
if ($mappingType == 'Export') {
$required = TRUE;
//we need to unset groups, tags, notes for component export
if ($exportMode != CRM_Export_Form_Select::CONTACT_EXPORT) {
foreach (array(
- 'groups', 'tags', 'notes') as $value) {
+ 'groups',
+ 'tags',
+ 'notes'
+ ) as $value) {
unset($fields['Individual'][$value]);
unset($fields['Household'][$value]);
unset($fields['Organization'][$value]);
if (!empty($fields['Household'][$key]) && !empty($fields['Organization'][$key])) {
$fields['Contact'][$key] = $value;
unset($fields['Organization'][$key],
- $fields['Household'][$key],
- $fields['Individual'][$key]);
+ $fields['Household'][$key],
+ $fields['Individual'][$key]);
}
}
if (array_key_exists('note', $fields['Contact'])) {
$noteTitle = $fields['Contact']['note']['title'];
$fields['Contact']['note']['title'] = $noteTitle . ': ' . ts('Body and Subject');
- $fields['Contact']['note_body'] = array('title' => $noteTitle . ': ' . ts('Body Only'), 'name' => 'note_body');
- $fields['Contact']['note_subject'] = array('title' => $noteTitle . ': ' . ts('Subject Only'), 'name' => 'note_subject');
+ $fields['Contact']['note_body'] = array('title' => $noteTitle . ': ' . ts('Body Only'), 'name' => 'note_body');
+ $fields['Contact']['note_subject'] = array(
+ 'title' => $noteTitle . ': ' . ts('Subject Only'),
+ 'name' => 'note_subject'
+ );
}
}
if ($mappingType == 'Export') {
$subTypeRelationshipTypes =
CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, $val['parent'],
- FALSE, 'label', TRUE, $subType);
+ FALSE, 'label', TRUE, $subType);
foreach ($subTypeRelationshipTypes as $key => $var) {
if (!array_key_exists($key, $fields[$val['parent']])) {
}
}
- $sel3[''] = NULL;
- $sel5[''] = NULL;
- $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
+ $sel3[''] = NULL;
+ $sel5[''] = NULL;
+ $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
$imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id');
asort($phoneTypes);
if ($relationshipType->find(TRUE)) {
$direction = "contact_sub_type_$second";
if (isset($relationshipType->$direction)) {
- $relatedFields = array_merge((array)$relatedMapperFields[$relationshipType->$direction], (array)$relationshipCustomFields);
+ $relatedFields = array_merge((array) $relatedMapperFields[$relationshipType->$direction], (array) $relationshipCustomFields);
}
else {
$target_type = 'contact_type_' . $second;
- $relatedFields = array_merge((array)$relatedMapperFields[$relationshipType->$target_type], (array)$relationshipCustomFields);
+ $relatedFields = array_merge((array) $relatedMapperFields[$relationshipType->$target_type], (array) $relationshipCustomFields);
}
}
$relationshipType->free();
//special fields that have location, hack for primary location
$specialFields = array(
- 'street_address', 'supplemental_address_1', 'supplemental_address_2',
- 'city', 'postal_code', 'postal_code_suffix', 'geo_code_1', 'geo_code_2',
- 'state_province', 'country', 'phone', 'email', 'im',
+ 'street_address',
+ 'supplemental_address_1',
+ 'supplemental_address_2',
+ 'city',
+ 'postal_code',
+ 'postal_code_suffix',
+ 'geo_code_1',
+ 'geo_code_2',
+ 'state_province',
+ 'country',
+ 'phone',
+ 'email',
+ 'im',
);
if (isset($mappingId)) {
list($mappingName, $mappingContactType, $mappingLocation, $mappingPhoneType, $mappingImProvider,
$mappingRelation, $mappingOperator, $mappingValue
- ) = CRM_Core_BAO_Mapping::getMappingFields($mappingId);
+ ) = CRM_Core_BAO_Mapping::getMappingFields($mappingId);
$blkCnt = count($mappingName);
if ($blkCnt >= $blockCount) {
$js = "<script type='text/javascript'>\n";
$formName = "document.{$name}";
if (!empty($nullArray)) {
- $js .= "var nullArray = [";
+ $js .= "var nullArray = [";
$elements = array();
- $seen = array();
+ $seen = array();
foreach ($nullArray as $element) {
$key = "{$element[0]}, {$element[1]}, {$element[2]}";
if (!isset($seen[$key])) {
";
}
if (!empty($noneArray)) {
- $js .= "var noneArray = [";
+ $js .= "var noneArray = [";
$elements = array();
- $seen = array();
+ $seen = array();
foreach ($noneArray as $element) {
$key = "{$element[0]}, {$element[1]}, {$element[2]}";
if (!isset($seen[$key])) {
if (in_array($v[0], $types)) {
if ($contactType && $contactType != $v[0]) {
CRM_Core_Error::fatal(ts("Cannot have two clauses with different types: %1, %2",
- array(1 => $contactType, 2 => $v[0])
- ));
+ array(1 => $contactType, 2 => $v[0])
+ ));
}
$contactType = $v[0];
}
}
if ($v[0] == 'Contribution' && substr($fldName, 0, 7) != 'custom_'
- && substr($fldName, 0, 10) != 'financial_') {
+ && substr($fldName, 0, 10) != 'financial_'
+ ) {
if (substr($fldName, 0, 13) != 'contribution_') {
$fldName = 'contribution_' . $fldName;
}
}
// CRM-14983: verify if values are comma separated convert to array
- if (!is_array($value) && (strpos($value,',') !== FALSE || strstr($value, '(')) && empty($isCustomField) && $params['operator'][$key][$k] == 'IN') {
+ if (!is_array($value) && (strpos($value, ',') !== FALSE || strstr($value, '(')) && empty($isCustomField) && $params['operator'][$key][$k] == 'IN') {
preg_match('#\((.*?)\)#', $value, $match);
$tmpArray = explode(',', $match[1]);
- $value = array_combine(array_values($tmpArray),array_values($tmpArray));
+ $value = array_combine(array_values($tmpArray), array_values($tmpArray));
}
if ($row) {
$messageTemplates = new CRM_Core_DAO_MessageTemplate();
$messageTemplates->id = $messageTemplateID;
- $domain = CRM_Core_BAO_Domain::getDomain();
- $result = NULL;
+ $domain = CRM_Core_BAO_Domain::getDomain();
+ $result = NULL;
$hookTokens = array();
if ($messageTemplates->find(TRUE)) {
- $body_text = $messageTemplates->msg_text;
- $body_html = $messageTemplates->msg_html;
+ $body_text = $messageTemplates->msg_text;
+ $body_html = $messageTemplates->msg_html;
$body_subject = $messageTemplates->msg_subject;
if (!$body_text) {
$body_text = CRM_Utils_String::htmlToText($body_html);
// get tokens to be replaced
$tokens = array_merge(CRM_Utils_Token::getTokens($body_text),
- CRM_Utils_Token::getTokens($body_html),
- CRM_Utils_Token::getTokens($body_subject));
+ CRM_Utils_Token::getTokens($body_html),
+ CRM_Utils_Token::getTokens($body_subject));
// get replacement text for these tokens
$returnProperties = array("preferred_mail_format" => 1);
}
}
list($details) = CRM_Utils_Token::getTokenDetails(array($contactId),
- $returnProperties,
- NULL, NULL, FALSE,
- $tokens,
- 'CRM_Core_BAO_MessageTemplate');
+ $returnProperties,
+ NULL, NULL, FALSE,
+ $tokens,
+ 'CRM_Core_BAO_MessageTemplate');
$contact = reset($details);
// call token hook
$smarty = CRM_Core_Smarty::singleton();
foreach (array(
- 'text', 'html') as $elem) {
+ 'text',
+ 'html'
+ ) as $elem) {
$$elem = $smarty->fetch("string:{$$elem}");
}
}
if ($html && ($contact['preferred_mail_format'] == 'HTML' ||
$contact['preferred_mail_format'] == 'Both'
- )) {
+ )
+ ) {
$mailParams['html'] = $html;
}
CRM_Core_Error::fatal(ts('Did not find a message template with id of %1.', array(1 => $id)));
}
- $orig = new self;
+ $orig = new self;
$orig->workflow_id = $diverted->workflow_id;
$orig->is_reserved = 1;
$orig->find(1);
CRM_Core_Error::fatal(ts('No such message template: id=%1.', array(1 => $params['messageTemplateID'])));
}
else {
- CRM_Core_Error::fatal(ts('No such message template: option group %1, option value %2.', array(1 => $params['groupName'], 2 => $params['valueName'])));
+ CRM_Core_Error::fatal(ts('No such message template: option group %1, option value %2.', array(
+ 1 => $params['groupName'],
+ 2 => $params['valueName']
+ )));
}
}
$subject = $dao->subject;
- $text = $dao->text;
- $html = $dao->html;
- $format = $dao->format;
+ $text = $dao->text;
+ $html = $dao->html;
+ $format = $dao->format;
$dao->free();
// add the test banner (if requested)
$testDao->fetch();
$subject = $testDao->subject . $subject;
- $text = $testDao->text . $text;
- $html = preg_replace('/<body(.*)$/im', "<body\\1\n{$testDao->html}", $html);
+ $text = $testDao->text . $text;
+ $html = preg_replace('/<body(.*)$/im', "<body\\1\n{$testDao->html}", $html);
$testDao->free();
}
// replace tokens in the three elements (in subject as if it was the text body)
- $domain = CRM_Core_BAO_Domain::getDomain();
- $hookTokens = array();
- $mailing = new CRM_Mailing_BAO_Mailing;
+ $domain = CRM_Core_BAO_Domain::getDomain();
+ $hookTokens = array();
+ $mailing = new CRM_Mailing_BAO_Mailing;
$mailing->body_text = $text;
$mailing->body_html = $html;
- $tokens = $mailing->getTokens();
+ $tokens = $mailing->getTokens();
CRM_Utils_Hook::tokens($hookTokens);
$categories = array_keys($hookTokens);
}
$subject = CRM_Utils_Token::replaceDomainTokens($subject, $domain, FALSE, $tokens['text'], TRUE);
- $text = CRM_Utils_Token::replaceDomainTokens($text, $domain, FALSE, $tokens['text'], TRUE);
- $html = CRM_Utils_Token::replaceDomainTokens($html, $domain, TRUE, $tokens['html'], TRUE);
+ $text = CRM_Utils_Token::replaceDomainTokens($text, $domain, FALSE, $tokens['text'], TRUE);
+ $html = CRM_Utils_Token::replaceDomainTokens($html, $domain, TRUE, $tokens['html'], TRUE);
if ($contactID) {
$subject = CRM_Utils_Token::replaceContactTokens($subject, $contact, FALSE, $tokens['text'], FALSE, TRUE);
- $text = CRM_Utils_Token::replaceContactTokens($text, $contact, FALSE, $tokens['text'], FALSE, TRUE);
- $html = CRM_Utils_Token::replaceContactTokens($html, $contact, FALSE, $tokens['html'], FALSE, TRUE);
+ $text = CRM_Utils_Token::replaceContactTokens($text, $contact, FALSE, $tokens['text'], FALSE, TRUE);
+ $html = CRM_Utils_Token::replaceContactTokens($html, $contact, FALSE, $tokens['html'], FALSE, TRUE);
$contactArray = array($contactID => $contact);
$contact = $contactArray[$contactID];
$subject = CRM_Utils_Token::replaceHookTokens($subject, $contact, $categories, TRUE);
- $text = CRM_Utils_Token::replaceHookTokens($text, $contact, $categories, TRUE);
- $html = CRM_Utils_Token::replaceHookTokens($html, $contact, $categories, TRUE);
+ $text = CRM_Utils_Token::replaceHookTokens($text, $contact, $categories, TRUE);
+ $html = CRM_Utils_Token::replaceHookTokens($html, $contact, $categories, TRUE);
}
// strip whitespace from ends and turn into a single line
$smarty->assign($name, $value);
}
foreach (array(
- 'subject', 'text', 'html') as $elem) {
+ 'subject',
+ 'text',
+ 'html'
+ ) as $elem) {
$$elem = $smarty->fetch("string:{$$elem}");
}
// create the params array
$params['subject'] = $subject;
- $params['text'] = $text;
- $params['html'] = $html;
+ $params['text'] = $text;
+ $params['html'] = $html;
if ($params['toEmail']) {
$contactParams = array(array('email', 'LIKE', $params['toEmail'], 0, 1));
'parentID' => $navigation->parent_id,
'navID' => $navigation->id,
'active' => $navigation->is_active,
- ));
+ )
+ );
self::buildNavigationTree($navigationTree[$navigation->id]['child'], $navigation->id, $navigationMenu);
}
// want to use ts() as it would throw the ts-extractor off
$i18n = CRM_Core_I18n::singleton();
- $name = $i18n->crm_translate($value['attributes']['label'], array('context' => 'menu'));
- $url = $value['attributes']['url'];
+ $name = $i18n->crm_translate($value['attributes']['label'], array('context' => 'menu'));
+ $url = $value['attributes']['url'];
$permission = $value['attributes']['permission'];
- $operator = $value['attributes']['operator'];
- $parentID = $value['attributes']['parentID'];
- $navID = $value['attributes']['navID'];
- $active = $value['attributes']['active'];
- $menuName = $value['attributes']['name'];
- $target = CRM_Utils_Array::value('target', $value['attributes']);
+ $operator = $value['attributes']['operator'];
+ $parentID = $value['attributes']['parentID'];
+ $navID = $value['attributes']['navID'];
+ $active = $value['attributes']['active'];
+ $menuName = $value['attributes']['name'];
+ $target = CRM_Utils_Array::value('target', $value['attributes']);
if (in_array($parentID, $skipMenuItems) || !$active) {
$skipMenuItems[] = $navID;
//we need to check core view/edit or supported acls.
if (in_array($menuName, array(
- 'Search...', 'Contacts'))) {
+ 'Search...',
+ 'Contacts'
+ ))) {
if (!CRM_Core_Permission::giveMeAllACLs()) {
$skipMenuItems[] = $navID;
return FALSE;
* @static
*/
public static function processNavigation(&$params) {
- $nodeID = (int)str_replace("node_", "", $params['id']);
- $referenceID = (int)str_replace("node_", "", $params['ref_id']);
- $position = $params['ps'];
- $type = $params['type'];
- $label = CRM_Utils_Array::value('data', $params);
+ $nodeID = (int) str_replace("node_", "", $params['id']);
+ $referenceID = (int) str_replace("node_", "", $params['ref_id']);
+ $position = $params['ps'];
+ $type = $params['type'];
+ $label = CRM_Utils_Array::value('data', $params);
switch ($type) {
case "move":
}
$incrementOtherNodes = TRUE;
- $sql = "SELECT weight from civicrm_navigation WHERE {$parentClause} ORDER BY weight LIMIT %1, 1";
+ $sql = "SELECT weight from civicrm_navigation WHERE {$parentClause} ORDER BY weight LIMIT %1, 1";
$params = array(1 => array($position, 'Positive'));
$newWeight = CRM_Core_DAO::singleValueQuery($sql, $params);
// this means node is moved to last position, so you need to get the weight of last element + 1
if (!$newWeight) {
$lastPosition = $position - 1;
- $sql = "SELECT weight from civicrm_navigation WHERE {$parentClause} ORDER BY weight LIMIT %1, 1";
+ $sql = "SELECT weight from civicrm_navigation WHERE {$parentClause} ORDER BY weight LIMIT %1, 1";
$params = array(1 => array($lastPosition, 'Positive'));
$newWeight = CRM_Core_DAO::singleValueQuery($sql, $params);
* @static
*/
public static function getNavigationInfo($navigationID) {
- $query = "SELECT parent_id, weight FROM civicrm_navigation WHERE id = %1";
+ $query = "SELECT parent_id, weight FROM civicrm_navigation WHERE id = %1";
$params = array($navigationID, 'Integer');
- $dao = CRM_Core_DAO::executeQuery($query, array(1 => $params));
+ $dao = CRM_Core_DAO::executeQuery($query, array(1 => $params));
$dao->fetch();
return array(
'parent_id' => $dao->parent_id,
if (empty($params)) {
return NULL;
}
- $note = new CRM_Core_BAO_Note();
- $note->entity_id = $params['contact_id'];
+ $note = new CRM_Core_BAO_Note();
+ $note->entity_id = $params['contact_id'];
$note->entity_table = 'civicrm_contact';
// get the total count of notes
* @static
*/
public static function del($id, $showStatus = TRUE) {
- $return = NULL;
- $recent = array($id);
- $note = new CRM_Core_DAO_Note();
+ $return = NULL;
+ $recent = array($id);
+ $note = new CRM_Core_DAO_Note();
$note->id = $id;
$note->find();
$note->fetch();
*/
public static function deleteContact($id) {
// need to delete for both entity_id
- $dao = new CRM_Core_DAO_Note();
+ $dao = new CRM_Core_DAO_Note();
$dao->entity_table = 'civicrm_contact';
- $dao->entity_id = $id;
+ $dao->entity_id = $id;
$dao->delete();
// and the creator contact id
* @static
*/
public static function getContactNoteCount($contactID) {
- $note = new CRM_Core_DAO_Note();
- $note->entity_id = $contactID;
+ $note = new CRM_Core_DAO_Note();
+ $note->entity_id = $contactID;
$note->entity_table = 'civicrm_contact';
$note->find();
$count = 0;
* @static
*/
public static function getChildCount($id) {
- $note = new CRM_Core_DAO_Note();
+ $note = new CRM_Core_DAO_Note();
$note->entity_table = 'civicrm_note';
- $note->entity_id = $id;
+ $note->entity_id = $id;
$note->find();
$count = 0;
while ($note->fetch()) {
}
// get direct children of given parentId note
- $note = new CRM_Core_DAO_Note();
+ $note = new CRM_Core_DAO_Note();
$note->entity_table = 'civicrm_note';
- $note->entity_id = $parentId;
+ $note->entity_id = $parentId;
$note->orderBy('modified_date asc');
$note->find();
while ($note->fetch()) {
CRM_Core_DAO::storeValues($note, $tree[$note->id]);
// get name of user that created this note
- $contact = new CRM_Contact_DAO_Contact();
+ $contact = new CRM_Contact_DAO_Contact();
$createdById = $note->contact_id;
$contact->id = $createdById;
$contact->find();
*/
public static function getDescendentIds($parentId, &$ids = array()) {
// get direct children of given parentId note
- $note = new CRM_Core_DAO_Note();
+ $note = new CRM_Core_DAO_Note();
$note->entity_table = 'civicrm_note';
- $note->entity_id = $parentId;
+ $note->entity_id = $parentId;
$note->find();
while ($note->fetch()) {
// foreach child, add to ids list, and recurse
$params = array(1 => array($id, 'Integer'));
$openids = $values = array();
- $dao = CRM_Core_DAO::executeQuery($query, $params);
- $count = 1;
+ $dao = CRM_Core_DAO::executeQuery($query, $params);
+ $count = 1;
while ($dao->fetch()) {
$values = array(
'locationType' => $dao->locationType,
}
return CRM_Core_BAO_OptionValue::add($params, $ids);
}
+
/**
* Set default Parameters
* This functions sets default parameters if not set:
*/
public static function getDefaultWeight($params) {
return (int) CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue',
- array('option_group_id' => $params['option_group_id']));
+ array('option_group_id' => $params['option_group_id']));
}
/**
* @param array $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'])) {
- $bao->domain_id = $params['domain_id'];
- }
- $bao->selectAdd();
- $bao->whereAdd("value REGEXP '^[0-9]+$'");
- $bao->selectAdd('(ROUND(COALESCE(MAX(CONVERT(value, UNSIGNED)),0)) +1) as nextvalue');
- $bao->find(TRUE);
- return $bao->nextvalue;
+ $bao = new CRM_Core_BAO_OptionValue();
+ $bao->option_group_id = $params['option_group_id'];
+ if (isset($params['domain_id'])) {
+ $bao->domain_id = $params['domain_id'];
+ }
+ $bao->selectAdd();
+ $bao->whereAdd("value REGEXP '^[0-9]+$'");
+ $bao->selectAdd('(ROUND(COALESCE(MAX(CONVERT(value, UNSIGNED)),0)) +1) as nextvalue');
+ $bao->find(TRUE);
+ return $bao->nextvalue;
}
+
/**
* Fetch object based on array of properties
*
'gender' => 'gender_id',
'individual_prefix' => 'prefix_id',
'individual_suffix' => 'suffix_id',
- 'communication_style' => 'communication_style_id', // Not only Individuals -- but the code seems to be generic for all contact types, despite the naming...
+ 'communication_style' => 'communication_style_id',
+ // Not only Individuals -- but the code seems to be generic for all contact types, despite the naming...
);
$contributions = array('payment_instrument' => 'payment_instrument_id');
- $activities = array('activity_type' => 'activity_type_id');
- $participant = array('participant_role' => 'role_id');
- $eventType = array('event_type' => 'event_type_id');
- $aclRole = array('acl_role' => 'acl_role_id');
+ $activities = array('activity_type' => 'activity_type_id');
+ $participant = array('participant_role' => 'role_id');
+ $eventType = array('event_type' => 'event_type_id');
+ $aclRole = array('acl_role' => 'acl_role_id');
$all = array_merge($individuals, $contributions, $activities, $participant, $eventType, $aclRole);
$fieldName = '';
*/
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();
+ $cacheKey = "CRM_Core_BAO_OptionValue_OptionGroupID_{$optionGroupID}";
+ $cache = CRM_Utils_Cache::singleton();
$optionValues = $cache->get($cacheKey);
if (empty($optionValues)) {
$dao = new CRM_Core_DAO_OptionValue();
}
return $options;
}
+
/**
* Get the values of all option values given an option group Name as a key => value pair
* Use above cached function to make it super efficient
if (array_key_exists($field, self::$optionValueFields)) {
switch (self::$optionValueFields[$field]['type']) {
case CRM_Utils_Type::T_INT:
- return (int)CRM_Utils_Array::value($field, $values, $default);
+ return (int) CRM_Utils_Array::value($field, $values, $default);
case CRM_Utils_Type::T_FLOAT:
// Round float values to three decimal places and trim trailing zeros.
$f = sprintf('%05.3f', $values[$field]);
$f = rtrim($f, '0');
$f = rtrim($f, '.');
- return (float)(empty($f) ? '0' : $f);
+ return (float) (empty($f) ? '0' : $f);
}
return CRM_Utils_Array::value($field, $values, $default);
}
if (array_key_exists($field, self::$optionValueFields)) {
switch (self::$optionValueFields[$field]['type']) {
case CRM_Utils_Type::T_INT:
- return (int)CRM_Utils_Array::value($field, $values, $default);
+ return (int) CRM_Utils_Array::value($field, $values, $default);
case CRM_Utils_Type::T_FLOAT:
// Round float values to three decimal places and trim trailing zeros.
$f = sprintf('%05.3f', $values[$field]);
$f = rtrim($f, '0');
$f = rtrim($f, '.');
- return (float)(empty($f) ? '0' : $f);
+ return (float) (empty($f) ? '0' : $f);
}
return CRM_Utils_Array::value($field, $values, $default);
}
);
$numbers = $values = array();
- $dao = CRM_Core_DAO::executeQuery($query, $params);
- $count = 1;
+ $dao = CRM_Core_DAO::executeQuery($query, $params);
+ $count = 1;
while ($dao->fetch()) {
$values = array(
'locationType' => $dao->locationType,
$dirParams = array();
$urlParams = array();
- $dao = CRM_Core_DAO::executeQuery($sql);
+ $dao = CRM_Core_DAO::executeQuery($sql);
while ($dao->fetch()) {
if (!isset($params[$dao->valueName])) {
continue;
1 => array($mergeId, 'Integer'),
2 => array($cacheKey, 'String'),
);
- $sql = "SELECT pn.id, pn.entity_id1, pn.entity_id2, pn.data FROM civicrm_prevnext_cache pn {$join} ";
+ $sql = "SELECT pn.id, pn.entity_id1, pn.entity_id2, pn.data FROM civicrm_prevnext_cache pn {$join} ";
$wherePrev = " WHERE pn.id < %1 AND pn.cacheKey = %2 {$where} ORDER BY ID DESC LIMIT 1";
- $sqlPrev = $sql . $wherePrev;
+ $sqlPrev = $sql . $wherePrev;
$dao = CRM_Core_DAO::executeQuery($sqlPrev, $p);
$params = array(1 => array($entityTable, 'String'));
$pair =
- ! $isViceVersa ?
- "entity_id1 = %2 AND entity_id2 = %3" :
- "(entity_id1 = %2 AND entity_id2 = %3) OR (entity_id1 = %3 AND entity_id2 = %2)";
+ !$isViceVersa ?
+ "entity_id1 = %2 AND entity_id2 = %3" :
+ "(entity_id1 = %2 AND entity_id2 = %3) OR (entity_id1 = %3 AND entity_id2 = %2)";
$sql .= " AND ( {$pair} )";
$params[2] = array($id1, 'Integer');
$params[3] = array($id2, 'Integer');
$cids[$dupe[1]] = 1;
}
$cidString = implode(', ', array_keys($cids));
- $sql = "SELECT id, display_name FROM civicrm_contact WHERE id IN ($cidString) ORDER BY sort_name";
- $dao = new CRM_Core_DAO();
+ $sql = "SELECT id, display_name FROM civicrm_contact WHERE id IN ($cidString) ORDER BY sort_name";
+ $dao = new CRM_Core_DAO();
$dao->query($sql);
while ($dao->fetch()) {
$displayNames[$dao->id] = $dao->display_name;
$params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
}
- $qfKey = CRM_Utils_Request::retrieve('qfKey','String', $form);
+ $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $form);
$cacheKey = "civicrm search {$qfKey}";
$query = "
static $_tableDAOMapper =
array(
- 'civicrm_event' => 'CRM_Event_DAO_Event',
+ 'civicrm_event' => 'CRM_Event_DAO_Event',
'civicrm_price_set_entity' => 'CRM_Price_DAO_PriceSetEntity',
- 'civicrm_uf_join' => 'CRM_Core_DAO_UFJoin',
+ 'civicrm_uf_join' => 'CRM_Core_DAO_UFJoin',
'civicrm_tell_friend' => 'CRM_Friend_DAO_Friend',
- 'civicrm_pcp_block' => 'CRM_PCP_DAO_PCPBlock',
- 'civicrm_activity' => 'CRM_Activity_DAO_Activity',
- 'civicrm_activity_contact' => 'CRM_Activity_DAO_ActivityContact',
+ 'civicrm_pcp_block' => 'CRM_PCP_DAO_PCPBlock',
+ 'civicrm_activity' => 'CRM_Activity_DAO_Activity',
+ 'civicrm_activity_contact' => 'CRM_Activity_DAO_ActivityContact',
);
static $_updateSkipFields =
array(
- 'civicrm_event' => array('start_date', 'end_date'),
+ 'civicrm_event' => array('start_date', 'end_date'),
'civicrm_tell_friend' => array('entity_id'),
- 'civicrm_pcp_block' => array('entity_id'),
- 'civicrm_activity' => array('activity_date_time'),
+ 'civicrm_pcp_block' => array('entity_id'),
+ 'civicrm_activity' => array('activity_date_time'),
);
static $_linkedEntitiesInfo =
array(
'civicrm_tell_friend' => array(
- 'entity_id_col' => 'entity_id',
+ 'entity_id_col' => 'entity_id',
'entity_table_col' => 'entity_table'
),
'civicrm_price_set_entity' => array(
- 'entity_id_col' => 'entity_id',
+ 'entity_id_col' => 'entity_id',
'entity_table_col' => 'entity_table',
- 'is_multirecord' => TRUE,
+ 'is_multirecord' => TRUE,
),
'civicrm_uf_join' => array(
- 'entity_id_col' => 'entity_id',
+ 'entity_id_col' => 'entity_id',
'entity_table_col' => 'entity_table',
- 'is_multirecord' => TRUE,
+ 'is_multirecord' => TRUE,
),
'civicrm_pcp_block' => array(
- 'entity_id_col' => 'entity_id',
+ 'entity_id_col' => 'entity_id',
'entity_table_col' => 'entity_table'
),
);
public static function setStatus($status) {
self::$status = $status;
}
+
/**
* Save records in civicrm_recujrring_entity table
*
public static function quickAdd($parentId, $entityId, $entityTable) {
$params =
array(
- 'parent_id' => $parentId,
- 'entity_id' => $entityId,
+ 'parent_id' => $parentId,
+ 'entity_id' => $entityId,
'entity_table' => $entityTable
);
return self::add($params);
public function generateEntities() {
self::setStatus(self::RUNNING);
- $newEntities = array();
+ $newEntities = array();
$findCriteria = array();
if (!empty($this->recursionDates)) {
if ($this->entity_id) {
$exRangeStart = $exRangeEnd = NULL;
if (!empty($this->excludeDateRangeColumns)) {
$exRangeStart = $this->excludeDateRangeColumns[0];
- $exRangeEnd = $this->excludeDateRangeColumns[1];
+ $exRangeEnd = $this->excludeDateRangeColumns[1];
}
$count = 1;
}
if ($exRangeStart) {
$exRangeStartDate = CRM_Utils_Date::processDate($recursionDates[$count][$exRangeStart], NULL, FALSE, 'Ymd');
- $exRangeEndDate = CRM_Utils_Date::processDate($recursionDates[$count][$exRangeEnd], NULL, FALSE, 'Ymd');
+ $exRangeEndDate = CRM_Utils_Date::processDate($recursionDates[$count][$exRangeEnd], NULL, FALSE, 'Ymd');
}
foreach ($this->excludeDates as $exDate) {
}
$queryParams = array(
- 1 => array($parentId, 'Integer'),
+ 1 => array($parentId, 'Integer'),
2 => array($entityTable, 'String'),
3 => array($initiatorId, 'Integer'),
);
$newObject = CRM_Core_DAO::copyGeneric($daoName, $fromCriteria, $newParams);
if (is_a($newObject, 'CRM_Core_DAO') && $newObject->id && $createRecurringEntity) {
- $object = new $daoName( );
+ $object = new $daoName();
foreach ($fromCriteria as $key => $value) {
$object->$key = $value;
}
$processedEntities[$key] = 1;
if (array_key_exists($entityTable, self::$_tableDAOMapper)) {
- $daoName = self::$_tableDAOMapper[$entityTable];
+ $daoName = self::$_tableDAOMapper[$entityTable];
$skipData = array();
if (array_key_exists($entityTable, self::$_updateSkipFields)) {
if (empty($hasaRecurringRecord)) {
// check if its a linked entity
if (array_key_exists($obj->__table, self::$_linkedEntitiesInfo) &&
- !CRM_Utils_Array::value('is_multirecord', self::$_linkedEntitiesInfo[$obj->__table])) {
+ !CRM_Utils_Array::value('is_multirecord', self::$_linkedEntitiesInfo[$obj->__table])
+ ) {
$linkedDAO = new self::$_tableDAOMapper[$obj->__table]();
$linkedDAO->id = $obj->id;
if ($linkedDAO->find(TRUE)) {
$idCol = self::$_linkedEntitiesInfo[$obj->__table]['entity_id_col'];
$tableCol = self::$_linkedEntitiesInfo[$obj->__table]['entity_table_col'];
- $pEntityID = $linkedDAO->$idCol;
+ $pEntityID = $linkedDAO->$idCol;
$pEntityTable = $linkedDAO->$tableCol;
// find all parent recurring entity set
else {
// linked entity doesn't exist. lets create them
$newCriteria = array(
- $idCol => $val['id'],
+ $idCol => $val['id'],
$tableCol => $val['table']
);
$linkedObj = CRM_Core_BAO_RecurringEntity::copyCreateEntity($obj->__table,
}
if ($formParams['repeats_by'] == 2) {
if (CRM_Utils_Array::value('entity_status_1', $formParams) && CRM_Utils_Array::value('entity_status_2', $formParams)) {
- $dbParams['entity_status'] = $formParams['entity_status_1']." ".$formParams['entity_status_2'];
+ $dbParams['entity_status'] = $formParams['entity_status_1'] . " " . $formParams['entity_status_2'];
}
}
}
if ($repetition_frequency_unit == "day") {
$repetition_frequency_unit = "dai";
}
- $repetition_frequency_unit = $repetition_frequency_unit.'ly';
+ $repetition_frequency_unit = $repetition_frequency_unit . 'ly';
$r->recur($start, $repetition_frequency_unit);
}
if ($scheduleReminderDetails['entity_status']) {
$startActionDate = explode(" ", $scheduleReminderDetails['entity_status']);
switch ($startActionDate[0]) {
- case 'first':
- $startActionDate1 = 1;
- break;
+ case 'first':
+ $startActionDate1 = 1;
+ break;
- case 'second':
- $startActionDate1 = 2;
- break;
+ case 'second':
+ $startActionDate1 = 2;
+ break;
- case 'third':
- $startActionDate1 = 3;
- break;
+ case 'third':
+ $startActionDate1 = 3;
+ break;
- case 'fourth':
- $startActionDate1 = 4;
- break;
+ case 'fourth':
+ $startActionDate1 = 4;
+ break;
- case 'last':
- $startActionDate1 = -1;
- break;
+ case 'last':
+ $startActionDate1 = -1;
+ break;
}
- $concatStartActionDateBits = $startActionDate1.strtoupper(substr($startActionDate[1], 0, 2));
+ $concatStartActionDateBits = $startActionDate1 . strtoupper(substr($startActionDate[1], 0, 2));
$r->byday(array($concatStartActionDateBits));
}
elseif ($scheduleReminderDetails['limit_to']) {
if (CRM_Utils_Array::value('absolute_date', $scheduleReminderDetails)) {
$absoluteDate = CRM_Utils_Date::setDateDefaults($scheduleReminderDetails['absolute_date']);
- $endDate = new DateTime($absoluteDate[0].' '.$absoluteDate[1]);
+ $endDate = new DateTime($absoluteDate[0] . ' ' . $absoluteDate[1]);
$endDate->modify('+1 day');
$r->until($endDate);
}
static public function getInterval($startDate, $endDate) {
if ($startDate && $endDate) {
$startDate = new DateTime($startDate);
- $endDate = new DateTime($endDate);
+ $endDate = new DateTime($endDate);
return $startDate->diff($endDate);
}
}
*/
public static function updateModeLinkedEntity($entityId, $linkedEntityTable, $mainEntityTable) {
$result = array();
- if ( $entityId && $linkedEntityTable && $mainEntityTable ) {
+ if ($entityId && $linkedEntityTable && $mainEntityTable) {
if (CRM_Utils_Array::value($linkedEntityTable, self::$_tableDAOMapper)) {
$dao = self::$_tableDAOMapper[$linkedEntityTable];
}
}
$entityTable = $linkedEntityTable;
$params = array(
- 'entity_id' => $entityId,
- 'entity_table' => $mainEntityTable
- );
+ 'entity_id' => $entityId,
+ 'entity_table' => $mainEntityTable
+ );
$defaults = array();
CRM_Core_DAO::commonRetrieve($dao, $params, $defaults);
if (CRM_Utils_Array::value('id', $defaults)) {
* structure, similar to what is used in GenCode.php
*
* $table = array(
- 'name' => TABLE_NAME,
+ * 'name' => TABLE_NAME,
* 'attributes' => ATTRIBUTES,
* 'fields' => array(
* array(
- 'name' => FIELD_NAME,
+ * 'name' => FIELD_NAME,
* 'type' => FIELD_SQL_TYPE,
- // can be field, index, constraint
+ * // can be field, index, constraint
* 'class' => FIELD_CLASS_TYPE,
* 'primary' => BOOLEAN,
* 'required' => BOOLEAN,
$lengthName = isset($substrLenghts[$table][$field]) ? "_{$substrLenghts[$table][$field]}" : '';
$lengthSize = isset($substrLenghts[$table][$field]) ? "({$substrLenghts[$table][$field]})" : '';
- $names = array("index_{$field}{$lengthName}", "FK_{$table}_{$field}{$lengthName}", "UI_{$field}{$lengthName}", "{$createIndexPrefix}_{$field}{$lengthName}");
+ $names = array(
+ "index_{$field}{$lengthName}",
+ "FK_{$table}_{$field}{$lengthName}",
+ "UI_{$field}{$lengthName}",
+ "{$createIndexPrefix}_{$field}{$lengthName}"
+ );
// skip to the next $field if one of the above $names exists; handle multilingual for CRM-4126
foreach ($names as $name) {
}
else {
CRM_Core_Error::fatal(ts('Could Not Find Custom Field Details for %1, %2, %3',
- array(
- 1 => $tableName,
- 2 => $columnName,
- 3 => $customFieldID,
- )
- ));
+ array(
+ 1 => $tableName,
+ 2 => $columnName,
+ 3 => $customFieldID,
+ )
+ ));
}
}
}
return isset(self::$_cache[$cacheKey]) ? $cacheKey : NULL;
}
+
/**
- * Allow key o be cleared
- * @param string $cacheKey
- */
+ * Allow key o be cleared
+ * @param string $cacheKey
+ */
public static function flushCache($cacheKey) {
unset(self::$_cache[$cacheKey]);
$globalCache = CRM_Utils_Cache::singleton();
$dao->name = $name;
$dao->component_id = $componentID;
if (empty($domainID)) {
- $dao->domain_id = CRM_Core_Config::domainID();
+ $dao->domain_id = CRM_Core_Config::domainID();
}
else {
$dao->domain_id = $domainID;
foreach ($fieldsToGet as $name => $value) {
if (!empty($fields['values'][$name]['prefetch'])) {
if (isset($params['filters']) && isset($params['filters']['prefetch'])
- && $params['filters']['prefetch'] == 0) {
+ && $params['filters']['prefetch'] == 0
+ ) {
// we are filtering out the prefetches from the return array
// so we will skip
continue;
}
- $configKey = CRM_Utils_Array::value('config_key', $fields['values'][$name], $name);
+ $configKey = CRM_Utils_Array::value('config_key', $fields['values'][$name], $name);
if (isset($config->$configKey)) {
$setting = $config->$configKey;
}
else {
$setting =
CRM_Core_BAO_Setting::getItem(
- $fields['values'][$name]['group_name'],
- $name,
- CRM_Utils_Array::value('component_id', $params),
- NULL,
- CRM_Utils_Array::value('contact_id', $params),
- $domainID
- );
+ $fields['values'][$name]['group_name'],
+ $name,
+ CRM_Utils_Array::value('component_id', $params),
+ NULL,
+ CRM_Utils_Array::value('contact_id', $params),
+ $domainID
+ );
}
if (!is_null($setting)) {
// we won't return if not set - helps in return all scenario - otherwise we can't indentify the missing ones
list($name) = array_keys($settingParams);
$getFieldsParams['name'] = $name;
}
- $fields = civicrm_api3('setting','getfields', $getFieldsParams);
+ $fields = civicrm_api3('setting', 'getfields', $getFieldsParams);
$invalidParams = (array_diff_key($settingParams, $fields['values']));
if (!empty($invalidParams)) {
throw new api_Exception(implode(',', array_keys($invalidParams)) . " not valid settings");
*/
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 = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, $value) . CRM_Core_DAO::VALUE_SEPARATOR;
}
if (empty($fieldSpec['validate_callback'])) {
return TRUE;
}
else {
- list($class,$fn) = explode('::',$fieldSpec['validate_callback']);
- if (!$class::$fn($value,$fieldSpec)) {
+ list($class, $fn) = explode('::', $fieldSpec['validate_callback']);
+ if (!$class::$fn($value, $fieldSpec)) {
throw new api_Exception("validation failed for {$fieldSpec['name']} = $value based on callback {$fieldSpec['validate_callback']}");
}
}
$metaDataFolders = array($civicrm_root . '/settings');
CRM_Utils_Hook::alterSettingsFolders($metaDataFolders);
$settingsMetadata = self::loadSettingsMetaDataFolders($metaDataFolders);
- CRM_Core_BAO_Cache::setItem($settingsMetadata,'CiviCRM setting Spec', 'All', $componentID);
+ CRM_Core_BAO_Cache::setItem($settingsMetadata, 'CiviCRM setting Spec', 'All', $componentID);
}
$cached = 0;
}
$settings = include $file;
$settingMetaData = array_merge($settingMetaData, $settings);
}
- CRM_Core_BAO_Cache::setItem($settingMetaData,'CiviCRM setting Spec', 'All');
+ CRM_Core_BAO_Cache::setItem($settingMetaData, 'CiviCRM setting Spec', 'All');
return $settingMetaData;
}
if (!empty($cbValues)) {
$optionValue = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
- array_keys($cbValues)
- ) . CRM_Core_DAO::VALUE_SEPARATOR;
+ array_keys($cbValues)
+ ) . CRM_Core_DAO::VALUE_SEPARATOR;
}
else {
$optionValue = NULL;
* @return array
*/
public static function getTagsUsedFor($usedFor = array(
- 'civicrm_contact'),
- $buildSelect = TRUE,
- $all = FALSE,
- $parentId = NULL
+ 'civicrm_contact'
+ ),
+ $buildSelect = TRUE,
+ $all = FALSE,
+ $parentId = NULL
) {
$tags = array();
'prefix' => '',
'name' => $dao->name,
'idPrefix' => $idPrefix,
- );
+ );
}
else {
$rows[] = array(
'name' => $dao->name,
'parent_id' => $dao->parent_id,
'idPrefix' => $idPrefix,
- );
+ );
}
}
// iterate through because we must modify the unplaced nodes list
// during the loop.
while (count($roots)) {
- $new_roots = array();
- $current_rows = $rows;
- $root = array_shift($roots);
+ $new_roots = array();
+ $current_rows = $rows;
+ $root = array_shift($roots);
$tags[$root['id']] = array(
$root['prefix'],
$root['name'],
$root['idPrefix'],
- );
+ );
// As you find the children, append them to the end of the new set
// of roots (maintain alphabetical ordering). Also remove the node
'prefix' => $tags[$root['id']][0] . $separator,
'name' => $row['name'],
'idPrefix' => $row['idPrefix'],
- );
+ );
unset($rows[$key]);
}
}
// save creator id and time
if (!$tag->id) {
- $session = CRM_Core_Session::singleton();
- $tag->created_id = $session->get('userID');
+ $session = CRM_Core_Session::singleton();
+ $tag->created_id = $session->get('userID');
$tag->created_date = date('YmdHis');
}
if ($tag->parent_id === 'null') {
CRM_Core_DAO::executeQuery("UPDATE civicrm_tag SET used_for=%1 WHERE parent_id = %2",
array(
- 1 => array($params['used_for'], 'String'),
+ 1 => array($params['used_for'], 'String'),
2 => array($tag->id, 'Integer'),
)
);
$tagSets = array();
$query = "SELECT name, id FROM civicrm_tag
WHERE is_tagset=1 AND parent_id IS NULL and used_for LIKE %1";
- $dao = CRM_Core_DAO::executeQuery($query, array(1 => array('%' . $entityTable . '%', 'String')), TRUE, NULL, FALSE, FALSE);
+ $dao = CRM_Core_DAO::executeQuery($query, array(
+ 1 => array(
+ '%' . $entityTable . '%',
+ 'String'
+ )
+ ), TRUE, NULL, FALSE, FALSE);
while ($dao->fetch()) {
$tagSets[$dao->id] = $dao->name;
}
$profileFields = civicrm_api3('uf_field', 'get', array_merge($profileFilter,
array(
- 'is_active' => 1,
- 'return' => 'field_name, is_required',
- 'options' => array(
- 'limit' => 0,
- ))
+ 'is_active' => 1,
+ 'return' => 'field_name, is_required',
+ 'options' => array(
+ 'limit' => 0,
+ )
+ )
));
//check for valid fields ( fields that are present in billing block )
$validBillingFields = array(
}
if (!empty($index) && (
- // it's empty so we set it OR
- !CRM_Utils_array::value($prefixName, $profileAddressFields)
+ // it's empty so we set it OR
+ !CRM_Utils_array::value($prefixName, $profileAddressFields)
//we are dealing with billing id (precedence)
|| $index == $billing_id
// we are dealing with primary & billing not set
|| ($index == 'Primary' && $profileAddressFields[$prefixName] != $billing_id)
|| ($index == CRM_Core_BAO_LocationType::getDefault()->id
- && $profileAddressFields[$prefixName] != $billing_id
- && $profileAddressFields[$prefixName] != 'Primary'
+ && $profileAddressFields[$prefixName] != $billing_id
+ && $profileAddressFields[$prefixName] != 'Primary'
+ )
)
- )
) {
$profileAddressFields[$prefixName] = $index;
}
$potentiallyMissingRequiredFields = array_diff($requiredBillingFields, $requiredProfileFields);
- CRM_Core_Resources::singleton()->addSetting(array('billing' => array('billingProfileIsHideable' => empty($potentiallyMissingRequiredFields))));
+ CRM_Core_Resources::singleton()
+ ->addSetting(array('billing' => array('billingProfileIsHideable' => empty($potentiallyMissingRequiredFields))));
}
/**
* Get a list of fields which can be added to profiles
*
- * @param int $gid: UF group ID
- * @param array $defaults: Form defaults
+ * @param int $gid : UF group ID
+ * @param array $defaults : Form defaults
* @return array, multidimensional; e.g. $result['FieldGroup']['field_name']['label']
* @static
*/
* @param array $params
*/
public static function deleteAll(&$params) {
- $module = CRM_Utils_Array::value('module', $params);
+ $module = CRM_Utils_Array::value('module', $params);
$entityTable = CRM_Utils_Array::value('entity_table', $params);
- $entityID = CRM_Utils_Array::value('entity_id', $params);
+ $entityID = CRM_Utils_Array::value('entity_id', $params);
if (empty($entityTable) ||
empty($entityID) ||
return;
}
- $dao = new CRM_Core_DAO_UFJoin();
- $dao->module = $module;
+ $dao = new CRM_Core_DAO_UFJoin();
+ $dao->module = $module;
$dao->entity_table = $entityTable;
- $dao->entity_id = $entityID;
+ $dao->entity_id = $entityID;
$dao->delete();
}
$dao = new CRM_Core_DAO_UFJoin();
$dao->entity_table = CRM_Utils_Array::value('entity_table', $params);
- $dao->entity_id = CRM_Utils_Array::value('entity_id', $params);
- $dao->weight = CRM_Utils_Array::value('weight', $params);
+ $dao->entity_id = CRM_Utils_Array::value('entity_id', $params);
+ $dao->weight = CRM_Utils_Array::value('weight', $params);
if ($dao->find(TRUE)) {
return $dao->uf_group_id;
}
}
//make sure we have session w/ consistent ids.
- $ufID = $ufmatch->uf_id;
- $userID = $ufmatch->contact_id;
+ $ufID = $ufmatch->uf_id;
+ $userID = $ufmatch->contact_id;
$ufUniqID = '';
if ($isUserLoggedIn) {
$loggedInUserUfID = CRM_Utils_System::getLoggedInUfID();
//are we processing logged in user.
if ($loggedInUserUfID && $loggedInUserUfID != $ufID) {
- $userIds = self::getUFValues($loggedInUserUfID);
- $ufID = CRM_Utils_Array::value('uf_id', $userIds, '');
- $userID = CRM_Utils_Array::value('contact_id', $userIds, '');
+ $userIds = self::getUFValues($loggedInUserUfID);
+ $ufID = CRM_Utils_Array::value('uf_id', $userIds, '');
+ $userID = CRM_Utils_Array::value('contact_id', $userIds, '');
$ufUniqID = CRM_Utils_Array::value('uf_name', $userIds, '');
}
}
$newContact = FALSE;
// make sure that a contact id exists for this user id
- $ufmatch = new CRM_Core_DAO_UFMatch();
+ $ufmatch = new CRM_Core_DAO_UFMatch();
$ufmatch->domain_id = CRM_Core_Config::domainID();
- $ufmatch->uf_id = $userKey;
+ $ufmatch->uf_id = $userKey;
if (!$ufmatch->find(TRUE)) {
$transaction = new CRM_Core_Transaction();
$conflict = CRM_Core_DAO::singleValueQuery($sql, $params);
if (!$conflict) {
- $found = TRUE;
+ $found = TRUE;
$ufmatch->contact_id = $dao->contact_id;
- $ufmatch->uf_name = $uniqId;
+ $ufmatch->uf_name = $uniqId;
}
}
}
}
- $contactId = CRM_Contact_BAO_Contact::createProfileContact($params, CRM_Core_DAO::$_nullArray);
+ $contactId = CRM_Contact_BAO_Contact::createProfileContact($params, CRM_Core_DAO::$_nullArray);
$ufmatch->contact_id = $contactId;
- $ufmatch->uf_name = $uniqId;
+ $ufmatch->uf_name = $uniqId;
}
// check that there are not two CMS IDs matching the same CiviCRM contact - this happens when a civicrm
$update = FALSE;
// 1.do check for contact Id.
- $ufmatch = new CRM_Core_DAO_UFMatch();
+ $ufmatch = new CRM_Core_DAO_UFMatch();
$ufmatch->contact_id = $contactId;
- $ufmatch->domain_id = CRM_Core_Config::domainID();
+ $ufmatch->domain_id = CRM_Core_Config::domainID();
if (!$ufmatch->find(TRUE)) {
return;
}
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
$emailAddress = $strtolower($emailAddress);
- $ufmatch = new CRM_Core_DAO_UFMatch();
+ $ufmatch = new CRM_Core_DAO_UFMatch();
$ufmatch->contact_id = $contactId;
- $ufmatch->domain_id = CRM_Core_Config::domainID();
+ $ufmatch->domain_id = CRM_Core_Config::domainID();
if ($ufmatch->find(TRUE)) {
// Save the email in UF Match table
$ufmatch->uf_name = $emailAddress;
}
else {
//else insert a new email record
- $email = new CRM_Core_DAO_Email();
+ $email = new CRM_Core_DAO_Email();
$email->contact_id = $contactId;
$email->is_primary = 1;
- $email->email = $emailAddress;
+ $email->email = $emailAddress;
$email->save();
$emailID = $email->id;
}
static $ufValues;
if ($ufID && !isset($ufValues[$ufID])) {
- $ufmatch = new CRM_Core_DAO_UFMatch();
- $ufmatch->uf_id = $ufID;
+ $ufmatch = new CRM_Core_DAO_UFMatch();
+ $ufmatch->uf_id = $ufID;
$ufmatch->domain_id = CRM_Core_Config::domainID();
if ($ufmatch->find(TRUE)) {
$ufValues[$ufID] = array(
* @static
*/
public static function &getValues(&$params, &$values) {
- $websites = array();
- $website = new CRM_Core_DAO_Website();
+ $websites = array();
+ $website = new CRM_Core_DAO_Website();
$website->contact_id = $params['contact_id'];
$website->find();
$params = array(1 => array($id, 'Integer'));
$websites = $values = array();
- $dao = CRM_Core_DAO::executeQuery($query, $params);
- $count = 1;
+ $dao = CRM_Core_DAO::executeQuery($query, $params);
+ $count = 1;
while ($dao->fetch()) {
$values = array(
'id' => $dao->id,
public function __construct() {
parent::__construct();
}
+
/**
* Takes a bunch of params that are needed to match certain criteria and
* retrieves the relevant objects.
$wordReplacementCreateParams = array();
// get all domains
$result = civicrm_api3('domain', 'get', array(
- 'return' => array('locale_custom_strings'),
- ));
+ 'return' => array('locale_custom_strings'),
+ ));
if (!empty($result["values"])) {
foreach ($result["values"] as $value) {
$params = array();
foreach (self::properties() as $id => $value) {
if ($value['active']) {
if (in_array($id, array(
- self::ADD, self::CREATE_NEW))) {
+ self::ADD,
+ self::CREATE_NEW
+ ))) {
$hasAccess = TRUE;
if (!CRM_Core_Permission::check('add contacts') &&
!CRM_Core_Permission::check('edit groups')
$defaultLocation = CRM_Core_BAO_LocationType::getDefault();
$defaultPrimaryLocationId = $defaultLocation->id;
$values = array(
- 'postURL' => CRM_Utils_System::url('civicrm/contact/add', 'reset=1&ct=Individual'),
+ 'postURL' => CRM_Utils_System::url('civicrm/contact/add', 'reset=1&ct=Individual'),
'primaryLocationType' => $defaultPrimaryLocationId,
);
$urlArray = array(
'fullTextSearchID' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue',
'CRM_Contact_Form_Search_Custom_FullText', 'value', 'name'
- ));
+ )
+ );
self::setProperty(self::FULLTEXT_SEARCH, 'templateValues', $urlArray);
break;
'query' => 'action=add&reset=1&context=standalone',
'ref' => 'new-activity',
'title' => ts('Activity'),
- )));
+ )
+ ));
$components = CRM_Core_Component::getEnabledComponents();
// new email (select recipients)
$shortCuts = array_merge($shortCuts, array(
array(
- 'path' => 'civicrm/activity/email/add',
- 'query' => 'atype=3&action=add&reset=1&context=standalone',
- 'ref' => 'new-email',
- 'title' => ts('Email'),
- )));
+ 'path' => 'civicrm/activity/email/add',
+ 'query' => 'atype=3&action=add&reset=1&context=standalone',
+ 'ref' => 'new-email',
+ 'title' => ts('Email'),
+ )
+ ));
if (CRM_Core_Permission::check('edit groups')) {
$shortCuts = array_merge($shortCuts, array(
array(
- 'path' => 'civicrm/group/add',
- 'query' => 'reset=1',
- 'ref' => 'new-group',
- 'title' => ts('Group'),
- )));
+ 'path' => 'civicrm/group/add',
+ 'query' => 'reset=1',
+ 'ref' => 'new-group',
+ 'title' => ts('Group'),
+ )
+ ));
}
if (CRM_Core_Permission::check('administer CiviCRM')) {
$shortCuts = array_merge($shortCuts, array(
array(
- 'path' => 'civicrm/admin/tag',
- 'query' => 'reset=1&action=add',
- 'ref' => 'new-tag',
- 'title' => ts('Tag'),
- )));
+ 'path' => 'civicrm/admin/tag',
+ 'query' => 'reset=1&action=add',
+ 'ref' => 'new-tag',
+ 'title' => ts('Tag'),
+ )
+ ));
}
if (empty($shortCuts)) {
$value['url'] = CRM_Utils_System::url($short['path'], $short['query'], FALSE);
}
$value['title'] = $short['title'];
- $value['ref'] = $short['ref'];
+ $value['ref'] = $short['ref'];
if (!empty($short['shortCuts'])) {
foreach ($short['shortCuts'] as $shortCut) {
$value['shortCuts'][] = self::setShortcutValues($shortCut);
if (CRM_Core_Permission::check('access Contact Dashboard')) {
$dashboardLinks = array(
array(
- 'path' => 'civicrm/user',
+ 'path' => 'civicrm/user',
'query' => 'reset=1',
'title' => ts('My Contact Dashboard'),
- ));
+ )
+ );
}
if (empty($dashboardLinks)) {
$value['url'] = CRM_Utils_System::url($dash['path'], $dash['query'], FALSE);
}
$value['title'] = $dash['title'];
- $value['key'] = CRM_Utils_Array::value('key', $dash);
- $values[] = $value;
+ $value['key'] = CRM_Utils_Array::value('key', $dash);
+ $values[] = $value;
}
self::setProperty(self::DASHBOARD, 'templateValues', array('dashboardLinks' => $values));
}
if (!($shortCuts)) {
$shortCuts = array(
array(
- 'path' => 'civicrm/mailing/send',
+ 'path' => 'civicrm/mailing/send',
'query' => 'reset=1',
'title' => ts('Send Mailing'),
),
$values = array();
foreach ($shortCuts as $short) {
- $value = array();
- $value['url'] = CRM_Utils_System::url($short['path'], $short['query']);
+ $value = array();
+ $value['url'] = CRM_Utils_System::url($short['path'], $short['query']);
$value['title'] = $short['title'];
- $values[] = $value;
+ $values[] = $value;
}
self::setProperty(self::MAIL, 'templateValues', array('shortCuts' => $values));
}
return NULL;
}
- $block = array();
- $block['name'] = 'block-civicrm';
- $block['id'] = $block['name'] . '_' . $id;
+ $block = array();
+ $block['name'] = 'block-civicrm';
+ $block['id'] = $block['name'] . '_' . $id;
$block['subject'] = self::fetch($id, 'Subject.tpl',
array('subject' => self::getProperty($id, 'subject'))
);
public function setupCms() {
if (!in_array($this->config->cms, array(
- 'drupal', 'joomla', 'wordpress'))) {
+ 'drupal',
+ 'joomla',
+ 'wordpress'
+ ))
+ ) {
echo "Config file for '{$this->config->cms}' not known.";
exit();
}
CRM_Core_CodeGen_Util_Smarty::singleton()->setPluginDirs($smartyPluginDirs);
- $versionFile = "version.xml";
- $versionXML = CRM_Core_CodeGen_Util_Xml::parse($versionFile);
- $this->db_version = $versionXML->version_no;
+ $versionFile = "version.xml";
+ $versionXML = CRM_Core_CodeGen_Util_Xml::parse($versionFile);
+ $this->db_version = $versionXML->version_no;
$this->buildVersion = preg_replace('/^(\d{1,2}\.\d{1,2})\.(\d{1,2}|\w{4,7})$/i', '$1', $this->db_version);
if (isset($argVersion)) {
// change the version to that explicitly passed, if any
* @param $fields
*/
public function getField(&$fieldXML, &$fields) {
- $name = trim((string ) $fieldXML->name);
+ $name = trim((string ) $fieldXML->name);
$field = array('name' => $name, 'localizable' => $fieldXML->localizable);
- $type = (string ) $fieldXML->type;
+ $type = (string ) $fieldXML->type;
switch ($type) {
case 'varchar':
case 'char':
$field['cols'] = isset($fieldXML->html) ? $this->value('cols', $fieldXML->html) : NULL;
break;
- break;
+ break;
case 'datetime':
$field['sqlType'] = $field['phpType'] = $type;
}
$field['required'] = $this->value('required', $fieldXML);
- $field['collate'] = $this->value('collate', $fieldXML);
- $field['comment'] = $this->value('comment', $fieldXML);
- $field['default'] = $this->value('default', $fieldXML);
- $field['import'] = $this->value('import', $fieldXML);
+ $field['collate'] = $this->value('collate', $fieldXML);
+ $field['comment'] = $this->value('comment', $fieldXML);
+ $field['default'] = $this->value('default', $fieldXML);
+ $field['import'] = $this->value('import', $fieldXML);
if ($this->value('export', $fieldXML)) {
$field['export'] = $this->value('export', $fieldXML);
}
$index = array();
// empty index name is fine
- $indexName = trim((string) $indexXML->name);
- $index['name'] = $indexName;
+ $indexName = trim((string) $indexXML->name);
+ $index['name'] = $indexName;
$index['field'] = array();
// populate fields
$fields = array();
foreach ($info as $name => $comp) {
if ($comp->usesSearch()) {
- $bqr = $comp->getBAOQueryObject();
- $flds = $bqr->getFields();
+ $bqr = $comp->getBAOQueryObject();
+ $flds = $bqr->getFields();
$fields = array_merge($fields, $flds);
}
}
* $Id$
*
*/
-
abstract class CRM_Core_Component_Config {
/**
* $Id$
*
*/
-
abstract class CRM_Core_Component_Info {
/**
* @param int $componentID
*/
public function __construct($name, $namespace, $componentID) {
- $this->name = $name;
- $this->namespace = $namespace;
+ $this->name = $name;
+ $this->namespace = $namespace;
$this->componentID = $componentID;
- $this->info = $this->getInfo();
+ $this->info = $this->getInfo();
$this->info['url'] = $this->getKeyword();
}
// Whether we delete/create or simply preserve directories, we should
// certainly make sure the restrictions are enforced.
- foreach (array($this->templateCompileDir, $this->uploadDir, $this->configAndLogDir, $this->customFileUploadDir) as $dir) {
+ foreach (array(
+ $this->templateCompileDir,
+ $this->uploadDir,
+ $this->configAndLogDir,
+ $this->customFileUploadDir
+ ) as $dir) {
if ($dir && is_dir($dir)) {
CRM_Utils_File::restrictAccess($dir);
}
global $civicrm_root;
$cmsPath = $config->userSystem->cmsRootPath();
$defaults['userFrameworkResourceURL'] = $baseURL . str_replace("$cmsPath/", '',
- str_replace('\\', '/', $civicrm_root)
- );
+ str_replace('\\', '/', $civicrm_root)
+ );
if (strpos($civicrm_root,
DIRECTORY_SEPARATOR . 'sites' .
DIRECTORY_SEPARATOR . 'all' .
DIRECTORY_SEPARATOR . 'modules'
- ) === FALSE) {
+ ) === FALSE
+ ) {
$startPos = strpos($civicrm_root,
DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR
);
* @var array
*/
public $enableComponents = array(
- 'CiviContribute', 'CiviPledge', 'CiviMember',
- 'CiviEvent', 'CiviMail', 'CiviReport',
+ 'CiviContribute',
+ 'CiviPledge',
+ 'CiviMember',
+ 'CiviEvent',
+ 'CiviMail',
+ 'CiviReport',
);
public $enableComponentIDs = array(1, 6, 2, 3, 4, 8);
// definitely different for different forms
$name = $scope;
}
- $name = $name . '_' . $this->key($name, $addSequence, $ignoreKey);
+ $name = $name . '_' . $this->key($name, $addSequence, $ignoreKey);
$this->_title = $title;
if ($scope) {
$this->_scope = $scope;
if (!empty($this->_key)) {
CRM_Core_Session::registerAndRetrieveSessionObjects(array(
"_{$name}_container",
- array('CiviCRM', $this->_scope),
- ));
+ array('CiviCRM', $this->_scope),
+ ));
}
$this->HTML_QuickForm_Controller($name, $modal);
public function fini() {
CRM_Core_BAO_Cache::storeSessionToCache(array(
- "_{$this->_name}_container",
+ "_{$this->_name}_container",
array('CiviCRM', $this->_scope),
),
TRUE
$pages = $stateMachine->getPages();
foreach ($pages as $name => $value) {
$className = CRM_Utils_Array::value('className', $value, $name);
- $title = CRM_Utils_Array::value('title', $value);
- $options = CRM_Utils_Array::value('options', $value);
+ $title = CRM_Utils_Array::value('title', $value);
+ $options = CRM_Utils_Array::value('options', $value);
$stateName = CRM_Utils_String::getClassName($className);
if (!empty($value['className'])) {
$formName = $name;
* @param string $name
* : name of the variable.
*
-
*
* @return mixed
*/
* @return array
*/
public function wizardHeader($currentPageName) {
- $wizard = array();
+ $wizard = array();
$wizard['steps'] = array();
- $count = 0;
+ $count = 0;
foreach ($this->_pages as $name => $page) {
$count++;
$wizard['steps'][] = array(
static $_dbColumnValueCache = NULL;
const NOT_NULL = 1, IS_NULL = 2,
- DB_DAO_NOTNULL = 128,
- VALUE_SEPARATOR = "\ 1",
- BULK_INSERT_COUNT = 200,
- BULK_INSERT_HIGH_COUNT = 200,
- // special value for mail bulk inserts to avoid
- // potential duplication, assuming a smaller number reduces number of queries
- // by some factor, so some tradeoff. CRM-8678
- BULK_MAIL_INSERT_COUNT = 10,
- QUERY_FORMAT_WILDCARD = 1,
- QUERY_FORMAT_NO_QUOTES = 2;
+ DB_DAO_NOTNULL = 128,
+ VALUE_SEPARATOR = "\ 1",
+ BULK_INSERT_COUNT = 200,
+ BULK_INSERT_HIGH_COUNT = 200,
+ // special value for mail bulk inserts to avoid
+ // potential duplication, assuming a smaller number reduces number of queries
+ // by some factor, so some tradeoff. CRM-8678
+ BULK_MAIL_INSERT_COUNT = 10,
+ QUERY_FORMAT_WILDCARD = 1,
+ QUERY_FORMAT_NO_QUOTES = 2;
/*
* Define entities that shouldn't be created or deleted when creating/ deleting
*
* @return array
*/
- static function &fields() {
+ static function &fields() {
$result = NULL;
return $result;
}
return;
}
- $dao = new CRM_Core_DAO_Log();
- $dao->entity_table = $this->getTableName();
- $dao->entity_id = $this->id;
- $dao->modified_id = $cid;
+ $dao = new CRM_Core_DAO_Log();
+ $dao->entity_table = $this->getTableName();
+ $dao->entity_id = $this->id;
+ $dao->modified_id = $cid;
$dao->modified_date = date("YmdHis");
$dao->insert();
}
$cols = 80;
}
- $attributes = array();
+ $attributes = array();
$attributes['rows'] = $rows;
$attributes['cols'] = $cols;
return $attributes;
* @static
*/
public static function getAttribute($class, $fieldName = NULL) {
- $object = new $class( );
+ $object = new $class();
$fields = &$object->fields();
if ($fieldName != NULL) {
$field = CRM_Utils_Array::value($fieldName, $fields);
* @static
*/
public static function objectExists($value, $daoName, $daoID, $fieldName = 'name') {
- $object = new $daoName( );
+ $object = new $daoName();
$object->$fieldName = $value;
$config = CRM_Core_Config::singleton();
LIKE %1
";
$params = array(1 => array($columnName, 'String'));
- $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, NULL, FALSE, $i18nRewrite);
+ $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, NULL, FALSE, $i18nRewrite);
$result = $dao->fetch() ? TRUE : FALSE;
$dao->free();
return $result;
}
$constraint = "`FK_{$tableName}_{$columnName}`";
$pattern = "/\bCONSTRAINT\b\s+%s\s+\bFOREIGN\s+KEY\b\s/i";
- return preg_match(sprintf($pattern, $constraint),$show[$tableName]) ? TRUE : FALSE;
+ return preg_match(sprintf($pattern, $constraint), $show[$tableName]) ? TRUE : FALSE;
}
/**
* @static
*/
public static function checkFieldHasAlwaysValue($tableName, $columnName, $columnValue) {
- $query = "SELECT * FROM $tableName WHERE $columnName != '$columnValue'";
- $dao = CRM_Core_DAO::executeQuery($query);
+ $query = "SELECT * FROM $tableName WHERE $columnName != '$columnValue'";
+ $dao = CRM_Core_DAO::executeQuery($query);
$result = $dao->fetch() ? FALSE : TRUE;
$dao->free();
return $result;
* @static
*/
public static function checkFieldIsAlwaysNull($tableName, $columnName) {
- $query = "SELECT * FROM $tableName WHERE $columnName IS NOT NULL";
- $dao = CRM_Core_DAO::executeQuery($query);
+ $query = "SELECT * FROM $tableName WHERE $columnName IS NOT NULL";
+ $dao = CRM_Core_DAO::executeQuery($query);
$result = $dao->fetch() ? FALSE : TRUE;
$dao->free();
return $result;
}
if (!array_key_exists($cacheKey, self::$_dbColumnValueCache) || $force) {
- $object = new $daoName( );
+ $object = new $daoName();
$object->$searchColumn = $searchValue;
$object->selectAdd();
$object->selectAdd($returnColumn);
* @static
*/
public static function setFieldValue($daoName, $searchValue, $setColumn, $setValue, $searchColumn = 'id') {
- $object = new $daoName( );
+ $object = new $daoName();
$object->selectAdd();
$object->selectAdd("$searchColumn, $setColumn");
$object->$searchColumn = $searchValue;
* @static
*/
public static function commonRetrieve($daoName, &$params, &$defaults, $returnProperities = NULL) {
- $object = new $daoName( );
+ $object = new $daoName();
$object->copyValues($params);
// return only specific fields if returnproperties are sent
* @static
*/
public static function deleteEntityContact($daoName, $contactId) {
- $object = new $daoName( );
+ $object = new $daoName();
$object->entity_table = 'civicrm_contact';
$object->entity_id = $contactId;
*/
static function &executeQuery(
$query,
- $params = array(),
- $abort = TRUE,
- $daoName = NULL,
- $freeDAO = FALSE,
- $i18nRewrite = TRUE,
+ $params = array(),
+ $abort = TRUE,
+ $daoName = NULL,
+ $freeDAO = FALSE,
+ $i18nRewrite = TRUE,
$trapException = FALSE
) {
$queryStr = self::composeQuery($query, $params, $abort);
$dao = new CRM_Core_DAO();
}
else {
- $dao = new $daoName( );
+ $dao = new $daoName();
}
if ($trapException) {
*/
static function &singleValueQuery(
$query,
- $params = array(),
- $abort = TRUE,
+ $params = array(),
+ $abort = TRUE,
$i18nRewrite = TRUE
) {
$queryStr = self::composeQuery($query, $params, $abort);
* @return (reference ) the newly created copy of the object
*/
static function ©Generic($daoName, $criteria, $newData = NULL, $fieldsFix = NULL, $blockCopyOfDependencies = NULL) {
- $object = new $daoName( );
+ $object = new $daoName();
if (!$newData) {
$object->id = $criteria['id'];
}
break;
}
- $newObject = new $daoName( );
+ $newObject = new $daoName();
$fields = &$object->fields();
if (!is_array($fieldsFix)) {
- $fieldsToPrefix = array();
- $fieldsToSuffix = array();
+ $fieldsToPrefix = array();
+ $fieldsToSuffix = array();
$fieldsToReplace = array();
}
if (!empty($fieldsFix['prefix'])) {
}
public static function cascadeUpdate($daoName, $fromId, $toId, $newData = array()) {
- $object = new $daoName( );
+ $object = new $daoName();
$object->id = $fromId;
if ($object->find(TRUE)) {
- $newObject = new $daoName( );
+ $newObject = new $daoName();
$newObject->id = $toId;
if ($newObject->find(TRUE)) {
* @static
*/
public static function commonRetrieveAll($daoName, $fieldIdName = 'id', $fieldId, &$details, $returnProperities = NULL) {
- require_once (str_replace('_', DIRECTORY_SEPARATOR, $daoName) . ".php");
- $object = new $daoName( );
+ require_once(str_replace('_', DIRECTORY_SEPARATOR, $daoName) . ".php");
+ $object = new $daoName();
$object->$fieldIdName = $fieldId;
// return only specific fields if returnproperties are sent
// note that mysql does not escape these characters
if ($string && in_array($string,
array('%', '_', '%%', '_%')
- )) {
+ )
+ ) {
return '\\' . $string;
}
'CRM_Core_DAO_StateProvince',
'CRM_Core_DAO_Country',
'CRM_Core_DAO_Domain',
- 'CRM_Financial_DAO_FinancialType'//because valid ones exist & we use pick them due to pseudoconstant can't reliably create & delete these
+ 'CRM_Financial_DAO_FinancialType'
+ //because valid ones exist & we use pick them due to pseudoconstant can't reliably create & delete these
);
// Prefer to instantiate BAO's instead of DAO's (when possible)
/** @var CRM_Core_DAO $object */
$object = new $daoName();
- $fields = & $object->fields();
+ $fields = &$object->fields();
foreach ($fields as $fieldName => $fieldDef) {
$dbName = $fieldDef['name'];
$FKClassName = CRM_Utils_Array::value('FKClassName', $fieldDef);
&& ($required || $dbName == 'contact_id')
//I'm a bit stuck on this one - we might need to change the singleValueAlter so that the entities don't share a contact
// to make this test process pass - line below makes pass for now
- && $dbName != 'member_of_contact_id') {
+ && $dbName != 'member_of_contact_id'
+ ) {
$deletions[] = array($FKClassName, array('id' => $object->$dbName)); // x
}
}
foreach ($deletions as $deletion) {
CRM_Core_DAO::deleteTestObjects($deletion[0], $deletion[1]);
- }
+ }
}
/**
}
foreach ($tables as $eventName => $events) {
foreach ($events as $whenName => $parts) {
- $varString = implode("\n", $parts['variables']);
- $sqlString = implode("\n", $parts['sql']);
- $validName = CRM_Core_DAO::shortenSQLName($tableName, 48, TRUE);
+ $varString = implode("\n", $parts['variables']);
+ $sqlString = implode("\n", $parts['sql']);
+ $validName = CRM_Core_DAO::shortenSQLName($tableName, 48, TRUE);
$triggerName = "{$validName}_{$whenName}_{$eventName}";
- $triggerSQL = "CREATE TRIGGER $triggerName $whenName $eventName ON $tableName FOR EACH ROW BEGIN $varString $sqlString END";
+ $triggerSQL = "CREATE TRIGGER $triggerName $whenName $eventName ON $tableName FOR EACH ROW BEGIN $varString $sqlString END";
CRM_Core_DAO::executeQuery("DROP TRIGGER IF EXISTS $triggerName");
CRM_Core_DAO::executeQuery(
default:
if (!$returnSanitisedArray) {
- return(sprintf('%s %s "%s"', $fieldName, $operator, CRM_Core_DAO::escapeString($criteria)));
+ return (sprintf('%s %s "%s"', $fieldName, $operator, CRM_Core_DAO::escapeString($criteria)));
}
else {
return NULL; // not yet implemented (tests required to implement)
* @return array
*/
public static function acceptedSQLOperators() {
- return array('=', '<=', '>=', '>', '<', 'LIKE', "<>", "!=", "NOT LIKE", 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN', 'IS NOT NULL', 'IS NULL');
+ return array(
+ '=',
+ '<=',
+ '>=',
+ '>',
+ '<',
+ 'LIKE',
+ "<>",
+ "!=",
+ "NOT LIKE",
+ 'IN',
+ 'NOT IN',
+ 'BETWEEN',
+ 'NOT BETWEEN',
+ 'IS NOT NULL',
+ 'IS NULL'
+ );
}
/**
/**
* @param array $params
*/
- public function setApiFilter(&$params) {}
+ public function setApiFilter(&$params) {
+ }
}
$file = self::$_prefix[$type] . $className;
$class = str_replace('/', '_', $file);
- require_once ($file . self::$_suffix);
+ require_once($file . self::$_suffix);
if ($type == 'singleton') {
$newObj = $class::singleton();
* Decide what permissions to check for an api call
* The contact must have all of the returned permissions for the api call to be allowed
*
- * @param $entity: (str) api entity
- * @param $action: (str) api action
- * @param $params: (array) api params
+ * @param $entity : (str) api entity
+ * @param $action : (str) api action
+ * @param $params : (array) api params
*
* @return array
- * of permissions to check for this entity-action combo
+ * of permissions to check for this entity-action combo
*/
function _civicrm_api3_permissions($entity, $action, &$params) {
$entity = _civicrm_api_get_entity_name_from_camel($entity);
<?php
+
/**
* This is included for backward compatibility with DAO's generated before 4.5.
*
* @param int $code
* @param Exception $previous
*/
- public function __construct($message = NULL, $code = 0, Exception$previous = NULL) {
+ public function __construct($message = NULL, $code = 0, Exception $previous = NULL) {
parent::__construct($message, $code, $previous);
}
}
}
// create the error array
- $error = array();
- $error['callback'] = $pearError->getCallback();
- $error['code'] = $pearError->getCode();
- $error['message'] = $pearError->getMessage();
- $error['mode'] = $pearError->getMode();
+ $error = array();
+ $error['callback'] = $pearError->getCallback();
+ $error['code'] = $pearError->getCode();
+ $error['message'] = $pearError->getMessage();
+ $error['mode'] = $pearError->getMode();
$error['debug_info'] = $pearError->getDebugInfo();
- $error['type'] = $pearError->getType();
- $error['user_info'] = $pearError->getUserInfo();
- $error['to_string'] = $pearError->toString();
+ $error['type'] = $pearError->getType();
+ $error['user_info'] = $pearError->getUserInfo();
+ $error['to_string'] = $pearError->toString();
if (function_exists('mysql_error') &&
mysql_error()
) {
public static function simpleHandler($pearError) {
// create the error array
- $error = array();
- $error['callback'] = $pearError->getCallback();
- $error['code'] = $pearError->getCode();
- $error['message'] = $pearError->getMessage();
- $error['mode'] = $pearError->getMode();
+ $error = array();
+ $error['callback'] = $pearError->getCallback();
+ $error['code'] = $pearError->getCode();
+ $error['message'] = $pearError->getMessage();
+ $error['mode'] = $pearError->getMode();
$error['debug_info'] = $pearError->getDebugInfo();
- $error['type'] = $pearError->getType();
- $error['user_info'] = $pearError->getUserInfo();
- $error['to_string'] = $pearError->toString();
+ $error['type'] = $pearError->getType();
+ $error['user_info'] = $pearError->getUserInfo();
+ $error['to_string'] = $pearError->toString();
// ensure that debug does not check permissions since we are in bootstrap
// mode and need to print a decent message to help the user
if (!empty($trace['args'])) {
foreach ($trace['args'] as $arg) {
- if (! $showArgs || $skipArgs) {
+ if (!$showArgs || $skipArgs) {
$args[] = '(' . gettype($arg) . ')';
continue;
}
* @param array $data
* Extra params to return. eg an extra array of ids. It is not mandatory, but can help the computer using the api. Keep in mind the api consumer isn't to be trusted. eg. the database password is NOT a good extra data.
*/
-
class CRM_Core_Exception extends PEAR_Exception {
private $errorData = array();
<?php
+
interface CRM_Core_FileSearchInterface {
const DEFAULT_SEARCH_LIMIT = 20;
const DEFAULT_SEARCH_OFFSET = 0;
*/
public function registerRules() {
static $rules = array(
- 'title', 'longTitle', 'variable', 'qfVariable',
- 'phone', 'integer', 'query',
- 'url', 'wikiURL',
- 'domain', 'numberOfDigit',
- 'date', 'currentDate',
- 'asciiFile', 'htmlFile', 'utf8File',
- 'objectExists', 'optionExists', 'postalCode', 'money', 'positiveInteger',
- 'xssString', 'fileExists', 'autocomplete', 'validContact',
+ 'title',
+ 'longTitle',
+ 'variable',
+ 'qfVariable',
+ 'phone',
+ 'integer',
+ 'query',
+ 'url',
+ 'wikiURL',
+ 'domain',
+ 'numberOfDigit',
+ 'date',
+ 'currentDate',
+ 'asciiFile',
+ 'htmlFile',
+ 'utf8File',
+ 'objectExists',
+ 'optionExists',
+ 'postalCode',
+ 'money',
+ 'positiveInteger',
+ 'xssString',
+ 'fileExists',
+ 'autocomplete',
+ 'validContact',
);
foreach ($rules as $rule) {
$this->postProcessHook();
// Respond with JSON if in AJAX context (also support legacy value '6')
- if ($allowAjax && !empty($_REQUEST['snippet']) && in_array($_REQUEST['snippet'], array(CRM_Core_Smarty::PRINT_JSON, 6))) {
+ if ($allowAjax && !empty($_REQUEST['snippet']) && in_array($_REQUEST['snippet'], array(
+ CRM_Core_Smarty::PRINT_JSON,
+ 6
+ ))
+ ) {
$this->ajaxResponse['buttonName'] = str_replace('_qf_' . $this->getAttribute('id') . '_', '', $this->controller->getButtonName());
$this->ajaxResponse['action'] = $this->_action;
if (isset($this->_id) || isset($this->id)) {
//Set html data-attribute to enable warning user of unsaved changes
if ($this->unsavedChangesWarn === TRUE
- || (!isset($this->unsavedChangesWarn)
- && ($this->_action & CRM_Core_Action::ADD || $this->_action & CRM_Core_Action::UPDATE)
- )
- ) {
+ || (!isset($this->unsavedChangesWarn)
+ && ($this->_action & CRM_Core_Action::ADD || $this->_action & CRM_Core_Action::UPDATE)
+ )
+ ) {
$this->setAttribute('data-warn-changes', 'true');
}
}
}
else {
$tplname = str_replace('_',
- DIRECTORY_SEPARATOR,
- CRM_Utils_System::getClassName($this)
- ) . '.tpl';
+ DIRECTORY_SEPARATOR,
+ CRM_Utils_System::getClassName($this)
+ ) . '.tpl';
}
return $tplname;
}
*/
public function addYesNo($id, $title, $allowClear = FALSE, $required = NULL, $attributes = array()) {
$attributes += array('id_suffix' => $id);
- $choice = array();
+ $choice = array();
$choice[] = $this->createElement('radio', NULL, '11', ts('Yes'), '1', $attributes);
$choice[] = $this->createElement('radio', NULL, '11', ts('No'), '0', $attributes);
'editor_id'
);
$editor = strtolower(CRM_Utils_Array::value($editorID,
- CRM_Core_OptionGroup::values('wysiwyg_editor')
- ));
+ CRM_Core_OptionGroup::values('wysiwyg_editor')
+ ));
if (!$editor || $forceTextarea) {
$editor = 'textarea';
}
public function addCountry($id, $title, $required = NULL, $extra = NULL) {
$this->addElement('select', $id, $title,
array(
- '' => ts('- select -')) + CRM_Core_PseudoConstant::country(), $extra
+ '' => ts('- select -')
+ ) + CRM_Core_PseudoConstant::country(), $extra
);
if ($required) {
$this->addRule($id, ts('Please select %1', array(1 => $title)), 'required');
if (!empty($params[$fieldName])) {
$params[$fieldName] = CRM_Utils_Date::isoToMysql(
CRM_Utils_Date::processDate(
- $params[$fieldName],
- CRM_Utils_Array::value("{$fieldName}_time", $params), TRUE)
+ $params[$fieldName],
+ CRM_Utils_Array::value("{$fieldName}_time", $params), TRUE)
);
}
else {
*/
public function addAutoSelector($profiles = array(), $autoCompleteField = array()) {
$autoCompleteField = array_merge(array(
- 'id_field' => 'select_contact_id',
- 'placeholder' => ts('Select someone else ...'),
- 'show_hide' => TRUE,
- 'api' => array('params' => array('contact_type' => 'Individual')),
- ), $autoCompleteField);
+ 'id_field' => 'select_contact_id',
+ 'placeholder' => ts('Select someone else ...'),
+ 'show_hide' => TRUE,
+ 'api' => array('params' => array('contact_type' => 'Individual')),
+ ), $autoCompleteField);
if ($this->canUseAjaxContactLookups()) {
$this->assign('selectable', $autoCompleteField['id_field']);
- $this->addEntityRef($autoCompleteField['id_field'], NULL, array('placeholder' => $autoCompleteField['placeholder'], 'api' => $autoCompleteField['api']));
+ $this->addEntityRef($autoCompleteField['id_field'], NULL, array(
+ 'placeholder' => $autoCompleteField['placeholder'],
+ 'api' => $autoCompleteField['api']
+ ));
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/AlternateContactSelector.js', 1, 'html-header')
- ->addSetting(array(
- 'form' => array('autocompletes' => $autoCompleteField),
- 'ids' => array('profile' => $profiles),
- ));
+ ->addSetting(array(
+ 'form' => array('autocompletes' => $autoCompleteField),
+ 'ids' => array('profile' => $profiles),
+ ));
}
}
*/
public function canUseAjaxContactLookups() {
if (0 < (civicrm_api3('contact', 'getcount', array('check_permissions' => 1))) &&
- CRM_Core_Permission::check(array(array('access AJAX API', 'access CiviCRM')))) {
+ CRM_Core_Permission::check(array(array('access AJAX API', 'access CiviCRM')))
+ ) {
return TRUE;
}
}
*/
public function addChainSelect($elementName, $settings = array()) {
$props = $settings += array(
- 'control_field' => str_replace(array('state_province', 'StateProvince', 'county', 'County'), array('country', 'Country', 'state_province', 'StateProvince'), $elementName),
+ 'control_field' => str_replace(array('state_province', 'StateProvince', 'county', 'County'), array(
+ 'country',
+ 'Country',
+ 'state_province',
+ 'StateProvince'
+ ), $elementName),
'data-callback' => strpos($elementName, 'rovince') ? 'civicrm/ajax/jqState' : 'civicrm/ajax/jqCounty',
'label' => strpos($elementName, 'rovince') ? ts('State/Province') : ts('County'),
'data-empty-prompt' => strpos($elementName, 'rovince') ? ts('Choose country first') : ts('Choose state first'),
'previous_2.month' => ts('Previous 2 Months'),
'previous_2.week' => ts('Previous 2 Weeks'),
'previous_2.day' => ts('Previous 2 Days'),
-
'previous_before.year' => ts('Prior to Previous Year'),
'previous_before.quarter' => ts('Prior to Previous Quarter'),
'previous_before.month' => ts('Prior to Previous Month'),
'previous_before.week' => ts('Prior to Previous Week'),
'previous_before.day' => ts('Prior to Previous Day'),
-
'previous.year' => ts('Previous Year'),
'previous.fiscal_year' => ts('Previous Fiscal Year'),
'previous.quarter' => ts('Previous Quarter'),
'previous.month' => ts('Previous Month'),
'previous.week' => ts('Previous Week'),
-
'earlier.year' => ts('To End of Previous Year'),
'earlier.quarter' => ts('To End of Previous Quarter'),
'earlier.month' => ts('To End of Previous Month'),
'earlier.week' => ts('To End of Previous Week'),
'earlier.day' => ts('To End of Previous Day'),
-
'greater_previous.year' => ts('From End of Previous Year'),
'greater_previous.quarter' => ts('From End of Previous Quarter'),
'greater_previous.month' => ts('From End of Previous Month'),
'greater_previous.week' => ts('From End of Previous Week'),
-
'greater.year' => ts('From Start of Current Year'),
'greater.quarter' => ts('From Start of Current Quarter'),
'greater.month' => ts('From Start of Current Month'),
'greater.week' => ts('From Start of Current Week'),
'greater.day' => ts('From Start of Current Day'),
-
'current.year' => ts('Current Year to-date'),
'current.quarter' => ts('Current Quarter to-date'),
'current.month' => ts('Current Month to-date'),
'current.week' => ts('Current Week to-date'),
-
'ending_3.year' => ts('Last 3 Years'),
'ending_2.year' => ts('Last 2 Years'),
'ending.year' => ts('Last 12 Months'),
'ending.month' => ts('Last Month'),
'ending.week' => ts('Last 7 days'),
'previous.day' => ts('Yesterday'),
-
'this.year' => ts('This Year'),
'this.fiscal_year' => ts('This Fiscal Year'),
'this.quarter' => ts('This Quarter'),
'this.month' => ts('This Month'),
'this.week' => ts('This Week'),
'this.day' => ts('Today'),
-
'starting.day' => ts('Tomorrow'),
'starting.week' => ts('Upcoming 7 days'),
'starting.month' => ts('Upcoming Month'),
'starting.year' => ts('Upcoming 12 Months'),
-
'less.year' => ts('To End of Current Year'),
'less.quarter' => ts('To End of Current Quarter'),
'less.month' => ts('To End of Current Month'),
'less.week' => ts('To End of Current Week'),
-
'next.week' => ts('Next Week'),
'next.month' => ts('Next Month'),
'next.quarter' => ts('Next Quarter'),
$selector,
$required,
array('class' => 'crm-select2')
- );
+ );
$form->addDateRange($fieldName, $from, $to, $fromLabel, $dateFormat, FALSE, $displayTime);
}
* $Id$
*
*/
+
/**
* This class generates form components for processing Entity
*
}
// echo "<pre>";print_r($freqUnitsDisplay);
$dayOfTheWeek = array(
- 'monday' => 'Monday',
- 'tuesday' => 'Tuesday',
- 'wednesday' => 'Wednesday',
- 'thursday' => 'Thursday',
- 'friday' => 'Friday',
- 'saturday' => 'Saturday',
- 'sunday' => 'Sunday',
- );
+ 'monday' => 'Monday',
+ 'tuesday' => 'Tuesday',
+ 'wednesday' => 'Wednesday',
+ 'thursday' => 'Thursday',
+ 'friday' => 'Friday',
+ 'saturday' => 'Saturday',
+ 'sunday' => 'Sunday',
+ );
$form->add('select', 'repetition_frequency_unit', ts('Repeats:'), $freqUnitsDisplay);
$numericOptions = CRM_Core_SelectValues::getNumericOptions(1, 30);
$form->add('select', 'repetition_frequency_interval', ts('Repeats every:'), $numericOptions, '', array('style' => 'width:55px;'));
}
$form->addGroup($startActionCondition, 'start_action_condition', ts('Repeats on'));
$roptionTypes = array(
- '1' => ts('day of the month'),
- '2' => ts('day of the week'),
- );
+ '1' => ts('day of the month'),
+ '2' => ts('day of the week'),
+ );
$form->addRadio('repeats_by', ts("Repeats By:"), $roptionTypes, array(), NULL);
$getMonths = CRM_Core_SelectValues::getNumericOptions(1, 31);
$form->add('select', 'limit_to', '', $getMonths, FALSE, array('style' => 'width:55px;'));
$dayOfTheWeekNo = array(
- 'first' => 'First',
- 'second' => 'Second',
- 'third' => 'Third',
- 'fourth' => 'Fourth',
- 'last' => 'Last',
- );
+ 'first' => 'First',
+ 'second' => 'Second',
+ 'third' => 'Third',
+ 'fourth' => 'Fourth',
+ 'last' => 'Last',
+ );
$form->add('select', 'entity_status_1', ts(''), $dayOfTheWeekNo);
$form->add('select', 'entity_status_2', ts(''), $dayOfTheWeek);
$eoptionTypes = array(
- '1' => ts('After'),
- '2' => ts('On'),
- );
+ '1' => ts('After'),
+ '2' => ts('On'),
+ );
$form->addRadio('ends', ts("Ends:"), $eoptionTypes, array(), NULL);
$form->add('text', 'start_action_offset', ts(''), array('size' => 3, 'maxlength' => 2));
$form->addFormRule(array('CRM_Core_Form_RecurringEntity', 'formRule'));
$form->addDate('repeat_absolute_date', ts('On'), FALSE, array('formatType' => 'mailing'));
$form->addDate('exclude_date', ts('Exclude Date(s)'), FALSE);
- $select = $form->add('select', 'exclude_date_list', ts(''), self::$_excludeDateInfo, FALSE, array('style' => 'width:150px;', 'size' => 4));
+ $select = $form->add('select', 'exclude_date_list', ts(''), self::$_excludeDateInfo, FALSE, array(
+ 'style' => 'width:150px;',
+ 'size' => 4
+ ));
$select->setMultiple(TRUE);
$form->addElement('button', 'add_to_exclude_list', '>>', 'onClick="addToExcludeList(document.getElementById(\'exclude_date\').value);"');
$form->addElement('button', 'remove_from_exclude_list', '<<', 'onClick="removeFromExcludeList(\'exclude_date_list\')"');
//Check if there exists any values for this option group
$optionGroupIdExists = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup',
- $type . '_repeat_exclude_dates_' . $params['parent_entity_id'],
- 'id',
- 'name'
- );
+ $type . '_repeat_exclude_dates_' . $params['parent_entity_id'],
+ 'id',
+ 'name'
+ );
if ($optionGroupIdExists) {
CRM_Core_BAO_OptionGroup::del($optionGroupIdExists);
}
$optionGroupParams =
- array(
- 'name' => $type . '_repeat_exclude_dates_' . $actionScheduleObj->entity_value,
- 'title' => $type . ' recursion',
- 'is_reserved' => 0,
- 'is_active' => 1,
- );
+ array(
+ 'name' => $type . '_repeat_exclude_dates_' . $actionScheduleObj->entity_value,
+ 'title' => $type . ' recursion',
+ 'is_reserved' => 0,
+ 'is_active' => 1,
+ );
$opGroup = CRM_Core_BAO_OptionGroup::add($optionGroupParams);
if ($opGroup->id) {
$oldWeight = 0;
$fieldValues = array('option_group_id' => $opGroup->id);
foreach ($excludeDates as $val) {
$optionGroupValue =
- array(
- 'option_group_id' => $opGroup->id,
- 'label' => CRM_Utils_Date::processDate($val),
- 'value' => CRM_Utils_Date::processDate($val),
- 'name' => $opGroup->name,
- 'description' => 'Used for recurring ' . $type,
- 'weight' => CRM_Utils_Weight::updateOtherWeights('CRM_Core_DAO_OptionValue', $oldWeight, CRM_Utils_Array::value('weight', $params), $fieldValues),
- 'is_active' => 1,
- );
+ array(
+ 'option_group_id' => $opGroup->id,
+ 'label' => CRM_Utils_Date::processDate($val),
+ 'value' => CRM_Utils_Date::processDate($val),
+ 'name' => $opGroup->name,
+ 'description' => 'Used for recurring ' . $type,
+ 'weight' => CRM_Utils_Weight::updateOtherWeights('CRM_Core_DAO_OptionValue', $oldWeight, CRM_Utils_Array::value('weight', $params), $fieldValues),
+ 'is_active' => 1,
+ );
$excludeDateList[] = $optionGroupValue['value'];
CRM_Core_BAO_OptionValue::add($optionGroupValue);
}
if ($params['entity_id']) {
//If entity has any pre delete function, consider that first
if (CRM_Utils_Array::value('pre_delete_func', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]) &&
- CRM_Utils_Array::value('helper_class', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']])) {
+ CRM_Utils_Array::value('helper_class', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']])
+ ) {
call_user_func(array(
CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['helper_class'],
- call_user_func_array(CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['pre_delete_func'], array($params['entity_id'])))
- );
+ call_user_func_array(CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['pre_delete_func'], array($params['entity_id']))
+ )
+ );
}
//Ready to execute delete on entities if it has delete function set
if (CRM_Utils_Array::value('delete_func', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]) &&
- CRM_Utils_Array::value('helper_class', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']])) {
+ CRM_Utils_Array::value('helper_class', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']])
+ ) {
//Check if pre delete function has some ids to be deleted
if (!empty(CRM_Core_BAO_RecurringEntity::$_entitiesToBeDeleted)) {
foreach (CRM_Core_BAO_RecurringEntity::$_entitiesToBeDeleted as $eid) {
}
$recursion = new CRM_Core_BAO_RecurringEntity();
- $recursion->dateColumns = $params['dateColumns'];
- $recursion->scheduleId = $actionScheduleObj->id;
+ $recursion->dateColumns = $params['dateColumns'];
+ $recursion->scheduleId = $actionScheduleObj->id;
if (!empty($excludeDateList)) {
$recursion->excludeDates = $excludeDateList;
$view[] = $contact[$fld];
}
}
- $field->setAttribute('data-entity-value', json_encode(array('id' => $contact['id'], 'text' => implode(' :: ', $view))));
+ $field->setAttribute('data-entity-value', json_encode(array(
+ 'id' => $contact['id'],
+ 'text' => implode(' :: ', $view)
+ )));
}
}
}
$mo_file = $config->gettextResourceDir . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR . 'civicrm.mo';
- if (! file_exists($mo_file)) {
+ if (!file_exists($mo_file)) {
// fallback to pre-4.5 mode
$mo_file = $config->gettextResourceDir . $locale . DIRECTORY_SEPARATOR . 'civicrm.mo';
}
if ($code == 'en_US') {
continue;
}
- if (!in_array($code, $codes))unset($all[$code]);
+ if (!in_array($code, $codes)) unset($all[$code]);
}
}
// gettext domain for extensions
$domain_changed = FALSE;
- if (! empty($params['domain']) && $this->_phpgettext) {
+ if (!empty($params['domain']) && $this->_phpgettext) {
if ($this->setGettextDomain($params['domain'])) {
$domain_changed = TRUE;
}
!$exactMatch &&
isset($stringTable['enabled']['wildcardMatch'])
) {
- $search = array_keys($stringTable['enabled']['wildcardMatch']);
+ $search = array_keys($stringTable['enabled']['wildcardMatch']);
$replace = array_values($stringTable['enabled']['wildcardMatch']);
- $text = str_replace($search, $replace, $text);
+ $text = str_replace($search, $replace, $text);
}
// dont translate if we've done exactMatch already
*/
public function setGettextDomain($key) {
/* No domain changes for en_US */
- if (! $this->_phpgettext) {
+ if (!$this->_phpgettext) {
return FALSE;
}
// It's only necessary to find/bind once
- if (! isset($this->_extensioncache[$key])) {
+ if (!isset($this->_extensioncache[$key])) {
$config = CRM_Core_Config::singleton();
try {
* Array an array of additional parameters.
*
* @return string
- * the translated string
+ * the translated string
*/
function ts($text, $params = array()) {
static $config = NULL;
$this->_locales = array_keys($config->languageLimit);
// get the part of the database we want to edit and validate it
- $table = CRM_Utils_Request::retrieve('table', 'String', $this);
- $field = CRM_Utils_Request::retrieve('field', 'String', $this);
- $id = CRM_Utils_Request::retrieve('id', 'Int', $this);
+ $table = CRM_Utils_Request::retrieve('table', 'String', $this);
+ $field = CRM_Utils_Request::retrieve('field', 'String', $this);
+ $id = CRM_Utils_Request::retrieve('id', 'Int', $this);
$this->_structure = CRM_Core_I18n_SchemaStructure::columns();
if (!isset($this->_structure[$table][$field])) {
CRM_Core_Error::fatal("$table.$field is not internationalized.");
public function postProcess() {
$values = $this->exportValues();
- $table = $values['table'];
- $field = $values['field'];
+ $table = $values['table'];
+ $field = $values['field'];
// validate table and field
if (!isset($this->_structure[$table][$field])) {
CRM_Core_Error::fatal("$table.$field is not internationalized.");
}
- $cols = array();
+ $cols = array();
$params = array(array($values['id'], 'Int'));
- $i = 1;
+ $i = 1;
foreach ($this->_locales as $locale) {
$cols[] = "{$field}_{$locale} = %$i";
$params[$i] = array($values["{$field}_{$locale}"], 'String');
$i++;
}
$query = "UPDATE $table SET " . implode(', ', $cols) . " WHERE id = %0";
- $dao = new CRM_Core_DAO();
+ $dao = new CRM_Core_DAO();
$query = CRM_Core_DAO::composeQuery($query, $params, TRUE);
$dao->query($query, FALSE);
}
if (!empty($triggers)) {
if (CRM_Core_Config::isUpgradeMode()) {
- foreach ($triggers as $triggerInfo) {
- $when = $triggerInfo['when'];
- $event = $triggerInfo['event'];
- $triggerName = "{$table}_{$when}_{$event}";
- CRM_Core_DAO::executeQuery("DROP TRIGGER IF EXISTS {$triggerName}");
+ foreach ($triggers as $triggerInfo) {
+ $when = $triggerInfo['when'];
+ $event = $triggerInfo['event'];
+ $triggerName = "{$table}_{$when}_{$event}";
+ CRM_Core_DAO::executeQuery("DROP TRIGGER IF EXISTS {$triggerName}");
+ }
}
- }
- // invoke the meta trigger creation call
- CRM_Core_DAO::triggerRebuild($table);
- }
+ // invoke the meta trigger creation call
+ CRM_Core_DAO::triggerRebuild($table);
+ }
}
/**
$class = 'CRM_Core_I18n_SchemaStructure';
}
$indices =& $class::indices();
- $tables =& $class::tables();
+ $tables =& $class::tables();
$queries = array();
$dao = new CRM_Core_DAO;
// class loader look for file like - CRM/Core/I18n/SchemaStructure/4/1/0.php which is not what we want to be loaded
require_once "CRM/Core/I18n/SchemaStructure_{$latest}.php";
$class = "CRM_Core_I18n_SchemaStructure_{$latest}";
- $tables =& $class::tables();
+ $tables =& $class::tables();
}
else {
$tables = CRM_Core_I18n_SchemaStructure::tables();
foreach ($locales as $old) {
$trigger[] = "ELSEIF NEW.{$column}_{$old} IS NOT NULL THEN";
foreach (array_merge($locales, array(
- $locale)) as $loc) {
+ $locale
+ )) as $loc) {
if ($loc == $old) {
continue;
}
foreach ($locales as $old) {
$trigger[] = "ELSEIF NEW.{$column}_{$old} IS NOT NULL THEN";
foreach (array_merge($locales, array(
- $locale)) as $loc) {
+ $locale
+ )) as $loc) {
if ($loc == $old) {
continue;
}
/**
* @return mixed
*/
- static function &indices() {
+ static function &indices() {
static $result = NULL;
if (!$result) {
$result = unserialize('a:4:{s:20:"civicrm_custom_group";a:1:{s:16:"UI_title_extends";a:4:{s:4:"name";s:16:"UI_title_extends";s:5:"field";a:2:{i:0;s:5:"title";i:1;s:7:"extends";}s:11:"localizable";b:1;s:6:"unique";b:1;}}s:20:"civicrm_custom_field";a:1:{s:24:"UI_label_custom_group_id";a:4:{s:4:"name";s:24:"UI_label_custom_group_id";s:5:"field";a:2:{i:0;s:5:"label";i:1;s:15:"custom_group_id";}s:11:"localizable";b:1;s:6:"unique";b:1;}}s:17:"civicrm_price_set";a:1:{s:8:"UI_title";a:4:{s:4:"name";s:8:"UI_title";s:5:"field";a:1:{i:0;s:5:"title";}s:11:"localizable";b:1;s:6:"unique";b:1;}}s:15:"civicrm_contact";a:5:{s:15:"index_sort_name";a:3:{s:4:"name";s:15:"index_sort_name";s:5:"field";a:1:{i:0;s:9:"sort_name";}s:11:"localizable";b:1;}s:16:"index_first_name";a:3:{s:4:"name";s:16:"index_first_name";s:5:"field";a:1:{i:0;s:10:"first_name";}s:11:"localizable";b:1;}s:15:"index_last_name";a:3:{s:4:"name";s:15:"index_last_name";s:5:"field";a:1:{i:0;s:9:"last_name";}s:11:"localizable";b:1;}s:20:"index_household_name";a:3:{s:4:"name";s:20:"index_household_name";s:5:"field";a:1:{i:0;s:14:"household_name";}s:11:"localizable";b:1;}s:23:"index_organization_name";a:3:{s:4:"name";s:23:"index_organization_name";s:5:"field";a:1:{i:0;s:17:"organization_name";}s:11:"localizable";b:1;}}}');
/**
* @return array
*/
- static function &tables() {
+ static function &tables() {
static $result = NULL;
if (!$result) {
$result = array_keys(self::columns());
/**
* @return array
*/
- static function &columns() {
+ static function &columns() {
static $result = NULL;
if (!$result) {
$result = array(
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
+
/**
*
* @package CRM
if (!$result) {
$result = array(
'civicrm_location_type' => array(
- 'display_name' => "varchar(64)",
- ) ,
+ 'display_name' => "varchar(64)",
+ ),
'civicrm_option_group' => array(
- 'title' => "varchar(255)",
- 'description' => "varchar(255)",
- ) ,
+ 'title' => "varchar(255)",
+ 'description' => "varchar(255)",
+ ),
'civicrm_contact_type' => array(
- 'label' => "varchar(64)",
- 'description' => "text",
- ) ,
+ 'label' => "varchar(64)",
+ 'description' => "text",
+ ),
'civicrm_premiums' => array(
'premiums_intro_title' => "varchar(255)",
'premiums_intro_text' => "text",
- ) ,
+ ),
'civicrm_product' => array(
'name' => "varchar(255)",
'description' => "text",
'options' => "text",
- ) ,
+ ),
'civicrm_membership_status' => array(
'label' => "varchar(128)",
- ) ,
+ ),
'civicrm_survey' => array(
'thankyou_title' => "varchar(255)",
'thankyou_text' => "text",
- ) ,
- 'civicrm_participant_status_type' => array(
- 'label' => "varchar(255)",
- ) ,
+ ),
+ 'civicrm_participant_status_type' => array(
+ 'label' => "varchar(255)",
+ ),
'civicrm_tell_friend' => array(
'title' => "varchar(255)",
'intro' => "text",
'suggested_message' => "text",
'thankyou_title' => "varchar(255)",
'thankyou_text' => "text",
- ) ,
+ ),
'civicrm_price_set' => array(
'title' => "varchar(255)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_batch' => array(
'title' => "varchar(64)",
'description' => "text",
- ) ,
+ ),
'civicrm_custom_group' => array(
'title' => "varchar(64)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_custom_field' => array(
'label' => "varchar(255)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_dashboard' => array(
'label' => "varchar(255)",
- ) ,
- 'civicrm_option_value' => array(
- 'label' => "varchar(255)",
- 'description' => "text",
- ) ,
+ ),
+ 'civicrm_option_value' => array(
+ 'label' => "varchar(255)",
+ 'description' => "text",
+ ),
'civicrm_group' => array(
'title' => "varchar(64)",
- ) ,
+ ),
'civicrm_contribution_page' => array(
'title' => "varchar(255)",
'intro_text' => "text",
'footer_text' => "text",
'honor_block_title' => "varchar(255)",
'honor_block_text' => "text",
- ) ,
+ ),
'civicrm_price_field' => array(
'label' => "varchar(255)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_uf_group' => array(
'title' => "varchar(64)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_uf_field' => array(
'help_post' => "text",
'help_pre' => "text",
'label' => "varchar(255)",
- ) ,
+ ),
'civicrm_membership_type' => array(
'name' => "varchar(128)",
'description' => "varchar(255)",
- ) ,
+ ),
'civicrm_membership_block' => array(
'new_title' => "varchar(255)",
'new_text' => "text",
'renewal_title' => "varchar(255)",
'renewal_text' => "text",
- ) ,
+ ),
'civicrm_price_field_value' => array(
'label' => "varchar(255)",
'description' => "text",
- ) ,
+ ),
'civicrm_pcp_block' => array(
'link_text' => "varchar(255)",
- ) ,
+ ),
'civicrm_event' => array(
'title' => "varchar(255)",
'summary' => "text",
'waitlist_text' => "text",
'approval_req_text' => "text",
'template_title' => "varchar(255)",
- ) ,
- );
- }
- return $result;
+ ),
+ );
}
+ return $result;
+ }
/**
* @return array
'field' => array(
'title',
'extends',
- ) ,
+ ),
'unique' => 1,
- ) ,
- ) ,
+ ),
+ ),
'civicrm_custom_field' => array(
'UI_label_custom_group_id' => array(
'name' => 'UI_label_custom_group_id',
'field' => array(
'label',
'custom_group_id',
- ) ,
+ ),
'unique' => 1,
- ) ,
- ) ,
+ ),
+ ),
'civicrm_group' => array(
'UI_title' => array(
'name' => 'UI_title',
'field' => array(
'title',
- ) ,
+ ),
'unique' => 1,
- ) ,
- ) ,
+ ),
+ ),
);
}
return $result;
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
+
/**
*
* @package CRM
$result = array(
'civicrm_location_type' => array(
'display_name' => "varchar(64)",
- ) ,
+ ),
'civicrm_option_group' => array(
'title' => "varchar(255)",
'description' => "varchar(255)",
- ) ,
+ ),
'civicrm_contact_type' => array(
'label' => "varchar(64)",
'description' => "text",
- ) ,
+ ),
'civicrm_batch' => array(
'title' => "varchar(64)",
'description' => "text",
- ) ,
+ ),
'civicrm_premiums' => array(
'premiums_intro_title' => "varchar(255)",
'premiums_intro_text' => "text",
'premiums_nothankyou_label' => "varchar(255)",
- ) ,
+ ),
'civicrm_membership_status' => array(
'label' => "varchar(128)",
- ) ,
+ ),
'civicrm_survey' => array(
'thankyou_title' => "varchar(255)",
'thankyou_text' => "text",
- ) ,
+ ),
'civicrm_participant_status_type' => array(
'label' => "varchar(255)",
- ) ,
+ ),
'civicrm_tell_friend' => array(
'title' => "varchar(255)",
'intro' => "text",
'suggested_message' => "text",
'thankyou_title' => "varchar(255)",
'thankyou_text' => "text",
- ) ,
+ ),
'civicrm_custom_group' => array(
'title' => "varchar(64)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_custom_field' => array(
'label' => "varchar(255)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_option_value' => array(
'label' => "varchar(255)",
'description' => "text",
- ) ,
+ ),
'civicrm_group' => array(
'title' => "varchar(64)",
- ) ,
+ ),
'civicrm_contribution_page' => array(
'title' => "varchar(255)",
'intro_text' => "text",
'footer_text' => "text",
'honor_block_title' => "varchar(255)",
'honor_block_text' => "text",
- ) ,
+ ),
'civicrm_product' => array(
'name' => "varchar(255)",
'description' => "text",
'options' => "text",
- ) ,
+ ),
'civicrm_membership_type' => array(
'name' => "varchar(128)",
'description' => "varchar(255)",
- ) ,
+ ),
'civicrm_membership_block' => array(
'new_title' => "varchar(255)",
'new_text' => "text",
'renewal_title' => "varchar(255)",
'renewal_text' => "text",
- ) ,
+ ),
'civicrm_price_set' => array(
'title' => "varchar(255)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_dashboard' => array(
'label' => "varchar(255)",
- ) ,
+ ),
'civicrm_uf_group' => array(
'title' => "varchar(64)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_uf_field' => array(
'help_post' => "text",
'help_pre' => "text",
'label' => "varchar(255)",
- ) ,
+ ),
'civicrm_price_field' => array(
'label' => "varchar(255)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_price_field_value' => array(
'label' => "varchar(255)",
'description' => "text",
- ) ,
+ ),
'civicrm_pcp_block' => array(
'link_text' => "varchar(255)",
- ) ,
+ ),
'civicrm_event' => array(
'title' => "varchar(255)",
'summary' => "text",
'waitlist_text' => "text",
'approval_req_text' => "text",
'template_title' => "varchar(255)",
- ) ,
+ ),
);
}
return $result;
'field' => array(
'title',
'extends',
- ) ,
+ ),
'unique' => 1,
- ) ,
- ) ,
+ ),
+ ),
'civicrm_custom_field' => array(
'UI_label_custom_group_id' => array(
'name' => 'UI_label_custom_group_id',
'field' => array(
'label',
'custom_group_id',
- ) ,
+ ),
'unique' => 1,
- ) ,
- ) ,
+ ),
+ ),
'civicrm_group' => array(
'UI_title' => array(
'name' => 'UI_title',
'field' => array(
'title',
- ) ,
+ ),
'unique' => 1,
- ) ,
- ) ,
+ ),
+ ),
);
}
return $result;
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
+
/**
*
* @package CRM
$result = array(
'civicrm_location_type' => array(
'display_name' => "varchar(64)",
- ) ,
+ ),
'civicrm_option_group' => array(
'title' => "varchar(255)",
'description' => "varchar(255)",
- ) ,
+ ),
'civicrm_contact_type' => array(
'label' => "varchar(64)",
'description' => "text",
- ) ,
+ ),
'civicrm_batch' => array(
'title' => "varchar(64)",
'description' => "text",
- ) ,
+ ),
'civicrm_premiums' => array(
'premiums_intro_title' => "varchar(255)",
'premiums_intro_text' => "text",
'premiums_nothankyou_label' => "varchar(255)",
- ) ,
+ ),
'civicrm_membership_status' => array(
'label' => "varchar(128)",
- ) ,
+ ),
'civicrm_survey' => array(
'title' => "varchar(255)",
'instructions' => "text",
'thankyou_title' => "varchar(255)",
'thankyou_text' => "text",
- ) ,
+ ),
'civicrm_participant_status_type' => array(
'label' => "varchar(255)",
- ) ,
+ ),
'civicrm_tell_friend' => array(
'title' => "varchar(255)",
'intro' => "text",
'suggested_message' => "text",
'thankyou_title' => "varchar(255)",
'thankyou_text' => "text",
- ) ,
+ ),
'civicrm_custom_group' => array(
'title' => "varchar(64)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_custom_field' => array(
'label' => "varchar(255)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_option_value' => array(
'label' => "varchar(255)",
'description' => "text",
- ) ,
+ ),
'civicrm_group' => array(
'title' => "varchar(64)",
- ) ,
+ ),
'civicrm_contribution_page' => array(
'title' => "varchar(255)",
'intro_text' => "text",
'receipt_from_name' => "varchar(255)",
'receipt_text' => "text",
'footer_text' => "text",
- ) ,
+ ),
'civicrm_product' => array(
'name' => "varchar(255)",
'description' => "text",
'options' => "text",
- ) ,
+ ),
'civicrm_membership_type' => array(
'name' => "varchar(128)",
'description' => "varchar(255)",
- ) ,
+ ),
'civicrm_membership_block' => array(
'new_title' => "varchar(255)",
'new_text' => "text",
'renewal_title' => "varchar(255)",
'renewal_text' => "text",
- ) ,
+ ),
'civicrm_price_set' => array(
'title' => "varchar(255)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_dashboard' => array(
'label' => "varchar(255)",
- ) ,
+ ),
'civicrm_uf_group' => array(
'title' => "varchar(64)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_uf_field' => array(
'help_post' => "text",
'help_pre' => "text",
'label' => "varchar(255)",
- ) ,
+ ),
'civicrm_price_field' => array(
'label' => "varchar(255)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_price_field_value' => array(
'label' => "varchar(255)",
'description' => "text",
- ) ,
+ ),
'civicrm_pcp_block' => array(
'link_text' => "varchar(255)",
- ) ,
+ ),
'civicrm_event' => array(
'title' => "varchar(255)",
'summary' => "text",
'waitlist_text' => "text",
'approval_req_text' => "text",
'template_title' => "varchar(255)",
- ) ,
+ ),
);
}
return $result;
'field' => array(
'title',
'extends',
- ) ,
+ ),
'unique' => 1,
- ) ,
- ) ,
+ ),
+ ),
'civicrm_custom_field' => array(
'UI_label_custom_group_id' => array(
'name' => 'UI_label_custom_group_id',
'field' => array(
'label',
'custom_group_id',
- ) ,
+ ),
'unique' => 1,
- ) ,
- ) ,
+ ),
+ ),
'civicrm_group' => array(
'UI_title' => array(
'name' => 'UI_title',
'field' => array(
'title',
- ) ,
+ ),
'unique' => 1,
- ) ,
- ) ,
+ ),
+ ),
);
}
return $result;
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
+
/**
*
* @package CRM
$result = array(
'civicrm_location_type' => array(
'display_name' => "varchar(64)",
- ) ,
+ ),
'civicrm_option_group' => array(
'title' => "varchar(255)",
'description' => "varchar(255)",
- ) ,
+ ),
'civicrm_contact_type' => array(
'label' => "varchar(64)",
'description' => "text",
- ) ,
+ ),
'civicrm_batch' => array(
'title' => "varchar(64)",
'description' => "text",
- ) ,
+ ),
'civicrm_premiums' => array(
'premiums_intro_title' => "varchar(255)",
'premiums_intro_text' => "text",
'premiums_nothankyou_label' => "varchar(255)",
- ) ,
+ ),
'civicrm_membership_status' => array(
'label' => "varchar(128)",
- ) ,
+ ),
'civicrm_survey' => array(
'title' => "varchar(255)",
'instructions' => "text",
'thankyou_title' => "varchar(255)",
'thankyou_text' => "text",
- ) ,
+ ),
'civicrm_participant_status_type' => array(
'label' => "varchar(255)",
- ) ,
+ ),
'civicrm_case_type' => array(
'title' => "varchar(64)",
'description' => "varchar(255)",
- ) ,
+ ),
'civicrm_tell_friend' => array(
'title' => "varchar(255)",
'intro' => "text",
'suggested_message' => "text",
'thankyou_title' => "varchar(255)",
'thankyou_text' => "text",
- ) ,
+ ),
'civicrm_custom_group' => array(
'title' => "varchar(64)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_custom_field' => array(
'label' => "varchar(255)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_option_value' => array(
'label' => "varchar(255)",
'description' => "text",
- ) ,
+ ),
'civicrm_group' => array(
'title' => "varchar(64)",
- ) ,
+ ),
'civicrm_contribution_page' => array(
'title' => "varchar(255)",
'intro_text' => "text",
'receipt_from_name' => "varchar(255)",
'receipt_text' => "text",
'footer_text' => "text",
- ) ,
+ ),
'civicrm_product' => array(
'name' => "varchar(255)",
'description' => "text",
'options' => "text",
- ) ,
+ ),
'civicrm_membership_type' => array(
'name' => "varchar(128)",
'description' => "varchar(255)",
- ) ,
+ ),
'civicrm_membership_block' => array(
'new_title' => "varchar(255)",
'new_text' => "text",
'renewal_title' => "varchar(255)",
'renewal_text' => "text",
- ) ,
+ ),
'civicrm_price_set' => array(
'title' => "varchar(255)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_dashboard' => array(
'label' => "varchar(255)",
- ) ,
+ ),
'civicrm_uf_group' => array(
'title' => "varchar(64)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_uf_field' => array(
'help_post' => "text",
'help_pre' => "text",
'label' => "varchar(255)",
- ) ,
+ ),
'civicrm_price_field' => array(
'label' => "varchar(255)",
'help_pre' => "text",
'help_post' => "text",
- ) ,
+ ),
'civicrm_price_field_value' => array(
'label' => "varchar(255)",
'description' => "text",
- ) ,
+ ),
'civicrm_pcp_block' => array(
'link_text' => "varchar(255)",
- ) ,
+ ),
'civicrm_event' => array(
'title' => "varchar(255)",
'summary' => "text",
'waitlist_text' => "text",
'approval_req_text' => "text",
'template_title' => "varchar(255)",
- ) ,
+ ),
);
}
return $result;
}
+
public static function &indices() {
static $result = NULL;
if (!$result) {
'field' => array(
'title',
'extends',
- ) ,
+ ),
'unique' => 1,
- ) ,
- ) ,
+ ),
+ ),
'civicrm_custom_field' => array(
'UI_label_custom_group_id' => array(
'name' => 'UI_label_custom_group_id',
'field' => array(
'label',
'custom_group_id',
- ) ,
+ ),
'unique' => 1,
- ) ,
- ) ,
+ ),
+ ),
'civicrm_group' => array(
'UI_title' => array(
'name' => 'UI_title',
'field' => array(
'title',
- ) ,
+ ),
'unique' => 1,
- ) ,
- ) ,
+ ),
+ ),
);
}
return $result;
}
+
public static function &tables() {
static $result = NULL;
if (!$result) {
require_once 'IDS/Init.php';
try {
$init = IDS_Init::init($configFile);
- $ids = new IDS_Monitor($_REQUEST, $init);
+ $ids = new IDS_Monitor($_REQUEST, $init);
}
catch (Exception $e) {
// might be an old stale copy of Config.IDS.ini
// lets try to rebuild it again and see if it works
$configFile = self::createConfigFile(TRUE);
$init = IDS_Init::init($configFile);
- $ids = new IDS_Monitor($_REQUEST, $init);
+ $ids = new IDS_Monitor($_REQUEST, $init);
}
$result = $ids->run();
$path = implode('/', $args);
if (in_array(
- $path,
- array("civicrm/ajax/rest", "civicrm/api/json")
- )) {
+ $path,
+ array("civicrm/ajax/rest", "civicrm/api/json")
+ )) {
require_once "api/v3/utils.php";
$error = civicrm_api3_create_error(
$msg,
}
}
}
+
/**
* Hackish support /civicrm/menu/rebuild
*
if ($item) {
// CRM-7656 - make sure we send a clean sanitized path to create printer friendly url
$printerFriendly = CRM_Utils_System::makeURL(
- 'snippet', FALSE, FALSE,
- CRM_Utils_Array::value('path', $item)
- ) . '2';
+ 'snippet', FALSE, FALSE,
+ CRM_Utils_Array::value('path', $item)
+ ) . '2';
$template->assign('printerFriendly', $printerFriendly);
if (!array_key_exists('page_callback', $item)) {
try {
$result = civicrm_api($job->api_entity, $job->api_action, $params);
}
- catch(Exception$e) {
+ catch (Exception$e) {
$this->logEntry('Error while executing ' . $job->name . ': ' . $e->getMessage());
}
$this->logEntry('Finished execution of ' . $job->name . ' with result: ' . $this->_apiResultToMessage($result));
if (is_null($id) && is_null($action)) {
CRM_Core_Error::fatal('You need to provide either id or name to use this method');
}
- $dao = new CRM_Core_DAO_Job();
- $dao->id = $id;
+ $dao = new CRM_Core_DAO_Job();
+ $dao->id = $id;
$dao->api_entity = $entity;
$dao->api_action = $action;
$dao->find();
$dao->description .= " (...)";
}
if ($this->currentJob) {
- $dao->job_id = $this->currentJob->id;
- $dao->name = $this->currentJob->name;
+ $dao->job_id = $this->currentJob->id;
+ $dao->name = $this->currentJob->name;
$dao->command = ts("Entity:") . " " . $this->currentJob->api_entity . " " . ts("Action:") . " " . $this->currentJob->api_action;
- $data = "";
+ $data = "";
if (!empty($this->currentJob->parameters)) {
$data .= "\n\nParameters raw (from db settings): \n" . $this->currentJob->parameters;
}
*/
private function _apiResultToMessage($apiResult) {
$status = $apiResult['is_error'] ? ts('Failure') : ts('Success');
- $msg = CRM_Utils_Array::value('error_message', $apiResult, 'empty error_message!');
- $vals = CRM_Utils_Array::value('values', $apiResult, 'empty values!');
+ $msg = CRM_Utils_Array::value('error_message', $apiResult, 'empty error_message!');
+ $vals = CRM_Utils_Array::value('values', $apiResult, 'empty values!');
if (is_array($msg)) {
$msg = serialize($msg);
}
*/
public static function get($name, $addSequence = FALSE) {
$privateKey = self::privateKey();
- $sessionID = self::sessionID();
- $key = md5($sessionID . $name . $privateKey);
+ $sessionID = self::sessionID();
+ $key = md5($sessionID . $name . $privateKey);
if ($addSequence) {
// now generate a random number between 1 and 100K and add it to the key
$params = array_merge($defaults, $todo['params']);
$result = civicrm_api($dao->entity_type, 'create', $params);
if ($result['is_error']) {
- $this->onApiError($dao->entity_type, 'create',$params, $result);
+ $this->onApiError($dao->entity_type, 'create', $params, $result);
}
}
);
$result = civicrm_api($dao->entity_type, 'create', $params);
if ($result['is_error']) {
- $this->onApiError($dao->entity_type, 'create',$params, $result);
+ $this->onApiError($dao->entity_type, 'create', $params, $result);
}
}
}
$config = CRM_Core_Config::singleton();
foreach ($menuArray as $path => $item) {
- $menu = new CRM_Core_DAO_Menu();
- $menu->path = $path;
+ $menu = new CRM_Core_DAO_Menu();
+ $menu->path = $path;
$menu->domain_id = CRM_Core_Config::domainID();
$menu->find(TRUE);
'title' => $item['title'],
'desc' => CRM_Utils_Array::value('desc', $item),
'id' => strtr($item['title'], array(
- '(' => '_',
- ')' => '',
- ' ' => '',
+ '(' => '_',
+ ')' => '',
+ ' ' => '',
',' => '_',
- '/' => '_',
+ '/' => '_',
)
),
'url' => CRM_Utils_System::url($path, $query,
- FALSE, // absolute
- NULL, // fragment
- TRUE, // htmlize
- FALSE, // frontend
- TRUE // forceBackend; CRM-14439 work-around; acceptable for now because we don't display breadcrumbs on frontend
+ FALSE, // absolute
+ NULL, // fragment
+ TRUE, // htmlize
+ FALSE, // frontend
+ TRUE // forceBackend; CRM-14439 work-around; acceptable for now because we don't display breadcrumbs on frontend
),
'icon' => CRM_Utils_Array::value('icon', $item),
'extra' => CRM_Utils_Array::value('extra', $item),
foreach ($values as $index => $item) {
if (strpos(CRM_Utils_Array::value($config->userFrameworkURLVar, $_REQUEST),
$item['path']
- ) === 0) {
+ ) === 0
+ ) {
$values[$index]['active'] = 'class="active"';
}
else {
$elements = array();
while (!empty($args)) {
- $string = implode('/', $args);
- $string = CRM_Core_DAO::escapeString($string);
+ $string = implode('/', $args);
+ $string = CRM_Core_DAO::escapeString($string);
$elements[] = "'{$string}'";
array_pop($args);
}
- $queryString = implode(', ', $elements);
- $domainID = CRM_Core_Config::domainID();
+ $queryString = implode(', ', $elements);
+ $domainID = CRM_Core_Config::domainID();
$domainWhereClause = " AND domain_id = $domainID ";
if ($config->isUpgradeMode() &&
!CRM_Core_DAO::checkFieldExists('civicrm_menu', 'domain_id')
$urlToSession[$count]['sessionVar'],
$urlToSession[$count]['type'],
$urlToSession[$count]['default']
- ) = explode(':', $keyVal);
+ ) = explode(':', $keyVal);
$count++;
}
$arr['urlToSession'] = $urlToSession;
}
if ($flip) {
- $p = array(1 => array($postValue, 'String'));
+ $p = array(1 => array($postValue, 'String'));
$lookupBy = 'v.label= %1';
- $select = "v.value";
+ $select = "v.value";
}
else {
- $p = array(1 => array($postValue, 'Integer'));
+ $p = array(1 => array($postValue, 'Integer'));
$lookupBy = 'v.value = %1';
- $select = "v.label";
+ $select = "v.label";
}
$p[2] = array($value['groupName'], 'String');
$query .= " AND v.is_active = 1 ";
}
$p = array(
- 1 => array($groupName, 'String'),
+ 1 => array($groupName, 'String'),
2 => array($value, 'Integer'),
);
$dao = CRM_Core_DAO::executeQuery($query, $p);
";
$p = array(
- 1 => array($groupName, 'String'),
+ 1 => array($groupName, 'String'),
2 => array($label, $labelType),
);
$dao = CRM_Core_DAO::executeQuery($query, $p);
public static function createAssoc($groupName, &$values, &$defaultID, $groupTitle = NULL) {
self::deleteAssoc($groupName);
if (!empty($values)) {
- $group = new CRM_Core_DAO_OptionGroup();
- $group->name = $groupName;
- $group->title = empty($groupTitle) ? $groupName : $groupTitle;
+ $group = new CRM_Core_DAO_OptionGroup();
+ $group->name = $groupName;
+ $group->title = empty($groupTitle) ? $groupName : $groupTitle;
$group->is_reserved = 1;
- $group->is_active = 1;
+ $group->is_active = 1;
$group->save();
foreach ($values as $v) {
AND g.name = %1
AND v.value = %2";
$params = array(
- 1 => array($groupName, 'String'),
+ 1 => array($groupName, 'String'),
2 => array($value, 'String'),
);
return CRM_Core_DAO::singleValueQuery($query, $params);
}
$p = array(
- 1 => array($groupName, 'String'),
+ 1 => array($groupName, 'String'),
2 => array($fieldValue, $fieldType),
);
$dao = CRM_Core_DAO::executeQuery($query, $p);
if ($dao->fetch()) {
foreach (array(
- 'id', 'name', 'value', 'label', 'weight', 'description') as $fld) {
+ 'id',
+ 'name',
+ 'value',
+ 'label',
+ 'weight',
+ 'description'
+ ) as $fld) {
$row[$fld] = $dao->$fld;
}
}
// if the corresponding group doesn't exist, create one, provided $groupParams has 'name' in it.
if (!$optionGroup->id) {
if ($groupParams['name']) {
- $newOptionGroup = CRM_Core_BAO_OptionGroup::add($groupParams, $defaults);
+ $newOptionGroup = CRM_Core_BAO_OptionGroup::add($groupParams, $defaults);
$params['weight'] = 1;
- $optionGroupID = $newOptionGroup->id;
+ $optionGroupID = $newOptionGroup->id;
}
}
else {
//the fields email greeting and postal greeting are meant only for Individual and Household
//the field addressee is meant for all contact types, CRM-4575
if (in_array($contactType, array(
- 'Individual', 'Household', 'Organization', 'All'))) {
+ 'Individual',
+ 'Household',
+ 'Organization',
+ 'All'
+ ))) {
$nameTitle = array(
'addressee' => array(
'name' => 'addressee',
* @return CRM_Core_Page
*/
public function __construct($title = NULL, $mode = NULL) {
- $this->_name = CRM_Utils_System::getClassName($this);
+ $this->_name = CRM_Utils_System::getClassName($this);
$this->_title = $title;
- $this->_mode = $mode;
+ $this->_mode = $mode;
// let the constructor initialize this, should happen only once
if (!isset(self::$_template)) {
CRM_Utils_Hook::pageRun($this);
if ($this->_print) {
- if (in_array($this->_print, array(CRM_Core_Smarty::PRINT_SNIPPET,
- CRM_Core_Smarty::PRINT_PDF, CRM_Core_Smarty::PRINT_NOFORM, CRM_Core_Smarty::PRINT_JSON))) {
+ if (in_array($this->_print, array(
+ CRM_Core_Smarty::PRINT_SNIPPET,
+ CRM_Core_Smarty::PRINT_PDF,
+ CRM_Core_Smarty::PRINT_NOFORM,
+ CRM_Core_Smarty::PRINT_JSON
+ ))) {
$content = self::$_template->fetch('CRM/common/snippet.tpl');
}
else {
CRM_Utils_Check::singleton()->showPeriodicAlerts();
if ($this->useLivePageJS &&
- CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajaxPopupsEnabled', NULL, TRUE))
- {
+ CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajaxPopupsEnabled', NULL, TRUE)
+ ) {
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js', 1, 'html-header');
$this->assign('includeWysiwygEditor', TRUE);
}
$ufId = CRM_Utils_Request::retrieve('ufId', 'Integer', CRM_Core_DAO::$_nullObject, TRUE);
// Verify user id
- $user = CRM_Utils_Request::retrieve('uid', 'Integer', CRM_Core_DAO::$_nullObject, FALSE, CRM_Core_Session::singleton()->get('userID'));
+ $user = CRM_Utils_Request::retrieve('uid', 'Integer', CRM_Core_DAO::$_nullObject, FALSE, CRM_Core_Session::singleton()
+ ->get('userID'));
if (empty($user) || (CRM_Utils_Request::retrieve('cs', 'String', $form, FALSE) && !CRM_Contact_BAO_Contact_Permission::validateChecksumContact($user, CRM_Core_DAO::$_nullObject, FALSE))
) {
CRM_Utils_System::civiExit();
CRM_Utils_System::civiExit();
}
- $values = array();
+ $values = array();
$entityBlock = array('contact_id' => $cid);
- $location = CRM_Core_BAO_Location::getValues($entityBlock);
+ $location = CRM_Core_BAO_Location::getValues($entityBlock);
$config = CRM_Core_Config::singleton();
$addressSequence = array_flip($config->addressSequence());
$profileFields = CRM_Core_BAO_UFGroup::getFields($ufId, FALSE, CRM_Core_Action::VIEW, NULL, NULL, FALSE,
- NULL, FALSE, NULL, CRM_Core_Permission::CREATE, NULL
- );
+ NULL, FALSE, NULL, CRM_Core_Permission::CREATE, NULL
+ );
$website = CRM_Core_BAO_Website::getValues($entityBlock, $values);
foreach ($location as $fld => $values) {
$locType = $values[1]['location_type_id'];
if ($fld == 'email') {
$elements["onbehalf_{$fld}-{$locType}"] = array(
- 'type' => 'Text',
- 'value' => $location[$fld][1][$fld],
- );
+ 'type' => 'Text',
+ 'value' => $location[$fld][1][$fld],
+ );
unset($profileFields["{$fld}-{$locType}"]);
}
elseif ($fld == 'phone') {
$phoneTypeId = $values[1]['phone_type_id'];
$elements["onbehalf_{$fld}-{$locType}-{$phoneTypeId}"] = array(
- 'type' => 'Text',
- 'value' => $location[$fld][1][$fld],
- );
+ 'type' => 'Text',
+ 'value' => $location[$fld][1][$fld],
+ );
unset($profileFields["{$fld}-{$locType}-{$phoneTypeId}"]);
}
elseif ($fld == 'im') {
$providerId = $values[1]['provider_id'];
$elements["onbehalf_{$fld}-{$locType}"] = array(
- 'type' => 'Text',
- 'value' => $location[$fld][1][$fld],
- );
+ 'type' => 'Text',
+ 'value' => $location[$fld][1][$fld],
+ );
$elements["onbehalf_{$fld}-{$locType}provider_id"] = array(
- 'type' => 'Select',
- 'value' => $location[$fld][1]['provider_id'],
- );
+ 'type' => 'Select',
+ 'value' => $location[$fld][1]['provider_id'],
+ );
unset($profileFields["{$fld}-{$locType}-{$providerId}"]);
}
}
foreach ($website as $key => $val) {
$websiteTypeId = $values[1]['website_type_id'];
$elements["onbehalf_url-1"] = array(
- 'type' => 'Text',
- 'value' => $website[1]['url'],
- );
+ 'type' => 'Text',
+ 'value' => $website[1]['url'],
+ );
$elements["onbehalf_url-1-website_type_id"] = array(
- 'type' => 'Select',
- 'value' => $website[1]['website_type_id'],
- );
+ 'type' => 'Select',
+ 'value' => $website[1]['website_type_id'],
+ );
unset($profileFields["url-1"]);
}
}
$locTypeId = isset($location['address'][1]) ? $location['address'][1]['location_type_id'] : NULL;
$addressFields = array(
- 'street_address',
- 'supplemental_address_1',
- 'supplemental_address_2',
- 'city',
- 'postal_code',
- 'county',
- 'state_province',
- 'country',
- );
+ 'street_address',
+ 'supplemental_address_1',
+ 'supplemental_address_2',
+ 'city',
+ 'postal_code',
+ 'county',
+ 'state_province',
+ 'country',
+ );
foreach ($addressFields as $field) {
if (array_key_exists($field, $addressSequence)) {
$type = 'Select';
}
$elements["onbehalf_{$field}-{$locTypeId}"] = array(
- 'type' => $type,
- 'value' => isset($location['address'][1]) ? $location['address'][1][$addField] : NULL,
- );
+ 'type' => $type,
+ 'value' => isset($location['address'][1]) ? $location['address'][1][$addField] : NULL,
+ );
unset($profileFields["{$field}-{$locTypeId}"]);
}
}
// lets output only required fields.
foreach ($addressOptions as $element => $isSet) {
if ($isSet && (!in_array($element, array(
- 'im', 'openid')))) {
+ 'im',
+ 'openid'
+ )))
+ ) {
if (in_array($element, array(
- 'country', 'state_province', 'county'))) {
+ 'country',
+ 'state_province',
+ 'county'
+ ))) {
$element .= '_id';
}
elseif ($element == 'address_name') {
$value = CRM_Utils_Array::value($element, $location['address'][1]);
$value = $value ? $value : "";
$result[str_replace(array(
- '][', '[', "]"), array('_', '_', ''), $fld)] = $value;
+ '][',
+ '[',
+ "]"
+ ), array('_', '_', ''), $fld)] = $value;
}
}
foreach (array(
- 'email', 'phone_type_id', 'phone') as $element) {
+ 'email',
+ 'phone_type_id',
+ 'phone'
+ ) as $element) {
$block = ($element == 'phone_type_id') ? 'phone' : $element;
for ($i = 1; $i < 3; $i++) {
$fld = "{$block}[{$i}][{$element}]";
$value = CRM_Utils_Array::value($element, $location[$block][$i]);
$value = $value ? $value : "";
$result[str_replace(array(
- '][', '[', "]"), array('_', '_', ''), $fld)] = $value;
+ '][',
+ '[',
+ "]"
+ ), array('_', '_', ''), $fld)] = $value;
}
}
*
* @author Priyanka
*/
-
class CRM_Core_Page_AJAX_RecurringEntity {
public static function updateMode() {
$params = $formValues = $genericResult = array();
$formValues = $_REQUEST;
if (!empty($formValues) &&
- CRM_Utils_Array::value('entity_table', $formValues)) {
+ CRM_Utils_Array::value('entity_table', $formValues)
+ ) {
$startDateColumnName = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['dateColumns'][0];
$endDateColumnName = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['intervalDateColumns'][0];
$recursion = new CRM_Core_BAO_RecurringEntity();
if (CRM_Utils_Array::value('dateColumns', CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']])) {
- $recursion->dateColumns = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['dateColumns'];
+ $recursion->dateColumns = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['dateColumns'];
}
$recursion->scheduleFormValues = $formValues;
if (!empty($formValues['exclude_date_list'])) {
$endDate = CRM_Core_DAO::getFieldValue($daoName, $parentEventId, $endDateColumnName);
}
if ($endDate) {
- $interval = $recursion->getInterval($startDate, $endDate);
+ $interval = $recursion->getInterval($startDate, $endDate);
$recursion->intervalDateColumns = array($endDateColumnName => $interval);
}
}
*/
public static function getAngularModules() {
$angularModules = array();
- $angularModules['angularFileUpload'] = array('ext' => 'civicrm', 'js' => array('bower_components/angular-file-upload/angular-file-upload.min.js'));
+ $angularModules['angularFileUpload'] = array(
+ 'ext' => 'civicrm',
+ 'js' => array('bower_components/angular-file-upload/angular-file-upload.min.js')
+ );
$angularModules['crmApp'] = array('ext' => 'civicrm', 'js' => array('js/angular-crmApp.js'));
- $angularModules['crmAttachment'] = array('ext' => 'civicrm', 'js' => array('js/angular-crmAttachment.js'), 'css' => array('css/angular-crmAttachment.css'));
- $angularModules['crmUi'] = array('ext' => 'civicrm', 'js' => array('js/angular-crm-ui.js', 'packages/ckeditor/ckeditor.js'));
+ $angularModules['crmAttachment'] = array(
+ 'ext' => 'civicrm',
+ 'js' => array('js/angular-crmAttachment.js'),
+ 'css' => array('css/angular-crmAttachment.css')
+ );
+ $angularModules['crmUi'] = array(
+ 'ext' => 'civicrm',
+ 'js' => array('js/angular-crm-ui.js', 'packages/ckeditor/ckeditor.js')
+ );
$angularModules['crmUtil'] = array('ext' => 'civicrm', 'js' => array('js/angular-crm-util.js'));
// https://github.com/jwstadler/angular-jquery-dialog-service
- $angularModules['dialogService'] = array('ext' => 'civicrm' , 'js' => array('bower_components/angular-jquery-dialog-service/dialog-service.js'));
+ $angularModules['dialogService'] = array(
+ 'ext' => 'civicrm',
+ 'js' => array('bower_components/angular-jquery-dialog-service/dialog-service.js')
+ );
$angularModules['ngSanitize'] = array('ext' => 'civicrm', 'js' => array('js/angular-sanitize.js'));
- $angularModules['ui.utils'] = array('ext' => 'civicrm', 'js' => array('bower_components/angular-ui-utils/ui-utils.min.js'));
- $angularModules['ui.sortable'] = array('ext' => 'civicrm', 'js' => array('bower_components/angular-ui-sortable/sortable.min.js'));
- $angularModules['unsavedChanges'] = array('ext' => 'civicrm', 'js' => array('bower_components/angular-unsavedChanges/dist/unsavedChanges.min.js'));
+ $angularModules['ui.utils'] = array(
+ 'ext' => 'civicrm',
+ 'js' => array('bower_components/angular-ui-utils/ui-utils.min.js')
+ );
+ $angularModules['ui.sortable'] = array(
+ 'ext' => 'civicrm',
+ 'js' => array('bower_components/angular-ui-sortable/sortable.min.js')
+ );
+ $angularModules['unsavedChanges'] = array(
+ 'ext' => 'civicrm',
+ 'js' => array('bower_components/angular-unsavedChanges/dist/unsavedChanges.min.js')
+ );
foreach (CRM_Core_Component::getEnabledComponents() as $component) {
$angularModules = array_merge($angularModules, $component->getAngularModules());
* $Id$
*
*/
-
-
-
-
abstract class CRM_Core_Page_Basic extends CRM_Core_Page {
protected $_action;
// CRM-9034
// dont see args or pageArgs being used, so we should
// consider eliminating them in a future version
- $n = func_num_args();
- $args = ($n > 0) ? func_get_arg(0) : NULL;
+ $n = func_num_args();
+ $args = ($n > 0) ? func_get_arg(0) : NULL;
$pageArgs = ($n > 1) ? func_get_arg(1) : NULL;
- $sort = ($n > 2) ? func_get_arg(2) : NULL;
+ $sort = ($n > 2) ? func_get_arg(2) : NULL;
// what action do we want to perform ? (store it for smarty too.. :)
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
* @return void
*/
public function browse() {
- $n = func_num_args();
+ $n = func_num_args();
$action = ($n > 0) ? func_get_arg(0) : NULL;
- $sort = ($n > 0) ? func_get_arg(1) : NULL;
- $links = &$this->links();
+ $sort = ($n > 0) ? func_get_arg(1) : NULL;
+ $links = &$this->links();
if ($action == NULL) {
if (!empty($links)) {
$action = array_sum(array_keys($links));
*/
public function action(&$object, $action, &$values, &$links, $permission, $forceAction = FALSE) {
$values['class'] = '';
- $newAction = $action;
- $hasDelete = $hasDisable = TRUE;
+ $newAction = $action;
+ $hasDelete = $hasDisable = TRUE;
if (!empty($values['name']) && in_array($values['name'], array(
- 'encounter_medium', 'case_type', 'case_status'))) {
+ 'encounter_medium',
+ 'case_type',
+ 'case_status'
+ ))
+ ) {
static $caseCount = NULL;
if (!isset($caseCount)) {
$caseCount = CRM_Case_BAO_Case::caseCount(NULL, FALSE);
class CRM_Core_Page_File extends CRM_Core_Page {
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);
- $quest = CRM_Utils_Request::retrieve('quest', 'String', $this);
+ $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);
+ $quest = CRM_Utils_Request::retrieve('quest', 'String', $this);
$action = CRM_Utils_Request::retrieve('action', 'String', $this);
list($path, $mimeType) = CRM_Core_BAO_File::path($id, $eid, NULL, $quest);
*/
use Civi\Payment\System;
+
/**
*
* @package CRM
* $Id$
*
*/
-
abstract class CRM_Core_Payment {
/**
RECURRING_PAYMENT_START = 'START',
RECURRING_PAYMENT_END = 'END';
- protected $_paymentProcessor;
+ protected $_paymentProcessor;
/**
* Singleton function used to manage this object
}
//we use two lines because we can't remove the '&singleton' without risking breakage
//of extension classes that extend this one
- $object = Civi\Payment\System::singleton()->getByProcessor($paymentProcessor);
+ $object = Civi\Payment\System::singleton()->getByProcessor($paymentProcessor);
return $object;
}
'rule_message' => ts('Please enter a valid value for your card security code. This is usually the last 3-4 digits on the card\'s signature panel.'),
'rule_name' => 'integer',
'rule_parameters' => NULL,
- )),
+ )
+ ),
),
'credit_card_exp_date' => array(
'htmlType' => 'date',
'rule_message' => ts('Card expiration date cannot be a past date.'),
'rule_name' => 'currentDate',
'rule_parameters' => TRUE,
- )),
+ )
+ ),
),
'credit_card_type' => array(
'htmlType' => 'select',
'rule_message' => ts('Please enter a valid Bank Identification Number (value must not contain punctuation characters).'),
'rule_name' => 'nopunctuation',
'rule_parameters' => NULL,
- )),
+ )
+ ),
'is_required' => TRUE,
),
//e.g. SWIFT-BIC can have maxlength of 11 digits
'rule_message' => ts('Please enter a valid Bank Identification Number (value must not contain punctuation characters).'),
'rule_name' => 'nopunctuation',
'rule_parameters' => NULL,
- )),
+ )
+ ),
),
'bank_name' => array(
'htmlType' => 'text',
break;
}
- $session = CRM_Core_Session::singleton();
- $userId = $session->get('userID');
- $contactID = 0;
+ $session = CRM_Core_Session::singleton();
+ $userId = $session->get('userID');
+ $contactID = 0;
$checksumValue = '';
- $entityArg = '';
+ $entityArg = '';
// Find related Contact
if ($entityID) {
// hence treat that also as test mode transaction
// fix for CRM-2566
if (($this->_mode == 'test') || $response_fields[6] == 0) {
- $query = "SELECT MAX(trxn_id) FROM civicrm_contribution WHERE trxn_id RLIKE 'test[0-9]+'";
- $p = array();
- $trxn_id = strval(CRM_Core_DAO::singleValueQuery($query, $p));
- $trxn_id = str_replace('test', '', $trxn_id);
- $trxn_id = intval($trxn_id) + 1;
+ $query = "SELECT MAX(trxn_id) FROM civicrm_contribution WHERE trxn_id RLIKE 'test[0-9]+'";
+ $p = array();
+ $trxn_id = strval(CRM_Core_DAO::singleValueQuery($query, $p));
+ $trxn_id = str_replace('test', '', $trxn_id);
+ $trxn_id = intval($trxn_id) + 1;
$params['trxn_id'] = sprintf('test%08d', $trxn_id);
}
else {
*/
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??
+ if (empty($amount)) {//CRM-9894 would this ever be the case??
$amount = $this->_getParam('amount');
}
$fields = array();
$fields['x_customer_ip'] = $this->_getParam('ip_address');
$fields['x_email'] = $this->_getParam('email');
$fields['x_invoice_num'] = substr($this->_getParam('invoiceID'), 0, 20);
- $fields['x_amount'] = $amount;
+ $fields['x_amount'] = $amount;
$fields['x_currency_code'] = $this->_getParam('currencyID');
$fields['x_description'] = $this->_getParam('description');
$fields['x_cust_id'] = $this->_getParam('contactID');
if (strlen($key) > $b) {
$key = pack("H*", md5($key));
}
- $key = str_pad($key, $b, chr(0x00));
- $ipad = str_pad('', $b, chr(0x36));
- $opad = str_pad('', $b, chr(0x5c));
+ $key = str_pad($key, $b, chr(0x00));
+ $ipad = str_pad('', $b, chr(0x36));
+ $opad = str_pad('', $b, chr(0x5c));
$k_ipad = $key ^ $ipad;
$k_opad = $key ^ $opad;
return md5($k_opad . pack("H*", md5($k_ipad . $data)));
if (empty($md5Hash)) {
return TRUE;
}
- $loginid = $this->_getParam('apiLogin');
+ $loginid = $this->_getParam('apiLogin');
$hashString = $ipn ? ($md5Hash . $transaction_id . $amount) : ($md5Hash . $loginid . $transaction_id . $amount);
- $result = strtoupper(md5($hashString));
+ $result = strtoupper(md5($hashString));
if ($result == $responseMD5) {
return TRUE;
* fingerprint
**/
public function CalculateFP() {
- $x_tran_key = $this->_getParam('paymentKey');
- $loginid = $this->_getParam('apiLogin');
- $sequence = $this->_getParam('sequence');
- $timestamp = $this->_getParam('timestamp');
- $amount = $this->_getParam('amount');
- $currency = $this->_getParam('currencyID');
+ $x_tran_key = $this->_getParam('paymentKey');
+ $loginid = $this->_getParam('apiLogin');
+ $sequence = $this->_getParam('sequence');
+ $timestamp = $this->_getParam('timestamp');
+ $amount = $this->_getParam('amount');
+ $currency = $this->_getParam('currencyID');
$transaction = "$loginid^$sequence^$timestamp^$amount^$currency";
return $this->hmac($x_tran_key, $transaction);
}
* refId, resultCode, code, text, subscriptionId
*/
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>');
- $text = $this->_substring_between($content, '<text>', '</text>');
+ $refId = $this->_substring_between($content, '<refId>', '</refId>');
+ $resultCode = $this->_substring_between($content, '<resultCode>', '</resultCode>');
+ $code = $this->_substring_between($content, '<code>', '</code>');
+ $text = $this->_substring_between($content, '<text>', '</text>');
$subscriptionId = $this->_substring_between($content, '<subscriptionId>', '</subscriptionId>');
return array(
'refId' => $refId,
// create a contribution and then get it processed
$contribution = new CRM_Contribute_BAO_Contribution();
$contribution->contact_id = $ids['contact'];
- $contribution->financial_type_id = $objects['contributionType']->id;
+ $contribution->financial_type_id = $objects['contributionType']->id;
$contribution->contribution_page_id = $ids['contributionPage'];
$contribution->contribution_recur_id = $ids['contributionRecur'];
$contribution->receive_date = $now;
protected $_isRecurring = FALSE;
protected $_isFirstOrLastRecurringPayment = FALSE;
+
/**
* Constructor
*/
}
$this->_inputParameters = $parameters;
}
+
/**
* Validate incoming data. This function is intended to ensure that incoming data matches
* It provides a form of pseudo-authentication - by checking the calling fn already knows
try {
$success = $contribution->loadRelatedObjects($input, $ids, $required);
}
- catch(Exception $e) {
+ catch (Exception $e) {
$success = FALSE;
if (!empty($error_handling['log_error'])) {
CRM_Core_Error::debug_log_message($e->getMessage());
}
if (!empty($error_handling['echo_error'])) {
- echo ($e->getMessage());
+ echo($e->getMessage());
}
if (!empty($error_handling['return_error'])) {
return array(
$participant = &$objects['participant'];
//CRM-15546
- $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array('labelColumn' => 'name', 'flip' => 1));
+ $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array(
+ 'labelColumn' => 'name',
+ 'flip' => 1
+ ));
$contribution->receive_date = CRM_Utils_Date::isoToMysql($contribution->receive_date);
$contribution->receipt_date = CRM_Utils_Date::isoToMysql($contribution->receipt_date);
$contribution->thankyou_date = CRM_Utils_Date::isoToMysql($contribution->thankyou_date);
if (empty($input['skipComponentSync'])) {
if (!empty($memberships)) {
// if transaction is failed then set "Cancelled" as membership status
- $membershipStatuses = CRM_Core_PseudoConstant::get('CRM_Member_DAO_Membership', 'status_id', array('labelColumn' => 'name', 'flip' => 1));
+ $membershipStatuses = CRM_Core_PseudoConstant::get('CRM_Member_DAO_Membership', 'status_id', array(
+ 'labelColumn' => 'name',
+ 'flip' => 1
+ ));
foreach ($memberships as $membership) {
if ($membership) {
$membership->status_id = $membershipStatuses['Cancelled'];
}
if ($participant) {
- $participantStatuses = CRM_Core_PseudoConstant::get('CRM_Event_DAO_Participant', 'status_id', array('labelColumn' => 'name', 'flip' => 1));
+ $participantStatuses = CRM_Core_PseudoConstant::get('CRM_Event_DAO_Participant', 'status_id', array(
+ 'labelColumn' => 'name',
+ 'flip' => 1
+ ));
$participant->status_id = $participantStatuses['Cancelled'];
$participant->save();
}
if (empty($contribution->id)) {
$addLineItems = TRUE;
}
- $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array('labelColumn' => 'name', 'flip' => 1));
+ $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array(
+ 'labelColumn' => 'name',
+ 'flip' => 1
+ ));
$contribution->contribution_status_id = $contributionStatuses['Cancelled'];
$contribution->cancel_date = self::$_now;
$contribution->cancel_reason = CRM_Utils_Array::value('reasonCode', $input);
if (empty($input['skipComponentSync'])) {
if (!empty($memberships)) {
- $membershipStatuses = CRM_Core_PseudoConstant::get('CRM_Member_DAO_Membership', 'status_id', array('labelColumn' => 'name', 'flip' => 1));
+ $membershipStatuses = CRM_Core_PseudoConstant::get('CRM_Member_DAO_Membership', 'status_id', array(
+ 'labelColumn' => 'name',
+ 'flip' => 1
+ ));
foreach ($memberships as $membership) {
if ($membership) {
$membership->status_id = $membershipStatuses['Cancelled'];
}
if ($participant) {
- $participantStatuses = CRM_Core_PseudoConstant::get('CRM_Event_DAO_Participant', 'status_id', array('labelColumn' => 'name', 'flip' => 1));
+ $participantStatuses = CRM_Core_PseudoConstant::get('CRM_Event_DAO_Participant', 'status_id', array(
+ 'labelColumn' => 'name',
+ 'flip' => 1
+ ));
$participant->status_id = $participantStatuses['Cancelled'];
$participant->save();
}
if (is_numeric($memberships)) {
$memberships = array($objects['membership']);
}
- $participant = &$objects['participant'];
- $event = &$objects['event'];
- $changeToday = CRM_Utils_Array::value('trxn_date', $input, self::$_now);
+ $participant = &$objects['participant'];
+ $event = &$objects['event'];
+ $changeToday = CRM_Utils_Array::value('trxn_date', $input, self::$_now);
$recurContrib = &$objects['contributionRecur'];
$values = array();
);
$formatedParams = array(
- 'status_id' => CRM_Utils_Array::value('id', $calcStatus, 2),
+ 'status_id' => CRM_Utils_Array::value('id', $calcStatus, 2),
'join_date' => CRM_Utils_Date::customFormat(CRM_Utils_Array::value('join_date', $dates), $format),
'start_date' => CRM_Utils_Date::customFormat(CRM_Utils_Array::value('start_date', $dates), $format),
'end_date' => CRM_Utils_Date::customFormat(CRM_Utils_Array::value('end_date', $dates), $format),
$ufJoinParams = array(
'entity_table' => 'civicrm_event',
- 'entity_id' => $ids['event'],
- 'module' => 'CiviEvent',
+ 'entity_id' => $ids['event'],
+ 'module' => 'CiviEvent',
);
list($custom_pre_id,
- $custom_post_ids
- ) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
+ $custom_post_ids
+ ) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
$values['custom_pre_id'] = $custom_pre_id;
$values['custom_post_id'] = $custom_post_ids;
$values['is_email_receipt'] = 1;
}
if (empty($input['skipComponentSync'])) {
- $participantStatuses = CRM_Core_PseudoConstant::get('CRM_Event_DAO_Participant', 'status_id', array('labelColumn' => 'name', 'flip' => 1));
+ $participantStatuses = CRM_Core_PseudoConstant::get('CRM_Event_DAO_Participant', 'status_id', array(
+ 'labelColumn' => 'name',
+ 'flip' => 1
+ ));
$participant->status_id = $participantStatuses['Registered'];
}
$participant->save();
if (empty($contribution->id)) {
$addLineItems = TRUE;
}
- $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array('labelColumn' => 'name', 'flip' => 1));
+ $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array(
+ 'labelColumn' => 'name',
+ 'flip' => 1
+ ));
$contribution->contribution_status_id = $contributionStatuses['Completed'];
$contribution->is_test = $input['is_test'];
$contribution->fee_amount = CRM_Utils_Array::value('fee_amount', $input, 0);
// From a lot of code reading /debugging I'm still not sure the intent WRT first & subsequent payments in this code
// it would be good if someone added some comments or refactored this
if ($contribution->id) {
- $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array('labelColumn' => 'name', 'flip' => 1));
- if ((empty($input['prevContribution']) && $paymentProcessorId) || (!$input['prevContribution']->is_pay_later && - $input['prevContribution']->contribution_status_id == $contributionStatuses['Pending'])) {
+ $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array(
+ 'labelColumn' => 'name',
+ 'flip' => 1
+ ));
+ if ((empty($input['prevContribution']) && $paymentProcessorId) || (!$input['prevContribution']->is_pay_later && -$input['prevContribution']->contribution_status_id == $contributionStatuses['Pending'])) {
$input['payment_processor'] = $paymentProcessorId;
}
$input['contribution_status_id'] = $contributionStatuses['Completed'];
*/
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);
- $componentName = CRM_Utils_Array::value('componentName', $params);
+ $statusId = CRM_Utils_Array::value('contribution_status_id', $params);
+ $componentId = CRM_Utils_Array::value('component_id', $params);
+ $componentName = CRM_Utils_Array::value('componentName', $params);
$contributionId = CRM_Utils_Array::value('contribution_id', $params);
if (!$contributionId || !$componentId || !$componentName || !$statusId) {
$contribution = &$objects['contribution'];
- $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array('labelColumn' => 'name', 'flip' => 1));
+ $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array(
+ 'labelColumn' => 'name',
+ 'flip' => 1
+ ));
$input['skipComponentSync'] = CRM_Utils_Array::value('skipComponentSync', $params);
if ($statusId == $contributionStatuses['Cancelled']) {
$baseIPN->cancelled($objects, $transaction, $input);
//set values for ipn code.
foreach (array(
- 'fee_amount', 'check_number', 'payment_instrument_id') as $field) {
+ 'fee_amount',
+ 'check_number',
+ 'payment_instrument_id'
+ ) as $field) {
if (!$input[$field] = CRM_Utils_Array::value($field, $params)) {
$input[$field] = $contribution->$field;
}
*/
public function updateRecurLinkedPledge(&$contribution) {
$returnProperties = array('id', 'pledge_id');
- $paymentDetails = $paymentIDs = array();
+ $paymentDetails = $paymentIDs = array();
if (CRM_Core_DAO::commonRetrieveAll('CRM_Pledge_DAO_PledgePayment', 'contribution_id', $contribution->id,
- $paymentDetails, $returnProperties
- )) {
+ $paymentDetails, $returnProperties
+ )
+ ) {
foreach ($paymentDetails as $key => $value) {
$paymentIDs[] = $value['id'];
$pledgeId = $value['pledge_id'];
$lineSets[$priceField->price_set_id][] = $value;
if ($value['entity_table'] == 'civicrm_membership') {
try {
- civicrm_api3('membership_payment', 'create', array('membership_id' => $value['entity_id'], 'contribution_id' => $contribution->id));
+ civicrm_api3('membership_payment', 'create', array(
+ 'membership_id' => $value['entity_id'],
+ 'contribution_id' => $contribution->id
+ ));
}
catch (CiviCRM_API3_Exception $e) {
// we are catching & ignoring errors as an extra precaution since lost IPNs may be more serious that lost membership_payment data
}
foreach ($table as $tableName => $tableColumns) {
- $insert = 'INSERT INTO ' . $tableName . ' (' . implode(', ', $tableColumns) . ') ';
+ $insert = 'INSERT INTO ' . $tableName . ' (' . implode(', ', $tableColumns) . ') ';
$tableColumns[0] = $targetContributionId;
- $select = 'SELECT ' . implode(', ', $tableColumns);
- $from = ' FROM ' . $tableName;
- $where = " WHERE {$tableName}.entity_id = {$sourceContributionId}";
- $query = $insert . $select . $from . $where;
- $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
+ $select = 'SELECT ' . implode(', ', $tableColumns);
+ $from = ' FROM ' . $tableName;
+ $where = " WHERE {$tableName}.entity_id = {$sourceContributionId}";
+ $query = $insert . $select . $from . $where;
+ $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
}
}
}
return $this->_doDirectPaymentResult;
}
if ($this->_mode == 'test') {
- $query = "SELECT MAX(trxn_id) FROM civicrm_contribution WHERE trxn_id LIKE 'test\\_%'";
- $p = array();
- $trxn_id = strval(CRM_Core_Dao::singleValueQuery($query, $p));
- $trxn_id = str_replace('test_', '', $trxn_id);
- $trxn_id = intval($trxn_id) + 1;
+ $query = "SELECT MAX(trxn_id) FROM civicrm_contribution WHERE trxn_id LIKE 'test\\_%'";
+ $p = array();
+ $trxn_id = strval(CRM_Core_Dao::singleValueQuery($query, $p));
+ $trxn_id = str_replace('test_', '', $trxn_id);
+ $trxn_id = intval($trxn_id) + 1;
$params['trxn_id'] = sprintf('test_%08d', $trxn_id);
}
else {
- $query = "SELECT MAX(trxn_id) FROM civicrm_contribution WHERE trxn_id LIKE 'live_%'";
- $p = array();
- $trxn_id = strval(CRM_Core_Dao::singleValueQuery($query, $p));
- $trxn_id = str_replace('live_', '', $trxn_id);
- $trxn_id = intval($trxn_id) + 1;
+ $query = "SELECT MAX(trxn_id) FROM civicrm_contribution WHERE trxn_id LIKE 'live_%'";
+ $p = array();
+ $trxn_id = strval(CRM_Core_Dao::singleValueQuery($query, $p));
+ $trxn_id = str_replace('live_', '', $trxn_id);
+ $trxn_id = intval($trxn_id) + 1;
$params['trxn_id'] = sprintf('live_%08d', $trxn_id);
}
$params['gross_amount'] = $params['amount'];
*/
/**
- -----------------------------------------------------------------------------------------------
- The basic functionality of this processor is that variables from the $params object are transformed
- into xml. The xml is submitted to the processor's https site
- using curl and the response is translated back into an array using the processor's function.
-
- If an array ($params) is returned to the calling function the values from
- the array are merged into the calling functions array.
-
- If an result of class error is returned it is treated as a failure. No error denotes a success. Be
- WARY of this when coding
-
- -----------------------------------------------------------------------------------------------
+ * -----------------------------------------------------------------------------------------------
+ * The basic functionality of this processor is that variables from the $params object are transformed
+ * into xml. The xml is submitted to the processor's https site
+ * using curl and the response is translated back into an array using the processor's function.
+ *
+ * If an array ($params) is returned to the calling function the values from
+ * the array are merged into the calling functions array.
+ *
+ * If an result of class error is returned it is treated as a failure. No error denotes a success. Be
+ * WARY of this when coding
+ *
+ * -----------------------------------------------------------------------------------------------
**/
class CRM_Core_Payment_Elavon extends CRM_Core_Payment {
// (not used, implicit in the API, might need to convert?)
const
- CHARSET = 'UFT-8';
+ CHARSET = 'UFT-8';
/**
* We only need one instance of this object. So we use the singleton
}
/**********************************************************
- // If gateway returned no data - tell 'em and bail out
+ * // If gateway returned no data - tell 'em and bail out
**********************************************************/
if (empty($responseData)) {
curl_close($ch);
}
/**********************************************************
- // Success so far - close the curl and check the data
+ * // Success so far - close the curl and check the data
**********************************************************/
curl_close($ch);
}
if ($processorResponse['ssl_result_message'] == "APPROVED") {
if ($this->_mode == 'test') {
- $query = "SELECT MAX(trxn_id) FROM civicrm_contribution WHERE trxn_id LIKE 'test%'";
- $p = array();
- $trxn_id = strval(CRM_Core_Dao::singleValueQuery($query, $p));
- $trxn_id = str_replace('test', '', $trxn_id);
- $trxn_id = intval($trxn_id) + 1;
+ $query = "SELECT MAX(trxn_id) FROM civicrm_contribution WHERE trxn_id LIKE 'test%'";
+ $p = array();
+ $trxn_id = strval(CRM_Core_Dao::singleValueQuery($query, $p));
+ $trxn_id = str_replace('test', '', $trxn_id);
+ $trxn_id = intval($trxn_id) + 1;
$params['trxn_id'] = sprintf('test%08d', $trxn_id);
return $params;
}
* Success !
*/
- if ($this->_mode == 'test') {}
+ if ($this->_mode == 'test') {
+ }
else {
// 'trxn_id' is varchar(255) field. returned value is length 37
$params['trxn_id'] = $processorResponse['ssl_txn_id'];
*/
/**
- Note that in order to use FirstData / LinkPoint you need a certificate (.pem) file issued by them
- and a store number. You can configure the path to the certificate and the store number
- through the front end of civiCRM. The path is as seen by the server not the url
- -----------------------------------------------------------------------------------------------
- The basic functionality of this processor is that variables from the $params object are transformed
- into xml using a function provided by the processor. The xml is submitted to the processor's https site
- using curl and the response is translated back into an array using the processor's function.
-
- If an array ($params) is returned to the calling function it is treated as a success and the values from
- the array are merged into the calling functions array.
-
- If an result of class error is returned it is treated as a failure
-
- -----------------------------------------------------------------------------------------------
+ * Note that in order to use FirstData / LinkPoint you need a certificate (.pem) file issued by them
+ * and a store number. You can configure the path to the certificate and the store number
+ * through the front end of civiCRM. The path is as seen by the server not the url
+ * -----------------------------------------------------------------------------------------------
+ * The basic functionality of this processor is that variables from the $params object are transformed
+ * into xml using a function provided by the processor. The xml is submitted to the processor's https site
+ * using curl and the response is translated back into an array using the processor's function.
+ *
+ * If an array ($params) is returned to the calling function it is treated as a success and the values from
+ * the array are merged into the calling functions array.
+ *
+ * If an result of class error is returned it is treated as a failure
+ *
+ * -----------------------------------------------------------------------------------------------
**/
/**
// @todo - replace this section with one similar to above per discussion - probably use a manual processor shell class to stand in for that capability
//return without adding billing fields if billing_mode = 4 (@todo - more the ability to set that to the payment processor)
// or payment processor is NULL (pay later)
- if (($processor == NULL && !$forceBillingFieldsForPayLater) || CRM_Utils_Array::value('billing_mode', $processor) == 4) {
+ if (($processor == NULL && !$forceBillingFieldsForPayLater) || CRM_Utils_Array::value('billing_mode', $processor) == 4) {
return;
}
//@todo setPaymentFields defines the billing fields - this should be moved to the processor class & renamed getBillingFields
'title' => ts('Country'),
'cc_field' => TRUE,
'attributes' => array(
- '' => ts('- select -')) +
- CRM_Core_PseudoConstant::country(),
+ '' => ts('- select -')
+ ) +
+ CRM_Core_PseudoConstant::country(),
'is_required' => TRUE,
);
//CRM-15509 working towards giving control over billing fields to payment processors. For now removing tpl hard-coding
* @param CRM_Core_Form $form
* @param array $paymentFields
* Array of properties including 'object' as loaded from CRM_Financial_BAO_PaymentProcessor::getPaymentProcessors.
-
* @param $paymentFields
*/
protected static function addRules(&$form, $paymentFields) {
$merchant_key = $this->_paymentProcessor['password'];
$server_type = ($this->_mode == 'test') ? 'sandbox' : '';
- $itemName = CRM_Utils_Array::value('item_name', $params);
- $description = CRM_Utils_Array::value('description', $params);
- $amount = CRM_Utils_Array::value('amount', $params);
+ $itemName = CRM_Utils_Array::value('item_name', $params);
+ $description = CRM_Utils_Array::value('description', $params);
+ $amount = CRM_Utils_Array::value('amount', $params);
$installments = CRM_Utils_Array::value('installments', $params);
- $cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $params['currencyID']);
- $item = new GoogleItem($itemName, $description, 1, $amount);
+ $cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $params['currencyID']);
+ $item = new GoogleItem($itemName, $description, 1, $amount);
$subscription_item = new GoogleSubscription("merchant", $intervalUnit, $amount, $installments);
$item->SetSubscription($subscription_item);
if ($request->getResponseCode() != 302) {
CRM_Core_Error::fatal(ts('Invalid response code received from Google Checkout: %1',
- array(1 => $request->getResponseCode())
- ));
+ array(1 => $request->getResponseCode())
+ ));
}
CRM_Utils_System::redirect($request->getResponseHeader('location'));
CRM_Utils_System::civiExit();
* returns an associtive array containing the response from the server.
*/
public function invokeAPI($paymentProcessor, $searchParams) {
- $merchantID = $paymentProcessor['user_name'];
+ $merchantID = $paymentProcessor['user_name'];
$merchantKey = $paymentProcessor['password'];
- $siteURL = rtrim(str_replace('https://', '', $paymentProcessor['url_site']), '/');
+ $siteURL = rtrim(str_replace('https://', '', $paymentProcessor['url_site']), '/');
$url = "https://{$merchantID}:{$merchantKey}@{$siteURL}/api/checkout/v2/reports/Merchant/{$merchantID}";
$xml = self::buildXMLQuery($searchParams);
public static function getArrayFromXML($xmlData) {
require_once 'Google/library/xml-processing/gc_xmlparser.php';
$xmlParser = new gc_XmlParser($xmlData);
- $root = $xmlParser->GetRoot();
- $data = $xmlParser->GetData();
+ $root = $xmlParser->GetRoot();
+ $data = $xmlParser->GetData();
return array($root, $data);
}
public function cancelSubscription(&$message = '', $params = array()) {
$orderNo = CRM_Utils_Array::value('subscriptionId', $params);
- $merchant_id = $this->_paymentProcessor['user_name'];
+ $merchant_id = $this->_paymentProcessor['user_name'];
$merchant_key = $this->_paymentProcessor['password'];
- $server_type = ($this->_mode == 'test') ? 'sandbox' : '';
+ $server_type = ($this->_mode == 'test') ? 'sandbox' : '';
$googleRequest = new GoogleRequest($merchant_id, $merchant_key, $server_type);
- $result = $googleRequest->SendCancelItems($orderNo, array(), 'Cancelled by admin', '');
- $message = "{$result[0]}: {$result[1]}";
+ $result = $googleRequest->SendCancelItems($orderNo, array(), 'Cancelled by admin', '');
+ $message = "{$result[0]}: {$result[1]}";
if ($result[0] != 200) {
return self::error($result[0], $result[1]);
*/
-
define('GOOGLE_DEBUG_PP', 0);
/**
$ids['contributionRecur'] = $ids['contributionPage'] = NULL;
if ($input['component'] == "event") {
- $ids['event'] = self::retrieve('eventID', 'Integer', $privateData, TRUE);
+ $ids['event'] = self::retrieve('eventID', 'Integer', $privateData, TRUE);
$ids['participant'] = self::retrieve('participantID', 'Integer', $privateData, TRUE);
- $ids['membership'] = NULL;
+ $ids['membership'] = NULL;
}
else {
$ids['membership'] = self::retrieve('membershipID', 'Integer', $privateData, FALSE);
// create a contribution and then get it processed
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->contact_id = $ids['contact'];
- $contribution->financial_type_id = $objects['contributionType']->id;
+ $contribution->financial_type_id = $objects['contributionType']->id;
$contribution->contribution_page_id = $objects['contribution']->contribution_page_id;
$contribution->contribution_recur_id = $ids['contributionRecur'];
$contribution->receive_date = date('YmdHis');
$ids['onbehalf_dupe_alert'] = NULL;
if ($contribution->trxn_id) {
list($ids['membership'], $ids['related_contact'], $ids['onbehalf_dupe_alert']) = explode(CRM_Core_DAO::VALUE_SEPARATOR,
- $contribution->trxn_id
+ $contribution->trxn_id
);
}
foreach (array(
- 'membership', 'related_contact', 'onbehalf_dupe_alert') as $fld) {
+ 'membership',
+ 'related_contact',
+ 'onbehalf_dupe_alert'
+ ) as $fld) {
if (!is_numeric($ids[$fld])) {
unset($ids[$fld]);
}
return $this->failed($objects, $transaction);
}
- $input['amount'] = $contribution->total_amount;
+ $input['amount'] = $contribution->total_amount;
$input['fee_amount'] = NULL;
$input['net_amount'] = NULL;
- $input['trxn_id'] = $ids['contributionRecur'] ? $serial : $dataRoot['google-order-number']['VALUE'];
- $input['is_test'] = $contribution->is_test;
+ $input['trxn_id'] = $ids['contributionRecur'] ? $serial : $dataRoot['google-order-number']['VALUE'];
+ $input['is_test'] = $contribution->is_test;
$recur = NULL;
if ($ids['contributionRecur']) {
*/
public function completeRecur($input, $ids, $objects) {
if ($ids['contributionRecur']) {
- $recur = &$objects['contributionRecur'];
- $contributionCount = CRM_Core_DAO::singleValueQuery("
+ $recur = &$objects['contributionRecur'];
+ $contributionCount = CRM_Core_DAO::singleValueQuery("
SELECT count(*)
FROM civicrm_contribution
WHERE contribution_recur_id = {$ids['contributionRecur']}
$privateData = $data[$root]['shopping-cart']['merchant-private-data']['VALUE'];
}
if (empty($privateData) && array_key_exists('order-summary', $data[$root])
- && array_key_exists('shopping-cart', $data[$root]['order-summary'])) {
+ && array_key_exists('shopping-cart', $data[$root]['order-summary'])
+ ) {
$privateData = $data[$root]['order-summary']['shopping-cart']['merchant-private-data']['VALUE'];
}
$privateData = $privateData ? self::stringToArray($privateData) : '';
- $orderNo = $data[$root]['google-order-number']['VALUE'];
- $serial = $data[$root]['serial-number'];
+ $orderNo = $data[$root]['google-order-number']['VALUE'];
+ $serial = $data[$root]['serial-number'];
// a dummy object to call get context and a parent function inside it.
$ipn = new CRM_Core_Payment_GoogleIPN('live', $dummyProcessor);
case "merchant-calculation-callback":
break;
- case "new-order-notification":{
+ case "new-order-notification": {
$response->SendAck($serial, FALSE);
$ipn->newOrderNotify($data[$root], $privateData, $module);
break;
- }
+ }
- case "order-state-change-notification":{
+ case "order-state-change-notification": {
$response->SendAck($serial, FALSE);
$new_financial_state = $data[$root]['new-financial-order-state']['VALUE'];
$new_fulfillment_order = $data[$root]['new-fulfillment-order-state']['VALUE'];
break;
}
break;
- }
+ }
- case "authorization-amount-notification":{
+ case "authorization-amount-notification": {
$response->SendAck($serial, FALSE);
$new_financial_state = $data[$root]['order-summary']['financial-order-state']['VALUE'];
$new_fulfillment_order = $data[$root]['order-summary']['fulfillment-order-state']['VALUE'];
break;
}
break;
- }
+ }
case "charge-amount-notification":
case "chargeback-amount-notification":
case 'week':
$scheduleType = 'WEEKLY';
$scheduleDate = $date['wday'] + 1;
- $endTime = $startTime + ($paymentsRecur * 7 * 24 * 60 * 60);
+ $endTime = $startTime + ($paymentsRecur * 7 * 24 * 60 * 60);
break;
case 'month':
default:
die('Invalid frequency unit!');
- break;
+ break;
}
$endDate = date('Y-m-d', $endTime);
$startDate = date('Y-m-d', $startTime);
// this just means we got some kind of answer, not necessarily approved
$result = $iatslink1->getAuthorizationResult();
//return self::error($result);
- $result = explode(':', $result, 2);
+ $result = explode(':', $result, 2);
$trxn_result = trim($result[0]);
- $trxn_id = trim($result[1]);
+ $trxn_id = trim($result[1]);
if ($trxn_result == 'OK') {
$params['trxn_id'] = $trxn_id . ':' . time();
$params['gross_amount'] = $amount;
// add a recurring payment if requested
if ($params['is_recur'] && $params['installments'] > 1) {
//Recur Variables
- $recurUnit = $params['frequency_unit'];
+ $recurUnit = $params['frequency_unit'];
$recurInterval = $params['frequency_interval'];
- $next = time();
- $day = 60 * 60 * 24;
+ $next = time();
+ $day = 60 * 60 * 24;
switch ($recurUnit) {
case 'day':
$next += $recurInterval * $day;
* @abstract
*/
public function doDirectPayment(&$params) {
- $logon = $this->_paymentProcessor['user_name'];
+ $logon = $this->_paymentProcessor['user_name'];
$password = $this->_paymentProcessor['password'];
$url_site = $this->_paymentProcessor['url_site'];
// Recur Variables
$dc_schedule_create = $params['is_recur'];
- $recurUnit = $params['frequency_unit'];
- $recurInterval = $params['frequency_interval'];
- $dc_schedule_start = $params['dc_schedule_start'];
+ $recurUnit = $params['frequency_unit'];
+ $recurInterval = $params['frequency_interval'];
+ $dc_schedule_start = $params['dc_schedule_start'];
// next payment in moneris required format
$startDate = date("Y/m/d", $next);
}
$contribution->contact_id = $ids['contact'];
- $contribution->financial_type_id = $objects['contributionType']->id;
+ $contribution->financial_type_id = $objects['contributionType']->id;
$contribution->contribution_page_id = $ids['contributionPage'];
$contribution->contribution_recur_id = $ids['contributionRecur'];
$contribution->receive_date = $now;
$input[$name] = $value ? $value : NULL;
}
- $input['is_test'] = self::retrieve('test_ipn', 'Integer', 'POST', FALSE);
+ $input['is_test'] = self::retrieve('test_ipn', 'Integer', 'POST', FALSE);
$input['fee_amount'] = self::retrieve('mc_fee', 'Money', 'POST', FALSE);
$input['net_amount'] = self::retrieve('settle_amount', 'Money', 'POST', FALSE);
- $input['trxn_id'] = self::retrieve('txn_id', 'String', 'POST', FALSE);
+ $input['trxn_id'] = self::retrieve('txn_id', 'String', 'POST', FALSE);
}
}
}
return FALSE;
}
+
/**
* Express checkout code. Check PayPal documentation for more information
*
* @param $method
*/
public function initialize(&$args, $method) {
- $args['user'] = $this->_paymentProcessor['user_name'];
- $args['pwd'] = $this->_paymentProcessor['password'];
- $args['version'] = 3.0;
+ $args['user'] = $this->_paymentProcessor['user_name'];
+ $args['pwd'] = $this->_paymentProcessor['password'];
+ $args['version'] = 3.0;
$args['signature'] = $this->_paymentProcessor['signature'];
- $args['subject'] = CRM_Utils_Array::value('subject', $this->_paymentProcessor);
- $args['method'] = $method;
+ $args['subject'] = CRM_Utils_Array::value('subject', $this->_paymentProcessor);
+ $args['method'] = $method;
}
/**
$this->initialize($args, 'ManageRecurringPaymentsProfileStatus');
$args['PROFILEID'] = CRM_Utils_Array::value('subscriptionId', $params);
- $args['ACTION'] = 'Cancel';
- $args['NOTE'] = CRM_Utils_Array::value('reason', $params);
+ $args['ACTION'] = 'Cancel';
+ $args['NOTE'] = CRM_Utils_Array::value('reason', $params);
$result = $this->invokeAPI($args);
if (is_a($result, 'CRM_Core_Error')) {
$args['EXPDATE'] = sprintf('%02d', $params['month']) . $params['year'];
$args['CVV2'] = $params['cvv2'];
- $args['FIRSTNAME'] = $params['first_name'];
- $args['LASTNAME'] = $params['last_name'];
- $args['STREET'] = $params['street_address'];
- $args['CITY'] = $params['city'];
- $args['STATE'] = $params['state_province'];
+ $args['FIRSTNAME'] = $params['first_name'];
+ $args['LASTNAME'] = $params['last_name'];
+ $args['STREET'] = $params['street_address'];
+ $args['CITY'] = $params['city'];
+ $args['STATE'] = $params['state_province'];
$args['COUNTRYCODE'] = $params['postal_code'];
- $args['ZIP'] = $params['country'];
+ $args['ZIP'] = $params['country'];
$result = $this->invokeAPI($args);
if (is_a($result, 'CRM_Core_Error')) {
}
}
- $url = ($component == 'event') ? 'civicrm/event/register' : 'civicrm/contribute/transact';
- $cancel = ($component == 'event') ? '_qf_Register_display' : '_qf_Main_display';
+ $url = ($component == 'event') ? 'civicrm/event/register' : 'civicrm/contribute/transact';
+ $cancel = ($component == 'event') ? '_qf_Register_display' : '_qf_Main_display';
$returnURL = CRM_Utils_System::url($url,
"_qf_ThankYou_display=1&qfKey={$params['qfKey']}",
TRUE, NULL, FALSE
$paypalParams += array(
'cmd' => '_xclick-subscriptions',
- 'a3' => $params['amount'],
- 'p3' => $params['frequency_interval'],
- 't3' => ucfirst(substr($params['frequency_unit'], 0, 1)),
+ 'a3' => $params['amount'],
+ 'p3' => $params['frequency_interval'],
+ 't3' => ucfirst(substr($params['frequency_unit'], 0, 1)),
'src' => 1,
'sra' => 1,
'srt' => CRM_Utils_Array::value('installments', $params),
$uri .= "&{$key}={$value}";
}
- $uri = substr($uri, 1);
- $url = $this->_paymentProcessor['url_site'];
- $sub = empty($params['is_recur']) ? 'cgi-bin/webscr' : 'subscriptions';
+ $uri = substr($uri, 1);
+ $url = $this->_paymentProcessor['url_site'];
+ $sub = empty($params['is_recur']) ? 'cgi-bin/webscr' : 'subscriptions';
$paypalURL = "{$url}{$sub}?$uri";
CRM_Utils_System::redirect($paypalURL);
$contributionStatuses = $contributionStatuses['values'];
switch ($txnType) {
case 'recurring_payment_profile_created':
- if (in_array($recur->contribution_status_id, array(array_search('Pending', $contributionStatuses), array_search('In Progress', $contributionStatuses)))
- && !empty($recur->processor_id)) {
+ if (in_array($recur->contribution_status_id, array(
+ array_search('Pending', $contributionStatuses),
+ array_search('In Progress', $contributionStatuses)
+ ))
+ && !empty($recur->processor_id)
+ ) {
echo "already handled";
return;
}
}
$contribution->contact_id = $recur->contact_id;
- $contribution->financial_type_id = $objects['contributionType']->id;
+ $contribution->financial_type_id = $objects['contributionType']->id;
$contribution->contribution_page_id = $ids['contributionPage'];
$contribution->contribution_recur_id = $ids['contributionRecur'];
$contribution->currency = $objects['contribution']->currency;
return;
}
$objects = $ids = $input = array();
- $this->_component = $input['component'] = self::getValue('m');
+ $this->_component = $input['component'] = self::getValue('m');
$input['invoice'] = self::getValue('i', TRUE);
// get the contribution and contact ids from the GET params
$ids['contact'] = self::getValue('c', TRUE);
WHERE m.contribution_recur_id = %2
LIMIT 1";
$sqlParams = array(
- 1 => array($ids['contribution'], 'Integer'),
+ 1 => array($ids['contribution'], 'Integer'),
2 => array($ids['contributionRecur'], 'Integer'),
);
if ($membershipId = CRM_Core_DAO::singleValueQuery($sql, $sqlParams)) {
$input[$name] = $value ? $value : NULL;
}
- $input['is_test'] = self::retrieve('test_ipn', 'Integer', 'POST', FALSE);
+ $input['is_test'] = self::retrieve('test_ipn', 'Integer', 'POST', FALSE);
$input['fee_amount'] = self::retrieve('mc_fee', 'Money', 'POST', FALSE);
$input['net_amount'] = self::retrieve('settle_amount', 'Money', 'POST', FALSE);
- $input['trxn_id'] = self::retrieve('txn_id', 'String', 'POST', FALSE);
+ $input['trxn_id'] = self::retrieve('txn_id', 'String', 'POST', FALSE);
$input['payment_date'] = self::retrieve('payment_date', 'String', 'POST', FALSE);
}
// as membership id etc can be derived by the load objects fn
$objects = $ids = $input = array();
$isFirst = FALSE;
- $input['txnType'] = $this->retrieve('txn_type', 'String');
+ $input['txnType'] = $this->retrieve('txn_type', 'String');
if ($input['txnType'] != 'recurring_payment') {
throw new CRM_Core_Exception('Paypal IPNS not handled other than recurring_payments');
}
throw new CRM_Core_Exception('This transaction has already been processed');
}
- $contributionRecur = civicrm_api3('contribution_recur', 'getsingle', array('return' => 'contact_id, id', 'invoice_id' => $input['invoice']));
+ $contributionRecur = civicrm_api3('contribution_recur', 'getsingle', array(
+ 'return' => 'contact_id, id',
+ 'invoice_id' => $input['invoice']
+ ));
$ids['contact'] = $contributionRecur['contact_id'];
$ids['contributionRecur'] = $contributionRecur['id'];
$result = civicrm_api3('contribution', 'getsingle', array('invoice_id' => $input['invoice']));
$isFirst = TRUE;
}
// arg api won't get this - fix it
- $ids['contributionPage'] = CRM_Core_DAO::singleValueQuery("SELECT contribution_page_id FROM civicrm_contribution WHERE invoice_id = %1", array(1 => array($ids['contribution'], 'Integer')));
+ $ids['contributionPage'] = CRM_Core_DAO::singleValueQuery("SELECT contribution_page_id FROM civicrm_contribution WHERE invoice_id = %1", array(
+ 1 => array(
+ $ids['contribution'],
+ 'Integer'
+ )
+ ));
// only handle component at this stage - not terribly sure how a recurring event payment would arise
// & suspec main function may be a victom of copy & paste
// membership would be an easy add - but not relevant to my customer...
- $this->_component = $input['component'] = 'contribute';
+ $this->_component = $input['component'] = 'contribute';
$input['trxn_date'] = date('Y-m-d-H-i-s', strtotime(self::retrieve('time_created', 'String')));
$paymentProcessorID = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessorType',
'PayPal', 'id', 'name'
if (CRM_Core_DAO::singleValueQuery("SELECT count(*) FROM civicrm_contribution WHERE trxn_id = %1",
array(
1 => array($trxn_id, 'String'),
- ))) {
+ ))
+ ) {
return TRUE;
}
}
class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
// (not used, implicit in the API, might need to convert?)
const
- CHARSET = 'UFT-8';
+ CHARSET = 'UFT-8';
/**
* We only need one instance of this object. So we use the singleton
* the cvv check, the avs check. This is stored in
* CiviCRM as part of the transact
* but not further processing is done. Business rules would need to be defined
-
*******************************************************/
$params['trxn_id'] = $nvpArray['PNREF'] . $nvpArray['TRXPNREF'];
//'trxn_id' is varchar(255) field. returned value is length 12
$ids['contribution'] = self::retrieve('contributionID', 'Integer', $privateData, TRUE);
if ($input['component'] == "event") {
- $ids['event'] = self::retrieve('eventID', 'Integer', $privateData, TRUE);
+ $ids['event'] = self::retrieve('eventID', 'Integer', $privateData, TRUE);
$ids['participant'] = self::retrieve('participantID', 'Integer', $privateData, TRUE);
- $ids['membership'] = NULL;
+ $ids['membership'] = NULL;
}
else {
$ids['membership'] = self::retrieve('membershipID', 'Integer', $privateData, FALSE);
}
// make sure the invoice is valid and matches what we have in the contribution record
- $input['invoice'] = $privateData['invoiceID'];
+ $input['invoice'] = $privateData['invoiceID'];
$input['newInvoice'] = $transactionReference;
- $contribution = &$objects['contribution'];
- $input['trxn_id'] = $transactionReference;
+ $contribution = &$objects['contribution'];
+ $input['trxn_id'] = $transactionReference;
if ($contribution->invoice_id != $input['invoice']) {
CRM_Core_Error::debug_log_message("Invoice values dont match between database and IPN request");
}
/**
-
- /**
+ *
+ * /**
* The function returns the component(Event/Contribute..)and whether it is Test or not
*
* @param array $privateData
$component = NULL;
$isTest = NULL;
- $contributionID = $privateData['contributionID'];
- $contribution = new CRM_Contribute_DAO_Contribution();
+ $contributionID = $privateData['contributionID'];
+ $contribution = new CRM_Contribute_DAO_Contribution();
$contribution->id = $contributionID;
if (!$contribution->find(TRUE)) {
if ($dps_method == "pxpay") {
$processResponse = CRM_Core_Payment_PaymentExpressUtils::_valueXml(array(
- 'PxPayUserId' => $dps_user,
- 'PxPayKey' => $dps_key,
- 'Response' => $_GET['result'],
- ));
+ 'PxPayUserId' => $dps_user,
+ 'PxPayKey' => $dps_key,
+ 'Response' => $_GET['result'],
+ ));
$processResponse = CRM_Core_Payment_PaymentExpressUtils::_valueXml('ProcessResponse', $processResponse);
fwrite($message_log, sprintf("\n\r%s:- %s\n", date("D M j G:i:s T Y"),
- $processResponse
- ));
+ $processResponse
+ ));
// Send the XML-formatted validation request to DPS so that we can receive a decrypted XML response which contains the transaction results
$curl = CRM_Core_Payment_PaymentExpressUtils::_initCURL($processResponse, $dps_url);
fwrite($message_log, sprintf("\n\r%s:- %s\n", date("D M j G:i:s T Y"),
- $curl
- ));
+ $curl
+ ));
$success = FALSE;
if ($response = curl_exec($curl)) {
fwrite($message_log, sprintf("\n\r%s:- %s\n", date("D M j G:i:s T Y"),
- $response
- ));
+ $response
+ ));
curl_close($curl);
// Assign the returned XML values to variables
- $valid = CRM_Core_Payment_PaymentExpressUtils::_xmlAttribute($response, 'valid');
- $success = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, 'Success');
- $txnId = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, 'TxnId');
- $responseText = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, 'ResponseText');
- $authCode = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, 'AuthCode');
- $DPStxnRef = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, 'DpsTxnRef');
- $qfKey = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "TxnData1");
- $privateData = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "TxnData2");
- list($component, $paymentProcessorID,) = explode(',', CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "TxnData3"));
- $amount = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "AmountSettlement");
+ $valid = CRM_Core_Payment_PaymentExpressUtils::_xmlAttribute($response, 'valid');
+ $success = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, 'Success');
+ $txnId = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, 'TxnId');
+ $responseText = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, 'ResponseText');
+ $authCode = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, 'AuthCode');
+ $DPStxnRef = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, 'DpsTxnRef');
+ $qfKey = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "TxnData1");
+ $privateData = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "TxnData2");
+ list($component, $paymentProcessorID,) = explode(',', CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "TxnData3"));
+ $amount = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "AmountSettlement");
$merchantReference = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "MerchantReference");
}
else {
#which encapsulates all the response data
$rsp = $pxaccess->getResponse($rawPostData);
- $qfKey = $rsp->getTxnData1();
- $privateData = $rsp->getTxnData2();
- list($component, $paymentProcessorID) = explode(',', $rsp->getTxnData3());
- $success = $rsp->getSuccess();
- $authCode = $rsp->getAuthCode();
- $DPStxnRef = $rsp->getDpsTxnRef();
- $amount = $rsp->getAmountSettlement();
+ $qfKey = $rsp->getTxnData1();
+ $privateData = $rsp->getTxnData2();
+ list($component, $paymentProcessorID) = explode(',', $rsp->getTxnData3());
+ $success = $rsp->getSuccess();
+ $authCode = $rsp->getAuthCode();
+ $DPStxnRef = $rsp->getDpsTxnRef();
+ $amount = $rsp->getAmountSettlement();
$MerchantReference = $rsp->getMerchantReference();
}
// make sure we have a valid payment class, else abort
if (!empty($form->_values['is_monetary']) &&
- !$form->_paymentProcessor['class_name'] && empty($form->_values['is_pay_later'])) {
+ !$form->_paymentProcessor['class_name'] && empty($form->_values['is_pay_later'])
+ ) {
CRM_Core_Error::fatal(ts('Payment processor is not set for this page'));
}
}
// Create sha1 hash for request
- $hashme = "{$this->_getParam('timestamp')}.{$this->_getParam('merchant_ref')}.{$this->_getParam('order_id')}.{$this->_getParam('amount')}.{$this->_getParam('currency')}.{$this->_getParam('card_number')}";
+ $hashme = "{$this->_getParam('timestamp')}.{$this->_getParam('merchant_ref')}.{$this->_getParam('order_id')}.{$this->_getParam('amount')}.{$this->_getParam('currency')}.{$this->_getParam('card_number')}";
$sha1hash = sha1($hashme);
- $hashme = "$sha1hash.{$this->_getParam('secret')}";
+ $hashme = "$sha1hash.{$this->_getParam('secret')}";
$sha1hash = sha1($hashme);
// Generate the request xml that is send to Realex Payments.
}
// Check the response hash
- $hashme = "{$this->_getParam('timestamp')}.{$this->_getParam('merchant_ref')}.{$this->_getParam('order_id')}.{$response['RESULT']}.{$response['MESSAGE']}.{$response['PASREF']}.{$response['AUTHCODE']}";
+ $hashme = "{$this->_getParam('timestamp')}.{$this->_getParam('merchant_ref')}.{$this->_getParam('order_id')}.{$response['RESULT']}.{$response['MESSAGE']}.{$response['PASREF']}.{$response['AUTHCODE']}";
$sha1hash = sha1($hashme);
- $hashme = "$sha1hash.{$this->_getParam('secret')}";
+ $hashme = "$sha1hash.{$this->_getParam('secret')}";
$sha1hash = sha1($hashme);
if ($response['SHA1HASH'] != $sha1hash) {
// Format the expiry date to MMYY
$expmonth = (string) $params['month'];
$expmonth = (strlen($expmonth) === 1) ? '0' . $expmonth : $expmonth;
- $expyear = substr((string) $params['year'], 2, 2);
+ $expyear = substr((string) $params['year'], 2, 2);
$this->_setParam('exp_date', $expmonth . $expyear);
if (isset($params['credit_card_start_date']) && (strlen($params['credit_card_start_date']['M']) !== 0) &&
) {
$startmonth = (string) $params['credit_card_start_date']['M'];
$startmonth = (strlen($startmonth) === 1) ? '0' . $startmonth : $startmonth;
- $startyear = substr((string) $params['credit_card_start_date']['Y'], 2, 2);
+ $startyear = substr((string) $params['credit_card_start_date']['Y'], 2, 2);
$this->_setParam('start_date', $startmonth . $startyear);
}
*/
/**
- -----------------------------------------------------------------------------------------------
- From the eWAY supplied 'Web.config' dated 25-Sep-2006 - check date and update links if required
- -----------------------------------------------------------------------------------------------
-
- LIVE gateway with CVN
- https://www.eway.com.au/gateway_cvn/xmlpayment.asp
-
- LIVE gateway without CVN
- https://www.eway.com.au/gateway/xmlpayment.asp
-
-
- Test gateway with CVN
- https://www.eway.com.au/gateway_cvn/xmltest/TestPage.asp
-
- Test gateway without CVN
- https://www.eway.com.au/gateway/xmltest/TestPage.asp
-
-
- LIVE gateway for Stored Transactions
- https://www.eway.com.au/gateway/xmlstored.asp
-
-
- -----------------------------------------------------------------------------------------------
- From the eWAY web-site - http://www.eway.com.au/Support/Developer/PaymentsRealTime.aspx
- -----------------------------------------------------------------------------------------------
- The test Customer ID is 87654321 - this is the only ID that will work on the test gateway.
- The test Credit Card number is 4444333322221111
- - this is the only credit card number that will work on the test gateway.
- The test Total Amount should end in 00 or 08 to get a successful response (e.g. $10.00 or $10.08)
- ie - all other amounts will return a failed response.
-
- -----------------------------------------------------------------------------------------------
+ * -----------------------------------------------------------------------------------------------
+ * From the eWAY supplied 'Web.config' dated 25-Sep-2006 - check date and update links if required
+ * -----------------------------------------------------------------------------------------------
+ *
+ * LIVE gateway with CVN
+ * https://www.eway.com.au/gateway_cvn/xmlpayment.asp
+ *
+ * LIVE gateway without CVN
+ * https://www.eway.com.au/gateway/xmlpayment.asp
+ *
+ *
+ * Test gateway with CVN
+ * https://www.eway.com.au/gateway_cvn/xmltest/TestPage.asp
+ *
+ * Test gateway without CVN
+ * https://www.eway.com.au/gateway/xmltest/TestPage.asp
+ *
+ *
+ * LIVE gateway for Stored Transactions
+ * https://www.eway.com.au/gateway/xmlstored.asp
+ *
+ *
+ * -----------------------------------------------------------------------------------------------
+ * From the eWAY web-site - http://www.eway.com.au/Support/Developer/PaymentsRealTime.aspx
+ * -----------------------------------------------------------------------------------------------
+ * The test Customer ID is 87654321 - this is the only ID that will work on the test gateway.
+ * The test Credit Card number is 4444333322221111
+ * - this is the only credit card number that will work on the test gateway.
+ * The test Total Amount should end in 00 or 08 to get a successful response (e.g. $10.00 or $10.08)
+ * ie - all other amounts will return a failed response.
+ *
+ * -----------------------------------------------------------------------------------------------
**/
class CRM_Core_Payment_eWAY extends CRM_Core_Payment {
# (not used, implicit in the API, might need to convert?)
// Prepare some composite data from _paymentProcessor fields
//-------------------------------------------------------------
$fullAddress = $params['street_address'] . ", " . $params['city'] . ", " . $params['state_province'] . ".";
- $expireYear = substr($params['year'], 2, 2);
+ $expireYear = substr($params['year'], 2, 2);
$expireMonth = sprintf('%02d', (int) $params['month']);
// CiviCRM V1.9 - Picks up reasonable description
//$description = $params['amount_level'];
$params = array();
$params['groupName'] = 'eWay Email Sender';
- $params['from'] = $from;
- $params['toName'] = $toName;
- $params['toEmail'] = $toEmail;
- $params['subject'] = $subject;
- $params['cc'] = $cc;
- $params['text'] = $message;
+ $params['from'] = $from;
+ $params['toName'] = $toName;
+ $params['toEmail'] = $toEmail;
+ $params['subject'] = $subject;
+ $params['cc'] = $cc;
+ $params['text'] = $message;
CRM_Utils_Mail::send($params);
}
public function whereClause($type, &$tables, &$whereTables) {
return '( 1 )';
}
+
/**
* Get the permissioned where clause for the user when trying to see groups
*
$group->id = $id;
if ($group->find(TRUE) && $group->saved_search_id) {
$clause = CRM_Contact_BAO_SavedSearch::whereClause($group->saved_search_id,
- $tables,
- $whereTables
+ $tables,
+ $whereTables
);
if (trim($clause)) {
$clauses[] = $clause;
}
return FALSE;
}
+
/**
* {@inheritDoc}
*/
* - orderColumn string the column to use for sorting, defaults to 'weight' column if one exists, else defaults to labelColumn
* - onlyActive boolean return only the action option values
* - fresh boolean ignore cache entries and go back to DB
- * @param string $context: Context string
+ * @param string $context : Context string
*
* @return Array|bool - array on success, FALSE on error.
*
$wheres[] = 'domain_id = ' . CRM_Core_Config::domainID();
}
$queryParams = array(
- 1 => array($params['keyColumn'], 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES),
- 2 => array($params['labelColumn'], 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES),
- 3 => array($pseudoconstant['table'], 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES),
+ 1 => array($params['keyColumn'], 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES),
+ 2 => array($params['labelColumn'], 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES),
+ 3 => array($pseudoconstant['table'], 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES),
);
// Add orderColumn param
if (!empty($params['orderColumn'])) {
$force = NULL
) {
$cacheKey = "CRM_PC_{$name}_{$all}_{$key}_{$retrieve}_{$filter}_{$condition}_{$orderby}";
- $cache = CRM_Utils_Cache::singleton();
- $var = $cache->get($cacheKey);
+ $cache = CRM_Utils_Cache::singleton();
+ $var = $cache->get($cacheKey);
if ($var && empty($force)) {
return $var;
}
$config = CRM_Core_Config::singleton();
if ($limit) {
$countryIsoCodes = self::countryIsoCode();
- $limitCodes = $config->provinceLimit();
- $limitIds = array();
+ $limitCodes = $config->provinceLimit();
+ $limitIds = array();
foreach ($limitCodes as $code) {
$limitIds = array_merge($limitIds, array_keys($countryIsoCodes, $code));
}
if ($tsLocale != '' and $tsLocale != 'en_US') {
$i18n = CRM_Core_I18n::singleton();
$i18n->localizeArray(self::$stateProvince, array(
- 'context' => 'province',
- ));
+ 'context' => 'province',
+ ));
self::$stateProvince = CRM_Utils_Array::asort(self::$stateProvince);
}
}
$whereClause = FALSE;
if ($limit) {
- $config = CRM_Core_Config::singleton();
+ $config = CRM_Core_Config::singleton();
$countryIsoCodes = self::countryIsoCode();
- $limitCodes = $config->provinceLimit();
- $limitIds = array();
+ $limitCodes = $config->provinceLimit();
+ $limitIds = array();
foreach ($limitCodes as $code) {
$tmpArray = array_keys($countryIsoCodes, $code);
if ($tsLocale != '' and $tsLocale != 'en_US') {
$i18n = CRM_Core_I18n::singleton();
$i18n->localizeArray(self::$country, array(
- 'context' => 'country',
- ));
+ 'context' => 'country',
+ ));
self::$country = CRM_Utils_Array::asort(self::$country);
}
}
public static function &greetingDefaults() {
if (!self::$greetingDefaults) {
$defaultGreetings = array();
- $contactTypes = self::get('CRM_Contact_DAO_Contact', 'contact_type', array('keyColumn' => 'id', 'labelColumn' => 'name'));
+ $contactTypes = self::get('CRM_Contact_DAO_Contact', 'contact_type', array(
+ 'keyColumn' => 'id',
+ 'labelColumn' => 'name'
+ ));
foreach ($contactTypes as $filter => $contactType) {
$filterCondition = " AND (v.filter = 0 OR v.filter = $filter) AND v.is_default = 1 ";
$newName = CRM_Utils_File::makeFileName($value['name']);
$status = $element->moveUploadedFile($this->_uploadDir, $newName);
if (!$status) {
- CRM_Core_Error::statusBounce(ts('We could not move the uploaded file %1 to the upload directory %2. Please verify that the \'Temporary Files\' setting points to a valid path which is writable by your web server.', array(1 => $value['name'], 2 => $this->_uploadDir)));
+ CRM_Core_Error::statusBounce(ts('We could not move the uploaded file %1 to the upload directory %2. Please verify that the \'Temporary Files\' setting points to a valid path which is writable by your web server.', array(
+ 1 => $value['name'],
+ 2 => $this->_uploadDir
+ )));
}
if (!empty($data['values'][$pageName][$uploadName]['name'])) {
@unlink($this->_uploadDir . $data['values'][$pageName][$uploadName]);
return $this->getFrozenHtml();
}
- $tabs = $this->_getTabs();
- $tab = $this->_getTab();
+ $tabs = $this->_getTabs();
+ $tab = $this->_getTab();
$strHtml = '';
if ($this->getComment() != '') {
}
$strHtmlSelected .= $tab . '</div>' . PHP_EOL;
- $strHtmlHidden = '';
+ $strHtmlHidden = '';
$strHtmlUnselected = '';
- $strHtmlAdd = '';
- $strHtmlRemove = '';
+ $strHtmlAdd = '';
+ $strHtmlRemove = '';
// build the select all button with all its attributes
$attributes = array('onclick' => "{$this->_jsPrefix}{$this->_jsPostfix}('" . $this->getName() . "', 1);");
// ... or a dual multi-select
// set name of Select From Box
- $this->_attributesUnselected = array('name' => '__' . $selectName, 'ondblclick' => "{$this->_jsPrefix}{$this->_jsPostfix}(this.form.elements['__" . $selectName . "'], this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "'], 'add')");
+ $this->_attributesUnselected = array(
+ 'name' => '__' . $selectName,
+ 'ondblclick' => "{$this->_jsPrefix}{$this->_jsPostfix}(this.form.elements['__" . $selectName . "'], this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "'], 'add')"
+ );
$this->_attributesUnselected = array_merge($this->_attributes, $this->_attributesUnselected);
$attrUnselected = $this->_getAttrString($this->_attributesUnselected);
// set name of Select To Box
- $this->_attributesSelected = array('name' => '_' . $selectName, 'ondblclick' => "{$this->_jsPrefix}{$this->_jsPostfix}(this.form.elements['__" . $selectName . "'], this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "'], 'remove')");
+ $this->_attributesSelected = array(
+ 'name' => '_' . $selectName,
+ 'ondblclick' => "{$this->_jsPrefix}{$this->_jsPostfix}(this.form.elements['__" . $selectName . "'], this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "'], 'remove')"
+ );
$this->_attributesSelected = array_merge($this->_attributes, $this->_attributesSelected);
$attrSelected = $this->_getAttrString($this->_attributesSelected);
// set name of Select hidden Box
- $this->_attributesHidden = array('name' => $selectName, 'style' => 'overflow: hidden; visibility: hidden; width: 1px; height: 0;');
+ $this->_attributesHidden = array(
+ 'name' => $selectName,
+ 'style' => 'overflow: hidden; visibility: hidden; width: 1px; height: 0;'
+ );
$this->_attributesHidden = array_merge($this->_attributes, $this->_attributesHidden);
$attrHidden = $this->_getAttrString($this->_attributesHidden);
// render extra labels, if any
if (is_array($labels)) {
foreach ($labels as $key => $text) {
- $key = is_int($key) ? $key + 2 : $key;
+ $key = is_int($key) ? $key + 2 : $key;
$strHtml = str_replace("{label_{$key}}", $text, $strHtml);
$strHtml = str_replace("<!-- BEGIN label_{$key} -->", '', $strHtml);
$strHtml = str_replace("<!-- END label_{$key} -->", '', $strHtml);
}
$placeHolders = array(
- '{stylesheet}', '{javascript}', '{class}',
- '{unselected}', '{selected}',
- '{add}', '{remove}',
- '{all}', '{none}', '{toggle}',
- '{moveup}', '{movedown}',
+ '{stylesheet}',
+ '{javascript}',
+ '{class}',
+ '{unselected}',
+ '{selected}',
+ '{add}',
+ '{remove}',
+ '{all}',
+ '{none}',
+ '{toggle}',
+ '{moveup}',
+ '{movedown}',
);
$htmlElements = array(
- $this->getElementCss(FALSE), $this->getElementJs(FALSE), $this->_tableAttributes,
- $strHtmlUnselected, $strHtmlSelected . $strHtmlHidden,
- $strHtmlAdd, $strHtmlRemove,
- $strHtmlAll, $strHtmlNone, $strHtmlToggle,
- $strHtmlMoveUp, $strHtmlMoveDown,
+ $this->getElementCss(FALSE),
+ $this->getElementJs(FALSE),
+ $this->_tableAttributes,
+ $strHtmlUnselected,
+ $strHtmlSelected . $strHtmlHidden,
+ $strHtmlAdd,
+ $strHtmlRemove,
+ $strHtmlAll,
+ $strHtmlNone,
+ $strHtmlToggle,
+ $strHtmlMoveUp,
+ $strHtmlMoveDown,
);
$strHtml = str_replace($placeHolders, $htmlElements, $strHtml);
$params = array(
1 => array($targetDao->$targetColumn, 'String'),
-
// If anyone complains about $targetDao::getTableName(), then could use
// "{get_class($targetDao)}::getTableName();"
2 => array($targetDao::getTableName(), 'String'),
$targetColumn = $this->getTargetKey();
$params = array(
1 => array($targetDao->$targetColumn, 'String'),
-
// If anyone complains about $targetDao::getTableName(), then could use
// "{get_class($targetDao)}::getTableName();"
2 => array($targetDao::getTableName(), 'String'),
* @throws CRM_Core_Exception
*/
public function findReferences($targetDao) {
- if (! ($targetDao instanceof CRM_Core_DAO_OptionValue)) {
+ if (!($targetDao instanceof CRM_Core_DAO_OptionValue)) {
throw new CRM_Core_Exception("Mismatched reference: expected OptionValue but received " . get_class($targetDao));
}
if ($targetDao->option_group_id == $this->getTargetOptionGroupId()) {
* @throws CRM_Core_Exception
*/
public function getReferenceCount($targetDao) {
- if (! ($targetDao instanceof CRM_Core_DAO_OptionValue)) {
+ if (!($targetDao instanceof CRM_Core_DAO_OptionValue)) {
throw new CRM_Core_Exception("Mismatched reference: expected OptionValue but received " . get_class($targetDao));
}
if ($targetDao->option_group_id == $this->getTargetOptionGroupId()) {
* @return CRM_Core_Region
*/
public static function &instance($name, $autocreate = TRUE) {
- if ($autocreate && ! isset(self::$_instances[$name])) {
+ if ($autocreate && !isset(self::$_instances[$name])) {
self::$_instances[$name] = new CRM_Core_Region($name);
}
return self::$_instances[$name];
case 'jquery':
$snippet['script'] = sprintf("CRM.\$(function(\$) {\n%s\n});", $snippet['jquery']);
- // no break - continue processing as script
+ // no break - continue processing as script
case 'script':
if (!$allowCmsOverride || !$cms->addScript($snippet['script'], $this->_name)) {
$html .= sprintf("<script type=\"text/javascript\">\n%s\n</script>\n", $snippet['script']);
default:
require_once 'CRM/Core/Error.php';
CRM_Core_Error::fatal(ts('Snippet type %1 is unrecognized',
- array(1 => $snippet['type'])));
+ array(1 => $snippet['type'])));
}
}
return $html;
* @param string $markup
* HTML.
*
- public function addMarkup($markup) {
- return $this->add(array(
- 'type' => 'markup',
- 'markup' => $markup,
- ));
- }
-
- /**
+ * public function addMarkup($markup) {
+ * return $this->add(array(
+ * 'type' => 'markup',
+ * 'markup' => $markup,
+ * ));
+ * }
+ *
+ * /**
* Add a Smarty template file to a region
*
* Note: File is not evaluated until the page is rendered
* @param string $template
* Path to the Smarty template file.
*
- public function addTemplate($template) {
- return $this->add(array(
- 'type' => 'template',
- 'template' => $template,
- ));
- }
-
- /**
+ * public function addTemplate($template) {
+ * return $this->add(array(
+ * 'type' => 'template',
+ * 'template' => $template,
+ * ));
+ * }
+ *
+ * /**
* Use a callback function to extend a region
*
* @param mixed $callback
* @param array $arguments
* Optional, array of parameters for callback; if omitted, the default arguments are ($snippetSpec, $html).
*
- public function addCallback($callback, $arguments = FALSE) {
- return $this->add(array(
- 'type' => 'callback',
- 'callback' => $callback,
- 'arguments' => $arguments,
- ));
- }
- */
+ * public function addCallback($callback, $arguments = FALSE) {
+ * return $this->add(array(
+ * 'type' => 'callback',
+ * 'callback' => $callback,
+ * 'arguments' => $arguments,
+ * ));
+ * }
+ */
}
$result = '';
- $config = CRM_Core_Config::singleton();
- $seperator = $config->fieldSeparator;
- $enclosed = '"';
- $escaped = $enclosed;
+ $config = CRM_Core_Config::singleton();
+ $seperator = $config->fieldSeparator;
+ $enclosed = '"';
+ $escaped = $enclosed;
$add_character = "\015\012";
$schema_insert = '';
* relative weight within a given region.
* @param string $region
* location within the file; 'html-header', 'page-header', 'page-footer'.
- * @param $translate, whether to parse this file for strings enclosed in ts()
+ * @param $translate , whether to parse this file for strings enclosed in ts()
*
* @return CRM_Core_Resources
*/
$region = self::isAjaxMode() ? 'ajax-snippet' : 'html-header';
$resources = $this;
CRM_Core_Region::instance($region)->add(array(
- 'callback' => function(&$snippet, &$html) use ($resources) {
- $html .= "\n" . $resources->renderSetting();
- },
+ 'callback' => function (&$snippet, &$html) use ($resources) {
+ $html .= "\n" . $resources->renderSetting();
+ },
'weight' => -100000,
));
$this->addedSettings = TRUE;
// Add global settings
$settings = array(
- 'config' => array(
- 'ajaxPopupsEnabled' => $this->ajaxPopupsEnabled,
- 'isFrontend' => $config->userFrameworkFrontend,
- ));
+ 'config' => array(
+ 'ajaxPopupsEnabled' => $this->ajaxPopupsEnabled,
+ 'isFrontend' => $config->userFrameworkFrontend,
+ )
+ );
// Disable profile creation if user lacks permission
if (!CRM_Core_Permission::check('edit all contacts') && !CRM_Core_Permission::check('add contacts')) {
$settings['config']['entityRef']['contactCreate'] = FALSE;
"packages/jquery/jquery-1.11.1$min.js",
"packages/jquery/jquery-ui/jquery-ui$min.js",
"packages/jquery/jquery-ui/jquery-ui$min.css",
-
"packages/backbone/lodash.compat$min.js",
-
"packages/jquery/plugins/jquery.mousewheel$min.js",
-
"packages/jquery/plugins/select2/select2$min.js",
"packages/jquery/plugins/select2/select2.css",
-
"packages/jquery/plugins/jquery.tableHeader.js",
-
"packages/jquery/plugins/jquery.textarearesizer.js",
-
"packages/jquery/plugins/jquery.form$min.js",
-
"packages/jquery/plugins/jquery.timeentry$min.js",
-
"packages/jquery/plugins/jquery.blockUI$min.js",
-
"packages/jquery/plugins/DataTables/media/js/jquery.dataTables$min.js",
"packages/jquery/plugins/DataTables/media/css/jquery.dataTables$min.css",
-
"packages/jquery/plugins/jquery.validate$min.js",
"packages/jquery/plugins/jquery.ui.datepicker.validation.pack.js",
-
"js/Common.js",
"js/crm.ajax.js",
);
* is this page request an ajax snippet?
*/
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));
+ 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
+ ));
}
/**
$filters['event'] = array(
array('key' => 'event_type_id', 'value' => ts('Event Type')),
array(
- 'key' => 'start_date',
- 'value' => ts('Start Date'),
- 'options' => array(
- array('key' => '{">":"now"}', 'value' => ts('Upcoming')),
- array('key' => '{"BETWEEN":["now - 3 month","now"]}', 'value' => ts('Past 3 Months')),
- array('key' => '{"BETWEEN":["now - 6 month","now"]}', 'value' => ts('Past 6 Months')),
- array('key' => '{"BETWEEN":["now - 1 year","now"]}', 'value' => ts('Past Year')),
- )),
+ 'key' => 'start_date',
+ 'value' => ts('Start Date'),
+ 'options' => array(
+ array('key' => '{">":"now"}', 'value' => ts('Upcoming')),
+ array('key' => '{"BETWEEN":["now - 3 month","now"]}', 'value' => ts('Past 3 Months')),
+ array('key' => '{"BETWEEN":["now - 6 month","now"]}', 'value' => ts('Past 6 Months')),
+ array('key' => '{"BETWEEN":["now - 1 year","now"]}', 'value' => ts('Past Year')),
+ )
+ ),
);
$filters['activity'] = array(
* @param null $date
*/
public function saveLastRun($date = NULL) {
- $dao = new CRM_Core_DAO_Job();
- $dao->id = $this->id;
+ $dao = new CRM_Core_DAO_Job();
+ $dao->id = $this->id;
$dao->last_run = ($date == NULL) ? CRM_Utils_Date::currentDBDate() : CRM_Utils_Date::currentDBDate($date);
$dao->save();
}
return TRUE;
case 'Hourly':
- $now = CRM_Utils_Date::currentDBDate();
+ $now = CRM_Utils_Date::currentDBDate();
$hourAgo = strtotime('-1 hour', strtotime($now));
$lastRun = strtotime($this->last_run);
if ($lastRun < $hourAgo) {
}
case 'Daily':
- $now = CRM_Utils_Date::currentDBDate();
- $dayAgo = strtotime('-1 day', strtotime($now));
+ $now = CRM_Utils_Date::currentDBDate();
+ $dayAgo = strtotime('-1 day', strtotime($now));
$lastRun = strtotime($this->last_run);
if ($lastRun < $dayAgo) {
return TRUE;
*/
public static function mailingComponents() {
return array(
- 'Header' => ts('Header'),
+ 'Header' => ts('Header'),
'Footer' => ts('Footer'),
'Reply' => ts('Reply Auto-responder'),
'OptOut' => ts('Opt-out Message'),
static $tokens = NULL;
if (!$tokens) {
$additionalFields = array(
- 'checksum' => array('title' => ts('Checksum')),
+ 'checksum' => array('title' => ts('Checksum')),
'contact_id' => array('title' => ts('Internal Contact ID')),
);
$exportFields = array_merge(CRM_Contact_BAO_Contact::exportableFields(), $additionalFields);
//FIXME:skipping some tokens for time being.
$skipTokens = array(
- 'is_bulkmail', 'group', 'tag', 'contact_sub_type', 'note',
- 'is_deceased', 'deceased_date', 'legal_identifier', 'contact_sub_type', 'user_unique_id',
+ 'is_bulkmail',
+ 'group',
+ 'tag',
+ 'contact_sub_type',
+ 'note',
+ 'is_deceased',
+ 'deceased_date',
+ 'legal_identifier',
+ 'contact_sub_type',
+ 'user_unique_id',
);
$customFields = CRM_Core_BAO_CustomField::getFields(array('Individual', 'Address'));
// skipping some tokens for time being.
$skipTokens = array(
- 'event_id', 'participant_is_pay_later', 'participant_is_test', 'participant_contact_id',
- 'participant_fee_currency', 'participant_campaign_id', 'participant_status', 'participant_discount_name',
+ 'event_id',
+ 'participant_is_pay_later',
+ 'participant_is_test',
+ 'participant_contact_id',
+ 'participant_fee_currency',
+ 'participant_campaign_id',
+ 'participant_status',
+ 'participant_discount_name',
);
$customFields = CRM_Core_BAO_CustomField::getFields('Participant');
*/
public static function getWordReplacementMatchType() {
return array(
- 'exactMatch' => ts('Exact Match'),
- 'wildcardMatch' => ts('Wildcard Match'),
- );
+ 'exactMatch' => ts('Exact Match'),
+ 'wildcardMatch' => ts('Wildcard Match'),
+ );
}
/**
static $scheduleReminderFrequencyUnits = NULL;
if (!$scheduleReminderFrequencyUnits) {
$scheduleReminderFrequencyUnits = array(
- 'hour' => ts('hour')) + CRM_Core_OptionGroup::values('recur_frequency_units');
+ 'hour' => ts('hour')
+ ) + CRM_Core_OptionGroup::values('recur_frequency_units');
}
return $scheduleReminderFrequencyUnits;
*/
// move the values from the session to the template
const SESSION = 1, TEMPLATE = 2,
- TRANSFER = 4, EXPORT = 8, SCREEN = 16, PDF = 32;
+ TRANSFER = 4, EXPORT = 8, SCREEN = 16, PDF = 32;
/**
* A CRM Object that implements CRM_Core_Selector_API
$this->_pageID = $pageID ? $pageID : 1;
$this->_sortID = $sortID ? $sortID : NULL;
$this->_action = $action;
- $this->_store = $store;
+ $this->_store = $store;
$this->_output = $output;
$this->_prefix = $prefix;
- $this->_case = $case;
+ $this->_case = $case;
// fix sortID
if ($this->_sortID && strpos($this->_sortID, '_') === FALSE) {
$rows = self::getRows($this);
CRM_Utils_Hook::searchColumns($contextName, $columnHeaders, $rows, $this);
$rowsEmpty = count($rows) ? FALSE : TRUE;
- $qill = $this->getQill();
- $summary = $this->getSummary();
+ $qill = $this->getQill();
+ $summary = $this->getSummary();
// if we need to store in session, lets update session
if ($this->_output & self::SESSION) {
$this->_store->set("{$this->_prefix}columnHeaders", $columnHeaders);
// FIXME: This belongs in CRM_Utils_System_*
if ($config->userSystem->is_drupal && function_exists('drupal_session_start')) {
// https://issues.civicrm.org/jira/browse/CRM-14356
- if (! (isset($GLOBALS['lazy_session']) && $GLOBALS['lazy_session'] == TRUE)) {
+ if (!(isset($GLOBALS['lazy_session']) && $GLOBALS['lazy_session'] == TRUE)) {
drupal_session_start();
}
$_SESSION = array();
$hideCode = "cj('#id_{$prefix}').hide(); cj('#id_{$prefix}_show').show(); return false;";
self::setIcons();
- $values = array();
+ $values = array();
$values['show'] = self::linkHtml("${prefix}_show", "#${prefix}_hide", self::$_showIcon . $showLinkText, "onclick=\"$showCode\"");
$values['hide'] = self::linkHtml("${prefix}_hide", "#${prefix}", self::$_hideIcon . $hideLinkText, "onclick=\"$hideCode\"");
if (isset($config->customPHPPathDir)) {
$customPluginsDir =
$config->customPHPPathDir . DIRECTORY_SEPARATOR .
- 'CRM' . DIRECTORY_SEPARATOR .
- 'Core' . DIRECTORY_SEPARATOR .
- 'Smarty' . DIRECTORY_SEPARATOR .
- 'plugins' . DIRECTORY_SEPARATOR;
+ 'CRM' . DIRECTORY_SEPARATOR .
+ 'Core' . DIRECTORY_SEPARATOR .
+ 'Smarty' . DIRECTORY_SEPARATOR .
+ 'plugins' . DIRECTORY_SEPARATOR;
if (!file_exists($customPluginsDir)) {
$customPluginsDir = NULL;
}
* The Smarty object.
*
* @return string
- * the string, translated by gettext
+ * the string, translated by gettext
*/
function smarty_block_edit($params, $text, &$smarty) {
$action = $smarty->_tpl_vars['action'];
* The Smarty object.
*
* @return string
- * the string, translated by gettext
+ * the string, translated by gettext
*/
function smarty_block_htxt($params, $text, &$smarty) {
$id = $params['id'];
* The Smarty object.
*
* @return string
- * multilingualized query
+ * multilingualized query
*/
function smarty_block_localize($params, $text, &$smarty) {
if (!$smarty->_tpl_vars['multilingual']) {
* The Smarty object.
*
* @return string
- * the string, translated by gettext
+ * the string, translated by gettext
*/
function smarty_block_serialize($params, $text, &$smarty) {
return serialize($text);
* The Smarty object.
*
* @return string
- * the string, translated by gettext
+ * the string, translated by gettext
*/
function smarty_block_ts($params, $text, &$smarty) {
if (!isset($params['domain'])) {
* The Smarty object.
*
* @return string
- * the generated key
+ * the generated key
*/
function smarty_function_crmKey($params, &$smarty) {
return
* The Smarty object.
*
* @return string
- * HTML
+ * HTML
*/
function smarty_function_crmNavigationMenu($params, &$smarty) {
$config = CRM_Core_Config::singleton();
* Reference to the smarty object.
*
* @return string
- * HTML code of a link to documentation
+ * HTML code of a link to documentation
*/
function smarty_function_docURL($params, &$smarty) {
if (!isset($smarty)) {
* Reference to the smarty object.
*
* @return string
- * the help html to be inserted
+ * the help html to be inserted
*/
function smarty_function_help($params, &$smarty) {
if (!isset($params['id']) || !isset($smarty->_tpl_vars['config'])) {
* The Smarty object.
*
* @return string
- * the string, translated by gettext
+ * the string, translated by gettext
*/
function smarty_function_sectionTotal($params, &$smarty) {
/* section totals are stored in template variable 'sectionTotals',
require_once 'api/api.php';
require_once 'api/v3/utils.php';
$activity = civicrm_api('activity', 'getsingle', array(
- 'version' => 3,
- 'id' => $params['activity_id'],
- 'return.target_contact_id' => 1,
- 'return.assignee_contact_id' => 1,
- ));
+ 'version' => 3,
+ 'id' => $params['activity_id'],
+ 'return.target_contact_id' => 1,
+ 'return.assignee_contact_id' => 1,
+ ));
$baseContactParams = array('version' => 3);
foreach (explode(',', $params['return']) as $field) {
}
foreach (array(
- 'target', 'assignee') as $role) {
+ 'target',
+ 'assignee'
+ ) as $role) {
$contact = array();
if (!empty($activity[$role . '_contact_id'])) {
$contact_id = array_shift($activity[$role . '_contact_id']);
* The new class or classes to add (separate with a space).
*
* @return string
- * the new modified html string
+ * the new modified html string
*/
function smarty_modifier_crmAddClass($string, $class) {
// Standardize white space
* @param string $btnName
*
* @return string
- * button type, one of: 'upload', 'next', 'back', 'cancel', 'refresh'
+ * button type, one of: 'upload', 'next', 'back', 'cancel', 'refresh'
* 'submit', 'done', 'display', 'jump' 'process'
*/
function smarty_modifier_crmBtnType($btnName) {
* @param bool $onlyTime
*
* @return string
- * human readable date format | invalid date message
+ * human readable date format | invalid date message
*/
function smarty_modifier_crmDate($dateString, $dateFormat = NULL, $onlyTime = FALSE) {
if ($dateString) {
* The attribute to modify.
*
* @return string
- * the new modified html string
+ * the new modified html string
*/
function smarty_modifier_crmDelete($string, $attribute) {
static $endOfElement = '/>';
* @param bool $gdata
*
* @return string
- * formatted text
+ * formatted text
*/
function smarty_modifier_crmICalDate($str, $gdata = FALSE) {
return CRM_Utils_ICalendar::formatDate($str, $gdata);
* @param string $str
*
* @return string
- * formatted text
+ * formatted text
*/
function smarty_modifier_crmICalText($str) {
return CRM_Utils_ICalendar::formatText($str);
* The string before which we want this tag inserted.
*
* @return string
- * the new modified html string
+ * the new modified html string
*/
function smarty_modifier_crmInsert($string, $attribute, $value, $insertBefore = '/>') {
return str_replace($insertBefore, ' ' . $attribute . '="' . $value . '"' . $insertBefore, $string);
* @param bool $onlyNumber
*
* @return string
- * formatted monetary amount
+ * formatted monetary amount
*/
function smarty_modifier_crmMoney($amount, $currency = NULL, $format = NULL, $onlyNumber = FALSE) {
return CRM_Utils_Money::format($amount, $currency, $format, $onlyNumber);
* Thousands sep character (if other than ",").
*
* @return string
- * the formatted string
+ * the formatted string
*
* For alternate decimal point and thousands separator, delimit values with single quotes in the template.
* EXAMPLE: {$number|crmNumberFormat:2:',':' '} for French notation - 1234.56 becomes 1 234,56
// Both dec_point AND thousands_sep are required if one is not specified
// then use the config defaults
if (!$dec_point || !$thousands_sep) {
- $config = CRM_Core_Config::singleton();
- $dec_point = $config->monetaryDecimalPoint;
+ $config = CRM_Core_Config::singleton();
+ $dec_point = $config->monetaryDecimalPoint;
$thousands_sep = $config->monetaryThousandSeparator;
}
* The new attribute value.
*
* @return string
- * the new modified html string
+ * the new modified html string
*/
function smarty_modifier_crmReplace($string, $attribute, $value) {
// we need to search and replace the string: $attribute=XXX or $attribute="XXX"
* All alternatives as a long string (or some other text).
*
* @return string
- * only the first alternative found (or the text without alternatives)
+ * only the first alternative found (or the text without alternatives)
*/
function smarty_modifier_crmStripAlternatives($full) {
return CRM_Utils_String::stripAlternatives($full);
* Text to HTML-ize.
*
* @return string
- * HTML-ized version of $text
+ * HTML-ized version of $text
*/
function smarty_modifier_htmlize($text) {
$text = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)?)@', '<a href="$1">$1</a>', $text);
* @param mixed $data
*
* @return string
- * JSON
+ * JSON
*/
function smarty_modifier_json($data) {
return json_encode($data);
* @return string
*/
function smarty_modifier_mb_truncate($string, $length = 80, $etc = '...',
- $break_words = FALSE
+ $break_words = FALSE
) {
if (function_exists('mb_internal_encoding') and function_exists('mb_strlen') and function_exists('mb_substr')) {
mb_internal_encoding('UTF-8');
return
'{crmScope extensionKey=""}'
. $tpl_source
- . '{/crmScope}';
+ . '{/crmScope}';
}
'civicrm_entity_tag' => '22',
'civicrm_note' => '23',
'civicrm_contribution' => '24',
- 'civicrm_financial_type' => '25',
+ 'civicrm_financial_type' => '25',
'civicrm_participant' => '26',
'civicrm_event' => '27',
'civicrm_worldregion' => '28',
$session->pushUserContext($url);
CRM_Utils_System::setTitle(ts('Change Field Type: %1',
- array(1 => $this->_values['label'])
- ));
+ array(1 => $this->_values['label'])
+ ));
}
/**
'dst_html_type',
ts('New HTML Type'),
array(
- '' => ts('- select -')) + $this->_htmlTypeTransitions,
+ '' => ts('- select -')
+ ) + $this->_htmlTypeTransitions,
TRUE
);
$customField->find(TRUE);
if ($dstHtmlType == 'Text' && in_array($srcHtmlType, array(
- 'Select', 'Radio', 'Autocomplete-Select'))) {
+ 'Select',
+ 'Radio',
+ 'Autocomplete-Select'
+ ))
+ ) {
$customField->option_group_id = "NULL";
CRM_Core_BAO_CustomField::checkOptionGroup($this->_values['option_group_id']);
}
CRM_Core_BAO_Cache::deleteGroup('contact fields');
CRM_Core_Session::setStatus(ts('Input type of custom field \'%1\' has been successfully changed to \'%2\'.',
- array(1 => $this->_values['label'], 2 => $dstHtmlType)
- ), ts('Field Type Changed'), 'success');
+ array(1 => $this->_values['label'], 2 => $dstHtmlType)
+ ), ts('Field Type Changed'), 'success');
}
/**
public function firstValueToFlatten($table, $column) {
$selectSql = "SELECT id, $column FROM $table WHERE $column IS NOT NULL";
$updateSql = "UPDATE $table SET $column = %1 WHERE id = %2";
- $dao = CRM_Core_DAO::executeQuery($selectSql);
+ $dao = CRM_Core_DAO::executeQuery($selectSql);
while ($dao->fetch()) {
if (!$dao->{$column}) {
continue;
}
$value = CRM_Core_DAO::VALUE_SEPARATOR . $dao->{$column} . CRM_Core_DAO::VALUE_SEPARATOR;
$params = array(
- 1 => array((string) $value, 'String'),
+ 1 => array((string) $value, 'String'),
2 => array($dao->id, 'Integer'),
);
CRM_Core_DAO::executeQuery($updateSql, $params);
public function flattenToFirstValue($table, $column) {
$selectSql = "SELECT id, $column FROM $table WHERE $column IS NOT NULL";
$updateSql = "UPDATE $table SET $column = %1 WHERE id = %2";
- $dao = CRM_Core_DAO::executeQuery($selectSql);
+ $dao = CRM_Core_DAO::executeQuery($selectSql);
while ($dao->fetch()) {
$values = self::explode($dao->{$column});
$params = array(
- 1 => array((string) array_shift($values), 'String'),
+ 1 => array((string) array_shift($values), 'String'),
2 => array($dao->id, 'Integer'),
);
CRM_Core_DAO::executeQuery($updateSql, $params);
if (self::$_dataToLabels == NULL) {
self::$_dataToLabels = array(
array(
- 'Text' => ts('Text'),
- 'Select' => ts('Select'),
+ 'Text' => ts('Text'),
+ 'Select' => ts('Select'),
'Radio' => ts('Radio'),
- 'CheckBox' => ts('CheckBox'),
- 'Multi-Select' => ts('Multi-Select'),
+ 'CheckBox' => ts('CheckBox'),
+ 'Multi-Select' => ts('Multi-Select'),
'AdvMulti-Select' => ts('Adv Multi-Select (obsolete)'),
'Autocomplete-Select' => ts('Autocomplete-Select'),
),
array(
- 'Text' => ts('Text'),
- 'Select' => ts('Select'),
+ 'Text' => ts('Text'),
+ 'Select' => ts('Select'),
'Radio' => ts('Radio'),
),
array(
- 'Text' => ts('Text'),
- 'Select' => ts('Select'),
+ 'Text' => ts('Text'),
+ 'Select' => ts('Select'),
'Radio' => ts('Radio'),
),
array(
- 'Text' => ts('Text'),
- 'Select' => ts('Select'),
+ 'Text' => ts('Text'),
+ 'Select' => ts('Select'),
'Radio' => ts('Radio'),
),
array('TextArea' => ts('TextArea'), 'RichTextEditor' => ts('Rich Text Editor')),
$this->assign('dontShowLink', $dontShowLink);
}
if ($this->_action & CRM_Core_Action::ADD &&
- CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_gid, 'is_multiple', 'id')) {
+ CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_gid, 'is_multiple', 'id')
+ ) {
$defaults['in_selector'] = 1;
}
}
else {
$optionTypes = array(
- '1' => ts('Create a new set of options'),
+ '1' => ts('Create a new set of options'),
'2' => ts('Reuse an existing set'),
);
'option_group_id',
ts('Multiple Choice Option Sets'),
array(
- '' => ts('- select -')) + $optionGroups
+ '' => ts('- select -')
+ ) + $optionGroups
);
}
ts('Option Type'),
$optionTypes,
array(
- 'onclick' => "showOptionSelect();"), '<br/>'
+ 'onclick' => "showOptionSelect();"
+ ), '<br/>'
);
$contactGroups = CRM_Core_PseudoConstant::group();
);
// is searchable by range?
- $searchRange = array();
+ $searchRange = array();
$searchRange[] = $this->createElement('radio', NULL, NULL, ts('Yes'), '1');
$searchRange[] = $this->createElement('radio', NULL, NULL, ts('No'), '0');
$errors = array();
//validate field label as well as name.
- $title = $fields['label'];
- $name = CRM_Utils_String::munge($title, '_', 64);
- $gId = $self->_gid; // CRM-7564
- $query = 'select count(*) from civicrm_custom_field where ( name like %1 OR label like %2 ) and id != %3 and custom_group_id = %4';
+ $title = $fields['label'];
+ $name = CRM_Utils_String::munge($title, '_', 64);
+ $gId = $self->_gid; // CRM-7564
+ $query = 'select count(*) from civicrm_custom_field where ( name like %1 OR label like %2 ) and id != %3 and custom_group_id = %4';
$fldCnt = CRM_Core_DAO::singleValueQuery($query, array(
- 1 => array($name, 'String'),
- 2 => array($title, 'String'),
- 3 => array((int) $self->_id, 'Integer'),
- 4 => array($gId, 'Integer'),
- ));
+ 1 => array($name, 'String'),
+ 2 => array($title, 'String'),
+ 3 => array((int) $self->_id, 'Integer'),
+ 4 => array($gId, 'Integer'),
+ ));
if ($fldCnt) {
$errors['label'] = ts('Custom field \'%1\' already exists in Database.', array(1 => $title));
}
* Incomplete row checking is also required.
*/
$_flagOption = $_rowError = 0;
- $_showHide = new CRM_Core_ShowHideBlocks('', '');
- $dataType = self::$_dataTypeKeys[$fields['data_type'][0]];
+ $_showHide = new CRM_Core_ShowHideBlocks('', '');
+ $dataType = self::$_dataTypeKeys[$fields['data_type'][0]];
if (isset($fields['data_type'][1])) {
$dataField = $fields['data_type'][1];
}
WHERE data_type != %1
AND option_group_id = %2";
$params = array(
- 1 => array(self::$_dataTypeKeys[$fields['data_type'][0]],
+ 1 => array(
+ self::$_dataTypeKeys[$fields['data_type'][0]],
'String',
),
2 => array($fields['option_group_id'], 'Integer'),
// store the submitted values in an array
$params = $this->controller->exportValues($this->_name);
if ($this->_action == CRM_Core_Action::UPDATE) {
- $dataTypeKey = $this->_defaultDataType[0];
+ $dataTypeKey = $this->_defaultDataType[0];
$params['data_type'] = self::$_dataTypeKeys[$this->_defaultDataType[0]];
$params['html_type'] = self::$_dataToHTML[$this->_defaultDataType[0]][$this->_defaultDataType[1]];
}
else {
- $dataTypeKey = $params['data_type'][0];
+ $dataTypeKey = $params['data_type'][0];
$params['html_type'] = self::$_dataToHTML[$params['data_type'][0]][$params['data_type'][1]];
$params['data_type'] = self::$_dataTypeKeys[$params['data_type'][0]];
}
//fix for 'is_search_range' field.
if (in_array($dataTypeKey, array(
- 1, 2, 3, 5))) {
+ 1,
+ 2,
+ 3,
+ 5
+ ))) {
if (empty($params['is_searchable'])) {
$params['is_search_range'] = 0;
}
if ($buttonName == $this->getButtonName('next', 'new')) {
$msg .= '<p>' . ts("Ready to add another.") . '</p>';
$session->replaceUserContext(CRM_Utils_System::url('civicrm/admin/custom/group/field/add',
- 'reset=1&action=add&gid=' . $this->_gid
- ));
+ 'reset=1&action=add&gid=' . $this->_gid
+ ));
}
else {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/admin/custom/group/field',
- 'reset=1&action=browse&gid=' . $this->_gid
- ));
+ 'reset=1&action=browse&gid=' . $this->_gid
+ ));
}
$session->setStatus($msg, ts('Saved'), 'success');
$errors = array();
//validate group title as well as name.
- $title = $fields['title'];
- $name = CRM_Utils_String::munge($title, '_', 64);
- $query = 'select count(*) from civicrm_custom_group where ( name like %1 OR title like %2 ) and id != %3';
+ $title = $fields['title'];
+ $name = CRM_Utils_String::munge($title, '_', 64);
+ $query = 'select count(*) from civicrm_custom_group where ( name like %1 OR title like %2 ) and id != %3';
$grpCnt = CRM_Core_DAO::singleValueQuery($query, array(
- 1 => array($name, 'String'),
- 2 => array($title, 'String'),
- 3 => array((int) $self->_id, 'Integer'),
- ));
+ 1 => array($name, 'String'),
+ 2 => array($title, 'String'),
+ 3 => array((int) $self->_id, 'Integer'),
+ ));
if ($grpCnt) {
$errors['title'] = ts('Custom group \'%1\' already exists in Database.', array(1 => $title));
}
$contactTypes = array('Contact', 'Individual', 'Household', 'Organization');
$this->assign('contactTypes', json_encode($contactTypes));
- $sel1 = array("" => "- select -") + CRM_Core_SelectValues::customGroupExtends();
- $sel2 = array();
+ $sel1 = array("" => "- select -") + CRM_Core_SelectValues::customGroupExtends();
+ $sel2 = array();
$activityType = CRM_Core_PseudoConstant::activityType(FALSE, TRUE, FALSE, 'label', TRUE);
- $eventType = CRM_Core_OptionGroup::values('event_type');
- $grantType = CRM_Core_OptionGroup::values('grant_type');
- $campaignTypes = CRM_Campaign_PseudoConstant::campaignType();
- $membershipType = CRM_Member_BAO_MembershipType::getMembershipTypes(FALSE);
+ $eventType = CRM_Core_OptionGroup::values('event_type');
+ $grantType = CRM_Core_OptionGroup::values('grant_type');
+ $campaignTypes = CRM_Campaign_PseudoConstant::campaignType();
+ $membershipType = CRM_Member_BAO_MembershipType::getMembershipTypes(FALSE);
$participantRole = CRM_Core_OptionGroup::values('participant_role');
- $relTypeInd = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Individual');
- $relTypeOrg = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Organization');
- $relTypeHou = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Household');
+ $relTypeInd = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Individual');
+ $relTypeOrg = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Organization');
+ $relTypeHou = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Household');
ksort($sel1);
asort($activityType);
if ($main == 'Relationship') {
$relName = self::getFormattedList($sel2[$main]);
$sel2[$main] = array(
- '' => ts("- Any -")) + $relName;
+ '' => ts("- Any -")
+ ) + $relName;
}
else {
$sel2[$main] = array(
- '' => ts("- Any -")) + $sel2[$main];
+ '' => ts("- Any -")
+ ) + $sel2[$main];
}
}
}
$contactSubTypes[$key] = $key;
}
$sel2['Contact'] = array(
- "" => "-- Any --") + $contactSubTypes;
+ "" => "-- Any --"
+ ) + $contactSubTypes;
}
else {
if (!isset($this->_id)) {
$action = CRM_Core_Resources::singleton()->ajaxPopupsEnabled ? '' : '/add';
$url = CRM_Utils_System::url("civicrm/admin/custom/group/field$action", 'reset=1&new=1&gid=' . $group->id . '&action=' . ($action ? 'add' : 'browse'));
CRM_Core_Session::setStatus(ts("Your custom field set '%1' has been added. You can add custom fields now.",
- array(1 => $group->title)
- ), ts('Saved'), 'success');
+ array(1 => $group->title)
+ ), ts('Saved'), 'success');
$session = CRM_Core_Session::singleton();
$session->replaceUserContext($url);
}
if (is_array($db_prefix) && $config->userSystem->is_drupal && module_exists('views')) {
// get table_name for each custom group
$tables = array();
- $sql = "SELECT table_name FROM civicrm_custom_group WHERE is_active = 1";
+ $sql = "SELECT table_name FROM civicrm_custom_group WHERE is_active = 1";
$result = CRM_Core_DAO::executeQuery($sql);
while ($result->fetch()) {
$tables[$result->table_name] = $result->table_name;
if (!empty($missingTableNames)) {
CRM_Core_Session::setStatus(ts("To ensure that all of your custom data groups are available to Views, you may need to add the following key(s) to the db_prefix array in your settings.php file: '%1'.",
- array(1 => implode(', ', $missingTableNames))
- ), ts('Note'), 'info');
+ array(1 => implode(', ', $missingTableNames))
+ ), ts('Note'), 'info');
}
}
}
);
CRM_Utils_System::setTitle(ts('Custom Field Move: %1',
- array(1 => $this->_srcFieldLabel)
- ));
+ array(1 => $this->_srcFieldLabel)
+ ));
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/admin/custom/group/field', "reset=1&action=browse&gid={$this->_srcGID}"));
}
$customGroup = array(
- '' => ts('- select -')) + $customGroup;
+ '' => ts('- select -')
+ ) + $customGroup;
$this->add('select',
'dst_group_id',
ts('Destination'),
*/
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();
+ $tmp = CRM_Core_BAO_CustomField::_moveFieldValidate($self->_srcFID, $self->_dstGID);
+ $errors = array();
if ($tmp['newGroupID']) {
$errors['dst_group_id'] = $tmp['newGroupID'];
}
$srcUrl = CRM_Utils_System::url('civicrm/admin/custom/group/field', "reset=1&action=browse&gid={$this->_dstGID}");
CRM_Core_Session::setStatus(ts("%1 has been moved to the custom set <a href='%3'>%2</a>.",
array(
- 1 => $this->_srcFieldLabel,
- 2 => $dstGroup,
+ 1 => $this->_srcFieldLabel,
+ 2 => $dstGroup,
3 => $srcUrl,
- )), '', 'success');
+ )), '', 'success');
}
}
* @static
*/
public static function formRule($fields, $files, $form) {
- $optionLabel = $fields['label'];
- $optionValue = $fields['value'];
- $fieldId = $form->_fid;
+ $optionLabel = $fields['label'];
+ $optionValue = $fields['value'];
+ $fieldId = $form->_fid;
$optionGroupId = $form->_optionGroupID;
$temp = array();
if ($this->_fieldId) {
// field preview
$defaults = array();
- $params = array('id' => $this->_fieldId);
+ $params = array('id' => $this->_fieldId);
$fieldDAO = new CRM_Core_DAO_CustomField();
CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $params, $defaults);
$this->assign('uploadSize', $uploadSize);
$this->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
$this->setMaxFileSize($uploadFileSize);
- $this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize);
+ $this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(
+ 1 => $uploadSize,
+ 2 => $uploadFileSize
+ )), 'maxfilesize', $uploadFileSize);
$this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
$this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
//get the saved mapping details
$mappingArray = CRM_Core_BAO_Mapping::getMappings(CRM_Core_OptionGroup::getValue('mapping_type',
- 'Import Multi value custom data',
- 'name'
- ));
+ 'Import Multi value custom data',
+ 'name'
+ ));
$this->assign('savedMapping', $mappingArray);
$this->add('select', 'savedMapping', ts('Mapping Option'), array('' => ts('- select -')) + $mappingArray);
$this->setDefaults(array(
'contactType' => CRM_Import_Parser::CONTACT_INDIVIDUAL,
- ));
+ ));
//build date formats
CRM_Core_Form_Date::buildAllowedDateFormats($this);
public function postProcess() {
$this->controller->resetPage('MapField');
- $fileName = $this->controller->exportValue($this->_name, 'uploadFile');
+ $fileName = $this->controller->exportValue($this->_name, 'uploadFile');
$skipColumnHeader = $this->controller->exportValue($this->_name, 'skipColumnHeader');
- $contactType = $this->controller->exportValue($this->_name, 'contactType');
- $dateFormats = $this->controller->exportValue($this->_name, 'dateFormats');
- $savedMapping = $this->controller->exportValue($this->_name, 'savedMapping');
+ $contactType = $this->controller->exportValue($this->_name, 'contactType');
+ $dateFormats = $this->controller->exportValue($this->_name, 'dateFormats');
+ $savedMapping = $this->controller->exportValue($this->_name, 'savedMapping');
$multipleCustomData = $this->controller->exportValue($this->_name, 'multipleCustomData');
$this->set('contactType', $contactType);
* @var string
*/
protected $_entity;
+
/**
* Set variables up before form is built
*
$this->assign('dataValues', $dataValues);
$this->_entity = $this->_multipleCustomData = $this->get('multipleCustomData');
- $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
+ $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
$this->_onDuplicate = $this->get('onDuplicate');
if ($skipColumnHeader) {
//showColNames needs to be true to show "Column Names" column
$config = CRM_Core_Config::singleton();
$separator = $config->fieldSeparator;
- $mapperKeys = array();
- $mapper = array();
- $mapperKeys = $this->controller->exportValue($this->_name, 'mapper');
+ $mapperKeys = array();
+ $mapper = array();
+ $mapperKeys = $this->controller->exportValue($this->_name, 'mapper');
$mapperKeysMain = array();
for ($i = 0; $i < $this->_columnCount; $i++) {
$updateMappingFields->column_number = $i;
$explodedValues = explode('_', $mapperKeys[$i][0]);
- $id = CRM_Utils_Array::value(0, $explodedValues);
- $first = CRM_Utils_Array::value(1, $explodedValues);
- $second = CRM_Utils_Array::value(2, $explodedValues);
+ $id = CRM_Utils_Array::value(0, $explodedValues);
+ $first = CRM_Utils_Array::value(1, $explodedValues);
+ $second = CRM_Utils_Array::value(2, $explodedValues);
$updateMappingFields->name = $mapper[$i];
$updateMappingFields->save();
$saveMappingFields->column_number = $i;
$explodedValues = explode('_', $mapperKeys[$i][0]);
- $id = CRM_Utils_Array::value(0, $explodedValues);
- $first = CRM_Utils_Array::value(1, $explodedValues);
- $second = CRM_Utils_Array::value(2, $explodedValues);
+ $id = CRM_Utils_Array::value(0, $explodedValues);
+ $first = CRM_Utils_Array::value(1, $explodedValues);
+ $second = CRM_Utils_Array::value(2, $explodedValues);
$saveMappingFields->name = $mapper[$i];
$saveMappingFields->save();
class CRM_Custom_Import_Form_Preview extends CRM_Import_Form_Preview {
public $_parser = 'CRM_Custom_Import_Parser_Api';
protected $_importParserUrl = '&parser=CRM_Custom_Import_Parser';
+
/**
* Set variables up before form is built
*
$skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
//get the data from the session
- $dataValues = $this->get('dataValues');
- $mapper = $this->get('mapper');
- $invalidRowCount = $this->get('invalidRowCount');
+ $dataValues = $this->get('dataValues');
+ $mapper = $this->get('mapper');
+ $invalidRowCount = $this->get('invalidRowCount');
$conflictRowCount = $this->get('conflictRowCount');
- $mismatchCount = $this->get('unMatchCount');
- $entity = $this->get('_entity');
+ $mismatchCount = $this->get('unMatchCount');
+ $entity = $this->get('_entity');
//get the mapping name displayed if the mappingId is set
$mappingId = $this->get('loadMappingId');
$properties = array(
'mapper',
- 'dataValues', 'columnCount',
- 'totalRowCount', 'validRowCount',
- 'invalidRowCount', 'conflictRowCount',
+ 'dataValues',
+ 'columnCount',
+ 'totalRowCount',
+ 'validRowCount',
+ 'invalidRowCount',
+ 'conflictRowCount',
'downloadErrorRecordsUrl',
'downloadConflictRecordsUrl',
'downloadMismatchRecordsUrl',
* @return void
*/
public function postProcess() {
- $fileName = $this->controller->exportValue('DataSource', 'uploadFile');
+ $fileName = $this->controller->exportValue('DataSource', 'uploadFile');
$skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
- $invalidRowCount = $this->get('invalidRowCount');
+ $invalidRowCount = $this->get('invalidRowCount');
$conflictRowCount = $this->get('conflictRowCount');
- $onDuplicate = $this->get('onDuplicate');
- $entity = $this->get('_entity');
+ $onDuplicate = $this->get('onDuplicate');
+ $entity = $this->get('_entity');
$config = CRM_Core_Config::singleton();
$separator = $config->fieldSeparator;
* $Id$
*
*/
-
-
abstract class CRM_Custom_Import_Parser extends CRM_Contact_Import_Parser {
protected $_fileName;
}
if ($this->_invalidRowCount) {
// removed view url for invlaid contacts
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('Reason'),
),
$customHeaders
self::exportCSV($this->_errorFileName, $headers, $this->_errors);
}
if ($this->_conflictCount) {
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('Reason'),
),
$customHeaders
self::exportCSV($this->_conflictFileName, $headers, $this->_conflicts);
}
if ($this->_duplicateCount) {
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('View Activity History URL'),
),
$customHeaders
* @var array
*/
protected $_params = array();
+
/**
* Class constructor
*/
parent::__construct();
$this->_mapperKeys = &$mapperKeys;
}
+
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);
+ $this->_fields = array_merge(array(
+ 'do_not_import' => array('title' => ts('- do not import -')),
+ 'contact_id' => array('title' => ts('Contact ID'))
+ ), $importableFields);
}
/**
*/
public function summary(&$values) {
$erroneousField = NULL;
- $response = $this->setActiveFieldValues($values, $erroneousField);
+ $response = $this->setActiveFieldValues($values, $erroneousField);
$errorRequired = FALSE;
$missingField = '';
$this->_params = &$this->getActiveFieldParams();
try {
civicrm_api3('custom_value', 'create', $this->_params);
}
- catch(CiviCRM_API3_Exception $e) {
+ catch (CiviCRM_API3_Exception $e) {
$error = $e->getMessage();
array_unshift($values, $error);
return CRM_Import_Parser::ERROR;
foreach ($customGroup as $key => $values) {
$subValue = CRM_Utils_Array::value('extends_entity_column_value', $customGroup[$key]);
- $subName = CRM_Utils_Array::value('extends_entity_column_id', $customGroup[$key]);
- $type = CRM_Utils_Array::value('extends', $customGroup[$key]);
+ $subName = CRM_Utils_Array::value('extends_entity_column_id', $customGroup[$key]);
+ $type = CRM_Utils_Array::value('extends', $customGroup[$key]);
if ($subValue) {
$subValue = explode(CRM_Core_DAO::VALUE_SEPARATOR,
substr($subValue, 1, -1)
FROM civicrm_custom_field
WHERE option_group_id = %1";
$params = array(
- 1 => array($optionGroupID, 'Integer'),
+ 1 => array($optionGroupID, 'Integer'),
2 => array($this->_fid, 'Integer'),
);
$dao = CRM_Core_DAO::executeQuery($query, $params);
$dao = CRM_Core_DAO::executeQuery($query, $params);
$customOption = array();
- $fields = array('label', 'value', 'is_active', 'weight');
- $config = CRM_Core_Config::singleton();
+ $fields = array('label', 'value', 'is_active', 'weight');
+ $config = CRM_Core_Config::singleton();
while ($dao->fetch()) {
$customOption[$dao->id] = array();
foreach ($fields as $field) {
// set the userContext stack
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/admin/custom/group/field/option',
- "reset=1&action=browse&fid={$this->_fid}&gid={$this->_gid}"
- ));
+ "reset=1&action=browse&fid={$this->_fid}&gid={$this->_gid}"
+ ));
$controller->setEmbedded(TRUE);
$controller->process();
$controller->run();
}
//as url contain $gid so append breadcrumb dynamically.
- $breadcrumb = array(array(
- 'title' => ts('Custom Data Fields'),
+ $breadcrumb = array(
+ array(
+ 'title' => ts('Custom Data Fields'),
'url' => CRM_Utils_System::url('civicrm/admin/custom/group/field', 'reset=1&gid=' . $this->_gid),
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadcrumb);
if ($this->_fid) {
CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
}
- $session = CRM_Core_Session::singleton();
- $userID = $session->get('userID');
+ $session = CRM_Core_Session::singleton();
+ $userID = $session->get('userID');
$upcoming = CRM_Case_BAO_Case::getCases(TRUE, $userID, 'upcoming', $context);
if (!empty($upcoming)) {
}
$session = &CRM_Core_Session::singleton();
- $userID = $session->get('userID');
+ $userID = $session->get('userID');
$summary = CRM_Case_BAO_Case::getCasesSummary(TRUE, $userID);
if (!empty($summary)) {
CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
}
- $session = CRM_Core_Session::singleton();
- $userID = $session->get('userID');
+ $session = CRM_Core_Session::singleton();
+ $userID = $session->get('userID');
$upcoming = CRM_Case_BAO_Case::getCases(FALSE, $userID, 'upcoming', $context);
if (!empty($upcoming)) {
return "($strID1 < $strID2)";
}
}
-};
+}
+
+;
$civicrm_address = CRM_Utils_Array::value('civicrm_address', $rg->params);
// Since definitely have first and last name, escape them upfront.
- $first_name = CRM_Core_DAO::escapeString(CRM_Utils_Array::value('first_name', $civicrm_contact, ''));
- $last_name = CRM_Core_DAO::escapeString(CRM_Utils_Array::value('last_name', $civicrm_contact, ''));
+ $first_name = CRM_Core_DAO::escapeString(CRM_Utils_Array::value('first_name', $civicrm_contact, ''));
+ $last_name = CRM_Core_DAO::escapeString(CRM_Utils_Array::value('last_name', $civicrm_contact, ''));
$street_address = CRM_Core_DAO::escapeString(CRM_Utils_Array::value('street_address', $civicrm_address, ''));
$query = "
AND " . self::internalFilters($rg);
return array("civicrm_contact.{$rg->name}.{$rg->threshold}" => $query);
}
-};
+}
+
+;
return array("civicrm_contact.{$rg->name}.{$rg->threshold}" => $query);
}
-};
+}
+
+;
// $using are arrays of required field matchings (for substring and
// full matches, respectively)
$where = array();
- $on = array("SUBSTR(t1.{$this->rule_field}, 1, {$this->rule_length}) = SUBSTR(t2.{$this->rule_field}, 1, {$this->rule_length})");
+ $on = array("SUBSTR(t1.{$this->rule_field}, 1, {$this->rule_length}) = SUBSTR(t2.{$this->rule_field}, 1, {$this->rule_length})");
$using = array($this->rule_field);
switch ($this->rule_table) {
break;
case 'civicrm_address':
- $id = 'contact_id';
- $on[] = 't1.location_type_id = t2.location_type_id';
+ $id = 'contact_id';
+ $on[] = 't1.location_type_id = t2.location_type_id';
$using[] = 'location_type_id';
if ($this->params['civicrm_address']['location_type_id']) {
$locTypeId = CRM_Utils_Type::escape($this->params['civicrm_address']['location_type_id'], 'Integer', FALSE);
* @return rule fields array associated to rule group
*/
public static function dedupeRuleFields($params) {
- $rgBao = new CRM_Dedupe_BAO_RuleGroup();
- $rgBao->used = $params['used'];
+ $rgBao = new CRM_Dedupe_BAO_RuleGroup();
+ $rgBao->used = $params['used'];
$rgBao->contact_type = $params['contact_type'];
$rgBao->find(TRUE);
);
// the table names we support in dedupe rules - a filter for importableFields()
$supportedTables = array(
- 'civicrm_address', 'civicrm_contact', 'civicrm_email',
- 'civicrm_im', 'civicrm_note', 'civicrm_openid', 'civicrm_phone',
+ 'civicrm_address',
+ 'civicrm_contact',
+ 'civicrm_email',
+ 'civicrm_im',
+ 'civicrm_note',
+ 'civicrm_openid',
+ 'civicrm_phone',
);
foreach (array('Individual', 'Organization', 'Household') as $ctype) {
CRM_Utils_File::isIncludable("CRM/Dedupe/BAO/QueryBuilder/{$this->name}.php")
) {
include_once "CRM/Dedupe/BAO/QueryBuilder/{$this->name}.php";
- $class = "CRM_Dedupe_BAO_QueryBuilder_{$this->name}";
+ $class = "CRM_Dedupe_BAO_QueryBuilder_{$this->name}";
$command = empty($this->params) ? 'internal' : 'record';
$queries = call_user_func(array($class, $command), $this);
}
if ($this->params && !$this->noRules) {
$tempTableQuery = "CREATE TEMPORARY TABLE dedupe (id1 int, weight int, UNIQUE UI_id1 (id1)) ENGINE=MyISAM";
- $insertClause = "INSERT INTO dedupe (id1, weight)";
- $groupByClause = "GROUP BY id1";
- $dupeCopyJoin = " JOIN dedupe_copy ON dedupe_copy.id1 = t1.column WHERE ";
+ $insertClause = "INSERT INTO dedupe (id1, weight)";
+ $groupByClause = "GROUP BY id1";
+ $dupeCopyJoin = " JOIN dedupe_copy ON dedupe_copy.id1 = t1.column WHERE ";
}
else {
$tempTableQuery = "CREATE TEMPORARY TABLE dedupe (id1 int, id2 int, weight int, UNIQUE UI_id1_id2 (id1, id2)) ENGINE=MyISAM";
- $insertClause = "INSERT INTO dedupe (id1, id2, weight)";
- $groupByClause = "GROUP BY id1, id2";
- $dupeCopyJoin = " JOIN dedupe_copy ON dedupe_copy.id1 = t1.column AND dedupe_copy.id2 = t2.column WHERE ";
+ $insertClause = "INSERT INTO dedupe (id1, id2, weight)";
+ $groupByClause = "GROUP BY id1, id2";
+ $dupeCopyJoin = " JOIN dedupe_copy ON dedupe_copy.id1 = t1.column AND dedupe_copy.id2 = t2.column WHERE ";
}
$patternColumn = '/t1.(\w+)/';
$exclWeightSum = array();
// extract the next query ( and weight ) to be executed
$fieldWeight = array_keys($tableQueries);
$fieldWeight = $fieldWeight[0];
- $query = array_shift($tableQueries);
+ $query = array_shift($tableQueries);
if ($searchWithinDupes) {
// get prepared to search within already found dupes if $searchWithinDupes flag is set
// since queries are already sorted by weights, we can continue as is
$fieldWeight = array_keys($tableQueries);
$fieldWeight = $fieldWeight[0];
- $query = array_shift($tableQueries);
- $query = "{$insertClause} {$query} {$groupByClause} ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight)";
+ $query = array_shift($tableQueries);
+ $query = "{$insertClause} {$query} {$groupByClause} ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight)";
$dao->query($query);
if ($dao->affectedRows() >= 1) {
$exclWeightSum[] = substr($fieldWeight, strrpos($fieldWeight, '.') + 1);
* @access public
*/
public static function dedupeRuleFieldsWeight($params) {
- $rgBao = new CRM_Dedupe_BAO_RuleGroup();
+ $rgBao = new CRM_Dedupe_BAO_RuleGroup();
$rgBao->contact_type = $params['contact_type'];
if (CRM_Utils_Array::value('id', $params)) {
// accept an ID if provided
* array of (cid1, cid2, weight) dupe triples
*/
public static function dupes($rgid, $cids = array()) {
- $rgBao = new CRM_Dedupe_BAO_RuleGroup();
- $rgBao->id = $rgid;
+ $rgBao = new CRM_Dedupe_BAO_RuleGroup();
+ $rgBao->id = $rgid;
$rgBao->contactIds = $cids;
if (!$rgBao->find(TRUE)) {
CRM_Core_Error::fatal("Dedupe rule not found for selected contacts");
$foundByID = FALSE;
if ($ruleGroupID) {
- $rgBao = new CRM_Dedupe_BAO_RuleGroup();
- $rgBao->id = $ruleGroupID;
+ $rgBao = new CRM_Dedupe_BAO_RuleGroup();
+ $rgBao->id = $ruleGroupID;
$rgBao->contact_type = $ctype;
if ($rgBao->find(TRUE)) {
$foundByID = TRUE;
}
if (!$foundByID) {
- $rgBao = new CRM_Dedupe_BAO_RuleGroup();
+ $rgBao = new CRM_Dedupe_BAO_RuleGroup();
$rgBao->contact_type = $ctype;
- $rgBao->used = $used;
+ $rgBao->used = $used;
if (!$rgBao->find(TRUE)) {
CRM_Core_Error::fatal("$used rule for $ctype does not exist");
}
}
$ctype = $dao->contact_type;
}
- $rgBao = new CRM_Dedupe_BAO_RuleGroup();
- $rgBao->used = $used;
+ $rgBao = new CRM_Dedupe_BAO_RuleGroup();
+ $rgBao->used = $used;
$rgBao->contact_type = $ctype;
if (!$rgBao->find(TRUE)) {
CRM_Core_Error::fatal("$used rule for $ctype does not exist");
// handle {birth,deceased}_date
foreach (array(
- 'birth_date', 'deceased_date') as $date) {
+ 'birth_date',
+ 'deceased_date'
+ ) as $date) {
if (!empty($fields[$date])) {
$flat[$date] = $fields[$date];
if (is_array($flat[$date])) {
// FIXME: we also need to do some hacking for id and name fields, see CRM-3902’s comments
$fixes = array(
'address_name' => 'name',
- 'country' => 'country_id',
+ 'country' => 'country_id',
'state_province' => 'state_province_id',
- 'county' => 'county_id',
+ 'county' => 'county_id',
);
foreach ($fixes as $orig => $target) {
if (!empty($flat[$orig])) {
* @static
*/
public static function merge($dupePairs = array(), $cacheParams = array(), $mode = 'safe',
- $autoFlip = TRUE, $redirectForPerformance = FALSE
+ $autoFlip = TRUE, $redirectForPerformance = FALSE
) {
$cacheKeyString = CRM_Utils_Array::value('cache_key_string', $cacheParams);
$resultStats = array('merged' => array(), 'skipped' => array());
}
elseif ((in_array(substr($key, 5), CRM_Dedupe_Merger::getContactFields()) or
substr($key, 0, 12) == 'move_custom_'
- ) and $val != NULL) {
+ ) and $val != NULL
+ ) {
// Rule: if both main-contact has other-contact, let $mode decide if to merge a
// particular field or not
if (!empty($migrationInfo['rows'][$key]['main'])) {
if ($fieldName == 'address') {
$mainNewLocTypeId = $migrationInfo['location'][$fieldName][$fieldCount]['locTypeId'];
if (!empty($migrationInfo['main_loc_address']) &&
- array_key_exists("main_{$mainNewLocTypeId}", $migrationInfo['main_loc_address'])) {
+ array_key_exists("main_{$mainNewLocTypeId}", $migrationInfo['main_loc_address'])
+ ) {
// main loc already has some address for the loc-type. Its a overwrite situation.
// look for next available loc-type
// Fetch contacts
foreach (array('main' => $mainId, 'other' => $otherId) as $moniker => $cid) {
- $params = array('contact_id' => $cid, 'version' => 3, 'return' => array_merge(array('display_name'), self::getContactFields()));
+ $params = array(
+ 'contact_id' => $cid,
+ 'version' => 3,
+ 'return' => array_merge(array('display_name'), self::getContactFields())
+ );
$result = civicrm_api('contact', 'get', $params);
if (empty($result['values'][$cid]['contact_type'])) {
}
$names = array(
'preferred_communication_method' =>
- array(
- 'newName' => 'preferred_communication_method_display',
- 'groupName' => 'preferred_communication_method',
- ),
+ array(
+ 'newName' => 'preferred_communication_method_display',
+ 'groupName' => 'preferred_communication_method',
+ ),
);
CRM_Core_OptionGroup::lookupValues($specialValues[$moniker], $names);
$js = array('onChange' => "mergeBlock('$name', this, $count );");
}
$elements[] = array(
- 'select', "location[{$name}][$count][locTypeId]", NULL,
- $defaultLocType + $locTypeValues, $js,
+ 'select',
+ "location[{$name}][$count][locTypeId]",
+ NULL,
+ $defaultLocType + $locTypeValues,
+ $js,
);
// keep location-type-id same as that of other-contact
$migrationInfo['location'][$name][$count]['locTypeId'] = $locTypeId;
$value = '0';
}
if ((in_array(substr($key, 5), CRM_Dedupe_Merger::getContactFields()) ||
- substr($key, 0, 12) == 'move_custom_') &&
+ substr($key, 0, 12) == 'move_custom_') &&
$value != NULL
) {
$submitted[substr($key, 5)] = $value;
//keep state and country as array format.
//for checkbox and m-select format w/ VALUE_SEPARATOR
if (in_array($htmlType, array(
- 'CheckBox', 'Multi-Select', 'AdvMulti-Select'))) {
+ 'CheckBox',
+ 'Multi-Select',
+ 'AdvMulti-Select'
+ ))) {
$submitted[$key] = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
- $mergeValue
- ) . CRM_Core_DAO::VALUE_SEPARATOR;
+ $mergeValue
+ ) . CRM_Core_DAO::VALUE_SEPARATOR;
}
else {
$submitted[$key] = $mergeValue;
}
}
elseif (in_array($htmlType, array(
- 'Multi-Select Country', 'Multi-Select State/Province'))) {
+ 'Multi-Select Country',
+ 'Multi-Select State/Province'
+ ))) {
//we require submitted values should be in array format
if ($value) {
$mergeValueArray = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
if (CRM_Core_DAO::singleValueQuery("
SELECT id
FROM civicrm_entity_file
- WHERE entity_table = '{$tableName}' AND file_id = {$fileIds[$otherId]}")) {
+ WHERE entity_table = '{$tableName}' AND file_id = {$fileIds[$otherId]}")
+ ) {
$sql = "
UPDATE civicrm_entity_file
SET entity_id = {$mainId}
*/
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');
+ $invalidFields = array(
+ 'api_key',
+ 'contact_is_deleted',
+ 'created_date',
+ 'display_name',
+ 'hash',
+ 'id',
+ 'modified_date',
+ 'primary_contact_id',
+ 'sort_name',
+ 'user_unique_id'
+ );
foreach ($contactFields as $field => $value) {
if (in_array($field, $invalidFields)) {
unset($contactFields[$field]);
*/
static function getEvents(
$all = 0,
- $id = FALSE,
- $isActive = TRUE,
- $checkPermission = TRUE
+ $id = FALSE,
+ $isActive = TRUE,
+ $checkPermission = TRUE
) {
$query = "
SELECT `id`, `title`, `start_date`
*/
public static function getParticipantCount(
$eventId,
- $considerStatus = TRUE,
- $status = TRUE,
- $considerRole = TRUE,
- $role = TRUE
+ $considerStatus = TRUE,
+ $status = TRUE,
+ $considerRole = TRUE,
+ $role = TRUE
) {
// consider both role and status for counted participants, CRM-4924.
$params = array('entity_id' => $id, 'entity_table' => 'civicrm_event');
$addressValues = CRM_Core_BAO_Location::getValues($params, TRUE);
$location['address'] = str_replace(array(
- "\r",
- "\n",
- ), '', addslashes(nl2br($addressValues['address'][1]['display_text'])));
+ "\r",
+ "\n",
+ ), '', addslashes(nl2br($addressValues['address'][1]['display_text'])));
$location['url'] = CRM_Utils_System::url('civicrm/event/register', 'reset=1&id=' . $dao->event_id);
$location['location_type'] = $dao->location_type;
// Fixme - this is going to ignore context, better to get conditions, add params, and call PseudoConstant::get
return CRM_Financial_BAO_FinancialType::getIncomeFinancialType();
- break;
+ break;
}
return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
}
//generally if people are creating participant_payments via the api they won't be setting the line item correctly - we can't help them if they are doing complex transactions
// but if they have a single line item for the contribution we can assume it should refer to the participant line
- $lineItemCount = CRM_Core_DAO::singleValueQuery("select count(*) FROM civicrm_line_item WHERE contribution_id = %1", array(1 => array($participantPayment->contribution_id, 'Integer')));
+ $lineItemCount = CRM_Core_DAO::singleValueQuery("select count(*) FROM civicrm_line_item WHERE contribution_id = %1", array(
+ 1 => array(
+ $participantPayment->contribution_id,
+ 'Integer'
+ )
+ ));
if ($lineItemCount == 1) {
$sql = "UPDATE civicrm_line_item li
SET entity_table = 'civicrm_participant', entity_id = %1
WHERE contribution_id = %2 AND entity_table = 'civicrm_contribution'";
- CRM_Core_DAO::executeQuery($sql, array(1 => array($participantPayment->participant_id, 'Integer'), 2 => array($participantPayment->contribution_id, 'Integer')));
+ CRM_Core_DAO::executeQuery($sql, array(
+ 1 => array($participantPayment->participant_id, 'Integer'),
+ 2 => array($participantPayment->contribution_id, 'Integer')
+ ));
}
return $participantPayment;
//lets get the transaction mechanism.
$transaction = new CRM_Core_Transaction();
- $ids = array($participantId);
+ $ids = array($participantId);
$expiredId = array_search('Expired', $expiredStatuses);
- $results = CRM_Event_BAO_Participant::transitionParticipants($ids, $expiredId, $values['status_id'], TRUE, TRUE);
+ $results = CRM_Event_BAO_Participant::transitionParticipants($ids, $expiredId, $values['status_id'], TRUE, TRUE);
$transaction->commit();
if (!empty($results)) {
"[[:>:]]' ";
$query->_tables['civicrm_participant'] =
- $query->_whereTables['civicrm_participant'] = 1;
+ $query->_whereTables['civicrm_participant'] = 1;
}
return;
/**
*/
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->style = array(
+ 'width' => 0.1,
+ 'cap' => 'round',
+ 'join' => 'round',
+ 'dash' => '2,2',
+ 'color' => array(0, 0, 200)
+ );
+ $this->format = '5160';
$this->imgExtension = 'png';
- $this->imgRes = 300;
- $this->event = NULL;
+ $this->imgRes = 300;
+ $this->event = NULL;
$this->setDebug(FALSE);
}
public function run(&$participants) {
// fetch the 1st participant, and take her event to retrieve its attributes
$participant = reset($participants);
- $eventID = $participant['event_id'];
+ $eventID = $participant['event_id'];
$this->event = self::retrieveEvent($eventID);
//call function to create labels
self::createLabels($participants);
$x = $this->pdf->GetAbsX();
$y = $this->pdf->GetY();
if ($this->debug) {
- $this->pdf->Rect($x, $y, $this->pdf->width, $this->pdf->height, 'D', array('all' => array('width' => 1, 'cap' => 'round', 'join' => 'round', 'dash' => '2,10', 'color' => array(255, 0, 0))));
+ $this->pdf->Rect($x, $y, $this->pdf->width, $this->pdf->height, 'D', array(
+ 'all' => array(
+ 'width' => 1,
+ 'cap' => 'round',
+ 'join' => 'round',
+ 'dash' => '2,10',
+ 'color' => array(255, 0, 0)
+ )
+ ));
}
$img = $this->getImageFileName($this->event->id, $img);
if ($img) {
public function __construct() {
parent::__construct();
// A4
- $pw = 210;
- $ph = 297;
- $h = 50;
- $w = 75;
+ $pw = 210;
+ $ph = 297;
+ $h = 50;
+ $w = 75;
$this->format = array(
'name' => 'Sigel 3C',
- 'paper-size' => 'A4',
- 'metric' => 'mm',
- 'lMargin' => ($pw - $w * 2) / 2,
+ 'paper-size' => 'A4',
+ 'metric' => 'mm',
+ 'lMargin' => ($pw - $w * 2) / 2,
'tMargin' => ($ph - $h * 5) / 2,
- 'NX' => 2,
- 'NY' => 5,
- 'SpaceX' => 0,
- 'SpaceY' => 0,
+ 'NX' => 2,
+ 'NY' => 5,
+ 'SpaceX' => 0,
+ 'SpaceY' => 0,
'width' => $w,
- 'height' => $h,
- 'font-size' => 12,
+ 'height' => $h,
+ 'font-size' => 12,
);
$this->lMarginLogo = 20;
$this->tMarginName = 20;
$x = $this->pdf->GetAbsX();
$y = $this->pdf->GetY();
$this->printBackground(TRUE);
- $this->pdf->SetLineStyle(array('width' => 0.1, 'cap' => 'round', 'join' => 'round', 'dash' => '2,2', 'color' => array(0, 0, 200)));
+ $this->pdf->SetLineStyle(array(
+ 'width' => 0.1,
+ 'cap' => 'round',
+ 'join' => 'round',
+ 'dash' => '2,2',
+ 'color' => array(0, 0, 200)
+ ));
$this->pdf->SetFontSize(8);
$this->pdf->MultiCell($this->pdf->width - $this->lMarginLogo, 0, $participant['event_title'], $this->border, "L", 0, 1, $x + $this->lMarginLogo, $y);
public function __construct() {
parent::__construct();
// A4
- $pw = 210;
- $ph = 297;
- $h = 59.2;
- $w = 85.7;
+ $pw = 210;
+ $ph = 297;
+ $h = 59.2;
+ $w = 85.7;
$this->format = array(
'name' => 'Avery 5395',
- 'paper-size' => 'A4',
- 'metric' => 'mm',
- 'lMargin' => 13.5,
+ 'paper-size' => 'A4',
+ 'metric' => 'mm',
+ 'lMargin' => 13.5,
'tMargin' => 3,
- 'NX' => 2,
- 'NY' => 4,
- 'SpaceX' => 15,
- 'SpaceY' => 8.5,
+ 'NX' => 2,
+ 'NY' => 4,
+ 'SpaceX' => 15,
+ 'SpaceY' => 8.5,
'width' => $w,
- 'height' => $h,
- 'font-size' => 12,
+ 'height' => $h,
+ 'font-size' => 12,
);
$this->lMarginLogo = 20;
$this->tMarginName = 20;
$x = $this->pdf->GetAbsX();
$y = $this->pdf->GetY();
$this->printBackground(TRUE);
- $this->pdf->SetLineStyle(array('width' => 0.1, 'cap' => 'round', 'join' => 'round', 'dash' => '2,2', 'color' => array(0, 0, 200)));
+ $this->pdf->SetLineStyle(array(
+ 'width' => 0.1,
+ 'cap' => 'round',
+ 'join' => 'round',
+ 'dash' => '2,2',
+ 'color' => array(0, 0, 200)
+ ));
$this->pdf->SetFontSize(9);
$this->pdf->MultiCell($this->pdf->width - $this->lMarginLogo, 0, $participant['event_title'], $this->border, "L", 0, 1, $x + $this->lMarginLogo, $y);
public function __construct() {
parent::__construct();
// A4
- $pw = 297;
- $ph = 210;
+ $pw = 297;
+ $ph = 210;
$this->lMargin = 10;
$this->tMargin = 0;
- $w = $pw - 2 * $this->lMargin;
- $h = $ph - 2 * $this->tMargin;
- $this->format = array(
+ $w = $pw - 2 * $this->lMargin;
+ $h = $ph - 2 * $this->tMargin;
+ $this->format = array(
'name' => 'A4 horiz',
- 'paper-size' => 'A4',
- 'metric' => 'mm',
- 'lMargin' => 0,
+ 'paper-size' => 'A4',
+ 'metric' => 'mm',
+ 'lMargin' => 0,
'tMargin' => 0,
- 'NX' => 1,
- 'NY' => 1,
- 'SpaceX' => 0,
- 'SpaceY' => 0,
+ 'NX' => 1,
+ 'NY' => 1,
+ 'SpaceX' => 0,
+ 'SpaceY' => 0,
'width' => $w,
- 'height' => $h,
- 'font-size' => 36,
+ 'height' => $h,
+ 'font-size' => 36,
);
// $this->setDebug ();
}
* @return $this|bool|CRM_Event_Cart_BAO_Cart
*/
public static function find_or_create_for_current_session() {
- $session = CRM_Core_Session::singleton();
+ $session = CRM_Core_Session::singleton();
$event_cart_id = $session->get('event_cart_id');
- $userID = $session->get('userID');
- $cart = FALSE;
+ $userID = $session->get('userID');
+ $cart = FALSE;
if (!is_null($event_cart_id)) {
$cart = self::find_uncompleted_by_id($event_cart_id);
if ($cart && $userID) {
$index++;
}
}
- return - 1;
+ return -1;
}
/**
slot.weight,
sub_event.start_date
EOS;
- $sql_args = array(1 => array($main_event_participant_id, 'Integer'));
- $dao = CRM_Core_DAO::executeQuery($sql, $sql_args);
+ $sql_args = array(1 => array($main_event_participant_id, 'Integer'));
+ $dao = CRM_Core_DAO::executeQuery($sql, $sql_args);
$smarty_sessions = array();
while ($dao->fetch()) {
$smarty_sessions[] = get_object_vars($dao);
$this->load_associations();
$contacts_to_delete = array();
foreach ($this->participants as $participant) {
- $defaults = array();
- $params = array('id' => $participant->contact_id);
+ $defaults = array();
+ $params = array('id' => $participant->contact_id);
$temporary_contact = CRM_Contact_BAO_Contact::retrieve($params, $defaults);
if ($temporary_contact->is_deleted) {
foreach ($this->cart->get_main_events_in_carts() as $event_in_cart) {
if (empty($event_in_cart->participants)) {
$participant_params = array(
- 'cart_id' => $this->cart->id,
- 'event_id' => $event_in_cart->event_id,
- 'contact_id' => self::find_or_create_contact($this->getContactID()),
+ 'cart_id' => $this->cart->id,
+ 'event_id' => $event_in_cart->event_id,
+ 'contact_id' => self::find_or_create_contact($this->getContactID()),
);
$participant = CRM_Event_Cart_BAO_MerParticipant::create($participant_params);
$participant->save();
$slot_buttons = array();
$group_name = "slot_$slot_index";
foreach ($events as $event) {
- $seats_available = $this->checkEventCapacity($event->id);
- $event_is_full = ($seats_available === NULL) ? FALSE : ($seats_available < 1);
- $radio = $this->createElement('radio', NULL, NULL, $event->title, $event->id);
- $slot_buttons[] = $radio;
+ $seats_available = $this->checkEventCapacity($event->id);
+ $event_is_full = ($seats_available === NULL) ? FALSE : ($seats_available < 1);
+ $radio = $this->createElement('radio', NULL, NULL, $event->title, $event->id);
+ $slot_buttons[] = $radio;
$event_description = ($event_is_full ? $event->event_full_text . "<p>" : '') . $event->description;
$session_options[$radio->getAttribute('id')] = array(
$values = array();
CRM_Core_DAO::storeValues($this->main_participant, $values);
- $values['id'] = NULL;
+ $values['id'] = NULL;
$values['event_id'] = $event_in_cart->event_id;
- $participant = CRM_Event_Cart_BAO_MerParticipant::create($values);
+ $participant = CRM_Event_Cart_BAO_MerParticipant::create($values);
$participant->save();
$event_in_cart->add_participant($participant);
}
);
if ($this->cid) {
- $params = array('id' => $this->cid);
- $contact = CRM_Contact_BAO_Contact::retrieve($params, $defaults);
+ $params = array('id' => $this->cid);
+ $contact = CRM_Contact_BAO_Contact::retrieve($params, $defaults);
$contact_values = array();
CRM_Core_DAO::storeValues($contact, $contact_values);
$this->assign('contact', $contact_values);
$price_set_id = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $event->id);
if ($price_set_id) {
$price_sets = CRM_Price_BAO_PriceSet::getSetDetail($price_set_id, TRUE, TRUE);
- $price_set = $price_sets[$price_set_id];
- $index = -1;
+ $price_set = $price_sets[$price_set_id];
+ $index = -1;
foreach ($price_set['fields'] as $field) {
$index++;
$field_name = "event_{$event->id}_price_{$field['id']}";
while ($participant->fetch()) {
if (array_key_exists($participant->status_id, $statusTypes)) {
$form = $mer_participant->get_form();
- $this->_errors[$form->html_field_name('email')] = ts("The participant %1 is already registered for %2 (%3).", array(1 => $participant_fields['email'], 2 => $event_in_cart->event->title, 3 => $event_in_cart->event->start_date));
+ $this->_errors[$form->html_field_name('email')] = ts("The participant %1 is already registered for %2 (%3).", array(
+ 1 => $participant_fields['email'],
+ 2 => $event_in_cart->event->title,
+ 3 => $event_in_cart->event->start_date
+ ));
}
}
}
$participant = $this->cart->get_event_in_cart_by_event_id($event_id)->get_participant_by_id($participant_id);
if ($participant->contact_id && $contact_id != $participant->contact_id) {
- $defaults = array();
- $params = array('id' => $participant->contact_id);
+ $defaults = array();
+ $params = array('id' => $participant->contact_id);
$temporary_contact = CRM_Contact_BAO_Contact::retrieve($params, $defaults);
foreach ($this->cart->get_subparticipants($participant) as $subparticipant) {
public function buildQuickForm() {
- $this->line_items = array();
- $this->sub_total = 0;
+ $this->line_items = array();
+ $this->sub_total = 0;
$this->_price_values = $this->getValuesForPage('ParticipantsAndPrices');
// iterate over each event in cart
* @param null $class
*/
public function process_event_line_item(&$event_in_cart, $class = NULL) {
- $cost = 0;
+ $cost = 0;
$price_set_id = CRM_Price_BAO_PriceSet::getFor("civicrm_event", $event_in_cart->event_id);
$amount_level = NULL;
if ($price_set_id) {
$event_price_values[$matches[1]] = $value;
}
}
- $price_sets = CRM_Price_BAO_PriceSet::getSetDetail($price_set_id, TRUE);
- $price_set = $price_sets[$price_set_id];
+ $price_sets = CRM_Price_BAO_PriceSet::getSetDetail($price_set_id, TRUE);
+ $price_set = $price_sets[$price_set_id];
$price_set_amount = array();
CRM_Price_BAO_PriceSet::processAmount($price_set['fields'], $event_price_values, $price_set_amount);
- $cost = $event_price_values['amount'];
- $amount_level = $event_price_values['amount_level'];
+ $cost = $event_price_values['amount'];
+ $amount_level = $event_price_values['amount_level'];
$price_details[$price_set_id] = $price_set_amount;
}
* @param array $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();
+ $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}"];
$state_province->find();
$state_province->fetch();
$transaction = new CRM_Core_Transaction();
$trxnDetails = NULL;
- $params = $this->_submitValues;
+ $params = $this->_submitValues;
$main_participants = $this->cart->get_main_event_participants();
foreach ($main_participants as $participant) {
- $defaults = array();
- $ids = array('contact_id' => $participant->contact_id);
- $contact = CRM_Contact_BAO_Contact::retrieve($ids, $defaults);
+ $defaults = array();
+ $ids = array('contact_id' => $participant->contact_id);
+ $contact = CRM_Contact_BAO_Contact::retrieve($ids, $defaults);
$contact->is_deleted = 0;
$contact->save();
}
$trxn_prefix = 'VR';
if (array_key_exists('billing_contact_email', $params)) {
$this->payer_contact_id = self::find_or_create_contact($this->getContactID(), array(
- 'email' => $params['billing_contact_email'],
- 'first_name' => $params['billing_first_name'],
- 'last_name' => $params['billing_last_name'],
- 'is_deleted' => FALSE,
- ));
+ 'email' => $params['billing_contact_email'],
+ 'first_name' => $params['billing_first_name'],
+ 'last_name' => $params['billing_last_name'],
+ 'is_deleted' => FALSE,
+ ));
$ctype = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
$this->payer_contact_id,
$payment = &CRM_Core_Payment::singleton($this->_mode, $this->_paymentProcessor, $this);
CRM_Core_Payment_Form::mapParams($this->_bltID, $params, $params, TRUE);
$params['month'] = $params['credit_card_exp_date']['M'];
- $params['year'] = $params['credit_card_exp_date']['Y'];
- $result = &$payment->doDirectPayment($params);
+ $params['year'] = $params['credit_card_exp_date']['Y'];
+ $result = &$payment->doDirectPayment($params);
if (is_a($result, 'CRM_Core_Error')) {
CRM_Core_Error::displaySessionError($result);
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/event/cart_checkout', "_qf_Payment_display=1&qfKey={$this->controller->_key}", TRUE, NULL, FALSE));
list(
$custom_fields_pre,
$custom_fields_post
- ) = $this->get_participant_custom_data_fields($this->participant->event_id);
+ ) = $this->get_participant_custom_data_fields($this->participant->event_id);
foreach ($custom_fields_pre as $key => $field) {
CRM_Core_BAO_UFGroup::buildProfile($form, $field, CRM_Profile_Form::MODE_CREATE, $this->participant->id);
}
$custom = CRM_Utils_Array::value('custom', $form->getTemplate()->_tpl_vars, array());
$form->assign('custom', array_merge($custom, array(
- $this->html_field_name('customPre') => $custom_fields_pre,
- $this->html_field_name('customPost') => $custom_fields_post,
- $this->html_field_name('number') => $this->name(),
- )));
+ $this->html_field_name('customPre') => $custom_fields_pre,
+ $this->html_field_name('customPost') => $custom_fields_post,
+ $this->html_field_name('number') => $this->name(),
+ )));
}
/**
$event_in_cart = $cart->add_event($this->_id);
$url = CRM_Utils_System::url('civicrm/event/view_cart');
- CRM_Utils_System::setUFMessage(ts("<b>%1</b> has been added to your cart. <a href='%2'>View your cart.</a>", array(1 => $event_in_cart->event->title, 2 => $url)));
+ CRM_Utils_System::setUFMessage(ts("<b>%1</b> has been added to your cart. <a href='%2'>View your cart.</a>", array(
+ 1 => $event_in_cart->event->title,
+ 2 => $url
+ )));
$transaction->commit();
$cart = CRM_Event_Cart_BAO_Cart::find_by_id($cart_id);
- $params_array = array('cart_id' => $cart->id, 'contact_id' => CRM_Event_Cart_Form_Cart::find_or_create_contact(), 'event_id' => $event_id);
+ $params_array = array(
+ 'cart_id' => $cart->id,
+ 'contact_id' => CRM_Event_Cart_Form_Cart::find_or_create_contact(),
+ 'event_id' => $event_id
+ );
//XXX security?
$participant = CRM_Event_Cart_BAO_MerParticipant::create($params_array);
class CRM_Event_Cart_Page_RemoveFromCart extends CRM_Core_Page {
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();
+ $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
+ $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($this->_id);
- $removed_event = $cart->remove_event_in_cart($event_in_cart->id);
+ $event_in_cart = $cart->get_event_in_cart_by_event_id($this->_id);
+ $removed_event = $cart->remove_event_in_cart($event_in_cart->id);
$removed_event_title = $removed_event->event->title;
CRM_Core_Session::setStatus(ts("<b>%1</b> has been removed from your cart.", array(1 => $removed_event_title)), '', 'success');
$transaction->commit();
CRM_Core_Error::statusBounce(ts("You don't have any events in you cart. Please add some events."), CRM_Utils_System::url('civicrm/event'));
}
- $pages = array();
- $is_monetary = FALSE;
+ $pages = array();
+ $is_monetary = FALSE;
$is_conference = FALSE;
foreach ($cart->events_in_carts as $event_in_cart) {
if ($event_in_cart->event->is_monetary) {
* $Id$
*
*/
-class CRM_Event_Config extends CRM_Core_Component_Config {}
+class CRM_Event_Config extends CRM_Core_Component_Config {
+}
if ($priceSetId) {
// get price set default values, CRM-4090
if (in_array(get_class($form),
- array(
- 'CRM_Event_Form_Participant',
- 'CRM_Event_Form_Registration_Register',
- 'CRM_Event_Form_Registration_AdditionalParticipant',
- )
- )) {
+ array(
+ 'CRM_Event_Form_Participant',
+ 'CRM_Event_Form_Registration_Register',
+ 'CRM_Event_Form_Registration_AdditionalParticipant',
+ )
+ )) {
$priceSetValues = self::setDefaultPriceSet($form->_pId, $form->_eventId);
if (!empty($priceSetValues)) {
$defaults[$form->_pId] = array_merge($defaults[$form->_pId], $priceSetValues);
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->id = $contriId;
$contribution->find(TRUE);
- foreach (array('financial_type_id', 'payment_instrument_id', 'contribution_status_id', 'receive_date', 'total_amount') as $f) {
+ foreach (array(
+ 'financial_type_id',
+ 'payment_instrument_id',
+ 'contribution_status_id',
+ 'receive_date',
+ 'total_amount'
+ ) as $f) {
if ($f == 'receive_date') {
list($defaults[$form->_pId]['receive_date']) = CRM_Utils_Date::setDateDefaults($contribution->$f);
}
if ($form->_pId) {
if (CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment',
- $form->_pId, 'contribution_id', 'participant_id'
- )) {
+ $form->_pId, 'contribution_id', 'participant_id'
+ )
+ ) {
$form->_online = TRUE;
}
}
$element = $form->add('select', 'discount_id',
ts('Discount Set'),
array(
- 0 => ts('- select -')) + $discounts,
+ 0 => ts('- select -')
+ ) + $discounts,
FALSE,
array('onchange' => "buildFeeBlock( {$form->_eventId}, this.value );")
);
if ($form->_contactId) {
list($form->_contributorDisplayName,
$form->_contributorEmail
- ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($form->_contactId);
+ ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($form->_contactId);
$form->assign('email', $form->_contributorEmail);
}
else {
$this->_doneUrl = CRM_Utils_System::url('civicrm/event/manage',
'reset=1'
);
- $breadCrumb = array(array(
- 'title' => ts('Manage Events'),
+ $breadCrumb = array(
+ array(
+ 'title' => ts('Manage Events'),
'url' => $this->_doneUrl,
- ));
+ )
+ );
}
}
else {
$this->_doneUrl = CRM_Utils_System::url('civicrm/admin/eventTemplate', 'reset=1');
- $breadCrumb = array(array(
- 'title' => ts('Manage Event Templates'),
+ $breadCrumb = array(
+ array(
+ 'title' => ts('Manage Event Templates'),
'url' => $this->_doneUrl,
- ));
+ )
+ );
}
CRM_Utils_System::appendBreadCrumb($breadCrumb);
}
}
CRM_Core_Session::setStatus(ts("'%1' information has been saved.",
- array(1 => CRM_Utils_Array::value('title', CRM_Utils_Array::value($subPage, $this->get('tabHeader')), $className))
- ), ts('Saved'), 'success');
+ array(1 => CRM_Utils_Array::value('title', CRM_Utils_Array::value($subPage, $this->get('tabHeader')), $className))
+ ), ts('Saved'), 'success');
$config = CRM_Core_Config::singleton();
if (in_array('CiviCampaign', $config->enableComponents)) {
$this->postProcessHook();
if ($this->controller->getButtonName('submit') == "_qf_{$className}_upload_done") {
if ($this->_isTemplate) {
- CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/admin/eventTemplate', 'reset=1'));
+ CRM_Core_Session::singleton()
+ ->pushUserContext(CRM_Utils_System::url('civicrm/admin/eventTemplate', 'reset=1'));
}
else {
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/event/manage', 'reset=1'));
}
else {
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url("civicrm/event/manage/{$subPage}",
- "action=update&reset=1&id={$this->_id}"
- ));
+ "action=update&reset=1&id={$this->_id}"
+ ));
}
}
}
public function setDefaultValues() {
$parentDefaults = parent::setDefaultValues();
- $eventId = $this->_id;
- $params = array();
+ $eventId = $this->_id;
+ $params = array();
$defaults = array();
if (isset($eventId)) {
$params = array('id' => $eventId);
'slot_label_id',
ts('Conference Slot'),
array(
- '' => ts('- select -')) + $slots,
+ '' => ts('- select -')
+ ) + $slots,
FALSE
);
if ($participant->find()) {
$searchURL = CRM_Utils_System::url('civicrm/event/search', 'reset=1');
CRM_Core_Session::setStatus(ts('This event cannot be deleted because there are participant records linked to it. If you want to delete this event, you must first find the participants linked to this event and delete them. You can use use <a href=\'%1\'> CiviEvent >> Find Participants page </a>.',
- array(1 => $searchURL)
- ), ts('Deletion Error'), 'error');
+ array(1 => $searchURL)
+ ), ts('Deletion Error'), 'error');
return;
}
CRM_Event_BAO_Event::del($this->_id);
$url = 'civicrm/event/manage';
$urlParams = 'reset=1';
CRM_Core_Session::setStatus(ts("'%1' information has been saved.",
- array(1 => $this->getTitle())
- ), ts('Saved'), 'success');
+ array(1 => $this->getTitle())
+ ), ts('Saved'), 'success');
}
CRM_Utils_System::redirect(CRM_Utils_System::url($url, $urlParams));
}
// pull template custom data as a default for event, CRM-5596
- $groupTree = CRM_Core_BAO_CustomGroup::getTree($this->_type, $this, $templateId, NULL, $this->_subType);
- $groupTree = CRM_Core_BAO_CustomGroup::formatGroupTree($groupTree, $this->_groupCount, $this);
+ $groupTree = CRM_Core_BAO_CustomGroup::getTree($this->_type, $this, $templateId, NULL, $this->_subType);
+ $groupTree = CRM_Core_BAO_CustomGroup::formatGroupTree($groupTree, $this->_groupCount, $this);
$customValues = array();
CRM_Core_BAO_CustomGroup::setDefaults($groupTree, $customValues);
foreach ($customValues as $key => $val) {
public function setDefaultValues() {
$parentDefaults = parent::setDefaultValues();
- $eventId = $this->_id;
- $params = array();
+ $eventId = $this->_id;
+ $params = array();
$defaults = array();
if (isset($eventId)) {
$params = array('id' => $eventId);
list($defaults["discount_start_date[$i]"]) = CRM_Utils_Date::setDateDefaults(CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Discount', $optionGroupId,
'start_date', 'price_set_id'
- ));
+ ));
list($defaults["discount_end_date[$i]"]) = CRM_Utils_Date::setDateDefaults(CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Discount', $optionGroupId,
'end_date', 'price_set_id'
- ));
+ ));
$defaultDiscounts[] = CRM_Price_BAO_PriceSet::getSetDetail($optionGroupId);
$i++;
}
if (!empty($defaults['payment_processor'])) {
$defaults['payment_processor'] = array_fill_keys(explode(CRM_Core_DAO::VALUE_SEPARATOR,
$defaults['payment_processor']
- ), '1');
+ ), '1');
}
return $defaults;
}
}
$this->add('select', 'price_set_id', ts('Price Set'),
array(
- '' => ts('- none -')) + $price,
+ '' => ts('- none -')
+ ) + $price,
NULL, array('onchange' => "return showHideByValue('price_set_id', '', 'map-field', 'block', 'select', false);")
);
$default = array($this->createElement('radio', NULL, NULL, NULL, 0));
public static function formRule($values) {
$errors = array();
if (!empty($values['is_discount'])) {
- $occurDiscount = array_count_values($values['discount_name']);
- $countemptyrows = 0;
+ $occurDiscount = array_count_values($values['discount_name']);
+ $countemptyrows = 0;
$countemptyvalue = 0;
for ($i = 1; $i <= self::NUM_DISCOUNT; $i++) {
$start_date = $end_date = NULL;
*/
public function postProcess() {
$eventTitle = '';
- $params = $this->exportValues();
+ $params = $this->exportValues();
$this->set('discountSection', 0);
}
else {
// if there are label / values, create custom options for them
- $labels = CRM_Utils_Array::value('label', $params);
- $values = CRM_Utils_Array::value('value', $params);
+ $labels = CRM_Utils_Array::value('label', $params);
+ $values = CRM_Utils_Array::value('value', $params);
$default = CRM_Utils_Array::value('default', $params);
$options = array();
if (!CRM_Utils_System::isNull($labels) && !CRM_Utils_System::isNull($values)) {
for ($i = 1; $i < self::NUM_OPTION; $i++) {
if (!empty($labels[$i]) && !CRM_Utils_System::isNull($values[$i])) {
$options[] = array(
- 'label' => trim($labels[$i]),
+ 'label' => trim($labels[$i]),
'value' => CRM_Utils_Rule::cleanMoney(trim($values[$i])),
'weight' => $i,
'is_active' => 1,
}
$discountPriceSets = !empty($this->_defaultValues['discount_price_set']) ? $this->_defaultValues['discount_price_set'] : array();
- $discountFieldIDs = !empty($this->_defaultValues['discount_option_id']) ? $this->_defaultValues['discount_option_id'] : array();
+ $discountFieldIDs = !empty($this->_defaultValues['discount_option_id']) ? $this->_defaultValues['discount_option_id'] : array();
if (CRM_Utils_Array::value('is_discount', $params) == 1) {
// if there are discounted set of label / values,
// create custom options for them
- $labels = CRM_Utils_Array::value('discounted_label', $params);
- $values = CRM_Utils_Array::value('discounted_value', $params);
+ $labels = CRM_Utils_Array::value('discounted_label', $params);
+ $values = CRM_Utils_Array::value('discounted_value', $params);
$default = CRM_Utils_Array::value('discounted_default', $params);
if (!CRM_Utils_System::isNull($labels) && !CRM_Utils_System::isNull($values)) {
'price_set_id' => $priceSetID,
'start_date' => CRM_Utils_Date::processDate($params['discount_start_date'][$j]),
'end_date' => CRM_Utils_Date::processDate($params['discount_end_date'][$j]),
- );
+ );
CRM_Core_BAO_Discount::add($discountParams);
}
}
if (!empty($locationEvents)) {
$this->assign('locEvents', TRUE);
$optionTypes = array(
- '1' => ts('Create new location'),
+ '1' => ts('Create new location'),
'2' => ts('Use existing location'),
);
if (!isset($locationEvents[$this->_oldLocBlockId]) || (!$this->_oldLocBlockId)) {
$locationEvents = array(
- '' => ts('- select -')) + $locationEvents;
+ '' => ts('- select -')
+ ) + $locationEvents;
}
$this->add('select', 'loc_event_id', ts('Use Location'), $locationEvents);
}
$defaultLocationType = CRM_Core_BAO_LocationType::getDefault();
foreach (array(
- 'address', 'phone', 'email') as $block) {
+ 'address',
+ 'phone',
+ 'email'
+ ) as $block) {
if (empty($params[$block]) || !is_array($params[$block])) {
continue;
}
list($defaults['custom_pre_id'],
$defaults['custom_post']
- ) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
+ ) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
// Get the id for the event registration profile
$eventRegistrationIdParams = $eventRegistrationIdDefaults = array(
list($defaults['additional_custom_pre_id'],
$defaults['additional_custom_post']
- ) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinAddParams);
+ ) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinAddParams);
if (isset($defaults['additional_custom_post']) && is_numeric($defaults['additional_custom_post'])) {
$defaults['additional_custom_post_id'] = $defaults['additional_custom_post'];
if (!empty($defaults['registration_start_date'])) {
list($defaults['registration_start_date'],
$defaults['registration_start_date_time']
- ) = CRM_Utils_Date::setDateDefaults($defaults['registration_start_date'],
+ ) = CRM_Utils_Date::setDateDefaults($defaults['registration_start_date'],
'activityDateTime'
);
}
if (!empty($defaults['registration_end_date'])) {
list($defaults['registration_end_date'],
$defaults['registration_end_date_time']
- ) = CRM_Utils_Date::setDateDefaults($defaults['registration_end_date'],
+ ) = CRM_Utils_Date::setDateDefaults($defaults['registration_end_date'],
'activityDateTime'
);
}
}
$params = array(
- 'used' => 'Supervised',
+ 'used' => 'Supervised',
'contact_type' => 'Individual',
);
$dedupeRuleFields = CRM_Dedupe_BAO_Rule::dedupeRuleFields($params);
'profileEntities' => array(),
);
- $configs['allowCoreTypes'] = array_merge(array('Contact', 'Individual'), CRM_Contact_BAO_ContactType::subTypes('Individual'));
+ $configs['allowCoreTypes'] = array_merge(array(
+ 'Contact',
+ 'Individual'
+ ), CRM_Contact_BAO_ContactType::subTypes('Individual'));
$configs['allowCoreTypes'][] = 'Participant';
//CRM-15427
$id = CRM_Utils_Request::retrieve('id', 'Integer');
if ($id) {
$participantEventType = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Event", $id, 'event_type_id', 'id');
- $participantRole = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $id, 'default_role_id');
+ $participantRole = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $id, 'default_role_id');
$configs['allowSubTypes']['ParticipantEventName'] = array($id);
$configs['allowSubTypes']['ParticipantEventType'] = array($participantEventType);
$configs['allowSubTypes']['ParticipantRole'] = array($participantRole);
}
$configs['profileEntities'][] = array('entity_name' => 'contact_1', 'entity_type' => 'IndividualModel');
- $configs['profileEntities'][] = array('entity_name' => 'participant_1', 'entity_type' => 'ParticipantModel', 'entity_sub_type' => '*');
+ $configs['profileEntities'][] = array(
+ 'entity_name' => 'participant_1',
+ 'entity_type' => 'ParticipantModel',
+ 'entity_sub_type' => '*'
+ );
return $configs;
}
isset($values['registration_end_date'])
) {
$start = CRM_Utils_Date::processDate($values['registration_start_date']);
- $end = CRM_Utils_Date::processDate($values['registration_end_date']);
+ $end = CRM_Utils_Date::processDate($values['registration_end_date']);
if ($end < $start) {
$errorMsg['registration_end_date'] = ts('Registration end date should be after Registration start date');
}
$ufAdd[1] = $params['custom_pre_id'];
$wtAdd = 1;
}
- elseif (CRM_Utils_Array::value('additional_custom_pre_id', $params) == 'none') {}
+ elseif (CRM_Utils_Array::value('additional_custom_pre_id', $params) == 'none') {
+ }
else {
$ufAdd[1] = $params['additional_custom_pre_id'];
$wtAdd = 1;
if (empty($params['additional_custom_post_id'])) {
$ufAdd[2] = $params['custom_post_id'];
}
- elseif (CRM_Utils_Array::value('additional_custom_post_id', $params) == 'none') {}
+ elseif (CRM_Utils_Array::value('additional_custom_post_id', $params) == 'none') {
+ }
else {
$ufAdd[2] = $params['additional_custom_post_id'];
}
//If this ID has parent, send parent id
if ($checkParentExistsForThisId) {
/**
- * Get connected event information list
- */
+ * Get connected event information list
+ */
//Get all connected event ids
$allEventIdsArray = CRM_Core_BAO_RecurringEntity::getEntitiesForParent($checkParentExistsForThisId, 'civicrm_event');
$allEventIds = array();
$linkedEntities = array(
array(
- 'table' => 'civicrm_price_set_entity',
- 'findCriteria' => array(
- 'entity_id' => $this->_id,
+ 'table' => 'civicrm_price_set_entity',
+ 'findCriteria' => array(
+ 'entity_id' => $this->_id,
'entity_table' => 'civicrm_event',
),
'linkedColumns' => array('entity_id'),
'isRecurringEntityRecord' => FALSE,
),
array(
- 'table' => 'civicrm_uf_join',
- 'findCriteria' => array(
- 'entity_id' => $this->_id,
+ 'table' => 'civicrm_uf_join',
+ 'findCriteria' => array(
+ 'entity_id' => $this->_id,
'entity_table' => 'civicrm_event',
),
'linkedColumns' => array('entity_id'),
'isRecurringEntityRecord' => FALSE,
),
array(
- 'table' => 'civicrm_tell_friend',
- 'findCriteria' => array(
- 'entity_id' => $this->_id,
+ 'table' => 'civicrm_tell_friend',
+ 'findCriteria' => array(
+ 'entity_id' => $this->_id,
'entity_table' => 'civicrm_event',
),
'linkedColumns' => array('entity_id'),
'isRecurringEntityRecord' => TRUE,
),
array(
- 'table' => 'civicrm_pcp_block',
- 'findCriteria' => array(
- 'entity_id' => $this->_id,
+ 'table' => 'civicrm_pcp_block',
+ 'findCriteria' => array(
+ 'entity_id' => $this->_id,
'entity_table' => 'civicrm_event',
),
'linkedColumns' => array('entity_id'),
*/
static public function getParticipantCountforEvent($listOfRelatedEntities = array()) {
if (!empty($listOfRelatedEntities)) {
- $implodeRelatedEntities = implode(',', array_map(function($entity) {
+ $implodeRelatedEntities = implode(',', array_map(function ($entity) {
return $entity['id'];
}, $listOfRelatedEntities));
if ($implodeRelatedEntities) {
CRM_Core_Resources::singleton()
->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
->addSetting(array(
- 'tabSettings' => array(
- 'active' => self::getCurrentTab($tabs),
- )));
+ 'tabSettings' => array(
+ 'active' => self::getCurrentTab($tabs),
+ )
+ ));
CRM_Event_Form_ManageEvent::addProfileEditScripts();
return $tabs;
}
CRM_Utils_Hook::tabset('civicrm/event/manage', $tabs,
array('event_id' => $eventID));
- $fullName = $form->getVar('_name');
+ $fullName = $form->getVar('_name');
$className = CRM_Utils_String::getClassName($fullName);
- $new = '';
+ $new = '';
// hack for special cases.
switch ($className) {
$this->assign('feeBlockPaid', FALSE);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
- $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
- $this->_eID = CRM_Utils_Request::retrieve('eid', 'Positive', $this);
- $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
+ $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
+ $this->_eID = CRM_Utils_Request::retrieve('eid', 'Positive', $this);
+ $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->assign('context', $this->_context);
if ($this->_contactId) {
if (
strpos($path, 'civicrm/contact/search') === 0 ||
strpos($path, 'civicrm/group/search') === 0
- ) {
+ ) {
$this->_id = NULL;
}
else {
$this->_single = TRUE;
$this->assign('urlPath', 'civicrm/contact/view/participant');
if (!$this->_id && !$this->_contactId) {
- $breadCrumbs = array(array(
- 'title' => ts('CiviEvent Dashboard'),
+ $breadCrumbs = array(
+ array(
+ 'title' => ts('CiviEvent Dashboard'),
'url' => CRM_Utils_System::url('civicrm/event', 'reset=1'),
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadCrumbs);
}
}
else {
//set the appropriate action
- $context = $this->get('context');
- $urlString = 'civicrm/contact/search';
+ $context = $this->get('context');
+ $urlString = 'civicrm/contact/search';
$this->_action = CRM_Core_Action::BASIC;
switch ($context) {
case 'advanced':
list($defaults[$this->_id]['register_date'],
$defaults[$this->_id]['register_date_time']
- ) = CRM_Utils_Date::setDateDefaults(
+ ) = CRM_Utils_Date::setDateDefaults(
CRM_Utils_Array::value('register_date', $defaults[$this->_id]), 'activityDateTime'
);
)) - 1;
if ($additionalParticipant) {
$deleteParticipants = array(
- 1 => ts('Delete this participant record along with associated participant record(s).'),
+ 1 => ts('Delete this participant record along with associated participant record(s).'),
2 => ts('Delete only this participant record.'),
);
$this->addRadio('delete_participant', NULL, $deleteParticipants, NULL, '<br />');
}
if ($this->_single && $this->_context == 'standalone') {
- $this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE, 'api' => array('extra' => array('email'))), TRUE);
+ $this->addEntityRef('contact_id', ts('Contact'), array(
+ 'create' => TRUE,
+ 'api' => array('extra' => array('email'))
+ ), TRUE);
}
$eventFieldParams = array(
//frozen the field fix for CRM-4171
if ($this->_action & CRM_Core_Action::UPDATE && $this->_id) {
if (CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment',
- $this->_id, 'contribution_id', 'participant_id'
- )) {
+ $this->_id, 'contribution_id', 'participant_id'
+ )
+ ) {
$element->freeze();
}
}
);
$checkCancelledJs = array(
'onchange' =>
- "checkCancelled( this.value, {$cancelledparticipantStatusId},{$cancelledContributionStatusId});",
+ "checkCancelled( this.value, {$cancelledparticipantStatusId},{$cancelledContributionStatusId});",
);
$participantStatusId = array_search('Pending from pay later',
}
}
- $this->addSelect('status_id', $checkCancelledJs + array('options' => $statusOptions, 'option_url' => 'civicrm/admin/participant_status'), TRUE);
+ $this->addSelect('status_id', $checkCancelledJs + array(
+ 'options' => $statusOptions,
+ 'option_url' => 'civicrm/admin/participant_status'
+ ), TRUE);
$this->addElement('checkbox', 'is_notify', ts('Send Notification'), NULL);
$params['fee_level'] = $params['amount_level'];
$contributionParams['total_amount'] = $params['amount'];
if ($this->_quickConfig && !empty($params['total_amount']) &&
- $params['status_id'] != array_search('Partially paid', $participantStatus)) {
+ $params['status_id'] != array_search('Partially paid', $participantStatus)
+ ) {
$params['fee_amount'] = $params['total_amount'];
}
else {
if (!empty($lineItem[0])) {
$this->set('lineItem', $lineItem);
- $this->_lineItem = $lineItem;
- $lineItem = array_merge($lineItem, $additionalParticipantDetails);
+ $this->_lineItem = $lineItem;
+ $lineItem = array_merge($lineItem, $additionalParticipantDetails);
$participantCount = array();
foreach ($lineItem as $k) {
$userID = $session->get('userID');
list($userName,
$userEmail
- ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($userID);
+ ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($userID);
if ($this->_contactId) {
list($this->_contributorDisplayName, $this->_contributorEmail, $this->_toDoNotEmail) = CRM_Contact_BAO_Contact::getContactDetails($this->_contactId);
// set source if not set
if (empty($params['source'])) {
- $this->_params['participant_source'] = ts('Offline Registration for Event: %2 by: %1', array(1 => $userName, 2 => $eventTitle));
+ $this->_params['participant_source'] = ts('Offline Registration for Event: %2 by: %1', array(
+ 1 => $userName,
+ 2 => $eventTitle
+ ));
}
else {
$this->_params['participant_source'] = $params['source'];
if (is_a($result, 'CRM_Core_Error')) {
CRM_Core_Error::displaySessionError($result);
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view/participant',
- "reset=1&action=add&cid={$this->_contactId}&context=participant&mode={$this->_mode}"
- ));
+ "reset=1&action=add&cid={$this->_contactId}&context=participant&mode={$this->_mode}"
+ ));
}
if ($result) {
//build contribution params
if (!$this->_onlinePendingContributionId) {
if (empty($params['source'])) {
- $contributionParams['source'] = ts('%1 : Offline registration (by %2)', array(1 => $eventTitle, 2 => $userName));
+ $contributionParams['source'] = ts('%1 : Offline registration (by %2)', array(
+ 1 => $eventTitle,
+ 2 => $userName
+ ));
}
else {
$contributionParams['source'] = $params['source'];
$contributionParams['non_deductible_amount'] = 'null';
$contributionParams['receipt_date'] = !empty($params['send_receipt']) ? CRM_Utils_Array::value('receive_date', $params) : 'null';
- $recordContribution = array('contact_id', 'financial_type_id',
- 'payment_instrument_id', 'trxn_id',
- 'contribution_status_id', 'receive_date',
- 'check_number', 'campaign_id',
+ $recordContribution = array(
+ 'contact_id',
+ 'financial_type_id',
+ 'payment_instrument_id',
+ 'trxn_id',
+ 'contribution_status_id',
+ 'receive_date',
+ 'check_number',
+ 'campaign_id',
);
foreach ($recordContribution as $f) {
$updateStatusMsg = NULL;
//send mail when participant status changed, CRM-4326
if ($this->_id && $this->_statusId &&
- $this->_statusId != CRM_Utils_Array::value('status_id', $params) && !empty($params['is_notify'])) {
+ $this->_statusId != CRM_Utils_Array::value('status_id', $params) && !empty($params['is_notify'])
+ ) {
$updateStatusMsg = CRM_Event_BAO_Participant::updateStatusMessage($this->_id,
$params['status_id'],
$template = CRM_Core_Smarty::singleton();
$taxAmt = $template->get_template_vars('dataArray');
$contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment',
- $this->_id, 'contribution_id', 'participant_id'
- );
+ $this->_id, 'contribution_id', 'participant_id'
+ );
$prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $prefixValue);
if (count($taxAmt) > 0 && (isset($invoicing) && isset($prefixValue['is_email_pdf']))) {
}
else {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view',
- "reset=1&cid={$this->_contactId}&selectedChild=participant"
- ));
+ "reset=1&cid={$this->_contactId}&selectedChild=participant"
+ ));
}
}
elseif ($buttonName == $this->getButtonName('upload', 'new')) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view/participant',
- "reset=1&action=add&context={$this->_context}&cid={$this->_contactId}"
- ));
+ "reset=1&action=add&context={$this->_context}&cid={$this->_contactId}"
+ ));
}
}
}
$statusOptions = CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label');
$this->add('select', 'status_id', ts('Participant Status'),
array(
- '' => ts('- select -')) + $statusOptions,
+ '' => ts('- select -')
+ ) + $statusOptions,
TRUE
);
if ($buttonName == $this->getButtonName('upload', 'new')) {
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/payment/add',
- "reset=1&action=add&component=event&id={$this->_participantId}&cid={$this->_contactId}"
- ));
+ "reset=1&action=add&component=event&id={$this->_participantId}&cid={$this->_contactId}"
+ ));
}
}
* @return void
*/
public function preProcess() {
- $values = $ids = array();
+ $values = $ids = array();
$participantID = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
- $contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
- $params = array('id' => $participantID);
+ $contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
+ $params = array('id' => $participantID);
CRM_Event_BAO_Participant::getValues($params,
$values,
$this->assign('hasPayment', $paymentId);
if ($parentParticipantId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant',
- $participantID, 'registered_by_id'
- )) {
+ $participantID, 'registered_by_id'
+ )
+ ) {
$parentHasPayment = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment',
$parentParticipantId, 'id', 'participant_id'
);
$eventGroupTree = &CRM_Core_BAO_CustomGroup::getTree('Participant', $this, $participantID, NULL,
$values[$participantID]['event_id'], $eventNameCustomDataTypeID
);
- $eventTypeID = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Event", $values[$participantID]['event_id'], 'event_type_id', 'id');
+ $eventTypeID = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Event", $values[$participantID]['event_id'], 'event_type_id', 'id');
$eventTypeGroupTree = CRM_Core_BAO_CustomGroup::getTree('Participant', $this, $participantID, NULL, $eventTypeID, $eventTypeCustomDataTypeID);
- $groupTree = CRM_Utils_Array::crmArrayMerge($roleGroupTree, $eventGroupTree);
- $groupTree = CRM_Utils_Array::crmArrayMerge($groupTree, $eventTypeGroupTree);
- $groupTree = CRM_Utils_Array::crmArrayMerge($groupTree, CRM_Core_BAO_CustomGroup::getTree('Participant', $this, $participantID));
+ $groupTree = CRM_Utils_Array::crmArrayMerge($roleGroupTree, $eventGroupTree);
+ $groupTree = CRM_Utils_Array::crmArrayMerge($groupTree, $eventTypeGroupTree);
+ $groupTree = CRM_Utils_Array::crmArrayMerge($groupTree, CRM_Core_BAO_CustomGroup::getTree('Participant', $this, $participantID));
foreach ($groupTree as $treeId => $trees) {
$finalTree[$treeId] = $trees;
}
);
list($this->_values['custom_pre_id'],
$this->_values['custom_post_id']
- ) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
+ ) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
// set profiles for additional participants
if ($this->_values['event']['is_multiple_registrations']) {
list($this->_values['additional_custom_pre_id'],
$this->_values['additional_custom_post_id'], $preActive, $postActive
- ) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
+ ) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
// CRM-4377:Â we need to maintain backward compatibility, hence if there is profile for main contact
// set same profile for additional contacts.
// Handle PCP
$pcpId = CRM_Utils_Request::retrieve('pcpId', 'Positive', $this);
if ($pcpId) {
- $pcp = CRM_PCP_BAO_PCP::handlePcp($pcpId, 'event', $this->_values['event']);
- $this->_pcpId = $pcp['pcpId'];
+ $pcp = CRM_PCP_BAO_PCP::handlePcp($pcpId, 'event', $this->_values['event']);
+ $this->_pcpId = $pcp['pcpId'];
$this->_values['event']['intro_text'] = CRM_Utils_Array::value('intro_text', $pcp['pcpInfo']);
}
$this->set('name', $name);
$vars = array(
- 'amount', 'currencyID', 'credit_card_type',
- 'trxn_id', 'amount_level', 'receive_date',
+ 'amount',
+ 'currencyID',
+ 'credit_card_type',
+ 'trxn_id',
+ 'amount_level',
+ 'receive_date',
);
foreach ($vars as $v) {
*/
public function buildCustom($id, $name, $viewOnly = FALSE) {
if ($id) {
- $button = substr($this->controller->getButtonName(), -4);
- $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
- $session = CRM_Core_Session::singleton();
+ $button = substr($this->controller->getButtonName(), -4);
+ $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
+ $session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
// we don't allow conflicting fields to be
$field['is_required'] = FALSE;
}
// CRM-11316 Is ReCAPTCHA enabled for this profile AND is this an anonymous visitor
- elseif ($field['add_captcha'] && !$contactID) {
+ elseif ($field['add_captcha'] && !$contactID) {
// only add captcha for first page
$addCaptcha = TRUE;
}
}
if (property_exists($form, '_context') && ($form->_context == 'standalone'
- || $form->_context == 'participant')) {
+ || $form->_context == 'participant')
+ ) {
$discountedEvent = CRM_Core_BAO_Discount::getOptionGroup($eventID, 'civicrm_event');
if (is_array($discountedEvent)) {
foreach ($discountedEvent as $key => $priceSetId) {
$this->_params['contactID'] = $contactID;
if (array_key_exists('email-5', $this->_params)) {
- $mail = 'email-5';
+ $mail = 'email-5';
}
else {
foreach ($this->_params as $name => $dontCare) {
// 3. waiting list participant.
// 4. require approval participant.
if (!empty($this->_params['is_pay_later']) ||
- $this->_allowWaitlist || $this->_requireApproval || empty($this->_values['event']['is_monetary'])) {
+ $this->_allowWaitlist || $this->_requireApproval || empty($this->_values['event']['is_monetary'])
+ ) {
$mail = 'email-Primary';
}
return $totalCount;
}
- $priceSetId = $form->get('priceSetId');
- $addParticipantNum = substr($form->_name, 12);
- $priceSetFields = $priceSetDetails = array();
+ $priceSetId = $form->get('priceSetId');
+ $addParticipantNum = substr($form->_name, 12);
+ $priceSetFields = $priceSetDetails = array();
$hasPriceFieldsCount = FALSE;
if ($priceSetId) {
$priceSetDetails = $form->get('priceSet');
* @return array
*/
public static function getPriceSetOptionCount(&$form) {
- $params = $form->get('params');
- $priceSet = $form->get('priceSet');
+ $params = $form->get('params');
+ $priceSet = $form->get('priceSet');
$priceSetId = $form->get('priceSetId');
$optionsCount = array();
// also set the allow confirmation stuff
if (array_key_exists(
- $this->_values['participant']['status_id'],
- CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Pending'")
- )) {
+ $this->_values['participant']['status_id'],
+ CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Pending'")
+ )) {
$this->_allowConfirmation = TRUE;
$this->set('allowConfirmation', TRUE);
}
$now = date('YmdHis');
$startDate = CRM_Utils_Date::processDate(CRM_Utils_Array::value('registration_start_date',
- $this->_values['event']
- ));
+ $this->_values['event']
+ ));
if (
$startDate &&
}
$endDate = CRM_Utils_Date::processDate(CRM_Utils_Array::value('registration_end_date',
- $this->_values['event']
- ));
+ $this->_values['event']
+ ));
$eventEndDate = CRM_Utils_Date::processDate(CRM_Utils_Array::value('event_end_date', $this->_values['event']));
if (
$endDate &&
//CRM-4320, setdefault additional participant values.
if ($this->_allowConfirmation && $this->_additionalParticipantId) {
//hack to get set default from eventFees.php
- $this->_discountId = $discountId;
- $this->_pId = $this->_additionalParticipantId;
- $this->_contactId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_additionalParticipantId, 'contact_id');
+ $this->_discountId = $discountId;
+ $this->_pId = $this->_additionalParticipantId;
+ $this->_contactId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_additionalParticipantId, 'contact_id');
$participantDefaults = CRM_Event_Form_EventFees::setDefaultValues($this);
$participantDefaults = array_merge($this->_defaults, $participantDefaults);
// use primary email address if billing email address is empty
$first_name = $last_name = NULL;
$pre = $post = array();
foreach (array(
- 'pre', 'post') as $keys) {
+ 'pre',
+ 'post'
+ ) as $keys) {
if (isset($this->_values['additional_custom_' . $keys . '_id'])) {
$this->buildCustom($this->_values['additional_custom_' . $keys . '_id'], 'additionalCustom' . ucfirst($keys), TRUE);
$$keys = CRM_Core_BAO_UFGroup::getFields($this->_values['additional_custom_' . $keys . '_id']);
}
foreach (array(
- 'first_name', 'last_name') as $name) {
+ 'first_name',
+ 'last_name'
+ ) as $name) {
if (array_key_exists($name, $$keys) &&
CRM_Utils_Array::value('is_required', CRM_Utils_Array::value($name, $$keys))
) {
$this->_allowWaitlist = FALSE;
$this->set('allowWaitlist', $this->_allowWaitlist);
if ($this->_requireApproval) {
- $statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed). Registration for this event requires approval. You will receive an email once your registration has been reviewed.", array(1 => ++$processedCnt, 2 => $spaces));
+ $statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed). Registration for this event requires approval. You will receive an email once your registration has been reviewed.", array(
+ 1 => ++$processedCnt,
+ 2 => $spaces
+ ));
}
else {
- $statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed).", array(1 => ++$processedCnt, 2 => $spaces));
+ $statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed).", array(
+ 1 => ++$processedCnt,
+ 2 => $spaces
+ ));
}
}
else {
- $statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed). Please go back to the main registration page and reduce the number of additional people. You will also need to complete payment information.", array(1 => ++$processedCnt, 2 => $spaces));
+ $statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed). Please go back to the main registration page and reduce the number of additional people. You will also need to complete payment information.", array(
+ 1 => ++$processedCnt,
+ 2 => $spaces
+ ));
$allowToProceed = FALSE;
}
CRM_Core_Session::setStatus($statusMessage, ts('Registration Error'), 'error');
//CRM-4320
if ($allowToProceed) {
$buttons = array_merge($buttons, array(
- array(
+ array(
'type' => 'next',
'name' => ts('Continue'),
'spacing' => ' ',
);
if ($includeSkipButton) {
$buttons = array_merge($buttons, array(
- array(
- 'type' => 'next',
- 'name' => ts('Skip Participant'),
- 'subName' => 'skip',
- 'icon' => 'seek-next',
- ))
+ array(
+ 'type' => 'next',
+ 'name' => ts('Skip Participant'),
+ 'subName' => 'skip',
+ 'icon' => 'seek-next',
+ )
+ )
);
}
}
if (!$self->_allowConfirmation && empty($self->_values['event']['has_waitlist']) &&
$totalParticipants > $self->_availableRegistrations
) {
- $errors['_qf_default'] = ts('It looks like event has only %2 seats available and you are trying to register %1 participants, so could you please select price options accordingly.', array(1 => $totalParticipants, 2 => $self->_availableRegistrations));
+ $errors['_qf_default'] = ts('It looks like event has only %2 seats available and you are trying to register %1 participants, so could you please select price options accordingly.', array(
+ 1 => $totalParticipants,
+ 2 => $self->_availableRegistrations
+ ));
}
}
}
return;
}
foreach (array(
- 'constantValues', 'submitValues', 'defaultValues') as $val) {
+ 'constantValues',
+ 'submitValues',
+ 'defaultValues'
+ ) as $val) {
$values = &$this->{"_$val"};
if (!is_array($values) || empty($values)) {
continue;
$registerParams["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($registerParams["billing_country_id-{$this->_bltID}"]);
}
if (isset($registerParams['credit_card_exp_date'])) {
- $registerParams['year'] = CRM_Core_Payment_Form::getCreditCardExpirationYear($registerParams);
+ $registerParams['year'] = CRM_Core_Payment_Form::getCreditCardExpirationYear($registerParams);
$registerParams['month'] = CRM_Core_Payment_Form::getCreditCardExpirationMonth($registerParams);
}
if ($this->_values['event']['is_monetary']) {
$taxAmount += $v['tax_amount'];
if (is_array($v)) {
foreach (array(
- 'first_name', 'last_name') as $name) {
+ 'first_name',
+ 'last_name'
+ ) as $name) {
if (isset($v['billing_' . $name]) &&
!isset($v[$name])
) {
}
return empty($errors) ? TRUE : $errors;
}
+
/**
* Process the form submission
*
* @return void
*/
public function postProcess() {
- $now = date('YmdHis');
+ $now = date('YmdHis');
$this->_params = $this->get('params');
if (!empty($this->_params[0]['contact_id'])) {
$value['contributionTypeID'] = $contribution->financial_type_id;
}
$value['contactID'] = $contactID;
- $value['eventID'] = $this->_eventId;
+ $value['eventID'] = $this->_eventId;
$value['item_name'] = $value['description'];
}
}
if (!empty($this->_lineItem)) {
- $lineItems = $this->_lineItem;
- $lineItem = array();
+ $lineItems = $this->_lineItem;
+ $lineItem = array();
if ($lineItemValue = CRM_Utils_Array::value($participantNum, $lineItems)) {
$lineItem[] = $lineItemValue;
}
$this->assign('amounts', $amount);
}
if ($this->_lineItem) {
- $lineItems = $this->_lineItem;
- $lineItem = array();
+ $lineItems = $this->_lineItem;
+ $lineItem = array();
if ($lineItemValue = CRM_Utils_Array::value($participantNum, $lineItems)) {
$lineItem[] = $lineItemValue;
}
) {
$transaction = new CRM_Core_Transaction();
- $now = date('YmdHis');
+ $now = date('YmdHis');
$receiptDate = NULL;
if (!empty($form->_values['event']['is_email_confirm'])) {
$contribParams = array(
'contact_id' => $contactID,
- 'financial_type_id' => !empty($form->_values['event']['financial_type_id']) ? $form->_values['event']['financial_type_id'] : $params['financial_type_id'],
+ 'financial_type_id' => !empty($form->_values['event']['financial_type_id']) ? $form->_values['event']['financial_type_id'] : $params['financial_type_id'],
'receive_date' => $now,
'total_amount' => $params['amount'],
'tax_amount' => $params['tax_amount'],
!$form->_values['event']['is_monetary'] ||
$form->_allowWaitlist ||
$form->_requireApproval
- ) && !empty($params["email-{$form->_bltID}"])) {
+ ) && !empty($params["email-{$form->_bltID}"])
+ ) {
$params['email-Primary'] = $params["email-{$form->_bltID}"];
}
}
public static function assignProfiles(&$form) {
$participantParams = $form->_params;
$formattedValues = $profileFields = array();
- $count = 1;
+ $count = 1;
foreach ($participantParams as $participantNum => $participantValue) {
if ($participantNum) {
$prefix1 = 'additional';
$statusMsg = NULL;
if (array_key_exists($this->_participantStatusId,
- CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Pending'")
- )) {
+ CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Pending'")
+ )) {
//need to confirm that though participant confirming
//registration - but is there enough space to confirm.
- $emptySeats = CRM_Event_BAO_Participant::pendingToConfirmSpaces($this->_eventId);
+ $emptySeats = CRM_Event_BAO_Participant::pendingToConfirmSpaces($this->_eventId);
$additonalIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_participantId);
$requireSpace = 1 + count($additonalIds);
if ($emptySeats !== NULL && ($requireSpace > $emptySeats)) {
else {
if ($this->_cc == 'fail') {
$statusMsg = '<div class="bold">' . ts('Your Credit Card transaction was not successful. No money has yet been charged to your card.') . '</div><div><br />' . ts('Click the "Confirm Registration" button to complete your registration in %1, or click "Cancel Registration" if you are no longer interested in attending this event.', array(
- 1 => $values['title'])) . '</div>';
+ 1 => $values['title']
+ )) . '</div>';
}
else {
$statusMsg = '<div class="bold">' . ts('Confirm your registration for %1.', array(
- 1 => $values['title'])) . '</div><div><br />' . ts('Click the "Confirm Registration" button to begin, or click "Cancel Registration" if you are no longer interested in attending this event.') . '</div>';
+ 1 => $values['title']
+ )) . '</div><div><br />' . ts('Click the "Confirm Registration" button to begin, or click "Cancel Registration" if you are no longer interested in attending this event.') . '</div>';
}
$buttons = array_merge($buttons, array(
array(
- 'type' => 'next',
- 'name' => ts('Confirm Registration'),
- 'spacing' => ' ',
- 'isDefault' => TRUE,
- )));
+ 'type' => 'next',
+ 'name' => ts('Confirm Registration'),
+ 'spacing' => ' ',
+ 'isDefault' => TRUE,
+ )
+ ));
}
}
// status class other than Negative should be able to cancel registration.
if (array_key_exists($this->_participantStatusId,
- CRM_Event_PseudoConstant::participantStatus(NULL, "class != 'Negative'")
- )) {
+ CRM_Event_PseudoConstant::participantStatus(NULL, "class != 'Negative'")
+ )) {
$cancelConfirm = ts('Are you sure you want to cancel your registration for this event?');
$buttons = array_merge($buttons, array(
array(
- 'type' => 'submit',
- 'name' => ts('Cancel Registration'),
- 'spacing' => ' ',
- 'js' => array('onclick' => 'return confirm(\'' . $cancelConfirm . '\');'),
- )));
+ 'type' => 'submit',
+ 'name' => ts('Cancel Registration'),
+ 'spacing' => ' ',
+ 'js' => array('onclick' => 'return confirm(\'' . $cancelConfirm . '\');'),
+ )
+ ));
if (!$statusMsg) {
$statusMsg = ts('You can cancel your registration for %1 by clicking "Cancel Registration".', array(1 => $values['title']));
}
*/
public function postProcess() {
//get the button.
- $buttonName = $this->controller->getButtonName();
+ $buttonName = $this->controller->getButtonName();
$participantId = $this->_participantId;
if ($buttonName == '_qf_ParticipantConfirm_next') {
);
$this->_defaults['amount'] = key(array_slice($this->_values['discount'][$discountId],
- $discountKey - 1, $discountKey, TRUE
- ));
+ $discountKey - 1, $discountKey, TRUE
+ ));
}
}
}
$this->_priceSetId
) &&
!$this->_allowConfirmation &&
- is_numeric($this->_availableRegistrations) && !empty($this->_values['event']['has_waitlist'])) {
+ is_numeric($this->_availableRegistrations) && !empty($this->_values['event']['has_waitlist'])
+ ) {
$bypassPayment = TRUE;
//case might be group become as a part of waitlist.
//If not waitlist then they require admin approve.
}
if (!$priceSetId ||
!is_array($priceSet) ||
- empty($priceSet) || empty($priceSet['optionsMaxValueTotal'])) {
+ empty($priceSet) || empty($priceSet['optionsMaxValueTotal'])
+ ) {
return;
}
continue;
}
foreach ($field['options'] as & $option) {
- $optId = $option['id'];
- $count = CRM_Utils_Array::value('count', $option, 0);
- $maxValue = CRM_Utils_Array::value('max_value', $option, 0);
- $dbTotalCount = CRM_Utils_Array::value($optId, $recordedOptionsCount, 0);
+ $optId = $option['id'];
+ $count = CRM_Utils_Array::value('count', $option, 0);
+ $maxValue = CRM_Utils_Array::value('max_value', $option, 0);
+ $dbTotalCount = CRM_Utils_Array::value($optId, $recordedOptionsCount, 0);
$currentTotalCount = CRM_Utils_Array::value($optId, $currentOptionsCount, 0);
$params['is_primary'] = 1;
if ($this->_values['event']['is_pay_later']
- && (!array_key_exists('hidden_processor', $params) || $params['payment_processor'] == 0)) {
+ && (!array_key_exists('hidden_processor', $params) || $params['payment_processor'] == 0)
+ ) {
$params['is_pay_later'] = 1;
}
else {
*/
public function preProcess() {
parent::preProcess();
- $this->_params = $this->get('params');
- $this->_lineItem = $this->get('lineItem');
- $this->_part = $this->get('part');
+ $this->_params = $this->get('params');
+ $this->_lineItem = $this->get('lineItem');
+ $this->_part = $this->get('part');
$this->_totalAmount = $this->get('totalAmount');
$this->_receiveDate = $this->get('receiveDate');
- $this->_trxnId = $this->get('trxnId');
- $finalAmount = $this->get('finalAmount');
+ $this->_trxnId = $this->get('trxnId');
+ $finalAmount = $this->get('finalAmount');
$this->assign('finalAmount', $finalAmount);
$participantInfo = $this->get('participantInfo');
$this->assign('part', $this->_part);
}
$this->assignToTemplate();
- $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings');
+ $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings);
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$getTaxDetails = FALSE;
$this->assign('isRequireApproval', $isRequireApproval);
// find pcp info
- $dao = new CRM_PCP_DAO_PCPBlock();
+ $dao = new CRM_PCP_DAO_PCPBlock();
$dao->entity_table = 'civicrm_event';
- $dao->entity_id = $this->_eventId;
- $dao->is_active = 1;
+ $dao->entity_id = $this->_eventId;
+ $dao->is_active = 1;
$dao->find(TRUE);
if ($dao->id) {
* we allow the controller to set force/reset externally, useful when we are being
* driven by the wizard framework
*/
- $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
- $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
+ $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
+ $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
+ $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'search');
- $this->_ssID = CRM_Utils_Request::retrieve('ssID', 'Positive', $this);
+ $this->_ssID = CRM_Utils_Request::retrieve('ssID', 'Positive', $this);
$this->assign("context", $this->_context);
// get user submitted values
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($this);
$this->addButtons(array(
- array(
- 'type' => 'refresh',
- 'name' => ts('Search'),
- 'isDefault' => TRUE,
- ),
- ));
+ array(
+ 'type' => 'refresh',
+ 'name' => ts('Search'),
+ 'isDefault' => TRUE,
+ ),
+ ));
}
public function postProcess() {
}
else {
$session->replaceUserContext(CRM_Utils_System::url("civicrm/contact/search/$searchFormName",
- $urlParams
- ));
+ $urlParams
+ ));
}
}
$groupParams['visibility'] = "User and User Admin Only";
if (array_key_exists('group_type', $params) && is_array($params['group_type'])) {
$groupParams['group_type'] = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
- array_keys($params['group_type'])
- ) . CRM_Core_DAO::VALUE_SEPARATOR;
+ array_keys($params['group_type'])
+ ) . CRM_Core_DAO::VALUE_SEPARATOR;
}
else {
$groupParams['group_type'] = '';
$groupParams['is_active'] = 1;
$createdGroup = CRM_Contact_BAO_Group::create($groupParams);
- $groupID = $createdGroup->id;
- $groupName = $groupParams['title'];
+ $groupID = $createdGroup->id;
+ $groupName = $groupParams['title'];
}
else {
- $groupID = $params['group_id'];
- $group = CRM_Core_PseudoConstant::group();
+ $groupID = $params['group_id'];
+ $group = CRM_Core_PseudoConstant::group();
$groupName = $group[$groupID];
}
list($total, $added, $notAdded) = CRM_Contact_BAO_GroupContact::addContactsToGroup($this->_contactIds, $groupID);
- $status = array(ts('%count contact added to group', array('count' => $added, 'plural' => '%count contacts added to group')));
+ $status = array(
+ ts('%count contact added to group', array(
+ 'count' => $added,
+ 'plural' => '%count contacts added to group'
+ ))
+ );
if ($notAdded) {
- $status[] = ts('%count contact was already in group', array('count' => $notAdded, 'plural' => '%count contacts were already in group'));
+ $status[] = ts('%count contact was already in group', array(
+ 'count' => $notAdded,
+ 'plural' => '%count contacts were already in group'
+ ));
}
$status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
- CRM_Core_Session::setStatus($status, ts('Added Contact to %1', array(1 => $groupName, 'count' => $added, 'plural' => 'Added Contacts to %1')), 'success', array('expires' => 0));
+ CRM_Core_Session::setStatus($status, ts('Added Contact to %1', array(
+ 1 => $groupName,
+ 'count' => $added,
+ 'plural' => 'Added Contacts to %1'
+ )), 'success', array('expires' => 0));
}
}
// also set the user context to send back to view page
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/contact/view/participant',
- "reset=1&action=view&id={$participantID}&cid={$contactID}"
- ));
+ "reset=1&action=view&id={$participantID}&cid={$contactID}"
+ ));
}
else {
parent::preProcess();
'badge_id',
ts('Name Badge Format'),
array(
- '' => ts('- select -')) + $label, TRUE
+ '' => ts('- select -')
+ ) + $label, TRUE
);
$next = 'next';
* @return void
*/
public function preProcess() {
- /*
- * initialize the task and row fields
- */
+ /*
+ * initialize the task and row fields
+ */
parent::preProcess();
//get the contact read only fields to display.
$deletedParticipants += $additionalCount;
}
- $status = array(ts('Participant(s) Deleted: %1 (Total Selected: %2)', array(1 => $deletedParticipants, 2 => count($this->_participantIds))));
+ $status = array(
+ ts('Participant(s) Deleted: %1 (Total Selected: %2)', array(
+ 1 => $deletedParticipants,
+ 2 => count($this->_participantIds)
+ ))
+ );
if (!empty($participantLinks)) {
$status[] = ts('The following participants no longer have an event fee recorded. You can edit their registration and record a replacement contribution by clicking the links below:') . '<br/>' . $participantLinks;
}
asort($statuses, SORT_STRING);
$this->add('select', 'status_change', ts('Change All Statuses'),
array(
- '' => ts('- select status -')) + $statuses
+ '' => ts('- select status -')
+ ) + $statuses
);
$this->assign('context', 'statusChange');
$ufGroupElement = $this->add('select', 'uf_group_id', ts('Select Profile'),
array(
- '' => ts('- select profile -')) + $profiles, TRUE
+ '' => ts('- select profile -')
+ ) + $profiles, TRUE
);
$this->addDefaultButtons(ts('Continue'));
}
$this->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
$this->setMaxFileSize($uploadFileSize);
- $this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize);
+ $this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(
+ 1 => $uploadSize,
+ 2 => $uploadFileSize
+ )), 'maxfilesize', $uploadFileSize);
$this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
$this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
//get the saved mapping details
$mappingArray = CRM_Core_BAO_Mapping::getMappings(CRM_Core_OptionGroup::getValue('mapping_type',
- 'Import Participant',
- 'name'
- ));
+ 'Import Participant',
+ 'name'
+ ));
$this->assign('savedMapping', $mappingArray);
$this->add('select', 'savedMapping', ts('Mapping Option'), array('' => ts('- select -')) + $mappingArray);
$this->setDefaults(array(
'onDuplicate' =>
CRM_Import_Parser::DUPLICATE_SKIP,
- ));
+ ));
//contact types option
$contactOptions = array();
$this->addGroup($contactOptions, 'contactType', ts('Contact Type'));
$this->setDefaults(array(
- 'contactType' => CRM_Import_Parser::CONTACT_INDIVIDUAL,
+ 'contactType' => CRM_Import_Parser::CONTACT_INDIVIDUAL,
)
);
public function postProcess() {
$this->controller->resetPage('MapField');
- $fileName = $this->controller->exportValue($this->_name, 'uploadFile');
+ $fileName = $this->controller->exportValue($this->_name, 'uploadFile');
$skipColumnHeader = $this->controller->exportValue($this->_name, 'skipColumnHeader');
- $onDuplicate = $this->controller->exportValue($this->_name, 'onDuplicate');
- $contactType = $this->controller->exportValue($this->_name, 'contactType');
- $dateFormats = $this->controller->exportValue($this->_name, 'dateFormats');
- $savedMapping = $this->controller->exportValue($this->_name, 'savedMapping');
+ $onDuplicate = $this->controller->exportValue($this->_name, 'onDuplicate');
+ $contactType = $this->controller->exportValue($this->_name, 'contactType');
+ $dateFormats = $this->controller->exportValue($this->_name, 'dateFormats');
+ $savedMapping = $this->controller->exportValue($this->_name, 'savedMapping');
$this->set('onDuplicate', $onDuplicate);
$this->set('contactType', $contactType);
class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField {
-
-
/**
* Set variables up before form is built
*
$this->_dataValues = $this->get('dataValues');
$this->assign('dataValues', $this->_dataValues);
- $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
+ $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
$this->_onDuplicate = $this->get('onDuplicate');
- $highlightedFields = array();
+ $highlightedFields = array();
if ($skipColumnHeader) {
$this->assign('skipColumnHeader', $skipColumnHeader);
$this->assign('rowDisplayCount', 3);
$this->_onDuplicate == CRM_Import_Parser::DUPLICATE_NOCHECK
) {
unset($this->_mapperFields['participant_id']);
- $highlightedFieldsArray = array('participant_contact_id', 'event_id', 'email', 'first_name', 'last_name', 'external_identifier', 'participant_status_id');
+ $highlightedFieldsArray = array(
+ 'participant_contact_id',
+ 'event_id',
+ 'email',
+ 'first_name',
+ 'last_name',
+ 'external_identifier',
+ 'participant_status_id'
+ );
foreach ($highlightedFieldsArray as $name) {
$highlightedFields[] = $name;
}
list($mappingName, $mappingContactType, $mappingLocation, $mappingPhoneType, $mappingRelation) = CRM_Core_BAO_Mapping::getMappingFields($savedMapping);
- $mappingName = $mappingName[1];
+ $mappingName = $mappingName[1];
$mappingContactType = $mappingContactType[1];
- $mappingLocation = CRM_Utils_Array::value('1', $mappingLocation);
- $mappingPhoneType = CRM_Utils_Array::value('1', $mappingPhoneType);
- $mappingRelation = CRM_Utils_Array::value('1', $mappingRelation);
+ $mappingLocation = CRM_Utils_Array::value('1', $mappingLocation);
+ $mappingPhoneType = CRM_Utils_Array::value('1', $mappingPhoneType);
+ $mappingRelation = CRM_Utils_Array::value('1', $mappingRelation);
//mapping is to be loaded from database
- $params = array('id' => $savedMapping);
- $temp = array();
+ $params = array('id' => $savedMapping);
+ $temp = array();
$mappingDetails = CRM_Core_BAO_Mapping::retrieve($params, $temp);
$this->assign('loadedMapping', $mappingDetails->name);
$this->addFormRule(array('CRM_Event_Import_Form_MapField', 'formRule'), $this);
- $defaults = array();
- $mapperKeys = array_keys($this->_mapperFields);
- $hasHeaders = !empty($this->_columnHeaders);
- $headerPatterns = $this->get('headerPatterns');
- $dataPatterns = $this->get('dataPatterns');
+ $defaults = array();
+ $mapperKeys = array_keys($this->_mapperFields);
+ $hasHeaders = !empty($this->_columnHeaders);
+ $headerPatterns = $this->get('headerPatterns');
+ $dataPatterns = $this->get('dataPatterns');
$hasLocationTypes = $this->get('fieldTypes');
$sel1 = $this->_mapperFields;
$sel2[''] = NULL;
- $js = "<script type='text/javascript'>\n";
+ $js = "<script type='text/javascript'>\n";
$formName = 'document.forms.' . $this->_name;
//used to warn for mismatch column count or mismatch mapping
CRM_Import_Parser::CONTACT_ORGANIZATION => 'Organization',
);
$params = array(
- 'used' => 'Unsupervised',
+ 'used' => 'Unsupervised',
'contact_type' => $contactTypes[$contactTypeId],
);
list($ruleFields, $threshold) = CRM_Dedupe_BAO_RuleGroup::dedupeRuleFieldsWeight($params);
}
else {
$errors['_qf_default'] .= ts('Missing required contact matching fields.') . " $fieldMessage " . ts('(Sum of all weights should be greater than or equal to threshold: %1).', array(
- 1 => $threshold)) . ' ' . ts('Or Provide Contact ID or External ID.') . '<br />';
+ 1 => $threshold
+ )) . ' ' . ts('Or Provide Contact ID or External ID.') . '<br />';
}
}
elseif (!in_array('event_title', $importKeys)) {
$errors['_qf_default'] .= ts('Missing required field: Provide %1 or %2',
- array(1 => $title, 2 => 'Event Title')
- ) . '<br />';
+ array(1 => $title, 2 => 'Event Title')
+ ) . '<br />';
}
}
}
$config = CRM_Core_Config::singleton();
$seperator = $config->fieldSeparator;
- $mapperKeys = array();
- $mapper = array();
- $mapperKeys = $this->controller->exportValue($this->_name, 'mapper');
+ $mapperKeys = array();
+ $mapper = array();
+ $mapperKeys = $this->controller->exportValue($this->_name, 'mapper');
$mapperKeysMain = array();
for ($i = 0; $i < $this->_columnCount; $i++) {
$updateMappingFields->column_number = $i;
$explodedValues = explode('_', $mapperKeys[$i][0]);
- $id = CRM_Utils_Array::value(0, $explodedValues);
- $first = CRM_Utils_Array::value(1, $explodedValues);
- $second = CRM_Utils_Array::value(2, $explodedValues);
+ $id = CRM_Utils_Array::value(0, $explodedValues);
+ $first = CRM_Utils_Array::value(1, $explodedValues);
+ $second = CRM_Utils_Array::value(2, $explodedValues);
$updateMappingFields->name = $mapper[$i];
$updateMappingFields->save();
$saveMappingFields->column_number = $i;
$explodedValues = explode('_', $mapperKeys[$i][0]);
- $id = CRM_Utils_Array::value(0, $explodedValues);
- $first = CRM_Utils_Array::value(1, $explodedValues);
- $second = CRM_Utils_Array::value(2, $explodedValues);
+ $id = CRM_Utils_Array::value(0, $explodedValues);
+ $first = CRM_Utils_Array::value(1, $explodedValues);
+ $second = CRM_Utils_Array::value(2, $explodedValues);
$saveMappingFields->name = $mapper[$i];
$saveMappingFields->save();
$skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
//get the data from the session
- $dataValues = $this->get('dataValues');
- $mapper = $this->get('mapper');
- $invalidRowCount = $this->get('invalidRowCount');
+ $dataValues = $this->get('dataValues');
+ $mapper = $this->get('mapper');
+ $invalidRowCount = $this->get('invalidRowCount');
$conflictRowCount = $this->get('conflictRowCount');
- $mismatchCount = $this->get('unMatchCount');
+ $mismatchCount = $this->get('unMatchCount');
//get the mapping name displayed if the mappingId is set
$mappingId = $this->get('loadMappingId');
$properties = array(
'mapper',
- 'dataValues', 'columnCount',
- 'totalRowCount', 'validRowCount',
- 'invalidRowCount', 'conflictRowCount',
+ 'dataValues',
+ 'columnCount',
+ 'totalRowCount',
+ 'validRowCount',
+ 'invalidRowCount',
+ 'conflictRowCount',
'downloadErrorRecordsUrl',
'downloadConflictRecordsUrl',
'downloadMismatchRecordsUrl',
* @return void
*/
public function postProcess() {
- $fileName = $this->controller->exportValue('DataSource', 'uploadFile');
+ $fileName = $this->controller->exportValue('DataSource', 'uploadFile');
$skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
- $invalidRowCount = $this->get('invalidRowCount');
+ $invalidRowCount = $this->get('invalidRowCount');
$conflictRowCount = $this->get('conflictRowCount');
- $onDuplicate = $this->get('onDuplicate');
+ $onDuplicate = $this->get('onDuplicate');
$config = CRM_Core_Config::singleton();
$seperator = $config->fieldSeparator;
}
$this->assign('dupeActionString', $dupeActionString);
- $properties = array('totalRowCount', 'validRowCount', 'invalidRowCount', 'conflictRowCount', 'downloadConflictRecordsUrl', 'downloadErrorRecordsUrl', 'duplicateRowCount', 'downloadDuplicateRecordsUrl', 'downloadMismatchRecordsUrl', 'groupAdditions', 'unMatchCount');
+ $properties = array(
+ 'totalRowCount',
+ 'validRowCount',
+ 'invalidRowCount',
+ 'conflictRowCount',
+ 'downloadConflictRecordsUrl',
+ 'downloadErrorRecordsUrl',
+ 'duplicateRowCount',
+ 'downloadDuplicateRecordsUrl',
+ 'downloadMismatchRecordsUrl',
+ 'groupAdditions',
+ 'unMatchCount'
+ );
foreach ($properties as $property) {
$this->assign($property, $this->get($property));
}
* $Id$
*
*/
-
-
abstract class CRM_Event_Import_Parser extends CRM_Import_Parser {
protected $_fileName;
if ($this->_invalidRowCount) {
// removed view url for invlaid contacts
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('Reason'),
),
$customHeaders
self::exportCSV($this->_errorFileName, $headers, $this->_errors);
}
if ($this->_conflictCount) {
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('Reason'),
),
$customHeaders
self::exportCSV($this->_conflictFileName, $headers, $this->_conflicts);
}
if ($this->_duplicateCount) {
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('View Participant URL'),
),
$customHeaders
public function summary(&$values) {
$erroneousField = NULL;
- $response = $this->setActiveFieldValues($values, $erroneousField);
+ $response = $this->setActiveFieldValues($values, $erroneousField);
$errorRequired = FALSE;
- $index = -1;
+ $index = -1;
if ($this->_eventIndex > -1 && $this->_eventTitleIndex > -1) {
array_unshift($values, ts('Select either EventID OR Event Title'));
else {
foreach ($val as $role) {
if (!CRM_Contact_Import_Parser_Contact::in_value(trim($role), $roleIDs)) {
- CRM_Contact_Import_Parser_Contact::addToErrorMsg('Participant Role', $errorMessage);
+ CRM_Contact_Import_Parser_Contact::addToErrorMsg('Participant Role', $errorMessage);
break;
}
}
if ($response != CRM_Import_Parser::VALID) {
return $response;
}
- $params = &$this->getActiveFieldParams();
- $session = CRM_Core_Session::singleton();
- $dateType = $session->get('dateTypes');
- $formatted = array('version' => 3);
+ $params = &$this->getActiveFieldParams();
+ $session = CRM_Core_Session::singleton();
+ $dateType = $session->get('dateTypes');
+ $formatted = array('version' => 3);
$customFields = CRM_Core_BAO_CustomField::getFields(CRM_Utils_Array::value('contact_type', $params));
// don't add to recent items, CRM-4399
// Using new Dedupe rule.
$ruleParams = array(
'contact_type' => $this->_contactType,
- 'used' => 'Unsupervised',
+ 'used' => 'Unsupervised',
);
$fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
if (is_array($newParticipant) && civicrm_error($newParticipant)) {
if ($onDuplicate == CRM_Import_Parser::DUPLICATE_SKIP) {
- $contactID = CRM_Utils_Array::value('contactID', $newParticipant);
+ $contactID = CRM_Utils_Array::value('contactID', $newParticipant);
$participantID = CRM_Utils_Array::value('participantID', $newParticipant);
- $url = CRM_Utils_System::url('civicrm/contact/view/participant',
+ $url = CRM_Utils_System::url('civicrm/contact/view/participant',
"reset=1&id={$participantID}&cid={$contactID}&action=view", TRUE
);
if (is_array($newParticipant['error_message']) &&
$config = CRM_Core_Config::singleton();
// ensure that the user has permission to see this page
if (!CRM_Core_Permission::event(CRM_Core_Permission::VIEW,
- $this->_id, 'view event info'
- )) {
+ $this->_id, 'view event info'
+ )
+ ) {
CRM_Utils_System::setUFMessage(ts('You do not have permission to view this event'));
return CRM_Utils_System::permissionDenied();
}
$this->assign('isPriceSet', 1);
$this->assign('isQuickConfig', $setDetails[$priceSetId]['is_quick_config']);
}
- }
+ }
$params = array('entity_id' => $this->_id, 'entity_table' => 'civicrm_event');
$values['location'] = CRM_Core_BAO_Location::getValues($params, TRUE);
$this->assign('mapKey', $config->mapAPIKey);
$sumLat = $sumLng = 0;
$maxLat = $maxLng = -400;
- $minLat = $minLng = + 400;
+ $minLat = $minLng = +400;
foreach ($locations as $location) {
$sumLat += $location['lat'];
$sumLng += $location['lng'];
'lng' => (float ) $sumLng / count($locations),
);
$span = array(
- 'lat' => (float )($maxLat - $minLat),
- 'lng' => (float )($maxLng - $minLng),
+ 'lat' => (float ) ($maxLat - $minLat),
+ 'lng' => (float ) ($maxLng - $minLng),
);
$this->assign_by_ref('center', $center);
$this->assign_by_ref('span', $span);
* @return void
*/
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);
- $end = CRM_Utils_Request::retrieve('end', 'Positive', $this, FALSE, 0);
+ $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);
+ $end = CRM_Utils_Request::retrieve('end', 'Positive', $this, FALSE, 0);
$iCalPage = CRM_Utils_Request::retrieve('list', 'Positive', $this, FALSE, 0);
- $gData = CRM_Utils_Request::retrieve('gData', 'Positive', $this, FALSE, 0);
- $html = CRM_Utils_Request::retrieve('html', 'Positive', $this, FALSE, 0);
- $rss = CRM_Utils_Request::retrieve('rss', 'Positive', $this, FALSE, 0);
+ $gData = CRM_Utils_Request::retrieve('gData', 'Positive', $this, FALSE, 0);
+ $html = CRM_Utils_Request::retrieve('html', 'Positive', $this, FALSE, 0);
+ $rss = CRM_Utils_Request::retrieve('rss', 'Positive', $this, FALSE, 0);
$info = CRM_Event_BAO_Event::getCompleteInfo($start, $type, $id, $end);
$this->assign('events', $info);
'field' => 'is_online_registration',
);
if (CRM_Core_Permission::check('administer CiviCRM')) {
- self::$_tabLinks[$cacheKey]['reminder'] =
- array(
- 'title' => ts('Schedule Reminders'),
- 'url' => 'civicrm/event/manage/reminder',
- 'field' => 'reminder',
- );
+ self::$_tabLinks[$cacheKey]['reminder'] =
+ array(
+ 'title' => ts('Schedule Reminders'),
+ 'url' => 'civicrm/event/manage/reminder',
+ 'field' => 'reminder',
+ );
}
self::$_tabLinks[$cacheKey]['conference'] =
array(
}
if (!$this->_isTemplate && $id) {
- $breadCrumb = array(array(
+ $breadCrumb = array(
+ array(
'title' => ts('Manage Events'),
'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1'),
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadCrumb);
}
* @return string
*/
public function whereClause(&$params, $sortBy = TRUE, $force) {
- $values = array();
- $clauses = array();
- $title = $this->get('title');
+ $values = array();
+ $clauses = array();
+ $title = $this->get('title');
$createdId = $this->get('cid');
if ($createdId) {
protected $_eventTitle;
protected $_pager;
+
public function preProcess() {
$this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this, TRUE);
if ($className == 'CRM_Event_Page_ParticipantListing') {
CRM_Core_Error::fatal(ts("Participant listing code file cannot be '%1'",
- array(1 => $className)
- ));
+ array(1 => $className)
+ ));
}
$classFile = str_replace('_',
- DIRECTORY_SEPARATOR,
- $className
- ) . '.php';
+ DIRECTORY_SEPARATOR,
+ $className
+ ) . '.php';
$error = include_once $classFile;
if ($error == FALSE) {
CRM_Core_Error::fatal('Participant listing code file: ' . $classFile . ' does not exist. Please verify your custom particpant listing settings in CiviCRM administrative panel.');
ORDER BY $orderBy
LIMIT $offset, $rowCount";
- $rows = array();
- $object = CRM_Core_DAO::executeQuery($query, $params);
+ $rows = array();
+ $object = CRM_Core_DAO::executeQuery($query, $params);
$statusLookup = CRM_Event_PseudoConstant::participantStatus();
while ($object->fetch()) {
$status = CRM_Utils_Array::value($object->status_id, $statusLookup);
if (!$headers) {
$headers = array();
$headers[1] = array(
- 'name' => ts('Name'),
+ 'name' => ts('Name'),
'sort' => 'civicrm_contact.sort_name',
'direction' => CRM_Utils_Sort::ASCENDING,
);
$headers[2] = array(
- 'name' => ts('Status'),
+ 'name' => ts('Status'),
'sort' => 'civicrm_participant.status_id',
'direction' => CRM_Utils_Sort::DONTCARE,
);
$headers[3] = array(
- 'name' => ts('Register Date'),
+ 'name' => ts('Register Date'),
'sort' => 'civicrm_participant.register_date',
'direction' => CRM_Utils_Sort::DONTCARE,
);
if (!$headers) {
$headers = array();
$headers[1] = array(
- 'name' => ts('Name'),
+ 'name' => ts('Name'),
'sort' => 'civicrm_contact.sort_name',
'direction' => CRM_Utils_Sort::ASCENDING,
);
if ($this->_participantListingType == 'Name and Email') {
$headers[2] = array(
- 'name' => ts('Email'),
+ 'name' => ts('Email'),
'sort' => 'civicrm_email.email',
'direction' => CRM_Utils_Sort::DONTCARE,
);
}
public function preProcess() {
- $context = CRM_Utils_Request::retrieve('context', 'String', $this);
+ $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);
+ $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
if ($context == 'standalone') {
$this->_action = CRM_Core_Action::ADD;
elseif ($this->_action & (CRM_Core_Action::UPDATE |
CRM_Core_Action::ADD |
CRM_Core_Action::DELETE
- )) {
+ )
+ ) {
$this->edit();
}
else {
break;
case 'fulltext':
- $keyName = '&qfKey';
+ $keyName = '&qfKey';
$urlParams = 'force=1';
$urlString = 'civicrm/contact/search/custom';
if ($this->_action == CRM_Core_Action::UPDATE) {
public static function flush($name = 'cache') {
if (isset(self::$$name)) {
self::$$name = NULL;
- }
+ }
}
/**
// submitted form values
$this->_queryParams = &$queryParams;
- $this->_single = $single;
- $this->_limit = $limit;
- $this->_context = $context;
+ $this->_single = $single;
+ $this->_limit = $limit;
+ $this->_context = $context;
$this->_compContext = $compContext;
$this->_eventClause = $eventClause;
}
$mask = CRM_Core_Action::mask($permissions);
- $statusTypes = CRM_Event_PseudoConstant::participantStatus();
- $statusClasses = CRM_Event_PseudoConstant::participantStatusClass();
+ $statusTypes = CRM_Event_PseudoConstant::participantStatus();
+ $statusClasses = CRM_Event_PseudoConstant::participantStatusClass();
$participantRoles = CRM_Event_PseudoConstant::participantRole();
- $sep = CRM_Core_DAO::VALUE_SEPARATOR;
+ $sep = CRM_Core_DAO::VALUE_SEPARATOR;
//get all campaigns.
$allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
if (!isset(self::$_columnHeaders)) {
self::$_columnHeaders = array(
array(
- 'name' => ts('Event'),
+ 'name' => ts('Event'),
'sort' => 'event_title',
'direction' => CRM_Utils_Sort::DONTCARE,
),
$pages = array_merge($pages, $additionalPages);
// CRM-11182 - Optional confirmation screen
- if (!$is_confirm_enabled && !$is_monetary) {
+ if (!$is_confirm_enabled && !$is_monetary) {
unset($pages['CRM_Event_Form_Registration_Confirm']);
}
class CRM_Event_Task {
// Value for SAVE_SEARCH is set to 13 in accordance with CRM_Contact_Task::SAVE_SEARCH
const DELETE_EVENTS = 1, PRINT_EVENTS = 2, EXPORT_EVENTS = 3, BATCH_EVENTS = 4, CANCEL_REGISTRATION = 5, EMAIL_CONTACTS = 6,
- // Value for LABEL_CONTACTS is set to 16 in accordance with CRM_Contact_Task::LABEL_CONTACTS
- SAVE_SEARCH = 13, SAVE_SEARCH_UPDATE = 14, PARTICIPANT_STATUS = 15,
- LABEL_CONTACTS = 16, GROUP_CONTACTS = 20;
+ // Value for LABEL_CONTACTS is set to 16 in accordance with CRM_Contact_Task::LABEL_CONTACTS
+ SAVE_SEARCH = 13, SAVE_SEARCH_UPDATE = 14, PARTICIPANT_STATUS = 15,
+ LABEL_CONTACTS = 16, GROUP_CONTACTS = 20;
/**
* The task array
public static function &tasks() {
if (!(self::$_tasks)) {
self::$_tasks = array(
- 1 => array(
- 'title' => ts('Delete Participants'),
+ 1 => array(
+ 'title' => ts('Delete Participants'),
'class' => 'CRM_Event_Form_Task_Delete',
'result' => FALSE,
),
*/
static function _trimNonTokens(
&$parsedString, $defaultGreeting,
- $addressMergeGreetings, $greetingType = 'postal_greeting'
+ $addressMergeGreetings, $greetingType = 'postal_greeting'
) {
if (!empty($addressMergeGreetings[$greetingType])) {
$greetingLabel = $addressMergeGreetings[$greetingType];
}
else {
// we need to determine component export
- $stateMachine = $this->controller->getStateMachine();
+ $stateMachine = $this->controller->getStateMachine();
- $formName = CRM_Utils_System::getClassName($stateMachine);
+ $formName = CRM_Utils_System::getClassName($stateMachine);
$componentName = explode('_', $formName);
- $components = array('Contribute', 'Member', 'Event', 'Pledge', 'Case', 'Grant', 'Activity');
+ $components = array('Contribute', 'Member', 'Event', 'Pledge', 'Case', 'Grant', 'Activity');
if (in_array($componentName[1], $components)) {
switch ($componentName[1]) {
$this->_task = $values['task'];
if ($this->_exportMode == self::CONTACT_EXPORT) {
$contactTasks = CRM_Contact_Task::taskTitles();
- $taskName = $contactTasks[$this->_task];
- $component = FALSE;
+ $taskName = $contactTasks[$this->_task];
+ $component = FALSE;
CRM_Contact_Form_Task::preProcessCommon($this, TRUE);
}
else {
$this->setDefaults(array(
'exportOption' => self::EXPORT_ALL,
- 'mergeOption' => self::EXPORT_MERGE_DO_NOT_MERGE,
- ));
+ 'mergeOption' => self::EXPORT_MERGE_DO_NOT_MERGE,
+ ));
$this->addButtons(array(
array(
* @return void
*/
public function postProcess() {
- $params = $this->controller->exportValues($this->_name);
- $exportOption = $params['exportOption'];
- $mergeSameAddress = CRM_Utils_Array::value('mergeOption', $params) == self::EXPORT_MERGE_SAME_ADDRESS ? 1 : 0;
+ $params = $this->controller->exportValues($this->_name);
+ $exportOption = $params['exportOption'];
+ $mergeSameAddress = CRM_Utils_Array::value('mergeOption', $params) == self::EXPORT_MERGE_SAME_ADDRESS ? 1 : 0;
$mergeSameHousehold = CRM_Utils_Array::value('mergeOption', $params) == self::EXPORT_MERGE_HOUSEHOLD ? 1 : 0;
$this->set('mergeSameAddress', $mergeSameAddress);
if (empty($exts)) {
$config = CRM_Core_Config::singleton();
CRM_Core_Session::setStatus(ts('There are currently no extensions on the CiviCRM public extension directory which are compatible with version %2 (<a href="%1">requested extensions from here</a>). If you want to install an extension which is not marked as compatible, you may be able to <a href="%3">download and install extensions manually</a> (depending on access to your web server).<br />', array(
- 1 => $this->getRepositoryUrl(),
- 2 => $config->civiVersion,
- 3 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Extensions',
- )), ts('No Extensions Available for this Version'), 'info');
+ 1 => $this->getRepositoryUrl(),
+ 2 => $config->civiVersion,
+ 3 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Extensions',
+ )), ts('No Extensions Available for this Version'), 'info');
}
ini_restore('allow_url_fopen');
);
}
- if (empty($errors) && ! CRM_Utils_HttpClient::singleton()->isRedirectSupported()) {
+ if (empty($errors) && !CRM_Utils_HttpClient::singleton()->isRedirectSupported()) {
CRM_Core_Session::setStatus(ts('WARNING: The downloader may be unable to download files which require HTTP redirection. This may be a configuration issue with PHP\'s open_basedir or safe_mode.'));
CRM_Core_Error::debug_log_message('WARNING: The downloader may be unable to download files which require HTTP redirection. This may be a configuration issue with PHP\'s open_basedir or safe_mode.');
}
CRM_Core_Error::fatal('Cannot install this extension - downloadUrl is not set!');
}
- if (! $this->fetch($downloadUrl, $filename)) {
+ if (!$this->fetch($downloadUrl, $filename)) {
return FALSE;
}
$extractedZipPath = $this->extractFiles($key, $filename);
- if (! $extractedZipPath) {
+ if (!$extractedZipPath) {
return FALSE;
}
- if (! $this->validateFiles($key, $extractedZipPath)) {
+ if (!$this->validateFiles($key, $extractedZipPath)) {
return FALSE;
}
* @param null $file
*/
public function __construct($key = NULL, $type = NULL, $name = NULL, $label = NULL, $file = NULL) {
- $this->key = $key;
- $this->type = $type;
- $this->name = $name;
- $this->label = $label;
- $this->file = $file;
+ $this->key = $key;
+ $this->type = $type;
+ $this->name = $name;
+ $this->label = $label;
+ $this->file = $file;
}
/**
* @return void
*/
public function parse($info) {
- $this->key = (string) $info->attributes()->key;
- $this->type = (string) $info->attributes()->type;
- $this->file = (string) $info->file;
+ $this->key = (string) $info->attributes()->key;
+ $this->type = (string) $info->attributes()->type;
+ $this->file = (string) $info->file;
$this->label = (string) $info->name;
// Convert first level variables to CRM_Core_Extension properties
* @throws CRM_Extension_Exception
*/
public function replace($tmpCodeDir) {
- if (! $this->defaultContainer) {
+ if (!$this->defaultContainer) {
throw new CRM_Extension_Exception("Default extension container is not configured");
}
// There is an old copy of the extension. Try to install in the same place -- but it must go somewhere in the default-container
list ($oldInfo, $typeManager) = $this->_getInfoTypeHandler($newInfo->key); // throws Exception
$tgtPath = $this->fullContainer->getPath($newInfo->key);
- if (! CRM_Utils_File::isChildPath($this->defaultContainer->getBaseDir(), $tgtPath)) {
+ if (!CRM_Utils_File::isChildPath($this->defaultContainer->getBaseDir(), $tgtPath)) {
// force installation in the default-container
$oldPath = $tgtPath;
$tgtPath = $this->defaultContainer->getBaseDir() . DIRECTORY_SEPARATOR . $newInfo->key;
case self::STATUS_INSTALLED_MISSING:
throw new CRM_Extension_Exception("Cannot uninstall extension; disable it first: $key");
- break;
+ break;
case self::STATUS_DISABLED:
list ($info, $typeManager) = $this->_getInfoTypeHandler($key); // throws Exception
$typeManager->onPreUninstall($info);
$dao = new CRM_Financial_DAO_PaymentProcessorType();
- $dao->is_active = 1;
- $dao->class_name = trim($info->key);
- $dao->title = trim($info->name) . ' (' . trim($info->key) . ')';
- $dao->name = trim($info->name);
+ $dao->is_active = 1;
+ $dao->class_name = trim($info->key);
+ $dao->title = trim($info->name) . ' (' . trim($info->key) . ')';
+ $dao->name = trim($info->name);
$dao->description = trim($info->description);
$dao->user_name_label = trim($info->typeInfo['userNameLabel']);
try {
$paymentClass = $this->mapper->keyToClass($info->key, 'payment');
$file = $this->mapper->classToPath($paymentClass);
- if (! file_exists($file)) {
- CRM_Core_Session::setStatus(ts('Failed to load file (%3) for payment processor (%1) while running "%2"', array(1 => $info->key, 2 => $method, 3 => $file)), '', 'error');
+ if (!file_exists($file)) {
+ CRM_Core_Session::setStatus(ts('Failed to load file (%3) for payment processor (%1) while running "%2"', array(
+ 1 => $info->key,
+ 2 => $method,
+ 3 => $file
+ )), '', 'error');
return;
}
else {
}
}
catch (CRM_Extension_Exception $e) {
- CRM_Core_Session::setStatus(ts('Failed to determine file path for payment processor (%1) while running "%2"', array(1 => $info->key, 2 => $method)), '', 'error');
+ CRM_Core_Session::setStatus(ts('Failed to determine file path for payment processor (%1) while running "%2"', array(
+ 1 => $info->key,
+ 2 => $method
+ )), '', 'error');
return;
}
WHERE ext.type = 'payment'
AND ext.full_name = %1
",
- array(
- 1 => array($info->key, 'String'),
- )
- )) {
+ array(
+ 1 => array($info->key, 'String'),
+ )
+ )
+ ) {
// If so, load params in the usual way ..
$paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($processor_id, NULL);
}
// Does PP implement this method, and can we call it?
if (method_exists($processorInstance, $method) && is_callable(array(
- $processorInstance, $method))) {
+ $processorInstance,
+ $method
+ ))
+ ) {
// If so, call it ...
$processorInstance->$method();
}
default:
CRM_Core_Session::setStatus(ts("Unrecognized payment hook (%1) in %2::%3",
- array(1 => $method, 2 => __CLASS__ , 3 => __METHOD__)),
- '', 'error');
+ array(1 => $method, 2 => __CLASS__, 3 => __METHOD__)),
+ '', 'error');
}
}
}
// }
$customReports = $this->getCustomReportsByName();
- $cr = $this->getCustomReportsById();
- $id = $cr[$customReports[$info->key]];
+ $cr = $this->getCustomReportsById();
+ $id = $cr[$customReports[$info->key]];
$optionValue = CRM_Core_BAO_OptionValue::del($id);
return $optionValue ? TRUE : FALSE;
*/
public function onPreDisable(CRM_Extension_Info $info) {
$customReports = $this->getCustomReportsByName();
- $cr = $this->getCustomReportsById();
- $id = $cr[$customReports[$info->key]];
+ $cr = $this->getCustomReportsById();
+ $id = $cr[$customReports[$info->key]];
$optionValue = CRM_Core_BAO_OptionValue::setIsActive($id, 0);
}
*/
public function onPreEnable(CRM_Extension_Info $info) {
$customReports = $this->getCustomReportsByName();
- $cr = $this->getCustomReportsById();
- $id = $cr[$customReports[$info->key]];
+ $cr = $this->getCustomReportsById();
+ $id = $cr[$customReports[$info->key]];
$optionValue = CRM_Core_BAO_OptionValue::setIsActive($id, 1);
}
CRM_Core_Error::fatal('This custom search is not registered.');
}
- $cs = $this->getCustomSearchesById();
- $id = $cs[$customSearchesByName[$info->key]];
+ $cs = $this->getCustomSearchesById();
+ $id = $cs[$customSearchesByName[$info->key]];
$optionValue = CRM_Core_BAO_OptionValue::del($id);
return TRUE;
*/
public function onPreDisable(CRM_Extension_Info $info) {
$customSearchesByName = $this->getCustomSearchesByName();
- $cs = $this->getCustomSearchesById();
- $id = $cs[$customSearchesByName[$info->key]];
+ $cs = $this->getCustomSearchesById();
+ $id = $cs[$customSearchesByName[$info->key]];
$optionValue = CRM_Core_BAO_OptionValue::setIsActive($id, 0);
}
*/
public function onPreEnable(CRM_Extension_Info $info) {
$customSearchesByName = $this->getCustomSearchesByName();
- $cs = $this->getCustomSearchesById();
- $id = $cs[$customSearchesByName[$info->key]];
+ $cs = $this->getCustomSearchesById();
+ $id = $cs[$customSearchesByName[$info->key]];
$optionValue = CRM_Core_BAO_OptionValue::setIsActive($id, 1);
}
* Create a subclass for a specific format.
* @see http://wiki.civicrm.org/confluence/display/CRM/CiviAccounts+Specifications+-++Batches#CiviAccountsSpecifications-Batches-%C2%A0Overviewofimplementation
*/
-
class CRM_Financial_BAO_ExportFormat {
/*
$this->_batchIds = $batchId;
while ($dao->fetch()) {
$creditAccountName = $creditAccountType =
- $creditAccount = NULL;
+ $creditAccount = NULL;
if ($dao->credit_account) {
$creditAccountName = $dao->credit_account_name;
$creditAccountType = $dao->credit_account_type_code;
* $Id$
*
*/
-
class CRM_Financial_BAO_FinancialAccount extends CRM_Financial_DAO_FinancialAccount {
/**
$dependancy = array(
array('Core', 'FinancialTrxn', 'to_financial_account_id'),
array('Financial', 'FinancialTypeAccount', 'financial_account_id'),
- );
+ );
foreach ($dependancy as $name) {
require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_" . $name[0] . "_BAO_" . $name[1]) . ".php";
$className = "CRM_{$name[0]}_BAO_{$name[1]}";
* $Id$
*
*/
-
class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem {
/**
$financialItemStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id');
$itemStatus = NULL;
if ($contribution->contribution_status_id == array_search('Completed', $contributionStatuses)
- || $contribution->contribution_status_id == array_search('Pending refund', $contributionStatuses)) {
+ || $contribution->contribution_status_id == array_search('Pending refund', $contributionStatuses)
+ ) {
$itemStatus = array_search('Paid', $financialItemStatus);
}
elseif ($contribution->contribution_status_id == array_search('Pending', $contributionStatuses)
- || $contribution->contribution_status_id == array_search('In Progress', $contributionStatuses)) {
+ || $contribution->contribution_status_id == array_search('In Progress', $contributionStatuses)
+ ) {
$itemStatus = array_search('Unpaid', $financialItemStatus);
}
elseif ($contribution->contribution_status_id == array_search('Partially paid', $contributionStatuses)) {
$itemStatus = array_search('Partially paid', $financialItemStatus);
}
$params = array(
- 'transaction_date' => CRM_Utils_Date::isoToMysql($contribution->receive_date),
- 'contact_id' => $contribution->contact_id,
- 'amount' => $lineItem->line_total,
- 'currency' => $contribution->currency,
- 'entity_table' => 'civicrm_line_item',
- 'entity_id' => $lineItem->id,
- 'description' => ($lineItem->qty != 1 ? $lineItem->qty . ' of ' : ''). ' ' . $lineItem->label,
- 'status_id' => $itemStatus,
+ 'transaction_date' => CRM_Utils_Date::isoToMysql($contribution->receive_date),
+ 'contact_id' => $contribution->contact_id,
+ 'amount' => $lineItem->line_total,
+ 'currency' => $contribution->currency,
+ 'entity_table' => 'civicrm_line_item',
+ 'entity_id' => $lineItem->id,
+ 'description' => ($lineItem->qty != 1 ? $lineItem->qty . ' of ' : '') . ' ' . $lineItem->label,
+ 'status_id' => $itemStatus,
);
if ($taxTrxnID) {
}
if ($lineItem->financial_type_id) {
$searchParams = array(
- 'entity_table' => 'civicrm_financial_type',
- 'entity_id' => $lineItem->financial_type_id,
+ 'entity_table' => 'civicrm_financial_type',
+ 'entity_id' => $lineItem->financial_type_id,
'account_relationship' => $accountRel,
);
$financialItem->save();
if (!empty($trxnIds['id'])) {
$entity_financial_trxn_params = array(
- 'entity_table' => "civicrm_financial_item",
- 'entity_id' => $financialItem->id,
+ 'entity_table' => "civicrm_financial_item",
+ 'entity_id' => $financialItem->id,
'financial_trxn_id' => $trxnIds['id'],
- 'amount' => $params['amount'],
+ 'amount' => $params['amount'],
);
$entity_trxn = new CRM_Financial_DAO_EntityFinancialTrxn();
$financialItem->find();
while ($financialItem->fetch()) {
$financialItems[$financialItem->id] = array(
- 'id' => $financialItem->id,
- 'entity_table' => $financialItem->entity_table,
- 'entity_id' => $financialItem->entity_id,
+ 'id' => $financialItem->id,
+ 'entity_table' => $financialItem->entity_table,
+ 'entity_id' => $financialItem->entity_id,
'financial_trxn_id' => $financialItem->financial_trxn_id,
- 'amount' => $financialItem->amount,
+ 'amount' => $financialItem->amount,
);
}
if (!empty($financialItems)) {
* $Id$
*
*/
-
class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType {
/**
* $Id$
*
*/
-
class CRM_Financial_BAO_FinancialTypeAccount extends CRM_Financial_DAO_EntityFinancialAccount {
/**
CRM_Core_Error::fatal(ts('Invalid value passed to getPayment function'));
}
- $dao = new CRM_Financial_DAO_PaymentProcessor();
- $dao->id = $paymentProcessorID;
+ $dao = new CRM_Financial_DAO_PaymentProcessor();
+ $dao->id = $paymentProcessorID;
$dao->is_active = 1;
if (!$dao->find(TRUE)) {
return NULL;
if ($mode == 'test') {
$testDAO = new CRM_Financial_DAO_PaymentProcessor();
- $testDAO->name = $dao->name;
+ $testDAO->name = $dao->name;
$testDAO->is_active = 1;
- $testDAO->is_test = 1;
+ $testDAO->is_test = 1;
if (!$testDAO->find(TRUE)) {
CRM_Core_Error::fatal(ts('Could not retrieve payment processor details'));
}
*/
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',
- 'subject', 'class_name', 'is_recur', 'billing_mode', 'is_test',
- 'payment_type', 'is_default',
+ 'id',
+ 'name',
+ 'payment_processor_type_id',
+ 'user_name',
+ 'password',
+ 'signature',
+ 'url_site',
+ 'url_api',
+ 'url_recur',
+ 'url_button',
+ 'subject',
+ 'class_name',
+ 'is_recur',
+ 'billing_mode',
+ 'is_test',
+ 'payment_type',
+ 'is_default',
);
$result = array();
foreach ($fields as $name) {
* @return array
*/
public static function getAllPaymentProcessors($mode, $reset = FALSE) {
- /**
- * $cacheKey = 'CRM_Financial_BAO_Payment_Processor_' . ($mode ? 'test' : 'all');
- if (!$reset) {
- $processors = CRM_Utils_Cache::singleton()->get($cacheKey);
- if (!empty($processors)) {
- return $processors;
- }
- }
+ /**
+ * $cacheKey = 'CRM_Financial_BAO_Payment_Processor_' . ($mode ? 'test' : 'all');
+ * if (!$reset) {
+ * $processors = CRM_Utils_Cache::singleton()->get($cacheKey);
+ * if (!empty($processors)) {
+ * return $processors;
+ * }
+ * }
* */
- $retrievalParameters = array('is_active' => TRUE, 'options' => array('sort' => 'is_default DESC, name'), 'api.payment_processor_type.getsingle' => 1);
+ $retrievalParameters = array(
+ 'is_active' => TRUE,
+ 'options' => array('sort' => 'is_default DESC, name'),
+ 'api.payment_processor_type.getsingle' => 1
+ );
if ($mode == 'test') {
$retrievalParameters['is_test'] = 1;
}
public static function getProcessorForEntity($entityID, $component = 'contribute', $type = 'id') {
$result = NULL;
if (!in_array($component, array(
- 'membership', 'contribute', 'recur'))) {
+ 'membership',
+ 'contribute',
+ 'recur'
+ ))
+ ) {
return $result;
}
//FIXME:
$this->assign('columnHeaders', $columnHeaders);
}
}
+
/**
* Build the form object
*
$this->addButtons(
array(
array(
- 'type' => 'submit',
+ 'type' => 'submit',
'name' => ts('Search'),
'isDefault' => TRUE,
),
public function &links() {
if (!(self::$_links)) {
self::$_links = array(
- 'view' => array(
- 'name' => ts('View'),
- 'url' => 'civicrm/contact/view/contribution',
- 'qs' => 'reset=1&id=%%contid%%&cid=%%cid%%&action=view&context=contribution&selectedChild=contribute',
+ 'view' => array(
+ 'name' => ts('View'),
+ 'url' => 'civicrm/contact/view/contribution',
+ 'qs' => 'reset=1&id=%%contid%%&cid=%%cid%%&action=view&context=contribution&selectedChild=contribute',
'title' => ts('View Contribution'),
),
'assign' => array(
- 'name' => ts('Assign'),
- 'ref' => 'disable-action',
+ 'name' => ts('Assign'),
+ 'ref' => 'disable-action',
'title' => ts('Assign Transaction'),
'extra' => 'onclick = "assignRemove( %%id%%,\'' . 'assign' . '\' );"',
),
$financialAccountType = CRM_Core_PseudoConstant::accountOptionValues('financial_account_type');
if ($financialAccount->financial_account_type_id == array_search('Asset', $financialAccountType)
&& strtolower($financialAccount->account_type_code) == 'ar'
- && !CRM_Financial_BAO_FinancialAccount::getARAccounts($this->_id, array_search('Asset', $financialAccountType))) {
+ && !CRM_Financial_BAO_FinancialAccount::getARAccounts($this->_id, array_search('Asset', $financialAccountType))
+ ) {
$this->_isARFlag = TRUE;
if ($this->_action & CRM_Core_Action::DELETE) {
$msg = ts("The selected financial account cannot be deleted because at least one Accounts Receivable type account is required (to ensure that accounting transactions are in balance).");
$this->add('text', 'description', ts('Description'), $attributes['description']);
$this->add('text', 'accounting_code', ts('Accounting Code'), $attributes['accounting_code']);
$elementAccounting = $this->add('text', 'account_type_code', ts('Account Type Code'), $attributes['account_type_code']);
- $this->addEntityRef('contact_id', ts('Owner'), array('api' => array('params' => array('contact_type' => 'Organization')), 'create' => TRUE));
+ $this->addEntityRef('contact_id', ts('Owner'), array(
+ 'api' => array('params' => array('contact_type' => 'Organization')),
+ 'create' => TRUE
+ ));
$this->add('text', 'tax_rate', ts('Tax Rate'), $attributes['tax_rate']);
$this->add('checkbox', 'is_deductible', ts('Tax-Deductible?'));
$elementActive = $this->add('checkbox', 'is_active', ts('Enabled?'));
}
if ($this->_action == CRM_Core_Action::UPDATE &&
- CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialAccount', $this->_id, 'is_reserved')) {
+ CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialAccount', $this->_id, 'is_reserved')
+ ) {
$this->freeze(array('name', 'description', 'is_active'));
}
$this->addFormRule(array('CRM_Financial_Form_FinancialAccount', 'formRule'), $this);
if (!(isset($values['is_tax']))) {
$relationshipId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Sales Tax Account is' "));
$params = array(
- 'financial_account_id' => $self->_id,
+ 'financial_account_id' => $self->_id,
'account_relationship' => $relationshipId,
);
$result = CRM_Financial_BAO_FinancialTypeAccount::retrieve($params, $defaults);
'edit own manual batches',
'edit all manual batches',
),
- 'actionName' => 'edit'),
+ 'actionName' => 'edit'
+ ),
CRM_Core_Action::DELETE => array(
'permission' => array(
'delete own manual batches',
'delete all manual batches',
),
- 'actionName' => 'delete'),
+ 'actionName' => 'delete'
+ ),
);
$createdID = CRM_Core_DAO::getFieldValue('CRM_Batch_DAO_Batch', $this->_id, 'created_id');
$session->replaceUserContext(CRM_Utils_System::url('civicrm', 'reset=1'));
}
elseif (($buttonName == $this->getButtonName('next') & $this->_action == CRM_Core_Action::UPDATE) ||
- ($buttonName == $this->getButtonName('next') & $this->_action == CRM_Core_Action::ADD & $context == 1)) {
+ ($buttonName == $this->getButtonName('next') & $this->_action == CRM_Core_Action::ADD & $context == 1)
+ ) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/financial/financialbatches',
"reset=1&batchStatus=1"));
}
$breadCrumb = array(
array(
- 'title' => ts('Financial Type Accounts'),
+ 'title' => ts('Financial Type Accounts'),
'url' => $url,
),
);
if ($this->_action == CRM_Core_Action::ADD) {
if (!empty($this->_submitValues['account_relationship']) || !empty($this->_submitValues['financial_account_id'])) {
$financialAccountType = array(
- '5' => 5, //expense
- '3' => 1, //AR relation
- '1' => 3, //revenue
- '6' => 1, //Asset
- '7' => 4, //cost of sales
- '8' => 1, //premium inventory
- '9' => 3 //discount account is,
- );
+ '5' => 5, //expense
+ '3' => 1, //AR relation
+ '1' => 3, //revenue
+ '6' => 1, //Asset
+ '7' => 4, //cost of sales
+ '8' => 1, //premium inventory
+ '9' => 3 //discount account is,
+ );
$financialAccountType = CRM_Utils_Array::value($this->_submitValues['account_relationship'], $financialAccountType);
$result = CRM_Contribute_PseudoConstant::financialAccount(NULL, $financialAccountType);
}
else {
$financialAccountSelect = array(
- 'select' => ts('- select -'),
- ) + CRM_Contribute_PseudoConstant::financialAccount();
+ 'select' => ts('- select -'),
+ ) + CRM_Contribute_PseudoConstant::financialAccount();
}
}
if ($this->_action == CRM_Core_Action::UPDATE) {
'7' => 4, //cost of sales
'8' => 1, //premium inventory
'9' => 3 //discount account is,
- );
+ );
$financialAccountType = $financialAccountType[$this->_defaultValues['account_relationship']];
$result = CRM_Contribute_PseudoConstant::financialAccount(NULL, $financialAccountType);
);
$this->addButtons(array(
- array(
- 'type' => 'next',
- 'name' => ts('Save'),
- 'isDefault' => TRUE,
- ),
- array(
- 'type' => 'next',
- 'name' => ts('Save and New'),
- 'subName' => 'new',
- ),
- array(
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ))
+ array(
+ 'type' => 'next',
+ 'name' => ts('Save'),
+ 'isDefault' => TRUE,
+ ),
+ array(
+ 'type' => 'next',
+ 'name' => ts('Save and New'),
+ 'subName' => 'new',
+ ),
+ array(
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ )
+ )
);
$this->addFormRule(array('CRM_Financial_Form_FinancialTypeAccount', 'formRule'), $this);
}
if (!empty($values['account_relationship']) && !empty($values['financial_account_id'])) {
$params = array(
'account_relationship' => $values['account_relationship'],
- 'entity_id' => $self->_aid,
+ 'entity_id' => $self->_aid,
);
$defaults = array();
if ($self->_action == CRM_Core_Action::ADD) {
}
public function buildQuickForm() {
- CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'packages/jquery/plugins/jquery.redirect.min.js', 0, 'html-header');
+ CRM_Core_Resources::singleton()
+ ->addScriptFile('civicrm', 'packages/jquery/plugins/jquery.redirect.min.js', 0, 'html-header');
$attributes = CRM_Core_DAO::getAttribute('CRM_Batch_DAO_Batch');
$attributes['total']['class'] = $attributes['item_count']['class'] = 'number';
$this->add('text', 'title', ts('Batch Name'), $attributes['title']);
*/
public static function jqFinancial($config) {
if (!isset($_GET['_value']) ||
- empty($_GET['_value'])) {
+ empty($_GET['_value'])
+ ) {
CRM_Utils_System::civiExit();
}
$defaultId = NULL;
}
$elements = array(
array(
- 'name' => ts('- select -'),
+ 'name' => ts('- select -'),
'value' => 'select',
),
);
$selectedArray['selected'] = 'Selected';
}
$elements[] = array(
- 'name' => $name,
- 'value' => $id,
- ) + $selectedArray;
+ 'name' => $name,
+ 'value' => $id,
+ ) + $selectedArray;
}
}
CRM_Utils_JSON::output($elements);
*/
public static function jqFinancialRelation($config) {
if (!isset($_GET['_value']) ||
- empty($_GET['_value'])) {
+ empty($_GET['_value'])
+ ) {
CRM_Utils_System::civiExit();
}
$elements = array(
array(
- 'name' => ts('- Select Financial Account Relationship -'),
+ 'name' => ts('- Select Financial Account Relationship -'),
'value' => 'select',
),
);
$countResult = count($financialAccountType[$financialAccountTypeId]);
if (!empty($result)) {
foreach ($result as $id => $name) {
- if (in_array($id, $financialAccountType[$financialAccountTypeId]) && $_GET['_value'] != 'select') {
+ if (in_array($id, $financialAccountType[$financialAccountTypeId]) && $_GET['_value'] != 'select') {
if ($countResult != 1) {
$elements[] = array(
- 'name' => $name,
+ 'name' => $name,
'value' => $id,
);
}
else {
$elements[] = array(
- 'name' => $name,
- 'value' => $id,
+ 'name' => $name,
+ 'value' => $id,
'selected' => 'Selected',
);
}
}
elseif ($_GET['_value'] == 'select') {
$elements[] = array(
- 'name' => $name,
+ 'name' => $name,
'value' => $id,
);
}
* @param $config
*/
public static function jqFinancialType($config) {
- if (! isset($_GET['_value']) ||
- empty($_GET['_value'])) {
+ if (!isset($_GET['_value']) ||
+ empty($_GET['_value'])
+ ) {
CRM_Utils_System::civiExit();
}
}
}
- $entityID = CRM_Utils_Array::value('entityID', $_POST);
+ $entityID = CRM_Utils_Array::value('entityID', $_POST);
$methods = array(
'assign' => 'addBatchEntity',
'remove' => 'removeBatchEntity',
$sortMapper =
array(
0 => '',
- 1 => '',
- 2 => 'sort_name',
+ 1 => '',
+ 2 => 'sort_name',
3 => 'amount',
- 4 => 'trxn_id',
- 5 => 'transaction_date',
- 6 => 'payment_method',
- 7 => 'status',
- 8 => 'name',
+ 4 => 'trxn_id',
+ 5 => 'transaction_date',
+ 6 => 'payment_method',
+ 7 => 'status',
+ 8 => 'name',
);
- $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
- $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
- $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
- $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
+ $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
+ $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
+ $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
+ $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
- $context = isset($_REQUEST['context']) ? CRM_Utils_Type::escape($_REQUEST['context'], 'String') : NULL;
- $entityID = isset($_REQUEST['entityID']) ? CRM_Utils_Type::escape($_REQUEST['entityID'], 'String') : NULL;
+ $context = isset($_REQUEST['context']) ? CRM_Utils_Type::escape($_REQUEST['context'], 'String') : NULL;
+ $entityID = isset($_REQUEST['entityID']) ? CRM_Utils_Type::escape($_REQUEST['entityID'], 'String') : NULL;
$notPresent = isset($_REQUEST['notPresent']) ? CRM_Utils_Type::escape($_REQUEST['notPresent'], 'String') : NULL;
- $statusID = isset($_REQUEST['statusID']) ? CRM_Utils_Type::escape($_REQUEST['statusID'], 'String') : NULL;
- $search = isset($_REQUEST['search']) ? TRUE : FALSE;
+ $statusID = isset($_REQUEST['statusID']) ? CRM_Utils_Type::escape($_REQUEST['statusID'], 'String') : NULL;
+ $search = isset($_REQUEST['search']) ? TRUE : FALSE;
$params = $_POST;
if ($sort && $sortOrder) {
array(
'contact_type' => '',
'sort_name' => ts('Contact Name'),
- 'amount' => ts('Amount'),
- 'trxn_id' => ts('Trxn ID'),
+ 'amount' => ts('Amount'),
+ 'trxn_id' => ts('Trxn ID'),
'transaction_date' => ts('Received'),
'payment_method' => ts('Payment Method'),
- 'status' => ts('Status'),
+ 'status' => ts('Status'),
'name' => ts('Type'),
);
$params['rp'] = $rowCount;
$params['context'] = $context;
- $params['offset'] = ($params['page'] - 1) * $params['rp'];
+ $params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['rowCount'] = $params['rp'];
- $params['sort'] = CRM_Utils_Array::value('sortBy', $params);
- $params['total'] = 0;
+ $params['sort'] = CRM_Utils_Array::value('sortBy', $params);
+ $params['total'] = 0;
// get batch list
if (isset($notPresent)) {
$iFilteredTotal = $iTotal = $params['total'];
$selectorElements =
array(
- 'check', 'contact_type', 'sort_name',
- 'amount', 'trxn_id', 'transaction_date', 'payment_method', 'status', 'name', 'action',
+ 'check',
+ 'contact_type',
+ 'sort_name',
+ 'amount',
+ 'trxn_id',
+ 'transaction_date',
+ 'payment_method',
+ 'status',
+ 'name',
+ 'action',
);
echo CRM_Utils_JSON::encodeDataTableSelector($financialitems, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
public static function bulkAssignRemove() {
$checkIDs = $_REQUEST['ID'];
$entityID = CRM_Utils_Type::escape($_REQUEST['entityID'], 'String');
- $action = CRM_Utils_Type::escape($_REQUEST['action'], 'String');
+ $action = CRM_Utils_Type::escape($_REQUEST['action'], 'String');
foreach ($checkIDs as $key => $value) {
if ((substr($value, 0, 7) == "mark_x_" && $action == 'Assign') || (substr($value, 0, 7) == "mark_y_" && $action == 'Remove')) {
$contributions = explode("_", $value);
$paymentInstrument = CRM_Core_OptionGroup::getLabel('payment_instrument', $batchPID);
foreach ($cIDs as $key => $value) {
$recordPID = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $value, 'payment_instrument_id');
- if ($action == 'Remove' || ($recordPID == $batchPID && $action == 'Assign') || !isset($batchPID)) {
+ if ($action == 'Remove' || ($recordPID == $batchPID && $action == 'Assign') || !isset($batchPID)) {
$params =
array(
'entity_id' => $value,
static $_columnHeader = NULL;
static $_returnvalues = NULL;
+
/**
* Get BAO Name
*
public function &links() {
if (!(self::$_links)) {
self::$_links = array(
- 'view' => array(
- 'name' => ts('View'),
- 'url' => 'civicrm/contact/view/contribution',
- 'qs' => 'reset=1&id=%%contid%%&cid=%%cid%%&action=view&context=contribution&selectedChild=contribute',
+ 'view' => array(
+ 'name' => ts('View'),
+ 'url' => 'civicrm/contact/view/contribution',
+ 'qs' => 'reset=1&id=%%contid%%&cid=%%cid%%&action=view&context=contribution&selectedChild=contribute',
'title' => ts('View Contribution'),
),
- 'remove' => array(
- 'name' => ts('Remove'),
+ 'remove' => array(
+ 'name' => ts('Remove'),
'title' => ts('Remove Transaction'),
'extra' => 'onclick = "assignRemove( %%id%%,\'' . 'remove' . '\' );"',
),
public function &links() {
if (!(self::$_links)) {
self::$_links = array(
- CRM_Core_Action::UPDATE => array(
- 'name' => ts('Edit'),
- 'url' => 'civicrm/admin/financial/financialAccount',
- 'qs' => 'action=update&id=%%id%%&reset=1',
+ CRM_Core_Action::UPDATE => array(
+ 'name' => ts('Edit'),
+ 'url' => 'civicrm/admin/financial/financialAccount',
+ 'qs' => 'action=update&id=%%id%%&reset=1',
'title' => ts('Edit Financial Type'),
),
CRM_Core_Action::DISABLE => array(
- 'name' => ts('Disable'),
+ 'name' => ts('Disable'),
'ref' => 'crm-enable-disable',
'title' => ts('Disable Financial Type'),
),
- CRM_Core_Action::ENABLE => array(
- 'name' => ts('Enable'),
+ CRM_Core_Action::ENABLE => array(
+ 'name' => ts('Enable'),
'ref' => 'crm-enable-disable',
'title' => ts('Enable Financial Type'),
),
- CRM_Core_Action::DELETE => array(
- 'name' => ts('Delete'),
- 'url' => 'civicrm/admin/financial/financialAccount',
- 'qs' => 'action=delete&id=%%id%%',
+ CRM_Core_Action::DELETE => array(
+ 'name' => ts('Delete'),
+ 'url' => 'civicrm/admin/financial/financialAccount',
+ 'qs' => 'action=delete&id=%%id%%',
'title' => ts('Delete Financial Type'),
),
);
CRM_Core_Action::ADD |
CRM_Core_Action::CLOSE |
CRM_Core_Action::REOPEN |
- CRM_Core_Action::EXPORT)) {
+ CRM_Core_Action::EXPORT)
+ ) {
$this->edit($action, $id);
}
// parent run
public function &links() {
if (!(self::$_links)) {
self::$_links = array(
- CRM_Core_Action::BROWSE => array(
- 'name' => ts('Accounts'),
- 'url' => 'civicrm/admin/financial/financialType/accounts',
- 'qs' => 'reset=1&action=browse&aid=%%id%%',
+ CRM_Core_Action::BROWSE => array(
+ 'name' => ts('Accounts'),
+ 'url' => 'civicrm/admin/financial/financialType/accounts',
+ 'qs' => 'reset=1&action=browse&aid=%%id%%',
'title' => ts('Accounts'),
),
- CRM_Core_Action::UPDATE => array(
- 'name' => ts('Edit'),
- 'url' => 'civicrm/admin/financial/financialType',
- 'qs' => 'action=update&id=%%id%%&reset=1',
+ CRM_Core_Action::UPDATE => array(
+ 'name' => ts('Edit'),
+ 'url' => 'civicrm/admin/financial/financialType',
+ 'qs' => 'action=update&id=%%id%%&reset=1',
'title' => ts('Edit Financial Type'),
),
CRM_Core_Action::DISABLE => array(
- 'name' => ts('Disable'),
- 'ref' => 'crm-enable-disable',
+ 'name' => ts('Disable'),
+ 'ref' => 'crm-enable-disable',
'title' => ts('Disable Financial Type'),
),
- CRM_Core_Action::ENABLE => array(
- 'name' => ts('Enable'),
- 'ref' => 'crm-enable-disable',
+ CRM_Core_Action::ENABLE => array(
+ 'name' => ts('Enable'),
+ 'ref' => 'crm-enable-disable',
'title' => ts('Enable Financial Type'),
),
- CRM_Core_Action::DELETE => array(
- 'name' => ts('Delete'),
- 'url' => 'civicrm/admin/financial/financialType',
- 'qs' => 'action=delete&id=%%id%%',
+ CRM_Core_Action::DELETE => array(
+ 'name' => ts('Delete'),
+ 'url' => 'civicrm/admin/financial/financialType',
+ 'qs' => 'action=delete&id=%%id%%',
'title' => ts('Delete Financial Type'),
),
);
public function &links() {
if (!(self::$_links)) {
self::$_links = array(
- CRM_Core_Action::UPDATE => array(
+ CRM_Core_Action::UPDATE => array(
'name' => ts('Edit'),
'url' => 'civicrm/admin/financial/financialType/accounts',
'qs' => 'action=update&id=%%id%%&aid=%%aid%%&reset=1',
'title' => ts('Edit Financial Type Account'),
),
- CRM_Core_Action::DELETE => array(
+ CRM_Core_Action::DELETE => array(
'name' => ts('Delete'),
'url' => 'civicrm/admin/financial/financialType/accounts',
'qs' => 'action=delete&id=%%id%%&aid=%%aid%%',
// attempt to save activity targets
$targetParams = array(
'activity_id' => $activity->id,
- 'contact_id' => $contact,
+ 'contact_id' => $contact,
'record_type_id' => $targetID,
);
$pcomponent = CRM_Utils_Request::retrieve('pcomponent', 'String', $this, TRUE);
if (in_array($pcomponent, array(
- 'contribute', 'event'))) {
+ 'contribute',
+ 'event'
+ ))) {
$values = array();
$params = array('id' => $this->_entityId);
CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_ContributionPage',
$params, $values, array('title', 'campaign_id', 'is_share')
);
- $this->_title = CRM_Utils_Array::value('title', $values);
- $this->_campaignId = CRM_Utils_Array::value('campaign_id', $values);
+ $this->_title = CRM_Utils_Array::value('title', $values);
+ $this->_campaignId = CRM_Utils_Array::value('campaign_id', $values);
$this->_entityTable = 'civicrm_contribution_page';
if ($pcomponent == 'event') {
$this->_entityTable = 'civicrm_event';
require_once 'CRM/PCP/BAO/PCP.php';
if ($linkText = CRM_PCP_BAO_PCP::getPcpBlockStatus($defaults['entity_id'], $defaults['entity_table'])) {
$linkTextUrl = CRM_Utils_System::url('civicrm/contribute/campaign',
- "action=add&reset=1&pageId={$defaults['entity_id']}&component=event",
- FALSE, NULL, TRUE,
- TRUE);
+ "action=add&reset=1&pageId={$defaults['entity_id']}&component=event",
+ FALSE, NULL, TRUE,
+ TRUE);
$this->assign('linkTextUrl', $linkTextUrl);
$this->assign('linkText', $linkText);
}
$fields = CRM_Grant_DAO_Grant::export();
$grantNote = array(
- 'grant_note' => array(
- 'title' => ts('Grant Note'),
+ 'grant_note' => array(
+ 'title' => ts('Grant Note'),
'name' => 'grant_note',
'data_type' => CRM_Utils_Type::T_TEXT,
- ));
+ )
+ );
$fields = array_merge($fields, $grantFields, $grantNote,
CRM_Core_BAO_CustomField::getFieldsForImport('Grant')
);
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause('civicrm_grant.grant_type_id', $op, $value, "Integer");
- $query->_qill[$grouping][] = ts('Grant Type %2 %1', array(1 => implode(' ' . ts('or') . ' ', $names), 2 => $op));
+ $query->_qill[$grouping][] = ts('Grant Type %2 %1', array(
+ 1 => implode(' ' . ts('or') . ' ', $names),
+ 2 => $op
+ ));
$query->_tables['civicrm_grant'] = $query->_whereTables['civicrm_grant'] = 1;
return;
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause('civicrm_grant.status_id', $op, $value, "Integer");
- $query->_qill[$grouping][] = ts('Grant Status %2 %1', array(1 => implode(' ' . ts('or') . ' ', $names), 2 => $op));
+ $query->_qill[$grouping][] = ts('Grant Status %2 %1', array(
+ 1 => implode(' ' . ts('or') . ' ', $names),
+ 2 => $op
+ ));
$query->_tables['civicrm_grant'] = $query->_whereTables['civicrm_grant'] = 1;
return;
* $Id$
*
*/
-class CRM_Grant_Config extends CRM_Core_Component_Config {}
+class CRM_Grant_Config extends CRM_Core_Component_Config {
+}
}
$this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
- $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
+ $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_grantType = NULL;
if ($this->_id) {
$this->_grantType =
// make this form an upload since we dont know if the custom data injected dynamically
// is of type file etc $uploadNames = $this->get( 'uploadNames' );
$this->addButtons(array(
- array(
- 'type' => 'upload',
- 'name' => ts('Save'),
- 'isDefault' => TRUE,
- ),
- array(
- 'type' => 'upload',
- 'name' => ts('Save and New'),
- 'js' => array('onclick' => "return verify( );"),
- 'subName' => 'new',
- ),
- array(
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ),
- )
+ array(
+ 'type' => 'upload',
+ 'name' => ts('Save'),
+ 'isDefault' => TRUE,
+ ),
+ array(
+ 'type' => 'upload',
+ 'name' => ts('Save and New'),
+ 'js' => array('onclick' => "return verify( );"),
+ 'subName' => 'new',
+ ),
+ array(
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ),
+ )
);
if ($this->_context == 'standalone') {
if ($this->_context == 'standalone') {
if ($buttonName == $this->getButtonName('upload', 'new')) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/grant/add',
- 'reset=1&action=add&context=standalone'
- ));
+ 'reset=1&action=add&context=standalone'
+ ));
}
else {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view',
- "reset=1&cid={$this->_contactID}&selectedChild=grant"
- ));
+ "reset=1&cid={$this->_contactID}&selectedChild=grant"
+ ));
}
}
elseif ($buttonName == $this->getButtonName('upload', 'new')) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view/grant',
- "reset=1&action=add&context=grant&cid={$this->_contactID}"
- ));
+ "reset=1&action=add&context=grant&cid={$this->_contactID}"
+ ));
}
}
}
*/
public function preProcess() {
$this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
- $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
- $context = CRM_Utils_Request::retrieve('context', 'String', $this);
+ $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
+ $context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->assign('context', $context);
$values = array();
$this->assign('grantType', $grantType[$values['grant_type_id']]);
$this->assign('grantStatus', $grantStatus[$values['status_id']]);
$grantTokens = array(
- 'amount_total', 'amount_requested', 'amount_granted',
- 'rationale', 'grant_report_received', 'application_received_date',
- 'decision_date', 'money_transfer_date', 'grant_due_date',
+ 'amount_total',
+ 'amount_requested',
+ 'amount_granted',
+ 'rationale',
+ 'grant_report_received',
+ 'application_received_date',
+ 'decision_date',
+ 'money_transfer_date',
+ 'grant_due_date',
);
foreach ($grantTokens as $token) {
* driven by the wizard framework
*/
- $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
- $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
+ $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
+ $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
+ $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'search');
$this->assign("context", $this->_context);
else {
$queryParams = $form->get('queryParams');
$sortOrder = NULL;
- if ($form->get(CRM_Utils_Sort::SORT_ORDER )) {
+ if ($form->get(CRM_Utils_Sort::SORT_ORDER)) {
$sortOrder = $form->get(CRM_Utils_Sort::SORT_ORDER);
}
$query = new CRM_Contact_BAO_Query($queryParams, NULL, NULL, FALSE, FALSE,
*/
public function registerTab() {
return array(
- 'title' => ts('Grants'),
+ 'title' => ts('Grants'),
'url' => 'grant',
'weight' => 50,
);
*/
public function registerAdvancedSearchPane() {
return array(
- 'title' => ts('Grants'),
+ 'title' => ts('Grants'),
'weight' => 50,
);
}
) {
$shortCuts = array_merge($shortCuts, array(
array(
- 'path' => 'civicrm/grant/add',
- 'query' => "reset=1&action=add&context=standalone",
- 'ref' => 'new-grant',
- 'title' => ts('Grant'),
- )));
+ 'path' => 'civicrm/grant/add',
+ 'query' => "reset=1&action=add&context=standalone",
+ 'ref' => 'new-grant',
+ 'title' => ts('Grant'),
+ )
+ ));
}
}
}
* @return void
*/
public function preProcess() {
- $context = CRM_Utils_Request::retrieve('context', 'String', $this);
+ $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);
+ $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
if ($context == 'standalone') {
$this->_action = CRM_Core_Action::ADD;
}
public function setContext() {
- $context = CRM_Utils_Request::retrieve('context', 'String', $this);
+ $context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this);
- $session = CRM_Core_Session::singleton();
+ $session = CRM_Core_Session::singleton();
$qfKey = CRM_Utils_Request::retrieve('key', 'String', $this);
//validate the qfKey
$session->pushUserContext($url);
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean',
- CRM_Core_DAO::$_nullObject
- )) {
+ CRM_Core_DAO::$_nullObject
+ )
+ ) {
CRM_Grant_BAO_Grant::del($this->_id);
CRM_Utils_System::redirect($url);
}
// submitted form values
$this->_queryParams = &$queryParams;
- $this->_single = $single;
- $this->_limit = $limit;
+ $this->_single = $single;
+ $this->_limit = $limit;
$this->_context = $context;
$this->_grantClause = $grantClause;
if ($cid) {
$delLink = array(
CRM_Core_Action::DELETE => array(
- 'name' => ts('Delete'),
+ 'name' => ts('Delete'),
'url' => 'civicrm/contact/view/grant',
'qs' => 'action=delete&reset=1&cid=%%cid%%&id=%%id%%&selectedChild=grant' . $extraParams,
'title' => ts('Delete Grant'),
if (!isset(self::$_columnHeaders)) {
self::$_columnHeaders = array(
array(
- 'name' => ts('Status'),
+ 'name' => ts('Status'),
'sort' => 'grant_status',
'direction' => CRM_Utils_Sort::DONTCARE,
),
public static function &tasks() {
if (!(self::$_tasks)) {
self::$_tasks = array(
- 1 => array(
- 'title' => ts('Delete Grants'),
+ 1 => array(
+ 'title' => ts('Delete Grants'),
'class' => 'CRM_Grant_Form_Task_Delete',
'result' => FALSE,
),
public function preProcess() {
$this->_id = $this->get('id');
if ($this->_id) {
- $breadCrumb = array(array(
- 'title' => ts('Manage Groups'),
+ $breadCrumb = array(
+ array(
+ 'title' => ts('Manage Groups'),
'url' => CRM_Utils_System::url('civicrm/group',
'reset=1'
),
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadCrumb);
$this->_groupValues = array();
- $params = array('id' => $this->_id);
- $this->_group = CRM_Contact_BAO_Group::retrieve($params, $this->_groupValues);
+ $params = array('id' => $this->_id);
+ $this->_group = CRM_Contact_BAO_Group::retrieve($params, $this->_groupValues);
$this->_title = $this->_groupValues['title'];
}
'id' => $this->_id,
'title' => $this->_title,
'saved_search_id' =>
- isset($this->_groupValues['saved_search_id']) ? $this->_groupValues['saved_search_id'] : '',
+ isset($this->_groupValues['saved_search_id']) ? $this->_groupValues['saved_search_id'] : '',
);
if (isset($this->_groupValues['saved_search_id'])) {
$groupValues['mapping_id'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch',
}
if (!((CRM_Core_Permission::check('access CiviMail')) ||
- (CRM_Mailing_Info::workflowEnabled() &&
- CRM_Core_Permission::check('create mailings')
- )
- )) {
+ (CRM_Mailing_Info::workflowEnabled() &&
+ CRM_Core_Permission::check('create mailings')
+ )
+ )
+ ) {
$groupTypes = CRM_Core_OptionGroup::values('group_type', TRUE);
if ($defaults['group_type'][$groupTypes['Mailing List']] == 1) {
$this->assign('freezeMailignList', $groupTypes['Mailing List']);
array(
'type' => 'upload',
'name' =>
- ($this->_action == CRM_Core_Action::ADD) ? ts('Continue') : ts('Save'),
+ ($this->_action == CRM_Core_Action::ADD) ? ts('Continue') : ts('Save'),
'isDefault' => TRUE,
),
array(
);
$this->addButtons(array(
- array(
- 'type' => 'refresh',
- 'name' => ts('Search'),
- 'isDefault' => TRUE,
- ),
- ));
+ array(
+ 'type' => 'refresh',
+ 'name' => ts('Search'),
+ 'isDefault' => TRUE,
+ ),
+ ));
parent::buildQuickForm();
$this->assign('suppressForm', TRUE);
if (isset($params['parent_id'])) {
// requesting child groups for a given parent
$params['page'] = 1;
- $params['rp'] = 0;
+ $params['rp'] = 0;
$groups = CRM_Contact_BAO_Group::getGroupListSelector($params);
CRM_Utils_JSON::output($groups);
else {
$sortMapper = array(
0 => 'groups.title',
- 1 => 'count',
- 2 => 'createdBy.sort_name',
- 3 => '',
+ 1 => 'count',
+ 2 => 'createdBy.sort_name',
+ 3 => '',
4 => 'groups.group_type',
- 5 => 'groups.visibility',
+ 5 => 'groups.visibility',
);
- $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
- $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
- $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
- $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
+ $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
+ $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
+ $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
+ $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
if ($sort && $sortOrder) {
// go ahead with flat hierarchy, CRM-12225
if (empty($groups)) {
$groupsAccessible = CRM_Core_PseudoConstant::group();
- $parentsOnly = CRM_Utils_Array::value('parentsOnly', $params);
+ $parentsOnly = CRM_Utils_Array::value('parentsOnly', $params);
if (!empty($groupsAccessible) && $parentsOnly) {
// recompute group list with flat hierarchy
$params['parentsOnly'] = 0;
$iFilteredTotal = $iTotal = $params['total'];
$selectorElements = array(
- 'group_name', 'count', 'created_by', 'group_description',
- 'group_type', 'visibility', 'org_info', 'links', 'class',
+ 'group_name',
+ 'count',
+ 'created_by',
+ 'group_description',
+ 'group_type',
+ 'visibility',
+ 'org_info',
+ 'links',
+ 'class',
);
if (empty($params['showOrgInfo'])) {
$form->assign('uploadSize', $uploadSize);
$form->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
$form->setMaxFileSize($uploadFileSize);
- $form->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize);
+ $form->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(
+ 1 => $uploadSize,
+ 2 => $uploadFileSize
+ )), 'maxfilesize', $uploadFileSize);
$form->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
$form->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
$result['original_col_header'] = $firstrow;
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
- $columns = array_map($strtolower, $firstrow);
- $columns = str_replace(' ', '_', $columns);
- $columns = preg_replace('/[^a-z_]/', '', $columns);
+ $columns = array_map($strtolower, $firstrow);
+ $columns = str_replace(' ', '_', $columns);
+ $columns = preg_replace('/[^a-z_]/', '', $columns);
// need to take care of null as well as duplicate col names.
$duplicateColName = FALSE;
rewind($fd);
}
- $sql = NULL;
+ $sql = NULL;
$first = TRUE;
$count = 0;
while ($row = fgetcsv($fd, 0, $fieldSeparator)) {
$sql = "INSERT IGNORE INTO $table VALUES $sql";
$db->query($sql);
- $sql = NULL;
+ $sql = NULL;
$first = TRUE;
$count = 0;
}
* @return string
*/
public function defaultFromData(&$patterns, $index) {
- $best = '';
+ $best = '';
$bestHits = 0;
- $n = count($this->_dataValues);
+ $n = count($this->_dataValues);
foreach ($patterns as $key => $re) {
// Skip empty key/patterns
* $Id$
*
*/
-
-
abstract class CRM_Import_Parser {
/**
* Settings
* @param string $interval
*/
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'];
+ $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;
- $this->log_date = $log_date;
- $this->interval = $interval;
+ $this->log_date = $log_date;
+ $this->interval = $interval;
}
/**
if ($contactID) {
$params[3] = array($contactID, 'Integer');
switch ($table) {
- case 'civicrm_contact':
- $contactIdClause = "AND id = %3";
- break;
+ case 'civicrm_contact':
+ $contactIdClause = "AND id = %3";
+ break;
- case 'civicrm_note':
- $contactIdClause = "AND (( entity_id = %3 AND entity_table = 'civicrm_contact' ) OR (entity_id IN (SELECT note.id FROM `{$this->db}`.log_civicrm_note note WHERE note.entity_id = %3 AND note.entity_table = 'civicrm_contact') AND entity_table = 'civicrm_note'))";
- break;
+ case 'civicrm_note':
+ $contactIdClause = "AND (( entity_id = %3 AND entity_table = 'civicrm_contact' ) OR (entity_id IN (SELECT note.id FROM `{$this->db}`.log_civicrm_note note WHERE note.entity_id = %3 AND note.entity_table = 'civicrm_contact') AND entity_table = 'civicrm_note'))";
+ break;
- case 'civicrm_entity_tag':
- $contactIdClause = "AND entity_id = %3 AND entity_table = 'civicrm_contact'";
- break;
+ case 'civicrm_entity_tag':
+ $contactIdClause = "AND entity_id = %3 AND entity_table = 'civicrm_contact'";
+ break;
- case 'civicrm_relationship':
- $contactIdClause = "AND (contact_id_a = %3 OR contact_id_b = %3)";
- break;
+ case 'civicrm_relationship':
+ $contactIdClause = "AND (contact_id_a = %3 OR contact_id_b = %3)";
+ break;
- case 'civicrm_activity':
- $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
- $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
- $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
- $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
+ case 'civicrm_activity':
+ $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
+ $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
+ $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
+ $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
- $join = "
+ $join = "
LEFT JOIN civicrm_activity_contact at ON at.activity_id = lt.id AND at.contact_id = %3 AND at.record_type_id = {$targetID}
LEFT JOIN civicrm_activity_contact aa ON aa.activity_id = lt.id AND aa.contact_id = %3 AND aa.record_type_id = {$assigneeID}
LEFT JOIN civicrm_activity_contact source ON source.activity_id = lt.id AND source.contact_id = %3 AND source.record_type_id = {$sourceID} ";
- $contactIdClause = "AND (at.id IS NOT NULL OR aa.id IS NOT NULL OR source.id IS NOT NULL)";
- break;
-
- case 'civicrm_case':
- $contactIdClause = "AND id = (select case_id FROM civicrm_case_contact WHERE contact_id = %3 LIMIT 1)";
- break;
+ $contactIdClause = "AND (at.id IS NOT NULL OR aa.id IS NOT NULL OR source.id IS NOT NULL)";
+ break;
- default:
- if (array_key_exists($table, $addressCustomTables)) {
- $join = "INNER JOIN `{$this->db}`.`log_civicrm_address` et ON et.id = lt.entity_id";
- $contactIdClause = "AND contact_id = %3";
+ case 'civicrm_case':
+ $contactIdClause = "AND id = (select case_id FROM civicrm_case_contact WHERE contact_id = %3 LIMIT 1)";
break;
- }
- // allow tables to be extended by report hook query objects
- list($contactIdClause, $join) = CRM_Report_BAO_Hook::singleton()->logDiffClause($this, $table);
+ default:
+ if (array_key_exists($table, $addressCustomTables)) {
+ $join = "INNER JOIN `{$this->db}`.`log_civicrm_address` et ON et.id = lt.entity_id";
+ $contactIdClause = "AND contact_id = %3";
+ break;
+ }
- if (empty($contactIdClause)) {
- $contactIdClause = "AND contact_id = %3";
- }
- if (strpos($table, 'civicrm_value') !== FALSE) {
- $contactIdClause = "AND entity_id = %3";
- }
+ // allow tables to be extended by report hook query objects
+ list($contactIdClause, $join) = CRM_Report_BAO_Hook::singleton()->logDiffClause($this, $table);
+
+ if (empty($contactIdClause)) {
+ $contactIdClause = "AND contact_id = %3";
+ }
+ if (strpos($table, 'civicrm_value') !== FALSE) {
+ $contactIdClause = "AND entity_id = %3";
+ }
}
}
case 'Delete':
// the previous state is kept in the current state, current should keep the keys and clear the values
$original = $changed;
- foreach ($changed as & $val) $val = NULL;
+ foreach ($changed as & $val) {
+ $val = NULL;
+ }
$changed['log_action'] = 'Delete';
break;
$values[$table] = array(
'contribution_page_id' => CRM_Contribute_PseudoConstant::contributionPage(),
'contribution_status_id' => CRM_Contribute_PseudoConstant::contributionStatus(),
- 'financial_type_id' => CRM_Contribute_PseudoConstant::financialType(),
+ 'financial_type_id' => CRM_Contribute_PseudoConstant::financialType(),
'country_id' => CRM_Core_PseudoConstant::country(),
'gender_id' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'),
'location_type_id' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'),
'website_type_id' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'),
'activity_type_id' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE),
'case_type_id' => CRM_Case_PseudoConstant::caseType('title', FALSE),
- 'priority_id' => CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id'),
+ 'priority_id' => CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id'),
);
// for columns that appear in more than 1 table
$this->db = $dsn['database'];
$this->log_conn_id = CRM_Utils_Request::retrieve('log_conn_id', 'Integer', CRM_Core_DAO::$_nullObject);
- $this->log_date = CRM_Utils_Request::retrieve('log_date', 'String', CRM_Core_DAO::$_nullObject);
- $this->cid = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
- $this->raw = CRM_Utils_Request::retrieve('raw', 'Boolean', CRM_Core_DAO::$_nullObject);
+ $this->log_date = CRM_Utils_Request::retrieve('log_date', 'String', CRM_Core_DAO::$_nullObject);
+ $this->cid = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
+ $this->raw = CRM_Utils_Request::retrieve('raw', 'Boolean', CRM_Core_DAO::$_nullObject);
- $this->altered_name = CRM_Utils_Request::retrieve('alteredName', 'String', CRM_Core_DAO::$_nullObject);
- $this->altered_by = CRM_Utils_Request::retrieve('alteredBy', 'String', CRM_Core_DAO::$_nullObject);
+ $this->altered_name = CRM_Utils_Request::retrieve('alteredName', 'String', CRM_Core_DAO::$_nullObject);
+ $this->altered_by = CRM_Utils_Request::retrieve('alteredBy', 'String', CRM_Core_DAO::$_nullObject);
$this->altered_by_id = CRM_Utils_Request::retrieve('alteredById', 'Integer', CRM_Core_DAO::$_nullObject);
parent::__construct();
CRM_Utils_System::resetBreadCrumb();
$breadcrumb =
array(
- array(
- 'title' => ts('Home'),
- 'url' => CRM_Utils_System::url()),
- array(
- 'title' => ts('CiviCRM'),
- 'url' => CRM_Utils_System::url('civicrm', 'reset=1')),
- array(
- 'title' => ts('View Contact'),
- 'url' => CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->cid}")),
- array(
- 'title' => ts('Search Results'),
- 'url' => CRM_Utils_System::url('civicrm/contact/search', "force=1")),
- );
+ array(
+ 'title' => ts('Home'),
+ 'url' => CRM_Utils_System::url()
+ ),
+ array(
+ 'title' => ts('CiviCRM'),
+ 'url' => CRM_Utils_System::url('civicrm', 'reset=1')
+ ),
+ array(
+ 'title' => ts('View Contact'),
+ 'url' => CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->cid}")
+ ),
+ array(
+ 'title' => ts('Search Results'),
+ 'url' => CRM_Utils_System::url('civicrm/contact/search', "force=1")
+ ),
+ );
CRM_Utils_System::appendBreadCrumb($breadcrumb);
if (CRM_Utils_Request::retrieve('revert', 'Boolean', CRM_Core_DAO::$_nullObject)) {
$skipped = array('contact_id', 'entity_id', 'id');
foreach ($diffs as $diff) {
$field = $diff['field'];
- $from = $diff['from'];
- $to = $diff['to'];
+ $from = $diff['from'];
+ $to = $diff['to'];
if ($this->raw) {
$field = "$table.$field";
if ((substr($from, 0, 1) == CRM_Core_DAO::VALUE_SEPARATOR &&
substr($from, -1, 1) == CRM_Core_DAO::VALUE_SEPARATOR) ||
(substr($to, 0, 1) == CRM_Core_DAO::VALUE_SEPARATOR &&
- substr($to, -1, 1) == CRM_Core_DAO::VALUE_SEPARATOR)) {
+ substr($to, -1, 1) == CRM_Core_DAO::VALUE_SEPARATOR)
+ ) {
$froms = $tos = array();
foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($from, CRM_Core_DAO::VALUE_SEPARATOR)) as $val) {
$froms[] = CRM_Utils_Array::value($val, $values[$field]);
$tos[] = CRM_Utils_Array::value($val, $values[$field]);
}
$from = implode(', ', array_filter($froms));
- $to = implode(', ', array_filter($tos));
+ $to = implode(', ', array_filter($tos));
}
if (isset($values[$field][$from])) {
);
$this->assign('whom_url', CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->cid}"));
- $this->assign('who_url', CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->altered_by_id}"));
+ $this->assign('who_url', CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->altered_by_id}"));
$this->assign('whom_name', $this->altered_name);
- $this->assign('who_name', $this->altered_by);
+ $this->assign('who_name', $this->altered_by);
$this->assign('log_date', CRM_Utils_Date::mysqlToIso($this->log_date));
* @param $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'];
+ $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;
- $this->log_date = $log_date;
+ $this->log_date = $log_date;
}
/**
foreach ($row as $id => $changes) {
$inserts = array('id' => '%1');
$updates = array();
- $params = array(1 => array($id, 'Integer'));
+ $params = array(1 => array($id, 'Integer'));
$counter = 2;
foreach ($changes as $field => $value) {
// don’t try reverting a field that’s no longer there
$value = CRM_Utils_Date::isoToMysql($value);
break;
}
- $inserts[$field] = "%$counter";
- $updates[] = "$field = %$counter";
+ $inserts[$field] = "%$counter";
+ $updates[] = "$field = %$counter";
$params[$counter] = array($value, $ctypes[$table][$field]);
$counter++;
}
//CRM-13028 / NYSS-6933 - table => array (cols) - to be excluded from the update statement
private $exceptions = array(
- 'civicrm_job' => array('last_run'),
+ 'civicrm_job' => array('last_run'),
'civicrm_group' => array('cache_date'),
);
$dao->executeQuery("DROP TRIGGER IF EXISTS {$validName}_before_update");
$dao->executeQuery("DROP TRIGGER IF EXISTS {$validName}_before_delete");
- // after triggers
+ // after triggers
$dao->executeQuery("DROP TRIGGER IF EXISTS {$validName}_after_insert");
$dao->executeQuery("DROP TRIGGER IF EXISTS {$validName}_after_update");
$dao->executeQuery("DROP TRIGGER IF EXISTS {$validName}_after_delete");
/**
* Sync log tables and rebuild triggers.
*
- * @param bool $enableLogging: Ensure logging is enabled
+ * @param bool $enableLogging : Ensure logging is enabled
*
* @return void
*/
// add report instances
$domain_id = CRM_Core_Config::domainID();
foreach ($this->reports as $report) {
- $dao = new CRM_Report_DAO_ReportInstance;
- $dao->domain_id = $domain_id;
- $dao->report_id = $report;
- $dao->title = $titles[$report];
+ $dao = new CRM_Report_DAO_ReportInstance;
+ $dao->domain_id = $domain_id;
+ $dao->report_id = $report;
+ $dao->title = $titles[$report];
$dao->permission = 'administer CiviCRM';
if ($report == 'logging/contact/summary')
$dao->is_reserved = 1;
}
$columnSpecs[$dao->TABLE_NAME][$dao->COLUMN_NAME] =
array(
- 'COLUMN_NAME' => $dao->COLUMN_NAME,
- 'DATA_TYPE' => $dao->DATA_TYPE,
- 'IS_NULLABLE' => $dao->IS_NULLABLE,
- 'COLUMN_DEFAULT' => $dao->COLUMN_DEFAULT,
- );
+ 'COLUMN_NAME' => $dao->COLUMN_NAME,
+ 'DATA_TYPE' => $dao->DATA_TYPE,
+ 'IS_NULLABLE' => $dao->IS_NULLABLE,
+ 'COLUMN_DEFAULT' => $dao->COLUMN_DEFAULT,
+ );
}
}
return $columnSpecs[$table];
*/
public function columnsWithDiffSpecs($civiTable, $logTable) {
$civiTableSpecs = $this->columnSpecsOf($civiTable);
- $logTableSpecs = $this->columnSpecsOf($logTable);
+ $logTableSpecs = $this->columnSpecsOf($logTable);
$diff = array('ADD' => array(), 'MODIFY' => array(), 'OBSOLETE' => array());
$diff['MODIFY'][] = $col;
}
elseif ($civiTableSpecs[$col]['IS_NULLABLE'] != CRM_Utils_Array::value('IS_NULLABLE', $logTableSpecs[$col]) &&
- $logTableSpecs[$col]['IS_NULLABLE'] == 'NO') {
+ $logTableSpecs[$col]['IS_NULLABLE'] == 'NO'
+ ) {
// if is-null property is different, and log table's column is NOT-NULL, surely consider the column
$diff['MODIFY'][] = $col;
}
elseif ($civiTableSpecs[$col]['COLUMN_DEFAULT'] != CRM_Utils_Array::value('COLUMN_DEFAULT', $logTableSpecs[$col]) &&
- !strstr($civiTableSpecs[$col]['COLUMN_DEFAULT'], 'TIMESTAMP')) {
+ !strstr($civiTableSpecs[$col]['COLUMN_DEFAULT'], 'TIMESTAMP')
+ ) {
// if default property is different, and its not about a timestamp column, consider it
$diff['MODIFY'][] = $col;
}
$oldCols = array_diff(array_keys($logTableSpecs), array_keys($civiTableSpecs));
foreach ($oldCols as $col) {
if (!in_array($col, array('log_date', 'log_conn_id', 'log_user_id', 'log_action')) &&
- $logTableSpecs[$col]['IS_NULLABLE'] == 'NO') {
+ $logTableSpecs[$col]['IS_NULLABLE'] == 'NO'
+ ) {
// if its a column present only in log table, not among those used by log tables for special purpose, and not-null
$diff['OBSOLETE'][] = $col;
}
// delete report instances
$domain_id = CRM_Core_Config::domainID();
foreach ($this->reports as $report) {
- $dao = new CRM_Report_DAO_ReportInstance;
+ $dao = new CRM_Report_DAO_ReportInstance;
$dao->domain_id = $domain_id;
$dao->report_id = $report;
$dao->delete();
$sqlStmt = '';
foreach ($columns as $column) {
- $sqlStmt .= "NEW.$column, ";
+ $sqlStmt .= "NEW.$column, ";
$deleteSQL .= "OLD.$column, ";
}
- $sqlStmt .= "CONNECTION_ID(), @civicrm_user_id, '{eventName}');";
+ $sqlStmt .= "CONNECTION_ID(), @civicrm_user_id, '{eventName}');";
$deleteSQL .= "CONNECTION_ID(), @civicrm_user_id, '{eventName}');";
- $sqlStmt .= "END IF;";
+ $sqlStmt .= "END IF;";
$deleteSQL .= "END IF;";
$insertSQL .= $sqlStmt;
$mailingGroup = new CRM_Mailing_DAO_MailingGroup();
$mailing = CRM_Mailing_BAO_Mailing::getTableName();
- $job = CRM_Mailing_BAO_MailingJob::getTableName();
- $mg = CRM_Mailing_DAO_MailingGroup::getTableName();
- $eq = CRM_Mailing_Event_DAO_Queue::getTableName();
- $ed = CRM_Mailing_Event_DAO_Delivered::getTableName();
- $eb = CRM_Mailing_Event_DAO_Bounce::getTableName();
+ $job = CRM_Mailing_BAO_MailingJob::getTableName();
+ $mg = CRM_Mailing_DAO_MailingGroup::getTableName();
+ $eq = CRM_Mailing_Event_DAO_Queue::getTableName();
+ $ed = CRM_Mailing_Event_DAO_Delivered::getTableName();
+ $eb = CRM_Mailing_Event_DAO_Bounce::getTableName();
$email = CRM_Core_DAO_Email::getTableName();
if ($mode == 'sms') {
if ($mode == 'sms') {
$phoneTypes = CRM_Core_OptionGroup::values('phone_type', TRUE, FALSE, FALSE, NULL, 'name');
- $query = "REPLACE INTO I_$job_id (phone_id, contact_id)
+ $query = "REPLACE INTO I_$job_id (phone_id, contact_id)
SELECT DISTINCT $phone.id as phone_id,
$contact.id as contact_id
$patterns = array();
- $protos = '(https?|ftp)';
+ $protos = '(https?|ftp)';
$letters = '\w';
- $gunk = '\{\}/#~:.?+=&;%@!\,\-';
- $punc = '.:?\-';
- $any = "{$letters}{$gunk}{$punc}";
+ $gunk = '\{\}/#~:.?+=&;%@!\,\-';
+ $punc = '.:?\-';
+ $any = "{$letters}{$gunk}{$punc}";
if ($onlyHrefs) {
$pattern = "\\bhref[ ]*=[ ]*([\"'])?(($protos:[$any]+?(?=[$punc]*[^$any]|$)))([\"'])?";
}
* returns an array that denotes the type of token that we are dealing with
* we use the type later on when we are doing a token replcement lookup
*
- * @param string $token The token for which we will be doing adata lookup
+ * @param string $token The token for which we will be doing adata lookup
*
* @return array
* An array that holds the token itself and the type.
**/
private function getPreparedTemplates() {
if (!$this->preparedTemplates) {
- $patterns['html'] = $this->getPatterns(TRUE);
+ $patterns['html'] = $this->getPatterns(TRUE);
$patterns['subject'] = $patterns['text'] = $this->getPatterns();
- $templates = $this->getTemplates();
+ $templates = $this->getTemplates();
$this->preparedTemplates = array();
foreach (array(
- 'html', 'text', 'subject') as $key) {
+ 'html',
+ 'text',
+ 'subject'
+ ) as $key) {
if (!isset($templates[$key])) {
continue;
}
- $matches = array();
- $tokens = array();
+ $matches = array();
+ $tokens = array();
$split_template = array();
$email = $templates[$key];
public function getTestRecipients($testParams) {
if (array_key_exists($testParams['test_group'], CRM_Core_PseudoConstant::group())) {
$contacts = civicrm_api('contact', 'get', array(
- 'version' => 3,
- 'group' => $testParams['test_group'],
- 'return' => 'id',
- 'options' => array('limit' => 100000000000,
- ))
- );
+ 'version' => 3,
+ 'group' => $testParams['test_group'],
+ 'return' => 'id',
+ 'options' => array(
+ 'limit' => 100000000000,
+ )
+ )
+ );
foreach (array_keys($contacts['values']) as $groupContact) {
$query = "
* @return void
*/
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();
+ $config = CRM_Core_Config::singleton();
+ $localpart = CRM_Core_BAO_MailSettings::defaultLocalpart();
+ $emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
$includeMessageId = CRM_Core_BAO_MailSettings::includeMessageId();
if ($includeMessageId && (!array_key_exists('Message-ID', $headers))) {
$headers['Message-ID'] = '<' . implode($config->verpSeparator,
- array(
- $localpart . $prefix,
- $job_id,
- $event_queue_id,
- $hash,
- )
- ) . "@{$emailDomain}>";
+ array(
+ $localpart . $prefix,
+ $job_id,
+ $event_queue_id,
+ $hash,
+ )
+ ) . "@{$emailDomain}>";
}
}
*/
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();
- $bao->_domain = CRM_Core_BAO_Domain::getDomain();
+ $config = CRM_Core_Config::singleton();
+ $bao = new CRM_Mailing_BAO_Mailing();
+ $bao->_domain = CRM_Core_BAO_Domain::getDomain();
$bao->from_name = $bao->from_email = $bao->subject = '';
// use $bao's instance method to get verp and urls
foreach ($verpTokens as $key => $value) {
$verp[$key] = implode($config->verpSeparator,
- array(
- $localpart . $value,
- $job_id,
- $event_queue_id,
- $hash,
- )
- ) . "@$emailDomain";
+ array(
+ $localpart . $value,
+ $job_id,
+ $event_queue_id,
+ $hash,
+ )
+ ) . "@$emailDomain";
}
//handle should override VERP address.
if (!$contact || is_a($contact, 'CRM_Core_Error')) {
CRM_Core_Error::debug_log_message(ts('CiviMail will not send email to a non-existent contact: %1',
- array(1 => $contactId)
- ));
+ array(1 => $contactId)
+ ));
// setting this because function is called by reference
//@todo test not calling function by reference
$res = NULL;
$pEmails = array();
foreach ($pTemplates as $type => $pTemplate) {
- $html = ($type == 'html') ? TRUE : FALSE;
+ $html = ($type == 'html') ? TRUE : FALSE;
$pEmails[$type] = array();
- $pEmail = &$pEmails[$type];
- $template = &$pTemplates[$type]['template'];
- $tokens = &$pTemplates[$type]['tokens'];
- $idx = 0;
+ $pEmail = &$pEmails[$type];
+ $template = &$pTemplates[$type]['template'];
+ $tokens = &$pTemplates[$type]['tokens'];
+ $idx = 0;
if (!empty($tokens)) {
foreach ($tokens as $idx => $token) {
$token_data = $this->getTokenData($token, $html, $contact, $verp, $urls, $event_queue_id);
if ($text && ($test || $contact['preferred_mail_format'] == 'Text' ||
$contact['preferred_mail_format'] == 'Both' ||
($contact['preferred_mail_format'] == 'HTML' && !array_key_exists('html', $pEmails))
- )) {
+ )
+ ) {
$textBody = join('', $text);
if ($useSmarty) {
$textBody = $smarty->fetch("string:$textBody");
if ($html && ($test || ($contact['preferred_mail_format'] == 'HTML' ||
$contact['preferred_mail_format'] == 'Both'
- ))) {
+ ))
+ ) {
$htmlBody = join('', $html);
if ($useSmarty) {
$htmlBody = $smarty->fetch("string:$htmlBody");
// CRM-9833
// something went wrong, lets log it and return null (by reference)
CRM_Core_Error::debug_log_message(ts('CiviMail will not send an empty mail body, Skipping: %1',
- array(1 => $email)
- ));
+ array(1 => $email)
+ ));
$res = NULL;
return $res;
}
foreach ($mailParams as $paramKey => $paramValue) {
//exclude values not intended for the header
if (!in_array($paramKey, array(
- 'text', 'html', 'attachments', 'toName', 'toEmail'))) {
+ 'text',
+ 'html',
+ 'attachments',
+ 'toName',
+ 'toEmail'
+ ))
+ ) {
$headers[$paramKey] = $paramValue;
}
}
* and returns the appropriate data for the token
*/
private function getTokenData(&$token_a, $html = FALSE, &$contact, &$verp, &$urls, $event_queue_id) {
- $type = $token_a['type'];
+ $type = $token_a['type'];
$token = $token_a['token'];
- $data = $token;
+ $data = $token;
$useSmarty = defined('CIVICRM_MAIL_SMARTY') && CIVICRM_MAIL_SMARTY ? TRUE : FALSE;
if (!isset($this->id)) {
return array();
}
- $mg = new CRM_Mailing_DAO_MailingGroup();
+ $mg = new CRM_Mailing_DAO_MailingGroup();
$mgtable = CRM_Mailing_DAO_MailingGroup::getTableName();
- $group = CRM_Contact_BAO_Group::getTableName();
+ $group = CRM_Contact_BAO_Group::getTableName();
$mg->query("SELECT $group.title as name FROM $mgtable
INNER JOIN $group ON $mgtable.entity_id = $group.id
CRM_Utils_Hook::pre('create', 'Mailing', NULL, $params);
}
- $mailing = new static();
- $mailing->id = $id;
+ $mailing = new static();
+ $mailing->id = $id;
$mailing->domain_id = CRM_Utils_Array::value('domain_id', $params, CRM_Core_Config::domainID());
if (!isset($params['replyto_email']) &&
);
if (isset($domain['from_email'])) {
$domain_email = $domain['from_email'];
- $domain_name = $domain['from_name'];
+ $domain_name = $domain['from_name'];
}
else {
$domain_email = 'info@EXAMPLE.ORG';
- $domain_name = 'EXAMPLE.ORG';
+ $domain_name = 'EXAMPLE.ORG';
}
if (!isset($params['created_id'])) {
$session =& CRM_Core_Session::singleton();
// load the default config settings for each
// eg reply_id, unsubscribe_id need to use
// correct template IDs here
- 'override_verp' => TRUE,
+ 'override_verp' => TRUE,
'forward_replies' => FALSE,
- 'open_tracking' => TRUE,
- 'url_tracking' => TRUE,
- 'visibility' => 'Public Pages',
- 'replyto_email' => $domain_email,
- 'header_id' => CRM_Mailing_PseudoConstant::defaultComponent('header_id', ''),
- 'footer_id' => CRM_Mailing_PseudoConstant::defaultComponent('footer_id', ''),
- 'from_email' => $domain_email,
- 'from_name' => $domain_name,
+ 'open_tracking' => TRUE,
+ 'url_tracking' => TRUE,
+ 'visibility' => 'Public Pages',
+ 'replyto_email' => $domain_email,
+ 'header_id' => CRM_Mailing_PseudoConstant::defaultComponent('header_id', ''),
+ 'footer_id' => CRM_Mailing_PseudoConstant::defaultComponent('footer_id', ''),
+ 'from_email' => $domain_email,
+ 'from_name' => $domain_name,
'msg_template_id' => NULL,
- 'created_id' => $params['created_id'],
- 'approver_id' => NULL,
- 'auto_responder' => 0,
- 'created_date' => date('YmdHis'),
- 'scheduled_date' => NULL,
- 'approval_date' => NULL,
+ 'created_id' => $params['created_id'],
+ 'approver_id' => NULL,
+ 'auto_responder' => 0,
+ 'created_date' => date('YmdHis'),
+ 'scheduled_date' => NULL,
+ 'approval_date' => NULL,
);
// Get the default from email address, if not provided.
if (!empty($params['search_id']) && !empty($params['group_id'])) {
$mg->reset();
- $mg->mailing_id = $mailing->id;
+ $mg->mailing_id = $mailing->id;
$mg->entity_table = $groupTableName;
- $mg->entity_id = $params['group_id'];
- $mg->search_id = $params['search_id'];
- $mg->search_args = $params['search_args'];
- $mg->group_type = 'Include';
+ $mg->entity_id = $params['group_id'];
+ $mg->search_id = $params['search_id'];
+ $mg->search_args = $params['search_args'];
+ $mg->group_type = 'Include';
$mg->save();
}
* 'include' or 'exclude'.
* @param string $entity
* 'groups' or 'mailings'.
- * @param array<int> $entityIds
+ * @param array <int> $entityIds
* @throws CiviCRM_API3_Exception
*/
public static function replaceGroups($mailingId, $type, $entity, $entityIds) {
'forward' => CRM_Mailing_Event_BAO_Forward::getTableName(),
'url' => CRM_Mailing_BAO_TrackableURL::getTableName(),
'urlopen' =>
- CRM_Mailing_Event_BAO_TrackableURLOpen::getTableName(),
+ CRM_Mailing_Event_BAO_TrackableURLOpen::getTableName(),
'component' => CRM_Mailing_BAO_Component::getTableName(),
'spool' => CRM_Mailing_BAO_Spool::getTableName(),
);
'type' => $components[$mailing->type],
'name' => $mailing->name,
'link' =>
- CRM_Utils_System::url('civicrm/mailing/component',
- "reset=1&action=update&id={$mailing->id}"
- ),
+ CRM_Utils_System::url('civicrm/mailing/component',
+ "reset=1&action=update&id={$mailing->id}"
+ ),
);
}
while ($mailing->fetch()) {
$row = array();
if (isset($mailing->group_id)) {
- $row['id'] = $mailing->group_id;
+ $row['id'] = $mailing->group_id;
$row['name'] = $mailing->group_title;
$row['link'] = CRM_Utils_System::url('civicrm/group/search',
- "reset=1&force=1&context=smog&gid={$row['id']}"
+ "reset=1&force=1&context=smog&gid={$row['id']}"
);
}
else {
- $row['id'] = $mailing->mailing_id;
- $row['name'] = $mailing->mailing_name;
+ $row['id'] = $mailing->mailing_id;
+ $row['name'] = $mailing->mailing_name;
$row['mailing'] = TRUE;
- $row['link'] = CRM_Utils_System::url('civicrm/mailing/report',
- "mid={$row['id']}"
+ $row['link'] = CRM_Utils_System::url('civicrm/mailing/report',
+ "mid={$row['id']}"
);
}
$report['jobs'] = array();
$report['event_totals'] = array();
$elements = array(
- 'queue', 'delivered', 'url', 'forward',
- 'reply', 'unsubscribe', 'optout', 'opened', 'bounce', 'spool',
+ 'queue',
+ 'delivered',
+ 'url',
+ 'forward',
+ 'reply',
+ 'unsubscribe',
+ 'optout',
+ 'opened',
+ 'bounce',
+ 'spool',
);
// initialize various counters
);
foreach (array(
- 'scheduled_date', 'start_date', 'end_date') as $key) {
+ 'scheduled_date',
+ 'start_date',
+ 'end_date'
+ ) as $key) {
$row[$key] = CRM_Utils_Date::customFormat($row[$key]);
}
$report['jobs'][] = $row;
$report['click_through'][] = array(
'url' => $mailing->url,
'link' =>
- CRM_Utils_System::url(
- 'civicrm/mailing/report/event',
- "reset=1&event=click&mid=$mailing_id&uid={$mailing->id}"
- ),
+ CRM_Utils_System::url(
+ 'civicrm/mailing/report/event',
+ "reset=1&event=click&mid=$mailing_id&uid={$mailing->id}"
+ ),
'link_unique' =>
- CRM_Utils_System::url(
- 'civicrm/mailing/report/event',
- "reset=1&event=click&mid=$mailing_id&uid={$mailing->id}&distinct=1"
- ),
+ CRM_Utils_System::url(
+ 'civicrm/mailing/report/event',
+ "reset=1&event=click&mid=$mailing_id&uid={$mailing->id}&distinct=1"
+ ),
'clicks' => $mailing->clicks,
'unique' => $mailing->unique_clicks,
'rate' => CRM_Utils_Array::value('delivered', $report['event_totals']) ? (100.0 * $mailing->unique_clicks) / $report['event_totals']['delivered'] : 0,
$report['event_totals']['actionlinks'] = array();
foreach (array(
- 'clicks', 'clicks_unique', 'queue', 'delivered', 'bounce', 'unsubscribe',
- 'forward', 'reply', 'opened', 'optout',
- ) as $key) {
- $url = 'mailing/detail';
+ 'clicks',
+ 'clicks_unique',
+ 'queue',
+ 'delivered',
+ 'bounce',
+ 'unsubscribe',
+ 'forward',
+ 'reply',
+ 'opened',
+ 'optout',
+ ) as $key) {
+ $url = 'mailing/detail';
$reportFilter = "reset=1&mailing_id_value={$mailing_id}";
$searchFilter = "force=1&mailing_id=%%mid%%";
switch ($key) {
if (!empty($mailingIDs)) {
$mailingIDs = implode(',', $mailingIDs);
- $tableName = !$alias ? self::getTableName() : $alias;
+ $tableName = !$alias ? self::getTableName() : $alias;
$mailingACL = " $tableName.id IN ( $mailingIDs ) ";
}
return $mailingACL;
*/
public function &getRows($offset, $rowCount, $sort, $additionalClause = NULL, $additionalParams = NULL) {
$mailing = self::getTableName();
- $job = CRM_Mailing_BAO_MailingJob::getTableName();
- $group = CRM_Mailing_DAO_MailingGroup::getTableName();
+ $job = CRM_Mailing_BAO_MailingJob::getTableName();
+ $group = CRM_Mailing_DAO_MailingGroup::getTableName();
$session = CRM_Core_Session::singleton();
$mailingACL = self::mailingACL();
ts('HTML Format'),
array(
'cols' => '80',
- 'rows' => '8',
+ 'rows' => '8',
'onkeyup' => "return verify(this)",
)
);
$form->add('textarea', $id, $label,
array(
'cols' => '80',
- 'rows' => '8',
+ 'rows' => '8',
'onkeyup' => "return verify(this, '{$prefix}')",
)
);
$form->assign('templates', TRUE);
$form->add('select', 'template', ts('Select Template'),
array(
- '' => ts('- select -')) + $form->_templates, FALSE,
+ '' => ts('- select -')
+ ) + $form->_templates, FALSE,
array('onChange' => "selectValue( this.value,'' );")
);
$form->add('checkbox', 'updateTemplate', ts('Update Template'), NULL);
ts('Your Letter'),
array(
'cols' => '80',
- 'rows' => '8',
+ 'rows' => '8',
'onkeyup' => "return verify(this)",
)
);
$config = &CRM_Core_Config::singleton();
if ($mode == NULL && CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG") {
- throw new CRM_Core_Exception(ts('The <a href="%1">default mailbox</a> has not been configured. You will find <a href="%2">more info in the online user and administrator guide</a>', array(1 => CRM_Utils_System::url('civicrm/admin/mailSettings', 'reset=1'), 2 => "http://book.civicrm.org/user/advanced-configuration/email-system-configuration/")));
+ throw new CRM_Core_Exception(ts('The <a href="%1">default mailbox</a> has not been configured. You will find <a href="%2">more info in the online user and administrator guide</a>', array(
+ 1 => CRM_Utils_System::url('civicrm/admin/mailSettings', 'reset=1'),
+ 2 => "http://book.civicrm.org/user/advanced-configuration/email-system-configuration/"
+ )));
}
// check if we are enforcing number of parallel cron jobs
*/
public static function getContactMailingSelector(&$params) {
// format the params
- $params['offset'] = ($params['page'] - 1) * $params['rp'];
+ $params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['rowCount'] = $params['rp'];
- $params['sort'] = CRM_Utils_Array::value('sortBy', $params);
- $params['caseId'] = NULL;
+ $params['sort'] = CRM_Utils_Array::value('sortBy', $params);
+ $params['caseId'] = NULL;
// get contact mailings
$mailings = CRM_Mailing_BAO_Mailing::getContactMailings($params);
*/
static public function getContactMailings(&$params) {
$params['version'] = 3;
- $params['offset'] = ($params['page'] - 1) * $params['rp'];
- $params['limit'] = $params['rp'];
- $params['sort'] = CRM_Utils_Array::value('sortBy', $params);
+ $params['offset'] = ($params['page'] - 1) * $params['rp'];
+ $params['limit'] = $params['rp'];
+ $params['sort'] = CRM_Utils_Array::value('sortBy', $params);
$result = civicrm_api('MailingContact', 'get', $params);
return $result['values'];
if (empty($id)) {
CRM_Core_Error::fatal();
}
- CRM_Core_Transaction::create()->run(function() use ($id) {
+ CRM_Core_Transaction::create()->run(function () use ($id) {
CRM_Utils_Hook::pre('delete', 'MailingAB', $id, CRM_Core_DAO::$_nullArray);
$dao = new CRM_Mailing_DAO_MailingAB();
public static function runJobs($testParams = NULL, $mode = NULL) {
$job = new CRM_Mailing_BAO_MailingJob();
- $config = CRM_Core_Config::singleton();
- $jobTable = CRM_Mailing_DAO_MailingJob::getTableName();
+ $config = CRM_Core_Config::singleton();
+ $jobTable = CRM_Mailing_DAO_MailingJob::getTableName();
$mailingTable = CRM_Mailing_DAO_Mailing::getTableName();
if (!empty($testParams)) {
}
else {
$currentTime = date('YmdHis');
- $mailingACL = CRM_Mailing_BAO_Mailing::mailingACL('m');
- $domainID = CRM_Core_Config::domainID();
+ $mailingACL = CRM_Mailing_BAO_Mailing::mailingACL('m');
+ $domainID = CRM_Core_Config::domainID();
$modeClause = 'AND m.sms_provider_id IS NULL';
if ($mode == 'sms') {
$job->queue($testParams);
// Mark up the starting time
- $saveJob = new CRM_Mailing_DAO_MailingJob();
- $saveJob->id = $job->id;
+ $saveJob = new CRM_Mailing_DAO_MailingJob();
+ $saveJob->id = $job->id;
$saveJob->start_date = date('YmdHis');
- $saveJob->status = 'Running';
+ $saveJob->status = 'Running';
$saveJob->save();
$transaction->commit();
$transaction = new CRM_Core_Transaction();
- $saveJob = new CRM_Mailing_DAO_MailingJob();
- $saveJob->id = $job->id;
+ $saveJob = new CRM_Mailing_DAO_MailingJob();
+ $saveJob->id = $job->id;
$saveJob->end_date = date('YmdHis');
- $saveJob->status = 'Complete';
+ $saveJob->status = 'Complete';
$saveJob->save();
$transaction->commit();
$mailing = new CRM_Mailing_BAO_Mailing();
- $config = CRM_Core_Config::singleton();
- $jobTable = CRM_Mailing_DAO_MailingJob::getTableName();
+ $config = CRM_Core_Config::singleton();
+ $jobTable = CRM_Mailing_DAO_MailingJob::getTableName();
$mailingTable = CRM_Mailing_DAO_Mailing::getTableName();
$currentTime = date('YmdHis');
- $mailingACL = CRM_Mailing_BAO_Mailing::mailingACL('m');
- $domainID = CRM_Core_Config::domainID();
+ $mailingACL = CRM_Mailing_BAO_Mailing::mailingACL('m');
+ $domainID = CRM_Core_Config::domainID();
$query = "
SELECT j.*
$transaction = new CRM_Core_Transaction();
- $saveJob = new CRM_Mailing_DAO_MailingJob();
- $saveJob->id = $job->id;
+ $saveJob = new CRM_Mailing_DAO_MailingJob();
+ $saveJob->id = $job->id;
$saveJob->end_date = date('YmdHis');
- $saveJob->status = 'Complete';
+ $saveJob->status = 'Complete';
$saveJob->save();
$mailing->reset();
public static function runJobs_pre($offset = 200, $mode = NULL) {
$job = new CRM_Mailing_BAO_MailingJob();
- $jobTable = CRM_Mailing_DAO_MailingJob::getTableName();
+ $jobTable = CRM_Mailing_DAO_MailingJob::getTableName();
$mailingTable = CRM_Mailing_DAO_Mailing::getTableName();
$currentTime = date('YmdHis');
// update the status of the parent job
$transaction = new CRM_Core_Transaction();
- $saveJob = new CRM_Mailing_DAO_MailingJob();
- $saveJob->id = $job->id;
+ $saveJob = new CRM_Mailing_DAO_MailingJob();
+ $saveJob->id = $job->id;
$saveJob->start_date = date('YmdHis');
- $saveJob->status = 'Running';
+ $saveJob->status = 'Running';
$saveJob->save();
$transaction->commit();
VALUES (%1, %2, %3, %4, %5, %6, %7)
";
$params = array(
- 1 => array($this->mailing_id, 'Integer'),
+ 1 => array($this->mailing_id, 'Integer'),
2 => array($this->scheduled_date, 'String'),
3 => array('Scheduled', 'String'),
4 => array('child', 'String'),
// FIXME: this is not very smart, we should move this to one DB call
// INSERT INTO ... SELECT FROM ..
// the thing we need to figure out is how to generate the hash automatically
- $now = time();
+ $now = time();
$params = array();
- $count = 0;
+ $count = 0;
while ($recipients->fetch()) {
if ($recipients->phone_id) {
$recipients->email_id = "null";
$mailing->find(TRUE);
$mailing->free();
- $eq = new CRM_Mailing_Event_BAO_Queue();
- $eqTable = CRM_Mailing_Event_BAO_Queue::getTableName();
- $emailTable = CRM_Core_BAO_Email::getTableName();
- $phoneTable = CRM_Core_DAO_Phone::getTableName();
+ $eq = new CRM_Mailing_Event_BAO_Queue();
+ $eqTable = CRM_Mailing_Event_BAO_Queue::getTableName();
+ $emailTable = CRM_Core_BAO_Email::getTableName();
+ $phoneTable = CRM_Core_DAO_Phone::getTableName();
$contactTable = CRM_Contact_BAO_Contact::getTableName();
- $edTable = CRM_Mailing_Event_BAO_Delivered::getTableName();
- $ebTable = CRM_Mailing_Event_BAO_Bounce::getTableName();
+ $edTable = CRM_Mailing_Event_BAO_Delivered::getTableName();
+ $ebTable = CRM_Mailing_Event_BAO_Bounce::getTableName();
$query = " SELECT $eqTable.id,
$emailTable.email as email,
// get the return properties
$returnProperties = $mailing->getReturnProperties();
- $params = $targetParams = $deliveredParams = array();
- $count = 0;
+ $params = $targetParams = $deliveredParams = array();
+ $count = 0;
/**
* CRM-15702: Sending bulk sms to contacts without e-mail addres fails.
if ($mailing->sms_provider_id) {
$provider = CRM_SMS_Provider::singleton(array('mailing_id' => $mailing->id));
- $body = $provider->getMessage($message, $field['contact_id'], $details[0][$contactID]);
- $headers = $provider->getRecipientDetails($field, $details[0][$contactID]);
+ $body = $provider->getMessage($message, $field['contact_id'], $details[0][$contactID]);
+ $headers = $provider->getRecipientDetails($field, $details[0][$contactID]);
}
// make $recipient actually be the *encoded* header, so as not to baffle Mail_RFC822, CRM-5743
in_array($job->status, array('Scheduled', 'Running', 'Paused'))
) {
- $newJob = new CRM_Mailing_BAO_MailingJob();
- $newJob->id = $job->id;
+ $newJob = new CRM_Mailing_BAO_MailingJob();
+ $newJob->id = $job->id;
$newJob->end_date = date('YmdHis');
- $newJob->status = 'Canceled';
+ $newJob->status = 'Canceled';
$newJob->save();
// also cancel all child jobs
AND status IN ( 'Scheduled', 'Running', 'Paused' )
";
$params = array(
- 1 => array($job->id, 'Integer'),
+ 1 => array($job->id, 'Integer'),
2 => array(date('YmdHis'), 'Timestamp'),
);
CRM_Core_DAO::executeQuery($sql, $params);
// get mailing name
if (!empty($query->_returnProperties['mailing_name'])) {
- $query->_select['mailing_name'] = "civicrm_mailing.name as mailing_name";
+ $query->_select['mailing_name'] = "civicrm_mailing.name as mailing_name";
$query->_element['mailing_name'] = 1;
}
// get mailing subject
if (!empty($query->_returnProperties['mailing_subject'])) {
- $query->_select['mailing_subject'] = "civicrm_mailing.subject as mailing_subject";
+ $query->_select['mailing_subject'] = "civicrm_mailing.subject as mailing_subject";
$query->_element['mailing_subject'] = 1;
}
if (!empty($query->_returnProperties['mailing_job_status'])) {
$query->_tables['civicrm_mailing_job'] = $query->_whereTables['civicrm_mailing_job'] =
" LEFT JOIN civicrm_mailing_job ON civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing_job.parent_id IS NULL AND civicrm_mailing_job.is_test != 1 ";
- $query->_select['mailing_job_status'] = "civicrm_mailing_job.status as mailing_job_status";
+ $query->_select['mailing_job_status'] = "civicrm_mailing_job.status as mailing_job_status";
$query->_element['mailing_job_status'] = 1;
}
if (!empty($query->_returnProperties['mailing_job_end_date'])) {
$query->_tables['civicrm_mailing_job'] = $query->_whereTables['civicrm_mailing_job'] =
" LEFT JOIN civicrm_mailing_job ON civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing_job.parent_id IS NULL AND civicrm_mailing_job.is_test != 1 ";
- $query->_select['mailing_job_end_date'] = "civicrm_mailing_job.end_date as mailing_job_end_date";
+ $query->_select['mailing_job_end_date'] = "civicrm_mailing_job.end_date as mailing_job_end_date";
$query->_element['mailing_job_end_date'] = 1;
}
$value = strtolower(addslashes($value));
if ($wildcard) {
$value = "%$value%";
- $op = 'LIKE';
+ $op = 'LIKE';
}
$query->_where[$grouping][] = "LOWER(civicrm_mailing.name) $op '$value'";
- $query->_qill[$grouping][] = "Mailing Namename $op \"$value\"";
+ $query->_qill[$grouping][] = "Mailing Namename $op \"$value\"";
$query->_tables['civicrm_mailing'] = $query->_whereTables['civicrm_mailing'] = 1;
$query->_tables['civicrm_mailing_recipients'] = $query->_whereTables['civicrm_mailing_recipients'] = 1;
return;
'civicrm_mailing_event_bounce',
'bounce_type_id',
ts('Bounce type(s)'),
- CRM_Core_PseudoConstant::get('CRM_Mailing_Event_DAO_Bounce', 'bounce_type_id', array('keyColumn' => 'id', 'labelColumn' => 'name'))
+ CRM_Core_PseudoConstant::get('CRM_Mailing_Event_DAO_Bounce', 'bounce_type_id', array(
+ 'keyColumn' => 'id',
+ 'labelColumn' => 'name'
+ ))
);
return;
$query->_tables['civicrm_mailing_recipients'] = $query->_whereTables['civicrm_mailing_recipients'] = 1;
$query->_where[$grouping][] = " civicrm_mailing_job.status = '{$value}' ";
- $query->_qill[$grouping][] = "Mailing Job Status IS \"$value\"";
+ $query->_qill[$grouping][] = "Mailing Job Status IS \"$value\"";
}
return;
}
return;
}
- $protos = '(https?|ftp)';
+ $protos = '(https?|ftp)';
$letters = '\w';
- $gunk = '/#~:.?+=&%@!\-';
- $punc = '.:?\-';
- $any = "{$letters}{$gunk}{$punc}";
+ $gunk = '/#~:.?+=&%@!\-';
+ $punc = '.:?\-';
+ $any = "{$letters}{$gunk}{$punc}";
if ($onlyHrefs) {
$pattern = "{\\b(href=([\"'])?($protos:[$any]+?(?=[$punc]*[^$any]|$))([\"'])?)}im";
}
return $success;
}
- $transaction = new CRM_Core_Transaction();
- $bounce = new CRM_Mailing_Event_BAO_Bounce();
+ $transaction = new CRM_Core_Transaction();
+ $bounce = new CRM_Mailing_Event_BAO_Bounce();
$bounce->time_stamp = date('YmdHis');
// if we dont have a valid bounce type, we should set it
$success = TRUE;
$bounceTable = CRM_Mailing_Event_BAO_Bounce::getTableName();
- $bounceType = CRM_Mailing_DAO_BounceType::getTableName();
- $emailTable = CRM_Core_BAO_Email::getTableName();
- $queueTable = CRM_Mailing_Event_BAO_Queue::getTableName();
+ $bounceType = CRM_Mailing_DAO_BounceType::getTableName();
+ $emailTable = CRM_Core_BAO_Email::getTableName();
+ $queueTable = CRM_Mailing_Event_BAO_Queue::getTableName();
$bounce->reset();
// might want to put distinct inside the count
while ($bounce->fetch()) {
if ($bounce->bounces >= $bounce->threshold) {
- $email = new CRM_Core_BAO_Email();
- $email->id = $q->email_id;
- $email->on_hold = TRUE;
+ $email = new CRM_Core_BAO_Email();
+ $email->id = $q->email_id;
+ $email->on_hold = TRUE;
$email->hold_date = date('YmdHis');
$email->save();
break;
public static function getTotalCount($mailing_id, $job_id = NULL, $is_distinct = FALSE, $toDate = NULL) {
$dao = new CRM_Core_DAO();
- $bounce = self::getTableName();
- $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
+ $bounce = self::getTableName();
+ $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
$mailing = CRM_Mailing_BAO_Mailing::getTableName();
- $job = CRM_Mailing_BAO_MailingJob::getTableName();
+ $job = CRM_Mailing_BAO_MailingJob::getTableName();
$query = "
SELECT COUNT($bounce.id) as bounce
$dao = new CRM_Core_Dao();
- $bounce = self::getTableName();
+ $bounce = self::getTableName();
$bounceType = CRM_Mailing_DAO_BounceType::getTableName();
- $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
- $mailing = CRM_Mailing_BAO_Mailing::getTableName();
- $job = CRM_Mailing_BAO_MailingJob::getTableName();
- $contact = CRM_Contact_BAO_Contact::getTableName();
- $email = CRM_Core_BAO_Email::getTableName();
+ $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
+ $mailing = CRM_Mailing_BAO_Mailing::getTableName();
+ $job = CRM_Mailing_BAO_MailingJob::getTableName();
+ $contact = CRM_Contact_BAO_Contact::getTableName();
+ $email = CRM_Core_BAO_Email::getTableName();
$query = "
SELECT $contact.display_name as display_name,
'email' => $dao->email,
// FIXME: translate this
'type' => (empty($dao->bounce_type)
- ? ts('Unknown') : $dao->bounce_type
+ ? ts('Unknown') : $dao->bounce_type
),
'reason' => $dao->reason,
'date' => CRM_Utils_Date::customFormat($dao->date),
$text = CRM_Utils_String::htmlToText($component->body_html);
}
- $bao = new CRM_Mailing_BAO_Mailing();
+ $bao = new CRM_Mailing_BAO_Mailing();
$bao->body_text = $text;
$bao->body_html = $html;
- $tokens = $bao->getTokens();
+ $tokens = $bao->getTokens();
$html = CRM_Utils_Token::replaceDomainTokens($html, $domain, TRUE, $tokens['html']);
$html = CRM_Utils_Token::replaceWelcomeTokens($html, $group->title, TRUE);
$mailParams = array(
'groupName' => 'Mailing Event ' . $component->component_type,
- 'subject' => $component->subject,
+ 'subject' => $component->subject,
'from' => "\"$domainEmailName\" <do-not-reply@$emailDomain>",
'toEmail' => $email,
'toName' => $display_name,
$queue->find(TRUE);
while ($queue->fetch()) {
- $email = new CRM_Core_BAO_Email();
- $email->id = $queue->email_id;
- $email->hold_date = '';
+ $email = new CRM_Core_BAO_Email();
+ $email->id = $queue->email_id;
+ $email->hold_date = '';
$email->reset_date = date('YmdHis');
$email->save();
}
$dao = new CRM_Core_DAO();
$delivered = self::getTableName();
- $bounce = CRM_Mailing_Event_BAO_Bounce::getTableName();
- $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
- $mailing = CRM_Mailing_BAO_Mailing::getTableName();
- $job = CRM_Mailing_BAO_MailingJob::getTableName();
+ $bounce = CRM_Mailing_Event_BAO_Bounce::getTableName();
+ $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
+ $mailing = CRM_Mailing_BAO_Mailing::getTableName();
+ $job = CRM_Mailing_BAO_MailingJob::getTableName();
$query = "
SELECT COUNT($delivered.id) as delivered
$dao = new CRM_Core_Dao();
$delivered = self::getTableName();
- $bounce = CRM_Mailing_Event_BAO_Bounce::getTableName();
- $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
- $mailing = CRM_Mailing_BAO_Mailing::getTableName();
- $job = CRM_Mailing_BAO_MailingJob::getTableName();
- $contact = CRM_Contact_BAO_Contact::getTableName();
- $email = CRM_Core_BAO_Email::getTableName();
+ $bounce = CRM_Mailing_Event_BAO_Bounce::getTableName();
+ $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
+ $mailing = CRM_Mailing_BAO_Mailing::getTableName();
+ $job = CRM_Mailing_BAO_MailingJob::getTableName();
+ $contact = CRM_Contact_BAO_Contact::getTableName();
+ $email = CRM_Core_BAO_Email::getTableName();
$query = "
SELECT $delivered.id as id,
while (!empty($values)) {
$input = array_splice($values, 0, CRM_Core_DAO::BULK_INSERT_COUNT);
- $str = implode(',', $input);
- $sql = "INSERT INTO civicrm_mailing_event_delivered ( event_queue_id, time_stamp ) VALUES $str;";
+ $str = implode(',', $input);
+ $sql = "INSERT INTO civicrm_mailing_event_delivered ( event_queue_id, time_stamp ) VALUES $str;";
CRM_Core_DAO::executeQuery($sql);
}
}
$q = new CRM_Mailing_Event_BAO_Queue();
$q->id = $queue_id;
if ($q->find(TRUE)) {
- $oe = new CRM_Mailing_Event_BAO_Opened();
+ $oe = new CRM_Mailing_Event_BAO_Opened();
$oe->event_queue_id = $queue_id;
- $oe->time_stamp = date('YmdHis');
+ $oe->time_stamp = date('YmdHis');
$oe->save();
$success = TRUE;
}
) {
$dao = new CRM_Core_DAO();
- $open = self::getTableName();
- $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
+ $open = self::getTableName();
+ $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
$mailing = CRM_Mailing_BAO_Mailing::getTableName();
- $job = CRM_Mailing_BAO_MailingJob::getTableName();
+ $job = CRM_Mailing_BAO_MailingJob::getTableName();
$query = "
SELECT COUNT($open.id) as opened
$dao = new CRM_Core_DAO();
$openedCount = array();
- $open = self::getTableName();
- $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
- $job = CRM_Mailing_BAO_MailingJob::getTableName();
+ $open = self::getTableName();
+ $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
+ $job = CRM_Mailing_BAO_MailingJob::getTableName();
$mailingIDs = implode(',', $mailingIDs);
$query = "
) {
$dao = new CRM_Core_Dao();
- $open = self::getTableName();
- $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
+ $open = self::getTableName();
+ $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
$mailing = CRM_Mailing_BAO_Mailing::getTableName();
- $job = CRM_Mailing_BAO_MailingJob::getTableName();
+ $job = CRM_Mailing_BAO_MailingJob::getTableName();
$contact = CRM_Contact_BAO_Contact::getTableName();
- $email = CRM_Core_BAO_Email::getTableName();
+ $email = CRM_Core_BAO_Email::getTableName();
$query = "
SELECT $contact.display_name as display_name,
* @static
*/
public static function hash($params) {
- $jobId = $params['job_id'];
- $emailId = CRM_Utils_Array::value('email_id', $params, '');
+ $jobId = $params['job_id'];
+ $emailId = CRM_Utils_Array::value('email_id', $params, '');
$contactId = $params['contact_id'];
return substr(sha1("{$jobId}:{$emailId}:{$contactId}:" . time()),
$success = NULL;
$q = new CRM_Mailing_Event_BAO_Queue();
if (!empty($job_id) && !empty($queue_id) && !empty($hash)) {
- $q->id = $queue_id;
+ $q->id = $queue_id;
$q->job_id = $job_id;
- $q->hash = $hash;
+ $q->hash = $hash;
if ($q->find(TRUE)) {
$success = $q;
}
*/
public static function getEmailAddress($queue_id) {
$email = CRM_Core_BAO_Email::getTableName();
- $eq = self::getTableName();
+ $eq = self::getTableName();
$query = " SELECT $email.email as email
FROM $email
INNER JOIN $eq
public static function getTotalCount($mailing_id, $job_id = NULL) {
$dao = new CRM_Core_DAO();
- $queue = self::getTableName();
+ $queue = self::getTableName();
$mailing = CRM_Mailing_BAO_Mailing::getTableName();
- $job = CRM_Mailing_BAO_MailingJob::getTableName();
+ $job = CRM_Mailing_BAO_MailingJob::getTableName();
$dao->query("
SELECT COUNT(*) as queued
) {
$dao = new CRM_Core_Dao();
- $queue = self::getTableName();
+ $queue = self::getTableName();
$mailing = CRM_Mailing_BAO_Mailing::getTableName();
- $job = CRM_Mailing_BAO_MailingJob::getTableName();
+ $job = CRM_Mailing_BAO_MailingJob::getTableName();
$contact = CRM_Contact_BAO_Contact::getTableName();
- $email = CRM_Core_BAO_Email::getTableName();
+ $email = CRM_Core_BAO_Email::getTableName();
$orderBy = "sort_name ASC, {$job}.start_date DESC";
if ($sort) {
* Mailing BAO
*/
public function &getMailing() {
- $mailing = new CRM_Mailing_BAO_Mailing();
- $jobs = CRM_Mailing_BAO_MailingJob::getTableName();
+ $mailing = new CRM_Mailing_BAO_Mailing();
+ $jobs = CRM_Mailing_BAO_MailingJob::getTableName();
$mailings = CRM_Mailing_BAO_Mailing::getTableName();
- $queue = self::getTableName();
+ $queue = self::getTableName();
$mailing->query("
SELECT $mailings.*
$values = array();
foreach ($params as $param) {
$values[] = "( {$param[0]}, {$param[1]}, {$param[2]}, {$param[3]}, '" . substr(sha1("{$param[0]}:{$param[1]}:{$param[2]}:{$param[3]}:{$now}"),
- 0, 16
- ) . "' )";
+ 0, 16
+ ) . "' )";
}
while (!empty($values)) {
$input = array_splice($values, 0, CRM_Core_DAO::BULK_INSERT_COUNT);
- $str = implode(',', $input);
- $sql = "INSERT INTO civicrm_mailing_event_queue ( job_id, email_id, contact_id, phone_id, hash ) VALUES $str;";
+ $str = implode(',', $input);
+ $sql = "INSERT INTO civicrm_mailing_event_queue ( job_id, email_id, contact_id, phone_id, hash ) VALUES $str;";
CRM_Core_DAO::executeQuery($sql);
}
}
WHERE civicrm_email.email = %1
AND civicrm_email.contact_id = %2";
$params = array(
- 1 => array($email, 'String'),
+ 1 => array($email, 'String'),
2 => array($contact_id, 'Integer'),
);
$dao = CRM_Core_DAO::executeQuery($query, $params);
$emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
$confirm = implode($config->verpSeparator,
- array(
- $localpart . 'c',
- $this->contact_id,
- $this->id,
- $this->hash,
- )
- ) . "@$emailDomain";
+ array(
+ $localpart . 'c',
+ $this->contact_id,
+ $this->id,
+ $this->hash,
+ )
+ ) . "@$emailDomain";
$group = new CRM_Contact_BAO_Group();
$group->id = $this->group_id;
$group[$groupID]['title'] = $contactGroups[$groupID]['title'];
$group[$groupID]['status'] = $contactGroups[$groupID]['status'];
- $status = ts('You are already subscribed in %1, your subscription is %2.', array(1 => $group[$groupID]['title'], 2 => $group[$groupID]['status']));
+ $status = ts('You are already subscribed in %1, your subscription is %2.', array(
+ 1 => $group[$groupID]['title'],
+ 2 => $group[$groupID]['status']
+ ));
CRM_Utils_System::setUFMessage($status);
continue;
}
/* To find the url, we also join on the queue and job tables. This
* prevents foreign key violations. */
- $job = CRM_Mailing_BAO_MailingJob::getTableName();
- $eq = CRM_Mailing_Event_BAO_Queue::getTableName();
+ $job = CRM_Mailing_BAO_MailingJob::getTableName();
+ $eq = CRM_Mailing_Event_BAO_Queue::getTableName();
$turl = CRM_Mailing_BAO_TrackableURL::getTableName();
if (!$queue_id) {
) {
$dao = new CRM_Core_DAO();
- $click = self::getTableName();
- $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
+ $click = self::getTableName();
+ $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
$mailing = CRM_Mailing_BAO_Mailing::getTableName();
- $job = CRM_Mailing_BAO_MailingJob::getTableName();
+ $job = CRM_Mailing_BAO_MailingJob::getTableName();
$query = "
SELECT COUNT($click.id) as opened
$dao = new CRM_Core_Dao();
- $click = self::getTableName();
- $url = CRM_Mailing_BAO_TrackableURL::getTableName();
- $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
+ $click = self::getTableName();
+ $url = CRM_Mailing_BAO_TrackableURL::getTableName();
+ $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
$mailing = CRM_Mailing_BAO_Mailing::getTableName();
- $job = CRM_Mailing_BAO_MailingJob::getTableName();
+ $job = CRM_Mailing_BAO_MailingJob::getTableName();
$contact = CRM_Contact_BAO_Contact::getTableName();
- $email = CRM_Core_BAO_Email::getTableName();
+ $email = CRM_Core_BAO_Email::getTableName();
$query = "
SELECT $contact.display_name as display_name,
WHERE email = %2
";
$sqlParams = array(
- 1 => array($now, 'Timestamp'),
+ 1 => array($now, 'Timestamp'),
2 => array($email->email, 'String'),
);
CRM_Core_DAO::executeQuery($sql, $sqlParams);
$buttons = array(
array(
- 'type' => 'next',
+ 'type' => 'next',
'name' => ts('Save'),
'spacing' => ' ',
'isDefault' => TRUE,
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/mailing/browse/scheduled',
- 'reset=1&scheduled=true'
- ));
+ 'reset=1&scheduled=true'
+ ));
}
/**
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
- $mailing = new CRM_Mailing_BAO_Mailing();
+ $mailing = new CRM_Mailing_BAO_Mailing();
$mailing->id = $this->_mailingId;
- $subject = '';
+ $subject = '';
if ($mailing->find(TRUE)) {
$subject = $mailing->subject;
}
$this->add('text', 'name', ts('Name'),
CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Component', 'name'), TRUE
);
- $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Mailing_DAO_Component', $this->_id));
+ $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array(
+ 'CRM_Mailing_DAO_Component',
+ $this->_id
+ ));
$this->add('select', 'component_type', ts('Component Type'), CRM_Core_SelectValues::mailingComponents());
}
$errors = array();
foreach (array(
- 'text', 'html') as $type) {
+ 'text',
+ 'html'
+ ) as $type) {
$dataErrors = array();
foreach ($InvalidTokens as $token => $desc) {
if ($params['body_' . $type]) {
if (preg_match('/' . preg_quote('{' . $token . '}') . '/', $params['body_' . $type])) {
$dataErrors[] = '<li>' . ts('This message is having a invalid token - %1: %2', array(
- 1 => $token,
- 2 => $desc)) . '</li>';
+ 1 => $token,
+ 2 => $desc
+ )) . '</li>';
}
}
}
if (!empty($dataErrors)) {
$errors['body_' . $type] = ts('The following errors were detected in %1 message:', array(
- 1 => $type)) . '<ul>' . implode('', $dataErrors) . '</ul><br /><a href="' . CRM_Utils_System::docURL2('Tokens', TRUE, NULL, NULL, NULL, "wiki") . '">' . ts('More information on tokens...') . '</a>';
+ 1 => $type
+ )) . '<ul>' . implode('', $dataErrors) . '</ul><br /><a href="' . CRM_Utils_System::docURL2('Tokens', TRUE, NULL, NULL, NULL, "wiki") . '">' . ts('More information on tokens...') . '</a>';
}
}
);
$this->addButtons(array(
- array(
- 'type' => 'next',
- 'name' => ts('Forward'),
- 'isDefault' => TRUE,
- ),
- array(
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ),
- ));
+ array(
+ 'type' => 'next',
+ 'name' => ts('Forward'),
+ 'isDefault' => TRUE,
+ ),
+ array(
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ),
+ ));
}
/**
* @return void
*/
public function postProcess() {
- $queue_id = $this->get('queue_id');
- $job_id = $this->get('job_id');
- $hash = $this->get('hash');
+ $queue_id = $this->get('queue_id');
+ $job_id = $this->get('job_id');
+ $hash = $this->get('hash');
$timeStamp = date('YmdHis');
- $formValues = $this->controller->exportValues($this->_name);
- $params = array();
+ $formValues = $this->controller->exportValues($this->_name);
+ $params = array();
$params['body_text'] = $formValues['forward_comment'];
- $html_comment = $formValues['html_comment'];
+ $html_comment = $formValues['html_comment'];
$params['body_html'] = str_replace('%7B', '{', str_replace('%7D', '}', $html_comment));
$emails = array();
}
}
- $status = ts('Mailing is not forwarded to the given email address.', array('count' => count($emails), 'plural' => 'Mailing is not forwarded to the given email addresses.'));
+ $status = ts('Mailing is not forwarded to the given email address.', array(
+ 'count' => count($emails),
+ 'plural' => 'Mailing is not forwarded to the given email addresses.'
+ ));
if ($forwarded) {
- $status = ts('Mailing is forwarded successfully to %count email address.', array('count' => $forwarded, 'plural' => 'Mailing is forwarded successfully to %count email addresses.'));
+ $status = ts('Mailing is forwarded successfully to %count email address.', array(
+ 'count' => $forwarded,
+ 'plural' => 'Mailing is forwarded successfully to %count email addresses.'
+ ));
}
CRM_Utils_System::setUFMessage($status);
*/
public function preProcess() {
if (CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG") {
- CRM_Core_Error::fatal(ts('The <a href="%1">default mailbox</a> has not been configured. You will find <a href="%2">more info in our online user and administrator guide.</a>', array(1 => CRM_Utils_System::url('civicrm/admin/mailSettings', 'reset=1'), 2 => "http://book.civicrm.org/user/advanced-configuration/email-system-configuration/")));
+ CRM_Core_Error::fatal(ts('The <a href="%1">default mailbox</a> has not been configured. You will find <a href="%2">more info in our online user and administrator guide.</a>', array(
+ 1 => CRM_Utils_System::url('civicrm/admin/mailSettings', 'reset=1'),
+ 2 => "http://book.civicrm.org/user/advanced-configuration/email-system-configuration/"
+ )));
}
$this->_mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
$showGroupSelector = TRUE;
if ($this->_searchBasedMailing) {
$showGroupSelector = FALSE;
- $formElements = array('includeGroups', 'excludeGroups', 'includeMailings', 'excludeMailings');
- $formValues = $this->controller->exportValues($this->_name);
+ $formElements = array('includeGroups', 'excludeGroups', 'includeMailings', 'excludeMailings');
+ $formValues = $this->controller->exportValues($this->_name);
foreach ($formElements as $element) {
if (!empty($formValues[$element])) {
$showGroupSelector = TRUE;
$this->add('select', 'baseGroup',
ts('Unsubscription Group'),
array(
- '' => ts('- select -')) + CRM_Contact_BAO_Group::getGroupsHierarchy($staticGroups, NULL, ' ', TRUE),
+ '' => ts('- select -')
+ ) + CRM_Contact_BAO_Group::getGroupsHierarchy($staticGroups, NULL, ' ', TRUE),
TRUE,
array('class' => 'crm-select2 huge')
);
if ($this->_resultSelectOption == 'ts_sel') {
// create a static grp if only a subset of result set was selected:
- $randID = md5(time());
+ $randID = md5(time());
$grpTitle = "Hidden Group {$randID}";
- $grpID = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $grpTitle, 'id', 'title');
+ $grpID = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $grpTitle, 'id', 'title');
if (!$grpID) {
$groupParams = array(
$newGroupTitle = "Hidden Group {$grpID}";
$groupParams = array(
- 'id' => $grpID,
- 'name' => CRM_Utils_String::titleToVar($newGroupTitle),
+ 'id' => $grpID,
+ 'name' => CRM_Utils_String::titleToVar($newGroupTitle),
'title' => $newGroupTitle,
'group_type' => array('2' => 1),
);
//get the hidden smart group id.
$ssId = $this->get('ssID');
$hiddenSmartParams = array(
- 'group_type' => array('2' => 1),
+ 'group_type' => array('2' => 1),
'form_values' => $this->get('formValues'),
'saved_search_id' => $ssId,
'search_custom_id' => $this->get('customSearchID'),
}
foreach (
- array('name', 'group_id', 'search_id', 'search_args', 'campaign_id', 'dedupe_email', 'location_type_id', 'email_selection_method') as $n
+ array(
+ 'name',
+ 'group_id',
+ 'search_id',
+ 'search_args',
+ 'campaign_id',
+ 'dedupe_email',
+ 'location_type_id',
+ 'email_selection_method'
+ ) as $n
) {
if (!empty($values[$n])) {
$params[$n] = $values[$n];
$qf_Group_submit = $this->controller->exportValue($this->_name, '_qf_Group_submit');
$this->set('name', $params['name']);
- $inGroups = $values['includeGroups'];
- $outGroups = $values['excludeGroups'];
- $inMailings = $values['includeMailings'];
+ $inGroups = $values['includeGroups'];
+ $outGroups = $values['excludeGroups'];
+ $inMailings = $values['includeMailings'];
$outMailings = $values['excludeMailings'];
if (is_array($inGroups)) {
}
}
- $session = CRM_Core_Session::singleton();
- $params['groups'] = $groups;
+ $session = CRM_Core_Session::singleton();
+ $params['groups'] = $groups;
$params['mailings'] = $mailings;
$ids = array();
if ($this->get('mailing_id')) {
// delete previous includes/excludes, if mailing already existed
foreach (array('groups', 'mailings') as $entity) {
- $mg = new CRM_Mailing_DAO_MailingGroup();
- $mg->mailing_id = $ids['mailing_id'];
+ $mg = new CRM_Mailing_DAO_MailingGroup();
+ $mg->mailing_id = $ids['mailing_id'];
$mg->entity_table = ($entity == 'groups') ? $groupTableName : $mailingTableName;
$mg->find();
while ($mg->fetch()) {
$queue_id = $this->_queue_id;
$hash = $this->_hash;
- $confirmURL = CRM_Utils_System::url("civicrm/mailing/{$this->_type}","reset=1&jid={$job_id}&qid={$queue_id}&h={$hash}&confirm=1");
+ $confirmURL = CRM_Utils_System::url("civicrm/mailing/{$this->_type}", "reset=1&jid={$job_id}&qid={$queue_id}&h={$hash}&confirm=1");
$this->assign('confirmURL', $confirmURL);
$session = CRM_Core_Session::singleton();
$session->pushUserContext($confirmURL);
$this->_scheduleFormOnly = TRUE;
}
}
+
/**
* Set default values for the form.
*
if ($this->_scheduleFormOnly) {
$title = ts('Schedule Mailing') . ' - ' . CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing',
- $this->_mailingID,
- 'name'
- );
+ $this->_mailingID,
+ 'name'
+ );
CRM_Utils_System::setTitle($title);
$buttons = array(
array(
- 'type' => 'next',
+ 'type' => 'next',
'name' => ts('Submit Mailing'),
'spacing' => ' ',
'isDefault' => TRUE,
$this->_scheduleFormOnly
) {
// add the preview elements
- $preview = array();
- $preview['type'] = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingID, 'body_html') ? 'html' : 'text';
+ $preview = array();
+ $preview['type'] = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingID, 'body_html') ? 'html' : 'text';
$preview['subject'] = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing',
$this->_mailingID,
'subject'
}
if (CRM_Utils_Date::format(CRM_Utils_Date::processDate($params['start_date'],
- $params['start_date_time']
- )) < CRM_Utils_Date::format(date('YmdHi00'))) {
+ $params['start_date_time']
+ )) < CRM_Utils_Date::format(date('YmdHi00'))
+ ) {
return array(
'start_date' => ts('Start date cannot be earlier than the current time.'),
);
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/mailing/browse/scheduled',
- 'reset=1&scheduled=true'
- ));
+ 'reset=1&scheduled=true'
+ ));
}
/**
$this->add('hidden', 'hidden_find_mailings', 1);
$this->addButtons(array(
- array(
- 'type' => 'refresh',
- 'name' => ts('Search'),
- 'isDefault' => TRUE,
- ),
- ));
+ array(
+ 'type' => 'refresh',
+ 'name' => ts('Search'),
+ 'isDefault' => TRUE,
+ ),
+ ));
}
/**
$parent = $this->controller->getParent();
if (!empty($params)) {
- $fields = array('mailing_name', 'mailing_from', 'mailing_to', 'sort_name',
- 'campaign_id', 'mailing_status', 'sms', 'status_unscheduled', 'is_archived', 'hidden_find_mailings');
+ $fields = array(
+ 'mailing_name',
+ 'mailing_from',
+ 'mailing_to',
+ 'sort_name',
+ 'campaign_id',
+ 'mailing_status',
+ 'sms',
+ 'status_unscheduled',
+ 'is_archived',
+ 'hidden_find_mailings'
+ );
foreach ($fields as $field) {
if (isset($params[$field]) &&
!CRM_Utils_System::isNull($params[$field])
) {
if (in_array($field, array(
- 'mailing_from', 'mailing_to')) && !$params["mailing_relative"]) {
+ 'mailing_from',
+ 'mailing_to'
+ )) && !$params["mailing_relative"]
+ ) {
$time = ($field == 'mailing_to') ? '235959' : NULL;
$parent->set($field, CRM_Utils_Date::processDate($params[$field], $time));
}
$dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
$rows = array();
while ($dao->fetch()) {
- $row = array();
- $row['id'] = $dao->id;
- $row['title'] = $dao->title;
+ $row = array();
+ $row['id'] = $dao->id;
+ $row['title'] = $dao->title;
$row['description'] = $dao->description;
- $row['checkbox'] = CRM_Core_Form::CB_PREFIX . $row['id'];
+ $row['checkbox'] = CRM_Core_Form::CB_PREFIX . $row['id'];
$this->addElement('checkbox',
$row['checkbox'],
NULL, NULL
// if recaptcha is not configured, then dont add it
// CRM-11316 Only enable ReCAPTCHA for anonymous visitors
$config = CRM_Core_Config::singleton();
- $session = CRM_Core_Session::singleton();
+ $session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
if (empty($config->recaptchaPublicKey) ||
empty($config->recaptchaPrivateKey) ||
- $contactID) {
+ $contactID
+ ) {
$addCaptcha = FALSE;
}
else {
else {
$queryParams = $form->get('queryParams');
$sortOrder = NULL;
- if ($form->get(CRM_Utils_Sort::SORT_ORDER )) {
+ if ($form->get(CRM_Utils_Sort::SORT_ORDER)) {
$sortOrder = $form->get(CRM_Utils_Sort::SORT_ORDER);
}
$this->addButtons($buttons);
$mailingID = $this->get('mailing_id');
- $textFile = $this->get('textFile');
- $htmlFile = $this->get('htmlFile');
+ $textFile = $this->get('textFile');
+ $htmlFile = $this->get('htmlFile');
$this->addFormRule(array('CRM_Mailing_Form_Test', 'testMail'), $this);
$preview = array();
);
$returnProperties = $mailing->getReturnProperties();
- $userID = $session->get('userID');
- $params = array('contact_id' => $userID);
+ $userID = $session->get('userID');
+ $params = array('contact_id' => $userID);
$details = CRM_Utils_Token::getTokenDetails($params,
$returnProperties,
}
if (!empty($testParams['_qf_Test_next']) &&
- $self->get('count') <= 0) {
+ $self->get('count') <= 0
+ ) {
return array(
'_qf_default' =>
- ts("You can not schedule or send this mailing because there are currently no recipients selected. Click 'Previous' to return to the Select Recipients step, OR click 'Save & Continue Later'."),
+ ts("You can not schedule or send this mailing because there are currently no recipients selected. Click 'Previous' to return to the Select Recipients step, OR click 'Save & Continue Later'."),
);
}
return $error;
}
- $job = new CRM_Mailing_BAO_MailingJob();
+ $job = new CRM_Mailing_BAO_MailingJob();
$job->mailing_id = $self->get('mailing_id');
- $job->is_test = TRUE;
+ $job->is_test = TRUE;
$job->save();
$newEmails = NULL;
$session = CRM_Core_Session::singleton();
'contact_type' => 'Individual',
'email' => array(
1 => array(
- 'email' => $email,
+ 'email' => $email,
'is_primary' => 1,
'location_type_id' => 1,
- )),
+ )
+ ),
);
- $contact = CRM_Contact_BAO_Contact::create($params);
- $emailId = $contact->email[0]->id;
+ $contact = CRM_Contact_BAO_Contact::create($params);
+ $emailId = $contact->email[0]->id;
$contactId = $contact->id;
$contact->free();
}
$queue_id = $this->_queue_id;
$hash = $this->_hash;
- $confirmURL = CRM_Utils_System::url("civicrm/mailing/{$this->_type}","reset=1&jid={$job_id}&qid={$queue_id}&h={$hash}&confirm=1");
+ $confirmURL = CRM_Utils_System::url("civicrm/mailing/{$this->_type}", "reset=1&jid={$job_id}&qid={$queue_id}&h={$hash}&confirm=1");
$this->assign('confirmURL', $confirmURL);
$session = CRM_Core_Session::singleton();
$session->pushUserContext($confirmURL);
array(1 => $values['email_confirm'])
);
- CRM_Core_Session::setStatus($statusMsg, '', 'fail');
+ CRM_Core_Session::setStatus($statusMsg, '', 'fail');
}
$this->assign("value", $result);
}
}
+
/**
* Set default values for the form.
* the default values are retrieved from the database
*/
public function buildQuickForm() {
$session = CRM_Core_Session::singleton();
- $config = CRM_Core_Config::singleton();
+ $config = CRM_Core_Config::singleton();
$options = array();
$tempVar = FALSE;
$this->add('select', 'from_email_address',
ts('From Email Address'), array(
- '' => '- select -') + $fromEmailAddress, TRUE
+ '' => '- select -'
+ ) + $fromEmailAddress, TRUE
);
//Added code to add custom field as Reply-To on form when it is enabled from Mailer settings
}
public function postProcess() {
- $params = $ids = array();
+ $params = $ids = array();
$uploadParams = array('header_id', 'footer_id', 'subject', 'from_name', 'from_email');
- $fileType = array('textFile', 'htmlFile');
+ $fileType = array('textFile', 'htmlFile');
$formValues = $this->controller->exportValues($this->_name);
$session = CRM_Core_Session::singleton();
$params['contact_id'] = $session->get('userID');
$composeFields = array(
- 'template', 'saveTemplate',
- 'updateTemplate', 'saveTemplateName',
+ 'template',
+ 'saveTemplate',
+ 'updateTemplate',
+ 'saveTemplateName',
);
$msgTemplate = NULL;
//mail template is composed
$urlParams .= "&qfKey=$qfKey";
}
- $session = CRM_Core_Session::singleton();
+ $session = CRM_Core_Session::singleton();
$draftURL = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
- $status = ts("You can continue later by clicking the 'Continue' action to resume working on it.<br />From <a href='%1'>Draft and Unscheduled Mailings</a>.", array(1 => $draftURL));
+ $status = ts("You can continue later by clicking the 'Continue' action to resume working on it.<br />From <a href='%1'>Draft and Unscheduled Mailings</a>.", array(1 => $draftURL));
CRM_Core_Session::setStatus($status, ts('Mailing Saved'), 'success');
// Redirect user to search.
$session = CRM_Core_Session::singleton();
$values = array(
- 'contact_id' => $session->get('userID'),
+ 'contact_id' => $session->get('userID'),
'version' => 3,
);
require_once 'api/api.php';
// set $header and $footer
foreach (array(
- 'header', 'footer') as $part) {
+ 'header',
+ 'footer'
+ ) as $part) {
$$part = array();
if ($params["{$part}_id"]) {
//echo "found<p>";
}
foreach (array(
- 'text', 'html') as $file) {
+ 'text',
+ 'html'
+ ) as $file) {
if (!$params['upload_type'] && !file_exists(CRM_Utils_Array::value('tmp_name', $files[$file . 'File']))) {
continue;
}
$name = $files[$file . 'File']['name'];
}
else {
- $str = $params[$file . '_message'];
- $str = ($file == 'html') ? str_replace('%7B', '{', str_replace('%7D', '}', $str)) : $str;
+ $str = $params[$file . '_message'];
+ $str = ($file == 'html') ? str_replace('%7B', '{', str_replace('%7D', '}', $str)) : $str;
$name = $file . ' message';
}
if ($err !== TRUE) {
foreach ($err as $token => $desc) {
$dataErrors[] = '<li>' . ts('This message is missing a required token - {%1}: %2',
- array(1 => $token, 2 => $desc)
- ) . '</li>';
+ array(1 => $token, 2 => $desc)
+ ) . '</li>';
}
}
}
// be a suggestion from someone on how to
// make it a bit more elegant
- $dummy_mail = new CRM_Mailing_BAO_Mailing();
- $mess = "body_{$file}";
+ $dummy_mail = new CRM_Mailing_BAO_Mailing();
+ $mess = "body_{$file}";
$dummy_mail->$mess = $str;
- $tokens = $dummy_mail->getTokens();
+ $tokens = $dummy_mail->getTokens();
$str = CRM_Utils_Token::replaceSubscribeInviteTokens($str);
$str = CRM_Utils_Token::replaceDomainTokens($str, $domain, NULL, $tokens[$file]);
}
if (!empty($dataErrors)) {
$errors[$file . 'File'] = ts('The following errors were detected in %1:', array(
- 1 => $name)) . ' <ul>' . implode('', $dataErrors) . '</ul><br /><a href="' . CRM_Utils_System::docURL2('Sample CiviMail Messages', TRUE, NULL, NULL, NULL, "wiki") . '" target="_blank">' . ts('More information on required tokens...') . '</a>';
+ 1 => $name
+ )) . ' <ul>' . implode('', $dataErrors) . '</ul><br /><a href="' . CRM_Utils_System::docURL2('Sample CiviMail Messages', TRUE, NULL, NULL, NULL, "wiki") . '" target="_blank">' . ts('More information on required tokens...') . '</a>';
}
}
$result = array();
$result['crmMailing'] = array(
'ext' => 'civicrm',
- 'js' => array('js/angular-crmMailing.js', 'js/angular-crmMailing/services.js', 'js/angular-crmMailing/directives.js'),
+ 'js' => array(
+ 'js/angular-crmMailing.js',
+ 'js/angular-crmMailing/services.js',
+ 'js/angular-crmMailing/directives.js'
+ ),
'css' => array('css/angular-crmMailing.css'),
);
$result['crmMailingAB'] = array(
'ext' => 'civicrm',
- 'js' => array('js/angular-crmMailingAB.js', 'js/angular-crmMailingAB/services.js', 'js/angular-crmMailingAB/directives.js'),
+ 'js' => array(
+ 'js/angular-crmMailingAB.js',
+ 'js/angular-crmMailingAB/services.js',
+ 'js/angular-crmMailingAB/directives.js'
+ ),
'css' => array('css/angular-crmMailingAB.css'),
);
$result['crmD3'] = array(
'contact_id' => $contactID,
));
$mesTemplate = civicrm_api3('MessageTemplate', 'get', array(
- 'sequential' => 1,
+ 'sequential' => 1,
'return' => array("msg_html", "id", "msg_title", "msg_subject", "msg_text"),
'workflow_id' => array('IS NULL' => ""),
));
'contactid' => $contactID,
'enableReplyTo' => isset($config->replyTo) ? $config->replyTo : 0,
'fromAddress' => array_values($fromAddress['values'][0]['api.OptionValue.get']['values']),
- 'defaultTestEmail' => civicrm_api3('Contact', 'getvalue', array('id' => 'user_contact_id', 'return' => 'email')),
+ 'defaultTestEmail' => civicrm_api3('Contact', 'getvalue', array(
+ 'id' => 'user_contact_id',
+ 'return' => 'email'
+ )),
'visibility' => array(
- array('value' => 'Public Pages', 'label' => ts('Public Pages')),
- array('value' => 'User and User Admin Only', 'label' => ts('User and User Admin Only')),
+ array('value' => 'Public Pages', 'label' => ts('Public Pages')),
+ array('value' => 'User and User Admin Only', 'label' => ts('User and User Admin Only')),
),
),
));
*/
public function registerAdvancedSearchPane() {
return array(
- 'title' => ts('Mailings'),
+ 'title' => ts('Mailings'),
'weight' => 20,
);
}
* mail store implementation for processing CiviMail-bound emails
*/
public static function getStore($name = NULL) {
- $dao = new CRM_Core_DAO_MailSettings;
- $dao->domain_id = CRM_Core_Config::domainID();
+ $dao = new CRM_Core_DAO_MailSettings;
+ $dao->domain_id = CRM_Core_Config::domainID();
$name ? $dao->name = $name : $dao->is_default = 1;
if (!$dao->find(TRUE)) {
throw new Exception("Could not find entry named $name in civicrm_mail_settings");
print "fetching $count messages\n";
}
}
- catch(ezcMailOffsetOutOfRangeException$e) {
+ catch (ezcMailOffsetOutOfRangeException$e) {
if ($this->_debug) {
print "got to the end of the mailbox\n";
}
$config = CRM_Core_Config::singleton();
$dir = $config->customFileUploadDir . DIRECTORY_SEPARATOR . $name;
foreach (array(
- 'cur', 'new', 'tmp') as $sub) {
+ 'cur',
+ 'new',
+ 'tmp'
+ ) as $sub) {
if (!file_exists($dir . DIRECTORY_SEPARATOR . $sub)) {
if ($this->_debug) {
print "creating $dir/$sub\n";
$this->_transport->authenticate($username, $password);
$this->_transport->selectMailbox($folder);
- $this->_ignored = implode($this->_transport->getHierarchyDelimiter(), array($folder, 'CiviMail', 'ignored'));
+ $this->_ignored = implode($this->_transport->getHierarchyDelimiter(), array($folder, 'CiviMail', 'ignored'));
$this->_processed = implode($this->_transport->getHierarchyDelimiter(), array($folder, 'CiviMail', 'processed'));
- $boxes = $this->_transport->listMailboxes();
+ $boxes = $this->_transport->listMailboxes();
if ($this->_debug) {
print 'mailboxes found: ' . implode(', ', $boxes) . "\n";
public function __construct($dir) {
$this->_dir = $dir;
- $this->_ignored = $this->maildir(implode(DIRECTORY_SEPARATOR, array('CiviMail.ignored', date('Y'), date('m'), date('d'))));
- $this->_processed = $this->maildir(implode(DIRECTORY_SEPARATOR, array('CiviMail.processed', date('Y'), date('m'), date('d'))));
+ $this->_ignored = $this->maildir(implode(DIRECTORY_SEPARATOR, array(
+ 'CiviMail.ignored',
+ date('Y'),
+ date('m'),
+ date('d')
+ )));
+ $this->_processed = $this->maildir(implode(DIRECTORY_SEPARATOR, array(
+ 'CiviMail.processed',
+ date('Y'),
+ date('m'),
+ date('d')
+ )));
}
/**
if (!$mail) {
return CRM_Core_Error::createAPIError(ts('%1 could not be parsed',
- array(1 => $file)
- ));
+ array(1 => $file)
+ ));
}
$mails[$file] = $mail[0];
}
public function __construct($dir) {
$this->_dir = $dir;
- $this->_ignored = $this->maildir(implode(DIRECTORY_SEPARATOR, array('CiviMail.ignored', date('Y'), date('m'), date('d'))));
- $this->_processed = $this->maildir(implode(DIRECTORY_SEPARATOR, array('CiviMail.processed', date('Y'), date('m'), date('d'))));
+ $this->_ignored = $this->maildir(implode(DIRECTORY_SEPARATOR, array(
+ 'CiviMail.ignored',
+ date('Y'),
+ date('m'),
+ date('d')
+ )));
+ $this->_processed = $this->maildir(implode(DIRECTORY_SEPARATOR, array(
+ 'CiviMail.processed',
+ date('Y'),
+ date('m'),
+ date('d')
+ )));
}
/**
$parser->options->parseTextAttachmentsAsFiles = TRUE;
foreach (array(
- 'cur', 'new') as $subdir) {
+ 'cur',
+ 'new'
+ ) as $subdir) {
$dir = $this->_dir . DIRECTORY_SEPARATOR . $subdir;
foreach (scandir($dir) as $file) {
if ($file == '.' or $file == '..') {
}
- $set = new ezcMailFileSet(array($path));
- $single = $parser->parseMail($set);
+ $set = new ezcMailFileSet(array($path));
+ $single = $parser->parseMail($set);
$mails[$path] = $single[0];
}
}
$this->_leftToProcess = count($this->_transport->listMessages());
- $this->_ignored = $this->maildir(implode(DIRECTORY_SEPARATOR, array('CiviMail.ignored', date('Y'), date('m'), date('d'))));
- $this->_processed = $this->maildir(implode(DIRECTORY_SEPARATOR, array('CiviMail.processed', date('Y'), date('m'), date('d'))));
+ $this->_ignored = $this->maildir(implode(DIRECTORY_SEPARATOR, array(
+ 'CiviMail.ignored',
+ date('Y'),
+ date('m'),
+ date('d')
+ )));
+ $this->_processed = $this->maildir(implode(DIRECTORY_SEPARATOR, array(
+ 'CiviMail.processed',
+ date('Y'),
+ date('m'),
+ date('d')
+ )));
}
/**
$this->_transport = new ezcMailPop3Transport($host, NULL, $options);
$this->_transport->authenticate($username, $password);
- $this->_ignored = $this->maildir(implode(DIRECTORY_SEPARATOR, array('CiviMail.ignored', date('Y'), date('m'), date('d'))));
- $this->_processed = $this->maildir(implode(DIRECTORY_SEPARATOR, array('CiviMail.processed', date('Y'), date('m'), date('d'))));
+ $this->_ignored = $this->maildir(implode(DIRECTORY_SEPARATOR, array(
+ 'CiviMail.ignored',
+ date('Y'),
+ date('m'),
+ date('d')
+ )));
+ $this->_processed = $this->maildir(implode(DIRECTORY_SEPARATOR, array(
+ 'CiviMail.processed',
+ date('Y'),
+ date('m'),
+ date('d')
+ )));
}
/**
$sortMapper = array(
0 => 'subject',
- 1 => 'creator_name',
- 2 => '',
- 3 => 'start_date',
- 4 => '',
- 5 => 'links',
+ 1 => 'creator_name',
+ 2 => '',
+ 3 => 'start_date',
+ 4 => '',
+ 5 => 'links',
);
- $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
- $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
- $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
- $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
+ $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
+ $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
+ $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
+ $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
$params = $_POST;
$iFilteredTotal = $iTotal = $params['total'];
$selectorElements = array(
- 'subject', 'mailing_creator', 'recipients',
- 'start_date', 'openstats', 'links',
+ 'subject',
+ 'mailing_creator',
+ 'recipients',
+ 'start_date',
+ 'openstats',
+ 'links',
);
echo CRM_Utils_JSON::encodeDataTableSelector($mailings, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
*/
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);
+ $this->_mailingId = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
+ $this->_sms = CRM_Utils_Request::retrieve('sms', 'Positive', $this);
$this->assign('sms', $this->_sms);
// check that the user has permission to access mailing id
CRM_Mailing_BAO_Mailing::checkPermission($this->_mailingId);
* @throws Exception
*/
public function run() {
- $job_id = CRM_Utils_Request::retrieve('jid', 'Integer', CRM_Core_DAO::$_nullObject);
+ $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);
+ $hash = CRM_Utils_Request::retrieve('h', 'String', CRM_Core_DAO::$_nullObject);
if (!$job_id ||
!$queue_id ||
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);
+ $contact_id = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
$subscribe_id = CRM_Utils_Request::retrieve('sid', 'Integer', CRM_Core_DAO::$_nullObject);
- $hash = CRM_Utils_Request::retrieve('h', 'String', CRM_Core_DAO::$_nullObject);
+ $hash = CRM_Utils_Request::retrieve('h', 'String', CRM_Core_DAO::$_nullObject);
if (!$contact_id ||
!$subscribe_id ||
$this->assign('report', $report);
CRM_Utils_System::setTitle(ts('CiviMail Report: %1',
- array(1 => $report['mailing']['name'])
- ));
+ array(1 => $report['mailing']['name'])
+ ));
return CRM_Core_Page::run();
}
*/
public function preProcess() {
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
- $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
+ $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId);
}
else {
//get tokens that are not contact specific resolved
- $params = array('contact_id' => 0);
+ $params = array('contact_id' => 0);
$details = CRM_Utils_Token::getAnonymousTokenDetails($params,
$returnProperties,
TRUE, TRUE, NULL,
$options = array(
'bounce' => array(
'N' => ts('Successful '),
- 'Y' => ts('Bounced '),
+ 'Y' => ts('Bounced '),
),
'delivered' => array(
'Y' => ts('Successful '),
- 'N' => ts('Bounced '),
+ 'N' => ts('Bounced '),
),
'open' => array(
'Y' => ts('Opened '),
- 'N' => ts('Unopened/Hidden '),
+ 'N' => ts('Unopened/Hidden '),
),
'click' => array(
'Y' => ts('Clicked '),
- 'N' => ts('Not Clicked '),
+ 'N' => ts('Not Clicked '),
),
'reply' => array(
'Y' => ts('Replied '),
- 'N' => ts('No Reply '),
+ 'N' => ts('No Reply '),
),
);
}
if (CRM_Campaign_BAO_Campaign::isCampaignEnable()) {
self::$_columnHeaders[] = array(
- 'name' => ts('Campaign'),
+ 'name' => ts('Campaign'),
'sort' => 'campaign_id',
'direction' => CRM_Utils_Sort::DONTCARE,
);
* Total number of rows
*/
public function getTotalCount($action) {
- $job = CRM_Mailing_BAO_MailingJob::getTableName();
- $mailing = CRM_Mailing_BAO_Mailing::getTableName();
+ $job = CRM_Mailing_BAO_MailingJob::getTableName();
+ $mailing = CRM_Mailing_BAO_Mailing::getTableName();
$mailingACL = CRM_Mailing_BAO_Mailing::mailingACL();
//get the where clause.
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?');
- $deleteExtra = ts('Are you sure you want to delete this mailing?');
+ $cancelExtra = ts('Are you sure you want to cancel this mailing?');
+ $deleteExtra = ts('Are you sure you want to delete this mailing?');
$archiveExtra = ts('Are you sure you want to archive this mailing?');
$actionLinks = array(
}
}
if (in_array($row['status'], array(
- 'Scheduled', 'Running', 'Paused'))) {
+ 'Scheduled',
+ 'Running',
+ 'Paused'
+ ))) {
if ($allAccess ||
($showApprovalLinks && $showCreateLinks && $showScheduleLinks)
) {
}
if (in_array($row['status'], array('Complete', 'Canceled')) &&
- !$row['archived']) {
+ !$row['archived']
+ ) {
if ($allAccess || $showCreateLinks) {
$actionMask |= CRM_Core_Action::RENEW;
}
*/
public function whereClause(&$params, $sortBy = TRUE) {
$values = $clauses = array();
- $isFormSubmitted = $this->_parent->get('hidden_find_mailings');
+ $isFormSubmitted = $this->_parent->get('hidden_find_mailings');
$title = $this->_parent->get('mailing_name');
if ($title) {
$dateClause1[] = 'civicrm_mailing_job.start_date <= %3';
$dateClause2[] = 'civicrm_mailing_job.scheduled_date <= %3';
}
- $params[3] = array($to, 'String');
+ $params[3] = array($to, 'String');
}
$dateClauses = array();
}
// get values submitted by form
- $isDraft = $this->_parent->get('status_unscheduled');
- $isArchived = $this->_parent->get('is_archived');
+ $isDraft = $this->_parent->get('status_unscheduled');
+ $isArchived = $this->_parent->get('is_archived');
$mailingStatus = $this->_parent->get('mailing_status');
if (!$isFormSubmitted && $this->_parent->get('scheduled')) {
* @access public
*/
public function __construct($event, $distinct, $mailing, $job = NULL, $url = NULL) {
- $this->_event_type = $event;
+ $this->_event_type = $event;
$this->_is_distinct = $distinct;
- $this->_mailing_id = $mailing;
- $this->_job_id = $job;
- $this->_url_id = $url;
+ $this->_mailing_id = $mailing;
+ $this->_job_id = $job;
+ $this->_url_id = $url;
}
/**
*/
public function getPagerParams($action, &$params) {
$params['csvString'] = NULL;
- $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
- $params['status'] = ts('%1 %%StatusMessage%%', array(1 => $this->eventToTitle()));
+ $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
+ $params['status'] = ts('%1 %%StatusMessage%%', array(1 => $this->eventToTitle()));
$params['buttonTop'] = 'PagerTopButton';
$params['buttonBottom'] = 'PagerBottomButton';
}
$dateSort = CRM_Mailing_Event_BAO_Unsubscribe::getTableName() . '.time_stamp';
$this->_columnHeaders = array_merge($this->_columnHeaders, array(
array(
- 'name' => ts('Unsubscribe'),
- ),
- ));
+ 'name' => ts('Unsubscribe'),
+ ),
+ ));
break;
case 'optout':
$dateSort = CRM_Mailing_Event_BAO_Unsubscribe::getTableName() . '.time_stamp';
$this->_columnHeaders = array_merge($this->_columnHeaders, array(
array(
- 'name' => ts('Opt-Out'),
- ),
- ));
+ 'name' => ts('Opt-Out'),
+ ),
+ ));
break;
case 'click':
$dateSort = CRM_Mailing_Event_BAO_TrackableURLOpen::getTableName() . '.time_stamp';
$this->_columnHeaders = array_merge($this->_columnHeaders, array(
array(
- 'name' => ts('URL'),
- ),
- ));
+ 'name' => ts('URL'),
+ ),
+ ));
break;
default:
return CRM_Mailing_Event_BAO_Queue::getRows($this->_mailing_id,
$this->_job_id, $offset, $rowCount, $sort
);
- break;
+ break;
case 'delivered':
return CRM_Mailing_Event_BAO_Delivered::getRows($this->_mailing_id,
'bounce' => ts('Bounces'),
'forward' => ts('Forwards'),
'reply' => $this->_is_distinct
- ? ts('Unique Replies')
- : ts('Replies'),
+ ? ts('Unique Replies')
+ : ts('Replies'),
'unsubscribe' => ts('Unsubscribe Requests'),
'optout' => ts('Opt-out Requests'),
'click' => $this->_is_distinct
- ? ts('Unique Click-throughs')
- : ts('Click-throughs'),
+ ? ts('Unique Click-throughs')
+ : ts('Click-throughs'),
'opened' => $this->_is_distinct
- ? ts('Unique Tracked Opens')
- : ts('Tracked Opens'),
+ ? ts('Unique Tracked Opens')
+ : ts('Tracked Opens'),
);
}
return $events[$this->_event_type];
// submitted form values
$this->_queryParams = &$queryParams;
- $this->_single = $single;
- $this->_limit = $limit;
- $this->_context = $context;
+ $this->_single = $single;
+ $this->_limit = $limit;
+ $this->_context = $context;
$this->_compContext = $compContext;
$this->_mailingClause = $mailingClause;
$searchContext = ($context) ? "&context=$context" : NULL;
self::$_links = array(
- CRM_Core_Action::VIEW => array(
- 'name' => ts('View'),
- 'url' => 'civicrm/contact/view',
- 'qs' => "reset=1&cid=%%cid%%{$searchContext}{$extraParams}",
- 'title' => ts('View Contact Details'),
- ),
- CRM_Core_Action::UPDATE => array(
- 'name' => ts('Edit'),
- 'url' => 'civicrm/contact/add',
- 'qs' => "reset=1&action=update&cid=%%cid%%{$searchContext}{$extraParams}",
- 'title' => ts('Edit Contact Details'),
- ),
- CRM_Core_Action::DELETE => array(
- 'name' => ts('Delete'),
- 'url' => 'civicrm/contact/view/delete',
- 'qs' => "reset=1&delete=1&cid=%%cid%%{$searchContext}{$extraParams}",
- 'title' => ts('Delete Contact'),
- ),
+ CRM_Core_Action::VIEW => array(
+ 'name' => ts('View'),
+ 'url' => 'civicrm/contact/view',
+ 'qs' => "reset=1&cid=%%cid%%{$searchContext}{$extraParams}",
+ 'title' => ts('View Contact Details'),
+ ),
+ CRM_Core_Action::UPDATE => array(
+ 'name' => ts('Edit'),
+ 'url' => 'civicrm/contact/add',
+ 'qs' => "reset=1&action=update&cid=%%cid%%{$searchContext}{$extraParams}",
+ 'title' => ts('Edit Contact Details'),
+ ),
+ CRM_Core_Action::DELETE => array(
+ 'name' => ts('Delete'),
+ 'url' => 'civicrm/contact/view/delete',
+ 'qs' => "reset=1&delete=1&cid=%%cid%%{$searchContext}{$extraParams}",
+ 'title' => ts('Delete Contact'),
+ ),
);
}
return self::$_links;
//insert payment record for this membership
if (!empty($params['relate_contribution_id'])) {
CRM_Member_BAO_MembershipPayment::create(array(
- 'membership_id' => $membership->id,
- 'contribution_id' => $params['relate_contribution_id'],
- ));
+ 'membership_id' => $membership->id,
+ 'contribution_id' => $params['relate_contribution_id'],
+ ));
}
// add activity record only during create mode and renew mode
*/
static function buildMembershipBlock(
&$form,
- $pageID,
- $cid,
- $formItems = FALSE,
- $selectedMembershipTypeID = NULL,
- $thankPage = FALSE,
- $isTest = NULL
+ $pageID,
+ $cid,
+ $formItems = FALSE,
+ $selectedMembershipTypeID = NULL,
+ $thankPage = FALSE,
+ $isTest = NULL
) {
$separateMembershipPayment = FALSE;
*/
public static function postProcessMembership(
$membershipParams, $contactID, &$form, $premiumParams,
- $customFieldsFormatted = NULL, $includeFieldTypes = NULL, $membershipDetails, $membershipTypeIDs, $isPaidMembership, $membershipID,
- $isProcessSeparateMembershipTransaction, $defaultContributionTypeID, $membershipLineItems, $isPayLater) {
+ $customFieldsFormatted = NULL, $includeFieldTypes = NULL, $membershipDetails, $membershipTypeIDs, $isPaidMembership, $membershipID,
+ $isProcessSeparateMembershipTransaction, $defaultContributionTypeID, $membershipLineItems, $isPayLater) {
$result = $membershipContribution = NULL;
$isTest = CRM_Utils_Array::value('is_test', $membershipParams, FALSE);
$errors = $createdMemberships = array();
if (!empty($membershipContribution->trxn_id)) {
try {
civicrm_api3('contribution', 'completetransaction', array(
- 'id' => $membershipContribution->id,
- 'trxn_id' => $membershipContribution->trxn_id,
- ));
+ 'id' => $membershipContribution->id,
+ 'trxn_id' => $membershipContribution->trxn_id,
+ ));
}
catch (CiviCRM_API3_Exception $e) {
// if for any reason it is already completed this will fail - e.g extensions hacking around core not completing transactions prior to CRM-15296
*/
public static function linkMembershipPayment($membership, $membershipContribution) {
CRM_Member_BAO_MembershipPayment::create(array(
- 'membership_id' => $membership->id,
- 'contribution_id' => $membershipContribution->id,
- ));
+ 'membership_id' => $membership->id,
+ 'contribution_id' => $membershipContribution->id,
+ ));
}
/**
}
$result['is_error'] = 0;
$result['messages'] = ts('Processed %1 membership records. Updated %2 records.', array(
- 1 => $processCount,
- 2 => $updateCount,
- ));
+ 1 => $processCount,
+ 2 => $updateCount,
+ ));
return $result;
}
//insert payment record for this membership
if (empty($ids['contribution']) || !empty($params['is_recur'])) {
CRM_Member_BAO_MembershipPayment::create(array(
- 'membership_id' => $membershipId,
- 'contribution_id' => $contribution->id,
- ));
+ 'membership_id' => $membershipId,
+ 'contribution_id' => $contribution->id,
+ ));
}
return $contribution;
}
public function __construct() {
parent::__construct();
}
+
/**
* Add the membership Blocks
*
public function __construct() {
parent::__construct();
}
+
/**
* Add the membership Payments
*
// table. However, at this stage we have both - there is still quite a bit of refactoring to do to set the line_iten entity_id right the first time
// however, we can assume at this stage that any contribution id will have only one line item with that membership type in the line item table
// OR the caller will have taken responsibility for updating the line items themselves so we will update using SQL here
- $membershipTypeID = civicrm_api3('membership', 'getvalue', array('id' => $dao->membership_id, 'return' => 'membership_type_id'));
+ $membershipTypeID = civicrm_api3('membership', 'getvalue', array(
+ 'id' => $dao->membership_id,
+ 'return' => 'membership_type_id'
+ ));
$sql = "UPDATE civicrm_line_item li
LEFT JOIN civicrm_price_field_value pv ON pv.id = li.price_field_value_id
SET entity_table = 'civicrm_membership', entity_id = %1
WHERE pv.membership_type_id = %2
AND contribution_id = %3";
- CRM_Core_DAO::executeQuery($sql, array(1 => array($dao->membership_id, 'Integer'), 2 => array($membershipTypeID, 'Integer'), 3 => array($dao->contribution_id, 'Integer')));
+ CRM_Core_DAO::executeQuery($sql, array(
+ 1 => array($dao->membership_id, 'Integer'),
+ 2 => array($membershipTypeID, 'Integer'),
+ 3 => array($dao->contribution_id, 'Integer')
+ ));
return $dao;
}
public static function create($params) {
$ids = array();
if (!empty($params['id'])) {
- $ids['membershipStatus'] = $params['id'];
+ $ids['membershipStatus'] = $params['id'];
}
else {
//don't allow duplicate names - if id not set
$membershipStatusBAO = CRM_Member_BAO_MembershipStatus::add($params, $ids);
return $membershipStatusBAO;
}
+
/**
* Add the membership types
*
// add in months
if ($membershipStatus->{$eve . '_event_adjust_unit'} == 'month') {
${$eve . 'Event'} = date('Ymd', mktime($hour, $minute, $second,
- ${$dat . 'Month'} + $membershipStatus->{$eve . '_event_adjust_interval'},
- ${$dat . 'Day'},
- ${$dat . 'Year'}
+ ${$dat . 'Month'} + $membershipStatus->{$eve . '_event_adjust_interval'},
+ ${$dat . 'Day'},
+ ${$dat . 'Year'}
));
}
// add in days
if ($membershipStatus->{$eve . '_event_adjust_unit'} == 'day') {
${$eve . 'Event'} = date('Ymd', mktime($hour, $minute, $second,
- ${$dat . 'Month'},
- ${$dat . 'Day'} + $membershipStatus->{$eve . '_event_adjust_interval'},
- ${$dat . 'Year'}
+ ${$dat . 'Month'},
+ ${$dat . 'Day'} + $membershipStatus->{$eve . '_event_adjust_interval'},
+ ${$dat . 'Year'}
));
}
// add in years
if ($membershipStatus->{$eve . '_event_adjust_unit'} == 'year') {
${$eve . 'Event'} = date('Ymd', mktime($hour, $minute, $second,
- ${$dat . 'Month'},
- ${$dat . 'Day'},
- ${$dat . 'Year'} + $membershipStatus->{$eve . '_event_adjust_interval'}
+ ${$dat . 'Month'},
+ ${$dat . 'Day'},
+ ${$dat . 'Year'} + $membershipStatus->{$eve . '_event_adjust_interval'}
));
}
// if no interval and unit, present
*/
public static function del($membershipTypeId) {
//check dependencies
- $check = FALSE;
- $status = array();
+ $check = FALSE;
+ $status = array();
$dependancy = array(
'Membership' => 'membership_type_id',
'MembershipBlock' => 'membership_type_default',
if (in_array('Membership', $status)) {
$findMembersURL = CRM_Utils_System::url('civicrm/member/search', 'reset=1');
$deleteURL = CRM_Utils_System::url('civicrm/contact/search/advanced', 'reset=1');
- $message .= '<br/>' . ts('%3. There are some contacts who have this membership type assigned to them. Search for contacts with this membership type from <a href=\'%1\'>Find Members</a>. If you are still getting this message after deleting these memberships, there may be contacts in the Trash (deleted) with this membership type. Try using <a href="%2">Advanced Search</a> and checking "Search in Trash".', array(1 => $findMembersURL, 2 => $deleteURL, 3 => $cnt));
+ $message .= '<br/>' . ts('%3. There are some contacts who have this membership type assigned to them. Search for contacts with this membership type from <a href=\'%1\'>Find Members</a>. If you are still getting this message after deleting these memberships, there may be contacts in the Trash (deleted) with this membership type. Try using <a href="%2">Advanced Search</a> and checking "Search in Trash".', array(
+ 1 => $findMembersURL,
+ 2 => $deleteURL,
+ 3 => $cnt
+ ));
$cnt++;
}
if (in_array('MembershipBlock', $status)) {
$deleteURL = CRM_Utils_System::url('civicrm/admin/contribute', 'reset=1');
- $message .= ts('%2. This Membership Type is used in an <a href=\'%1\'>Online Contribution page</a>. Uncheck this membership type in the Memberships tab.', array(1 => $deleteURL, 2 => $cnt));
+ $message .= ts('%2. This Membership Type is used in an <a href=\'%1\'>Online Contribution page</a>. Uncheck this membership type in the Memberships tab.', array(
+ 1 => $deleteURL,
+ 2 => $cnt
+ ));
throw new CRM_Core_Exception($message);
}
}
foreach ($periodDays as $pDay) {
if (!empty($details[$pDay])) {
if ($details[$pDay] > 31) {
- $month = substr($details[$pDay], 0, strlen($details[$pDay]) - 2);
- $day = substr($details[$pDay], -2);
+ $month = substr($details[$pDay], 0, strlen($details[$pDay]) - 2);
+ $day = substr($details[$pDay], -2);
$monthMap = array(
'1' => 'Jan',
'2' => 'Feb',
// convert all dates to 'Y-m-d' format.
foreach (array(
- 'joinDate', 'startDate', 'endDate') as $dateParam) {
+ 'joinDate',
+ 'startDate',
+ 'endDate'
+ ) as $dateParam) {
if (!empty($$dateParam)) {
$$dateParam = CRM_Utils_Date::processDate($$dateParam, NULL, FALSE, 'Y-m-d');
}
//get the fixed end date here.
$dateParts = explode('-', $actualStartDate);
$fixedEndDate = date('Y-m-d', mktime(0, 0, 0,
- $dateParts[1],
- $dateParts[2] - 1,
- $dateParts[0] + ($numRenewTerms * $membershipTypeDetails['duration_interval'])
- ));
+ $dateParts[1],
+ $dateParts[2] - 1,
+ $dateParts[0] + ($numRenewTerms * $membershipTypeDetails['duration_interval'])
+ ));
//make sure rollover window should be
//subset of membership period window.
//calculate end date if it is not passed by user
if (!$endDate) {
//end date calculation
- $date = explode('-', $actualStartDate);
- $year = $date[0];
+ $date = explode('-', $actualStartDate);
+ $year = $date[0];
$month = $date[1];
- $day = $date[2];
+ $day = $date[2];
switch ($membershipTypeDetails['duration_unit']) {
case 'year':
* @static
*/
public static function getRenewalDatesForMembershipType($membershipId, $changeToday = NULL, $membershipTypeID = NULL, $numRenewTerms = 1) {
- $params = array('id' => $membershipId);
+ $params = array('id' => $membershipId);
$membershipDetails = CRM_Member_BAO_Membership::getValues($params, $values);
- $statusID = $membershipDetails[$membershipId]->status_id;
+ $statusID = $membershipDetails[$membershipId]->status_id;
$membershipDates = array(
'join_date' => CRM_Utils_Date::customFormat($membershipDetails[$membershipId]->join_date, '%Y%m%d'),
);
$oldPeriodType = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType',
- CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $membershipId, 'membership_type_id'), 'period_type');
+ CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $membershipId, 'membership_type_id'), 'period_type');
// CRM-7297 Membership Upsell
if (is_null($membershipTypeID)) {
else {
$date = $membershipDetails[$membershipId]->end_date;
}
- $date = explode('-', $date);
+ $date = explode('-', $date);
$logStartDate = date('Y-m-d', mktime(0, 0, 0,
- (double) $date[1],
- (double) ($date[2] + 1),
- (double) $date[0]
- ));
+ (double) $date[1],
+ (double) ($date[2] + 1),
+ (double) $date[0]
+ ));
- $date = explode('-', $logStartDate);
- $year = $date[0];
+ $date = explode('-', $logStartDate);
+ $year = $date[0];
$month = $date[1];
- $day = $date[2];
+ $day = $date[2];
switch ($membershipTypeDetails['duration_unit']) {
case 'year':
}
else {
$endDate = date('Y-m-d', mktime(0, 0, 0,
- $month,
- $day - 1,
- $year
- ));
+ $month,
+ $day - 1,
+ $year
+ ));
}
$today = date('Y-m-d');
$membershipDates['today'] = CRM_Utils_Date::customFormat($today, '%Y%m%d');
else {
$fieldName = $previousID;
}
- $fieldLabel = 'Membership Amount';
- $optionsIds = NULL;
+ $fieldLabel = 'Membership Amount';
+ $optionsIds = NULL;
$fieldParams = array(
'price_set_id ' => $priceSetId,
'name' => $fieldName,
$results = array();
CRM_Price_BAO_PriceFieldValue::retrieve($fieldValueParams, $results);
if (!empty($results)) {
- $results['label'] = $results['name'] = $params['name'];
+ $results['label'] = $results['name'] = $params['name'];
$results['amount'] = empty($params['minimum_fee']) ? 0 : $params['minimum_fee'];
- $optionsIds['id'] = $results['id'];
+ $optionsIds['id'] = $results['id'];
}
else {
$results = array(
* $Id$
*
*/
-class CRM_Member_Config extends CRM_Core_Component_Config {}
+class CRM_Member_Config extends CRM_Core_Component_Config {
+}
}
list($this->_memberDisplayName,
- $this->_memberEmail
- ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
+ $this->_memberEmail
+ ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
//CRM-10375 Where the payer differs to the member the payer should get the email.
// here we store details in order to do that
if (!empty($formValues['soft_credit_contact_id'])) {
$this->_receiptContactId = $this->_contributorContactID = $formValues['soft_credit_contact_id'];
list($this->_contributorDisplayName,
- $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contributorContactID);
+ $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contributorContactID);
}
else {
$this->_receiptContactId = $this->_contributorContactID = $this->_contactID;
}
if ($this->_context == 'standalone') {
- $this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE, 'api' => array('extra' => array('email'))), TRUE);
+ $this->addEntityRef('contact_id', ts('Contact'), array(
+ 'create' => TRUE,
+ 'api' => array('extra' => array('email'))
+ ), TRUE);
}
$selOrgMemType[0][0] = $selMemTypeOrg[0] = ts('- select -');
}
$memTypeJs = array(
'onChange' =>
- "CRM.buildCustomData( 'Membership', this.value ); buildAutoRenew(this.value, null );",
+ "CRM.buildCustomData( 'Membership', this.value ); buildAutoRenew(this.value, null );",
);
}
}
CRM_Core_DAO::getAttribute('CRM_Member_DAO_Membership', 'max_related')
);
- $sel = & $this->addElement('hierselect',
+ $sel = &$this->addElement('hierselect',
'membership_type_id',
ts('Membership Organization and Type'),
$memTypeJs
}
if (empty($params['status_id']) || in_array($params['status_id'], $status_ids) == FALSE) {
$errors['status_id'] = ts('Please enter a status that does NOT represent a current membership status.');
- $errors['is_override'] = ts('This must be checked because you set an End Date for a lifetime membership');
+ $errors['is_override'] = ts('This must be checked because you set an End Date for a lifetime membership');
}
}
else {
}
if (isset($params['is_override']) &&
- $params['is_override'] && empty($params['status_id'])) {
+ $params['is_override'] && empty($params['status_id'])
+ ) {
$errors['status_id'] = ts('Please enter the status.');
}
if (!$this->_onlinePendingContributionId) {
if (empty($formValues['source'])) {
- $params['contribution_source'] = ts('%1 Membership: Offline signup (by %2)', array(1 => $membershipType, 2 => $userName));
+ $params['contribution_source'] = ts('%1 Membership: Offline signup (by %2)', array(
+ 1 => $membershipType,
+ 2 => $userName
+ ));
}
else {
$params['contribution_source'] = $formValues['source'];
$this->_memPriceSetId = $priceSetId;
$pFIDs = array();
if ($priceSetId) {
- CRM_Core_DAO::commonRetrieveAll('CRM_Price_DAO_PriceField', 'price_set_id', $priceSetId, $pFIDs, $return = array('html_type', 'name', 'label'));
+ CRM_Core_DAO::commonRetrieveAll('CRM_Price_DAO_PriceField', 'price_set_id', $priceSetId, $pFIDs, $return = array(
+ 'html_type',
+ 'name',
+ 'label'
+ ));
foreach ($pFIDs as $pid => $pValue) {
if ($pValue['html_type'] == 'Radio' && $pValue['name'] == 'membership_amount') {
$defaults['mem_price_field_id'] = $pValue['id'];
$membershipDefault[] = $this->createElement('radio', NULL, NULL, NULL, $k);
$membershipRequired[$k] = NULL;
if ($isRecur) {
- $autoRenew = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $k, 'auto_renew');
+ $autoRenew = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $k, 'auto_renew');
$membershipRequired[$k] = $autoRenew;
$autoRenewOptions = array();
if ($autoRenew) {
$this->assign('auto_renew', $this->_renewOption);
}
$this->addGroup($membership, 'membership_type', ts('Membership Types'));
- $this->addGroup($membershipDefault, 'membership_type_default', ts('Membership Types Default'))->setAttribute('allowClear', TRUE);
+ $this->addGroup($membershipDefault, 'membership_type_default', ts('Membership Types Default'))
+ ->setAttribute('allowClear', TRUE);
$this->addFormRule(array('CRM_Member_Form_MembershipBlock', 'formRule'), $this->_id);
}
//if both auto-renew and non-auto-renew memberships
if ($bothTypes) {
$paymentProcessorIds = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage',
- $contributionPageId, 'payment_processor'
- );
+ $contributionPageId, 'payment_processor'
+ );
$paymentProcessorId = explode(CRM_Core_DAO::VALUE_SEPARATOR, $paymentProcessorIds);
if ($pid) {
$paymentProcessorTypeId = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessor',
$pid, 'payment_processor_type_id'
- );
+ );
}
if (!($paymentProcessorTypeId == CRM_Utils_Array::key('PayPal', $paymentProcessorType) ||
- ($paymentProcessorTypeId == CRM_Utils_Array::key('AuthNet', $paymentProcessorType)))) {
+ ($paymentProcessorTypeId == CRM_Utils_Array::key('AuthNet', $paymentProcessorType)))
+ ) {
$errors['member_price_set_id'] = ts('The membership price set associated with this online contribution allows a user to select BOTH an auto-renew AND a non-auto-renew membership. This requires submitting multiple processor transactions, and is not supported for one or more of the payment processors enabled under the Amounts tab.');
}
}
if ($contributionPageId && !empty($params['member_price_set_id']) &&
- CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $contributionPageId, 'amount_block_is_active')) {
+ CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $contributionPageId, 'amount_block_is_active')
+ ) {
$errors['member_price_set_id'] = ts('You cannot use Membership Price Sets with the Contribution Amounts section. However, a membership price set may include additional fields for non-membership options that requires an additional fee (e.g. magazine subscription) or an additional voluntary contribution.');
}
$deletePriceSet = 0;
if ($params['membership_type']) {
// we do this in case the user has hit the forward/back button
- $dao = new CRM_Member_DAO_MembershipBlock();
+ $dao = new CRM_Member_DAO_MembershipBlock();
$dao->entity_table = 'civicrm_contribution_page';
- $dao->entity_id = $this->_id;
+ $dao->entity_id = $this->_id;
$dao->find(TRUE);
$membershipID = $dao->id;
if ($membershipID) {
unset($options[$priceFieldID]);
}
$membetype = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($memType);
- $fieldParams['option_label'][$rowCount] = CRM_Utils_Array::value('name', $membetype);
- $fieldParams['option_amount'][$rowCount] = CRM_Utils_Array::value('minimum_fee', $membetype, 0);
- $fieldParams['option_weight'][$rowCount] = CRM_Utils_Array::value('weight', $membetype);
+ $fieldParams['option_label'][$rowCount] = CRM_Utils_Array::value('name', $membetype);
+ $fieldParams['option_amount'][$rowCount] = CRM_Utils_Array::value('minimum_fee', $membetype, 0);
+ $fieldParams['option_weight'][$rowCount] = CRM_Utils_Array::value('weight', $membetype);
$fieldParams['option_description'][$rowCount] = CRM_Utils_Array::value('description', $membetype);
- $fieldParams['default_option'] = CRM_Utils_Array::value('membership_type_default', $params);
+ $fieldParams['default_option'] = CRM_Utils_Array::value('membership_type_default', $params);
$fieldParams['option_financial_type_id'][$rowCount] = CRM_Utils_Array::value('financial_type_id', $membetype);
$fieldParams['membership_type_id'][$rowCount] = $memType;
if ($priceSetID) {
$params['membership_types'] = 'null';
$params['membership_type_default'] = CRM_Utils_Array::value('membership_type_default', $params, 'null');
- $params['membership_types'] = serialize($membershipTypes);
- $params['display_min_fee'] = CRM_Utils_Array::value('display_min_fee', $params, FALSE);
- $params['is_separate_payment'] = CRM_Utils_Array::value('is_separate_payment', $params, FALSE);
+ $params['membership_types'] = serialize($membershipTypes);
+ $params['display_min_fee'] = CRM_Utils_Array::value('display_min_fee', $params, FALSE);
+ $params['is_separate_payment'] = CRM_Utils_Array::value('is_separate_payment', $params, FALSE);
}
$params['entity_table'] = 'civicrm_contribution_page';
$params['entity_id'] = $this->_id;
}
$this->assign('endDate', CRM_Utils_Date::customFormat(CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership',
- $this->_id, 'end_date'
- )
- ));
+ $this->_id, 'end_date'
+ )
+ ));
$this->assign('membershipStatus',
CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus',
CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership',
$statusMsg = ts('Membership Renewal using a credit card requires a Membership fee. Since there is no fee associated with the selected membership type, you can use the normal renewal mode.');
CRM_Core_Session::setStatus($statusMsg, '', 'info');
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view/membership',
- "reset=1&action=renew&cid={$this->_contactID}&id={$this->_id}&context=membership"
- ));
+ "reset=1&action=renew&cid={$this->_contactID}&id={$this->_id}&context=membership"
+ ));
}
}
return CRM_Custom_Form_CustomData::setDefaultValues($this);
}
- $defaults = parent::setDefaultValues();
+ $defaults = parent::setDefaultValues();
$this->_memType = $defaults['membership_type_id'];
// set renewal_date and receive_date to today in correct input format (setDateDefaults uses today if no value passed)
}
$defaults['total_amount'] = CRM_Utils_Money::format(CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType',
- $this->_memType,
- 'minimum_fee'
- ), NULL, '%a');
+ $this->_memType,
+ 'minimum_fee'
+ ), NULL, '%a');
$defaults['record_contribution'] = 0;
$defaults['num_terms'] = 1;
}
$names = array(
- 'first_name', 'middle_name', 'last_name', "street_address-{$this->_bltID}",
- "city-{$this->_bltID}", "postal_code-{$this->_bltID}", "country_id-{$this->_bltID}",
+ 'first_name',
+ 'middle_name',
+ 'last_name',
+ "street_address-{$this->_bltID}",
+ "city-{$this->_bltID}",
+ "postal_code-{$this->_bltID}",
+ "country_id-{$this->_bltID}",
"state_province_id-{$this->_bltID}",
);
foreach ($names as $name) {
parent::buildQuickForm();
- $defaults = parent::setDefaultValues();
+ $defaults = parent::setDefaultValues();
$this->_memType = $defaults['membership_type_id'];
$this->assign('customDataType', 'Membership');
$this->assign('customDataSubType', $this->_memType);
// membership type is selected.
$allMembershipInfo[$key] = array(
'financial_type_id' => CRM_Utils_Array::value('financial_type_id', $values),
- 'total_amount' => CRM_Utils_Money::format($values['minimum_fee'], NULL, '%a'),
+ 'total_amount' => CRM_Utils_Money::format($values['minimum_fee'], NULL, '%a'),
'total_amount_numeric' => CRM_Utils_Array::value('minimum_fee', $values),
);
while ($recurMembershipTypes->fetch()) {
$autoRenew[$recurMembershipTypes->id] = $recurMembershipTypes->auto_renew;
foreach (array(
- 'id', 'auto_renew', 'duration_unit', 'duration_interval') as $fld) {
+ 'id',
+ 'auto_renew',
+ 'duration_unit',
+ 'duration_interval'
+ ) as $fld) {
$this->_recurMembershipTypes[$recurMembershipTypes->id][$fld] = $recurMembershipTypes->$fld;
}
}
// Retrieve the name and email of the contact - this will be the TO for receipt email
list($this->_contributorDisplayName,
$this->_contributorEmail
- ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
+ ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
$this->assign('email', $this->_contributorEmail);
$mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
if ($this->_mode) {
$formValues['total_amount'] = CRM_Utils_Array::value('total_amount', $this->_params, CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType',
- $this->_memType, 'minimum_fee'
- ));
+ $this->_memType, 'minimum_fee'
+ ));
if (empty($formValues['financial_type_id'])) {
$formValues['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_memType, 'financial_type_id');
}
if (is_a($result, 'CRM_Core_Error')) {
CRM_Core_Error::displaySessionError($result);
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view/membership',
- "reset=1&action=renew&cid={$this->_contactID}&id={$this->_id}&context=membership&mode={$this->_mode}"
- ));
+ "reset=1&action=renew&cid={$this->_contactID}&id={$this->_id}&context=membership&mode={$this->_mode}"
+ ));
}
if ($result) {
$this->assign('mem_start_date', CRM_Utils_Date::customFormat($renewMembership->start_date));
$this->assign('mem_end_date', CRM_Utils_Date::customFormat($renewMembership->end_date));
$this->assign('membership_name', CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType',
- $renewMembership->membership_type_id
- ));
+ $renewMembership->membership_type_id
+ ));
$this->assign('customValues', $customValues);
if ($this->_mode) {
if (!empty($this->_params['billing_first_name'])) {
try {
CRM_Member_BAO_MembershipStatus::del($this->_id);
}
- catch(CRM_Core_Exception $e) {
+ catch (CRM_Core_Exception $e) {
CRM_Core_Error::statusBounce($e->getMessage(), NULL, ts('Delete Failed'));
}
CRM_Core_Session::setStatus(ts('Selected membership status has been deleted.'), ts('Record Deleted'), 'success');
$membershipStatus = CRM_Member_BAO_MembershipStatus::add($params, $ids);
CRM_Core_Session::setStatus(ts('The membership status \'%1\' has been saved.',
- array(1 => $membershipStatus->label)
- ), ts('Saved'), 'success');
+ array(1 => $membershipStatus->label)
+ ), ts('Saved'), 'success');
}
}
}
$periods = array('fixed_period_start_day', 'fixed_period_rollover_day');
foreach ($periods as $per) {
if (isset($defaults[$per])) {
- $date = $defaults[$per];
+ $date = $defaults[$per];
$defaults[$per] = array();
if ($date > 31) {
- $date = ($date < 999) ? '0' . $date : $date;
+ $date = ($date < 999) ? '0' . $date : $date;
$defaults[$per]['M'] = substr($date, 0, 2);
$defaults[$per]['d'] = substr($date, 2, 3);
}
);
//Auto-renew Option
- $paymentProcessor = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, 'is_recur = 1');
- $isAuthorize = FALSE;
- $options = array();
+ $paymentProcessor = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, 'is_recur = 1');
+ $isAuthorize = FALSE;
+ $options = array();
if (is_array($paymentProcessor) && !empty($paymentProcessor)) {
$isAuthorize = TRUE;
$options = CRM_Core_SelectValues::memberAutoRenew();
$this->assign('membershipRecordsExists', $membershipRecords);
$this->add('text', 'max_related', ts('Max related'),
- CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'max_related')
+ CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'max_related')
);
$this->addFormRule(array('CRM_Member_Form_MembershipType', 'formRule'));
}
if (in_array(CRM_Utils_Array::value('auto_renew', $params), array(
- 1, 2))) {
+ 1,
+ 2
+ ))) {
if (($params['duration_interval'] > 1 && $params['duration_unit'] == 'year') ||
($params['duration_interval'] > 12 && $params['duration_unit'] == 'month')
) {
public function postProcess() {
if ($this->_action & CRM_Core_Action::DELETE) {
try {
- CRM_Member_BAO_MembershipType::del($this->_id);
+ CRM_Member_BAO_MembershipType::del($this->_id);
}
- catch(CRM_Core_Exception $e) {
+ catch (CRM_Core_Exception $e) {
CRM_Core_Error::statusBounce($e->getMessage(), NULL, ts('Membership Type Not Deleted'));
}
CRM_Core_Session::setStatus(ts('Selected membership type has been deleted.'), ts('Record Deleted'), 'success');
$periods = array('fixed_period_start_day', 'fixed_period_rollover_day');
foreach ($periods as $per) {
if (!empty($params[$per]['M']) && !empty($params[$per]['d'])) {
- $mon = $params[$per]['M'];
- $dat = $params[$per]['d'];
- $mon = ($mon < 10) ? '0' . $mon : $mon;
- $dat = ($dat < 10) ? '0' . $dat : $dat;
+ $mon = $params[$per]['M'];
+ $dat = $params[$per]['d'];
+ $mon = ($mon < 10) ? '0' . $mon : $mon;
+ $dat = ($dat < 10) ? '0' . $dat : $dat;
$params[$per] = $mon . $dat;
}
- elseif($per == 'fixed_period_rollover_day' && !empty($params['month_fixed_period_rollover_day'])) {
+ elseif ($per == 'fixed_period_rollover_day' && !empty($params['month_fixed_period_rollover_day'])) {
$params['fixed_period_rollover_day'] = $params['month_fixed_period_rollover_day']['d'];
unset($params['month_fixed_period_rollover_day']);
}
$membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
CRM_Core_Session::setStatus(ts('The membership type \'%1\' has been saved.',
- array(1 => $membershipType->name)
- ), ts('Saved'), 'success');
+ array(1 => $membershipType->name)
+ ), ts('Saved'), 'success');
$session = CRM_Core_Session::singleton();
if ($buttonName == $this->getButtonName('upload', 'new')) {
$session->replaceUserContext(
* driven by the wizard framework
*/
- $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
- $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
+ $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
+ $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
+ $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'search');
$this->assign("context", $this->_context);
else {
$queryParams = $form->get('queryParams');
$sortOrder = NULL;
- if ($form->get(CRM_Utils_Sort::SORT_ORDER )) {
+ if ($form->get(CRM_Utils_Sort::SORT_ORDER)) {
$sortOrder = $form->get(CRM_Utils_Sort::SORT_ORDER);
}
$query = new CRM_Contact_BAO_Query($queryParams, NULL, NULL, FALSE, FALSE,
}
else {
$session->replaceUserContext(CRM_Utils_System::url("civicrm/contact/search/$searchFormName",
- $urlParams
- ));
+ $urlParams
+ ));
}
}
'join_date',
'membership_start_date',
'membership_end_date',
- );
+ );
if (isset($params['field'])) {
$customFields = array();
foreach ($params['field'] as $key => $value) {
* @return void
*/
public function postProcess() {
- $formValues = $this->controller->exportValues($this->_name);
+ $formValues = $this->controller->exportValues($this->_name);
$locationTypeID = $formValues['location_type_id'];
$respectDoNotMail = CRM_Utils_Array::value('do_not_mail', $formValues);
$labelName = $formValues['label_name'];
// format the addresses according to CIVICRM_ADDRESS_FORMAT (CRM-1327)
foreach ($rows as $id => $row) {
if ($commMethods = CRM_Utils_Array::value('preferred_communication_method', $row)) {
- $val = array_filter(explode(CRM_Core_DAO::VALUE_SEPARATOR, $commMethods));
+ $val = array_filter(explode(CRM_Core_DAO::VALUE_SEPARATOR, $commMethods));
$comm = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method');
$temp = array();
foreach ($val as $vals) {
if ($isPerMembership) {
$labelRows = array();
- $memberships = civicrm_api3('membership', 'get', array('id' => array('IN' => $this->_memberIds), 'return' => 'contact_id'));
+ $memberships = civicrm_api3('membership', 'get', array(
+ 'id' => array('IN' => $this->_memberIds),
+ 'return' => 'contact_id'
+ ));
foreach ($memberships['values'] as $id => $membership) {
$labelRows[$id] = $rows[$membership['contact_id']];
}
$validate = FALSE;
//validations
if (count($this->_memberIds) > $this->_maxMembers) {
- CRM_Core_Session::setStatus(ts("The maximum number of members you can select for Batch Update is %1. You have selected %2. Please select fewer members from your search results and try again.", array(1 => $this->_maxMembers, 2 => count($this->_memberIds))), ts('Batch Update Error'), 'error');
+ CRM_Core_Session::setStatus(ts("The maximum number of members you can select for Batch Update is %1. You have selected %2. Please select fewer members from your search results and try again.", array(
+ 1 => $this->_maxMembers,
+ 2 => count($this->_memberIds)
+ )), ts('Batch Update Error'), 'error');
$validate = TRUE;
}
$ufGroupElement = $this->add('select', 'uf_group_id', ts('Select Profile'),
array(
- '' => ts('- select profile -')) + $profiles, TRUE
+ '' => ts('- select profile -')
+ ) + $profiles, TRUE
);
$this->addDefaultButtons(ts('Continue'));
}
$this->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
$this->setMaxFileSize($uploadFileSize);
- $this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize);
+ $this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(
+ 1 => $uploadSize,
+ 2 => $uploadFileSize
+ )), 'maxfilesize', $uploadFileSize);
$this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
$this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
);
$this->setDefaults(array(
'onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP,
- ));
+ ));
//get the saved mapping details
$mappingArray = CRM_Core_BAO_Mapping::getMappings(CRM_Core_OptionGroup::getValue('mapping_type',
- 'Import Membership',
- 'name'
- ));
+ 'Import Membership',
+ 'name'
+ ));
$this->assign('savedMapping', $mappingArray);
$this->add('select', 'savedMapping', ts('Mapping Option'), array('' => ts('- select -')) + $mappingArray);
$this->setDefaults(array(
'contactType' => CRM_Import_Parser::CONTACT_INDIVIDUAL,
- ));
+ ));
//build date formats
CRM_Core_Form_Date::buildAllowedDateFormats($this);
public function postProcess() {
$this->controller->resetPage('MapField');
- $fileName = $this->controller->exportValue($this->_name, 'uploadFile');
+ $fileName = $this->controller->exportValue($this->_name, 'uploadFile');
$skipColumnHeader = $this->controller->exportValue($this->_name, 'skipColumnHeader');
- $onDuplicate = $this->controller->exportValue($this->_name, 'onDuplicate');
- $contactType = $this->controller->exportValue($this->_name, 'contactType');
- $dateFormats = $this->controller->exportValue($this->_name, 'dateFormats');
- $savedMapping = $this->controller->exportValue($this->_name, 'savedMapping');
+ $onDuplicate = $this->controller->exportValue($this->_name, 'onDuplicate');
+ $contactType = $this->controller->exportValue($this->_name, 'contactType');
+ $dateFormats = $this->controller->exportValue($this->_name, 'dateFormats');
+ $savedMapping = $this->controller->exportValue($this->_name, 'savedMapping');
$this->set('onDuplicate', $onDuplicate);
$this->set('contactType', $contactType);
class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField {
-
/**
* store contactType
*
}
elseif ($this->_onDuplicate == CRM_Import_Parser::DUPLICATE_SKIP) {
unset($this->_mapperFields['membership_id']);
- $highlightedFieldsArray = array('membership_contact_id', 'email', 'external_identifier', 'membership_start_date', 'membership_type_id');
+ $highlightedFieldsArray = array(
+ 'membership_contact_id',
+ 'email',
+ 'external_identifier',
+ 'membership_start_date',
+ 'membership_type_id'
+ );
foreach ($highlightedFieldsArray as $name) {
$highlightedFields[] = $name;
}
list($mappingName, $mappingContactType, $mappingLocation, $mappingPhoneType, $mappingRelation) = CRM_Core_BAO_Mapping::getMappingFields($savedMapping);
- $mappingName = $mappingName[1];
+ $mappingName = $mappingName[1];
$mappingContactType = $mappingContactType[1];
- $mappingLocation = CRM_Utils_Array::value('1', $mappingLocation);
- $mappingPhoneType = CRM_Utils_Array::value('1', $mappingPhoneType);
- $mappingRelation = CRM_Utils_Array::value('1', $mappingRelation);
+ $mappingLocation = CRM_Utils_Array::value('1', $mappingLocation);
+ $mappingPhoneType = CRM_Utils_Array::value('1', $mappingPhoneType);
+ $mappingRelation = CRM_Utils_Array::value('1', $mappingRelation);
//mapping is to be loaded from database
- $params = array('id' => $savedMapping);
- $temp = array();
+ $params = array('id' => $savedMapping);
+ $temp = array();
$mappingDetails = CRM_Core_BAO_Mapping::retrieve($params, $temp);
$this->assign('loadedMapping', $mappingDetails->name);
//-------- end of saved mapping stuff ---------
- $defaults = array();
- $mapperKeys = array_keys($this->_mapperFields);
- $hasHeaders = !empty($this->_columnHeaders);
- $headerPatterns = $this->get('headerPatterns');
- $dataPatterns = $this->get('dataPatterns');
+ $defaults = array();
+ $mapperKeys = array_keys($this->_mapperFields);
+ $hasHeaders = !empty($this->_columnHeaders);
+ $headerPatterns = $this->get('headerPatterns');
+ $dataPatterns = $this->get('dataPatterns');
$hasLocationTypes = $this->get('fieldTypes');
/* Initialize all field usages to false */
CRM_Import_Parser::CONTACT_ORGANIZATION => 'Organization',
);
$params = array(
- 'used' => 'Unsupervised',
+ 'used' => 'Unsupervised',
'contact_type' => $contactTypes[$contactTypeId],
);
list($ruleFields, $threshold) = CRM_Dedupe_BAO_RuleGroup::dedupeRuleFieldsWeight($params);
$errors['_qf_default'] = '';
}
$errors['_qf_default'] .= ts('Missing required contact matching fields.') . " $fieldMessage " . ts('(Sum of all weights should be greater than or equal to threshold: %1).', array(
- 1 => $threshold)) . ' ' . ts('(OR Membership ID if update mode.)') . '<br />';
+ 1 => $threshold
+ )) . ' ' . ts('(OR Membership ID if update mode.)') . '<br />';
}
}
else {
$errors['_qf_default'] = '';
}
$errors['_qf_default'] .= ts('Missing required field: %1', array(
- 1 => $title)) . '<br />';
+ 1 => $title
+ )) . '<br />';
}
}
}
$config = CRM_Core_Config::singleton();
$seperator = $config->fieldSeparator;
- $mapperKeys = array();
- $mapper = array();
- $mapperKeys = $this->controller->exportValue($this->_name, 'mapper');
- $mapperKeysMain = array();
- $mapperLocType = array();
+ $mapperKeys = array();
+ $mapper = array();
+ $mapperKeys = $this->controller->exportValue($this->_name, 'mapper');
+ $mapperKeysMain = array();
+ $mapperLocType = array();
$mapperPhoneType = array();
for ($i = 0; $i < $this->_columnCount; $i++) {
$skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
//get the data from the session
- $dataValues = $this->get('dataValues');
- $mapper = $this->get('mapper');
- $invalidRowCount = $this->get('invalidRowCount');
+ $dataValues = $this->get('dataValues');
+ $mapper = $this->get('mapper');
+ $invalidRowCount = $this->get('invalidRowCount');
$conflictRowCount = $this->get('conflictRowCount');
- $mismatchCount = $this->get('unMatchCount');
+ $mismatchCount = $this->get('unMatchCount');
//get the mapping name displayed if the mappingId is set
$mappingId = $this->get('loadMappingId');
$properties = array(
'mapper',
- 'dataValues', 'columnCount',
- 'totalRowCount', 'validRowCount',
- 'invalidRowCount', 'conflictRowCount',
+ 'dataValues',
+ 'columnCount',
+ 'totalRowCount',
+ 'validRowCount',
+ 'invalidRowCount',
+ 'conflictRowCount',
'downloadErrorRecordsUrl',
'downloadConflictRecordsUrl',
'downloadMismatchRecordsUrl',
* @return void
*/
public function postProcess() {
- $fileName = $this->controller->exportValue('DataSource', 'uploadFile');
+ $fileName = $this->controller->exportValue('DataSource', 'uploadFile');
$skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
- $invalidRowCount = $this->get('invalidRowCount');
+ $invalidRowCount = $this->get('invalidRowCount');
$conflictRowCount = $this->get('conflictRowCount');
- $onDuplicate = $this->get('onDuplicate');
+ $onDuplicate = $this->get('onDuplicate');
$config = CRM_Core_Config::singleton();
$seperator = $config->fieldSeparator;
}
$this->assign('dupeActionString', $dupeActionString);
- $properties = array('totalRowCount', 'validRowCount', 'invalidRowCount', 'conflictRowCount', 'downloadConflictRecordsUrl', 'downloadErrorRecordsUrl', 'duplicateRowCount', 'downloadDuplicateRecordsUrl', 'downloadMismatchRecordsUrl', 'groupAdditions', 'unMatchCount');
+ $properties = array(
+ 'totalRowCount',
+ 'validRowCount',
+ 'invalidRowCount',
+ 'conflictRowCount',
+ 'downloadConflictRecordsUrl',
+ 'downloadErrorRecordsUrl',
+ 'duplicateRowCount',
+ 'downloadDuplicateRecordsUrl',
+ 'downloadMismatchRecordsUrl',
+ 'groupAdditions',
+ 'unMatchCount'
+ );
foreach ($properties as $property) {
$this->assign($property, $this->get($property));
}
* $Id$
*
*/
-
-
abstract class CRM_Member_Import_Parser extends CRM_Import_Parser {
protected $_fileName;
}
if ($this->_invalidRowCount) {
// removed view url for invlaid contacts
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('Reason'),
),
$customHeaders
self::exportCSV($this->_errorFileName, $headers, $this->_errors);
}
if ($this->_conflictCount) {
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('Reason'),
),
$customHeaders
self::exportCSV($this->_conflictFileName, $headers, $this->_conflicts);
}
if ($this->_duplicateCount) {
- $headers = array_merge(array(ts('Line Number'),
+ $headers = array_merge(array(
+ ts('Line Number'),
ts('View Membership URL'),
),
$customHeaders
$params['join_date'] = $params['membership_start_date'];
}
- $session = CRM_Core_Session::singleton();
- $dateType = $session->get('dateTypes');
- $formatted = array();
+ $session = CRM_Core_Session::singleton();
+ $dateType = $session->get('dateTypes');
+ $formatted = array();
$customFields = CRM_Core_BAO_CustomField::getFields(CRM_Utils_Array::value('contact_type', $params));
// don't add to recent items, CRM-4399
}
if (!empty($formatValues['membership_id'])) {
- $dao = new CRM_Member_BAO_Membership();
+ $dao = new CRM_Member_BAO_Membership();
$dao->id = $formatValues['membership_id'];
- $dates = array('join_date', 'start_date', 'end_date');
+ $dates = array('join_date', 'start_date', 'end_date');
foreach ($dates as $v) {
if (empty($formatted[$v])) {
$formatted[$v] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $formatValues['membership_id'], $v);
//Format dates
$startDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('start_date', $formatted), '%Y-%m-%d');
- $endDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('end_date', $formatted), '%Y-%m-%d');
- $joinDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('join_date', $formatted), '%Y-%m-%d');
+ $endDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('end_date', $formatted), '%Y-%m-%d');
+ $joinDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('join_date', $formatted), '%Y-%m-%d');
if ($this->_contactIdIndex < 0) {
// Using new Dedupe rule.
$ruleParams = array(
'contact_type' => $this->_contactType,
- 'used' => 'Unsupervised',
+ 'used' => 'Unsupervised',
);
$fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
$disp = '';
foreach ($customOption as $customValueID => $customLabel) {
$customValue = $customLabel['value'];
if ((strtolower($customLabel['label']) == strtolower(trim($v1))) ||
- (strtolower($customValue) == strtolower(trim($v1)))) {
+ (strtolower($customValue) == strtolower(trim($v1)))
+ ) {
if ($type == 'CheckBox') {
$values[$key][$customValue] = 1;
}
if (!CRM_Utils_Rule::integer($value)) {
throw new Exception("contact_id not valid: $value");
}
- $dao = new CRM_Core_DAO();
+ $dao = new CRM_Core_DAO();
$qParams = array();
- $svq = $dao->singleValueQuery("SELECT id FROM civicrm_contact WHERE id = $value",
+ $svq = $dao->singleValueQuery("SELECT id FROM civicrm_contact WHERE id = $value",
$qParams
);
if (!$svq) {
case 'membership_type':
$membershipTypeId = CRM_Utils_Array::key(ucfirst($value),
- CRM_Member_PseudoConstant::membershipType()
+ CRM_Member_PseudoConstant::membershipType()
);
if ($membershipTypeId) {
if (!empty($values['membership_type_id']) &&
case 'membership_status':
$membershipStatusId = CRM_Utils_Array::key(ucfirst($value),
- CRM_Member_PseudoConstant::membershipStatus()
+ CRM_Member_PseudoConstant::membershipStatus()
);
if ($membershipStatusId) {
if (!empty($values['status_id']) &&
*/
public function getUserDashboardElement() {
return array(
- 'name' => ts('Memberships'),
+ 'name' => ts('Memberships'),
'title' => ts('Your Membership(s)'),
// this is CiviContribute specific permission, since
// there is no permission that could be checked for
*/
public function registerTab() {
return array(
- 'title' => ts('Memberships'),
+ 'title' => ts('Memberships'),
'url' => 'membership',
'weight' => 30,
);
*/
public function registerAdvancedSearchPane() {
return array(
- 'title' => ts('Memberships'),
+ 'title' => ts('Memberships'),
'weight' => 30,
);
}
foreach ($membershipTypes as $key => $value) {
$membershipSummary[$key]['premonth']['new'] = array(
- 'count' => CRM_Member_BAO_Membership::getMembershipJoins($key, $preMonth, $preMonthEnd),
+ 'count' => CRM_Member_BAO_Membership::getMembershipJoins($key, $preMonth, $preMonthEnd),
'name' => $value,
);
$membershipSummary[$key]['premonth']['renew'] = array(
- 'count' => CRM_Member_BAO_Membership::getMembershipRenewals($key, $preMonth, $preMonthEnd),
+ 'count' => CRM_Member_BAO_Membership::getMembershipRenewals($key, $preMonth, $preMonthEnd),
'name' => $value,
);
$membershipSummary[$key]['premonth']['total'] = array(
- 'count' => CRM_Member_BAO_Membership::getMembershipStarts($key, $preMonth, $preMonthEnd),
+ 'count' => CRM_Member_BAO_Membership::getMembershipStarts($key, $preMonth, $preMonthEnd),
'name' => $value,
);
$membershipSummary[$key]['month']['new'] = array(
- 'count' => CRM_Member_BAO_Membership::getMembershipJoins($key, $monthStart, $ymd),
+ 'count' => CRM_Member_BAO_Membership::getMembershipJoins($key, $monthStart, $ymd),
'name' => $value,
);
$membershipSummary[$key]['month']['renew'] = array(
- 'count' => CRM_Member_BAO_Membership::getMembershipRenewals($key, $monthStart, $ymd),
+ 'count' => CRM_Member_BAO_Membership::getMembershipRenewals($key, $monthStart, $ymd),
'name' => $value,
);
$membershipSummary[$key]['month']['total'] = array(
- 'count' => CRM_Member_BAO_Membership::getMembershipStarts($key, $monthStart, $ymd),
+ 'count' => CRM_Member_BAO_Membership::getMembershipStarts($key, $monthStart, $ymd),
'name' => $value,
);
$membershipSummary[$key]['year']['new'] = array(
- 'count' => CRM_Member_BAO_Membership::getMembershipJoins($key, $yearStart, $ymd),
+ 'count' => CRM_Member_BAO_Membership::getMembershipJoins($key, $yearStart, $ymd),
'name' => $value,
);
$membershipSummary[$key]['year']['renew'] = array(
- 'count' => CRM_Member_BAO_Membership::getMembershipRenewals($key, $yearStart, $ymd),
+ 'count' => CRM_Member_BAO_Membership::getMembershipRenewals($key, $yearStart, $ymd),
'name' => $value,
);
$membershipSummary[$key]['year']['total'] = array(
- 'count' => CRM_Member_BAO_Membership::getMembershipStarts($key, $yearStart, $ymd),
+ 'count' => CRM_Member_BAO_Membership::getMembershipStarts($key, $yearStart, $ymd),
'name' => $value,
);
$membershipSummary[$key]['current']['total'] = array(
- 'count' => CRM_Member_BAO_Membership::getMembershipCount($key, $current),
+ 'count' => CRM_Member_BAO_Membership::getMembershipCount($key, $current),
'name' => $value,
);
//LCD also get summary stats for membership owners
$membershipSummary[$key]['premonth_owner']['premonth_owner'] = array(
- 'count' => CRM_Member_BAO_Membership::getMembershipStarts($key, $preMonth, $preMonthEnd, 0, 1),
+ 'count' => CRM_Member_BAO_Membership::getMembershipStarts($key, $preMonth, $preMonthEnd, 0, 1),
'name' => $value,
);
$membershipSummary[$key]['month_owner']['month_owner'] = array(
- 'count' => CRM_Member_BAO_Membership::getMembershipStarts($key, $monthStart, $ymd, 0, 1),
+ 'count' => CRM_Member_BAO_Membership::getMembershipStarts($key, $monthStart, $ymd, 0, 1),
'name' => $value,
);
$membershipSummary[$key]['year_owner']['year_owner'] = array(
- 'count' => CRM_Member_BAO_Membership::getMembershipStarts($key, $yearStart, $ymd, 0, 1),
+ 'count' => CRM_Member_BAO_Membership::getMembershipStarts($key, $yearStart, $ymd, 0, 1),
'name' => $value,
);
$membershipSummary[$key]['current_owner']['current_owner'] = array(
- 'count' => CRM_Member_BAO_Membership::getMembershipCount($key, $current, 0, 1),
+ 'count' => CRM_Member_BAO_Membership::getMembershipCount($key, $current, 0, 1),
'name' => $value,
);
$totalCountPreMonth = $totalCountMonth = $totalCountYear = $totalCountCurrent = $totalCountTotal = 0;
$totalCountPreMonth_owner = $totalCountMonth_owner = $totalCountYear_owner = $totalCountCurrent_owner = $totalCountTotal_owner = 0;
foreach ($membershipSummary as $key => $value) {
- $newCountPreMonth = $newCountPreMonth + $value['premonth']['new']['count'];
+ $newCountPreMonth = $newCountPreMonth + $value['premonth']['new']['count'];
$renewCountPreMonth = $renewCountPreMonth + $value['premonth']['renew']['count'];
$totalCountPreMonth = $totalCountPreMonth + $value['premonth']['total']['count'];
- $newCountMonth = $newCountMonth + $value['month']['new']['count'];
- $renewCountMonth = $renewCountMonth + $value['month']['renew']['count'];
- $totalCountMonth = $totalCountMonth + $value['month']['total']['count'];
- $newCountYear = $newCountYear + $value['year']['new']['count'];
- $renewCountYear = $renewCountYear + $value['year']['renew']['count'];
- $totalCountYear = $totalCountYear + $value['year']['total']['count'];
- $totalCountCurrent = $totalCountCurrent + $value['current']['total']['count'];
- $totalCountTotal = $totalCountTotal + $value['total']['total']['count'];
+ $newCountMonth = $newCountMonth + $value['month']['new']['count'];
+ $renewCountMonth = $renewCountMonth + $value['month']['renew']['count'];
+ $totalCountMonth = $totalCountMonth + $value['month']['total']['count'];
+ $newCountYear = $newCountYear + $value['year']['new']['count'];
+ $renewCountYear = $renewCountYear + $value['year']['renew']['count'];
+ $totalCountYear = $totalCountYear + $value['year']['total']['count'];
+ $totalCountCurrent = $totalCountCurrent + $value['current']['total']['count'];
+ $totalCountTotal = $totalCountTotal + $value['total']['total']['count'];
//LCD add owner values
$totalCountPreMonth_owner = $totalCountPreMonth_owner + $value['premonth_owner']['premonth_owner']['count'];
//LCD add owner values
$totalCount['premonth_owner']['premonth_owner'] = array(
'count' => $totalCountPreMonth_owner,
- // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&start=$preMonth&end=$preMonthEnd&owner=1"),
+ // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&start=$preMonth&end=$preMonthEnd&owner=1"),
);
$totalCount['month_owner']['month_owner'] = array(
'count' => $totalCountMonth_owner,
- // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&start=$monthStart&end=$ymd&owner=1"),
+ // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&start=$monthStart&end=$ymd&owner=1"),
);
$totalCount['year_owner']['year_owner'] = array(
'count' => $totalCountYear_owner,
- // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&start=$yearStart&end=$ymd&owner=1"),
+ // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&start=$yearStart&end=$ymd&owner=1"),
);
$totalCount['current_owner']['current_owner'] = array(
'count' => $totalCountCurrent_owner,
- // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&owner=1"),
+ // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&owner=1"),
);
$totalCount['total_owner']['total_owner'] = array(
'count' => $totalCountTotal_owner,
- // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&owner=1"),
+ // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&owner=1"),
);
if (!$isCurrentMonth) {
$totalCount['total_owner']['total_owner'] = array(
'count' => $totalCountTotal_owner,
- // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&start=&end=$ymd&owner=1"),
+ // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&start=&end=$ymd&owner=1"),
);
}
//LCD end
WHERE m.owner_membership_id = {$dao->id} AND m.is_test = 0 AND ms.is_current_member = 1 AND ct.is_deleted = 0";
$num_related = CRM_Core_DAO::singleValueQuery($query);
$max_related = CRM_Utils_Array::value('max_related', $membership[$dao->id]);
- $membership[$dao->id]['related_count'] = ($max_related == '' ? ts('%1 created', array(1 => $num_related)) : ts('%1 out of %2', array(1 => $num_related, 2 => $max_related))
+ $membership[$dao->id]['related_count'] = ($max_related == '' ? ts('%1 created', array(1 => $num_related)) : ts('%1 out of %2', array(
+ 1 => $num_related,
+ 2 => $max_related
+ ))
);
}
else {
*/
static function &links(
$status = 'all',
- $isPaymentProcessor = NULL,
- $accessContribution = NULL,
- $isCancelSupported = FALSE,
- $isUpdateBilling = FALSE
+ $isPaymentProcessor = NULL,
+ $accessContribution = NULL,
+ $isCancelSupported = FALSE,
+ $isUpdateBilling = FALSE
) {
if (!CRM_Utils_Array::value('view', self::$_links)) {
self::$_links['view'] = array(
* return null
*/
public function listMemberships() {
- $membership = array();
- $dao = new CRM_Member_DAO_Membership();
+ $membership = array();
+ $dao = new CRM_Member_DAO_Membership();
$dao->contact_id = $this->_contactId;
- $dao->is_test = 0;
+ $dao->is_test = 0;
$dao->find();
while ($dao->fetch()) {
//get the membership status and type values.
$statusANDType = CRM_Member_BAO_Membership::getStatusANDTypeValues($dao->id);
foreach (array(
- 'status', 'membership_type') as $fld) {
+ 'status',
+ 'membership_type'
+ ) as $fld) {
$membership[$dao->id][$fld] = CRM_Utils_Array::value($fld, $statusANDType[$dao->id]);
}
if (!empty($statusANDType[$dao->id]['is_current_member'])) {
public static function flush($name = 'cache') {
if (isset(self::$$name)) {
self::$$name = NULL;
- }
+ }
}
}
// submitted form values
$this->_queryParams = &$queryParams;
- $this->_single = $single;
- $this->_limit = $limit;
+ $this->_single = $single;
+ $this->_limit = $limit;
$this->_context = $context;
$this->_memberClause = $memberClause;
//does membership have auto renew CRM-7137.
$autoRenew = FALSE;
if (isset($result->membership_recur_id) && $result->membership_recur_id &&
- !CRM_Member_BAO_Membership::isSubscriptionCancelled($row['membership_id'])
+ !CRM_Member_BAO_Membership::isSubscriptionCancelled($row['membership_id'])
) {
$autoRenew = TRUE;
}
'direction' => CRM_Utils_Sort::DONTCARE,
),
array(
- 'name' => ts('Member Since'),
+ 'name' => ts('Member Since'),
'sort' => 'join_date',
'direction' => CRM_Utils_Sort::DESCENDING,
),
public function preProcess() {
$this->_entityTable = $this->get('entityTable');
- $this->_entityId = $this->get('entityId');
- $this->_id = $this->get('id');
- $this->_parentId = CRM_Utils_Array::value('parentId', $_GET, 0);
+ $this->_entityId = $this->get('entityId');
+ $this->_id = $this->get('id');
+ $this->_parentId = CRM_Utils_Array::value('parentId', $_GET, 0);
if ($this->_parentId) {
$this->assign('parentId', $this->_parentId);
}
// set currency for CRM-1496
if (!isset($dao->currency)) {
- $config = & CRM_Core_Config::singleton();
+ $config = &CRM_Core_Config::singleton();
$dao->currency = $config->defaultCurrency;
}
);
$extraOption = array('onclick' => "return pcpAnonymous( );");
$elements = array();
- $elements[] = & $page->createElement('radio', NULL, '', ts('Include my name and message'), 0, $extraOption);
- $elements[] = & $page->createElement('radio', NULL, '', ts('List my support anonymously'), 1, $extraOption);
+ $elements[] = &$page->createElement('radio', NULL, '', ts('Include my name and message'), 0, $extraOption);
+ $elements[] = &$page->createElement('radio', NULL, '', ts('List my support anonymously'), 1, $extraOption);
$page->addGroup($elements, 'pcp_is_anonymous', NULL, ' ');
$page->_defaults['pcp_is_anonymous'] = 0;
* @return void
*/
public function postProcess() {
- $params = $this->controller->exportValues($this->_name);
+ $params = $this->controller->exportValues($this->_name);
$checkBoxes = array('is_thermometer', 'is_honor_roll', 'is_active');
foreach ($checkBoxes as $key) {
// we also need to purify it, so lets clean it up
$htmlFields = array('intro_text', 'page_text', 'title');
foreach ($htmlFields as $field) {
- if (! empty($params[$field])) {
+ if (!empty($params[$field])) {
$params[$field] = CRM_Utils_String::purifyHTML($params[$field]);
}
}
$statusId = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $pcp->id, 'status_id');
//send notification of PCP create/update.
- $pcpParams = array('entity_table' => $entity_table, 'entity_id' => $pcp->page_id);
+ $pcpParams = array('entity_table' => $entity_table, 'entity_id' => $pcp->page_id);
$notifyParams = array();
$notifyStatus = "";
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCPBlock', $pcpParams, $notifyParams, array('notify_email'));
}
CRM_Core_Session::setStatus(ts("Your Personal Campaign Page has been %1 %2 %3",
- array(1 => $pageStatus, 2 => $approvalMessage, 3 => $notifyStatus)
- ), '', 'info');
+ array(1 => $pageStatus, 2 => $approvalMessage, 3 => $notifyStatus)
+ ), '', 'info');
if (!$this->_pageId) {
$session->pushUserContext(CRM_Utils_System::url('civicrm/pcp/info', "reset=1&id={$pcp->id}&ap={$anonymousPCP}"));
}
$params['target_entity_type'] = CRM_Utils_Array::value('target_entity_type', $params, 'contribute');
$params['target_entity_id'] = $this->_id;
- $dao = new CRM_PCP_DAO_PCPBlock();
+ $dao = new CRM_PCP_DAO_PCPBlock();
$dao->entity_table = $params['entity_table'];
- $dao->entity_id = $this->_id;
+ $dao->entity_id = $this->_id;
$dao->find(TRUE);
$params['id'] = $dao->id;
$params['is_active'] = CRM_Utils_Array::value('pcp_active', $params, FALSE);
$defaults['link_text'] = ts('Promote this event with a personal campaign page');
if ($this->_id &&
- $ccReceipt = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'cc_receipt')) {
+ $ccReceipt = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'cc_receipt')
+ ) {
$defaults['notify_email'] = $ccReceipt;
}
}
$this->add('select', 'target_entity_id',
ts('Online Contribution Page'),
array(
- '' => ts('- select -')) +
+ '' => ts('- select -')
+ ) +
CRM_Contribute_PseudoConstant::contributionPage()
);
if (!empty($pcpBlock->id) && CRM_PCP_BAO_PCP::getPcpBlockInUse($pcpBlock->id)) {
foreach (array(
- 'target_entity_type', 'target_entity_id') as $element_name) {
+ 'target_entity_type',
+ 'target_entity_id'
+ ) as $element_name) {
$element = $this->getElement($element_name);
$element->freeze();
}
$params['target_entity_id'] = CRM_Utils_Array::value('target_entity_id', $params, $this->_id);
}
- $dao = new CRM_PCP_DAO_PCPBlock();
+ $dao = new CRM_PCP_DAO_PCPBlock();
$dao->entity_table = $params['entity_table'];
- $dao->entity_id = $this->_id;
+ $dao->entity_id = $this->_id;
$dao->find(TRUE);
$params['id'] = $dao->id;
$params['is_active'] = CRM_Utils_Array::value('pcp_active', $params, FALSE);
$session = CRM_Core_Session::singleton();
$context = $session->popUserContext();
- $userID = $session->get('userID');
+ $userID = $session->get('userID');
//do not allow destructive actions without permissions
$permission = FALSE;
'event' => ts('Event'),
);
$contribPages = array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionPage();
- $eventPages = array('' => ts('- select -')) + CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
+ $eventPages = array('' => ts('- select -')) + CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
$this->addElement('select', 'status_id', ts('Status'), $status);
$this->addElement('select', 'page_type', ts('Source Type'), $types);
public function preProcess() {
- $session = CRM_Core_Session::singleton();
- $config = CRM_Core_Config::singleton();
- $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
- $this->_pageId = CRM_Utils_Request::retrieve('pageId', 'Positive', $this);
+ $session = CRM_Core_Session::singleton();
+ $config = CRM_Core_Config::singleton();
+ $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
+ $this->_pageId = CRM_Utils_Request::retrieve('pageId', 'Positive', $this);
$this->_component = CRM_Utils_Request::retrieve('component', 'String', $this);
- $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
+ $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
if (!$this->_pageId && $config->userFramework == 'Joomla' && $config->userFrameworkFrontend) {
$this->_pageId = $this->_id;
if ($this->_single) {
$button = array(
array(
- 'type' => 'next',
+ 'type' => 'next',
'name' => ts('Save'),
'spacing' => ' ',
'isDefault' => TRUE,
'title' => ts('Delete Personal Campaign Page'),
),
CRM_Core_Action::ENABLE => array(
- 'name' => ts('Enable'),
+ 'name' => ts('Enable'),
'url' => 'civicrm/admin/pcp',
'qs' => 'action=enable&id=%%id%%',
'title' => ts('Enable'),
),
CRM_Core_Action::DISABLE => array(
- 'name' => ts('Disable'),
+ 'name' => ts('Disable'),
'url' => 'civicrm/admin/pcp',
'qs' => 'action=disable&id=%%id%%',
'title' => ts('Disable'),
* @return void
*/
public function run() {
- $session = CRM_Core_Session::singleton();
- $config = CRM_Core_Config::singleton();
+ $session = CRM_Core_Session::singleton();
+ $config = CRM_Core_Config::singleton();
$permissionCheck = FALSE;
- $statusMessage = '';
+ $statusMessage = '';
if ($config->userFramework != 'Joomla') {
$permissionCheck = CRM_Core_Permission::check('administer CiviCRM');
}
if ($pcpInfo['status_id'] != $approvedId || !$pcpInfo['is_active']) {
if ($pcpInfo['contact_id'] != $session->get('userID') && !$permissionCheck) {
CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url($urlBase,
- "reset=1&id=" . $pcpInfo['page_id'],
- FALSE, NULL, FALSE, TRUE
- ));
+ "reset=1&id=" . $pcpInfo['page_id'],
+ FALSE, NULL, FALSE, TRUE
+ ));
}
}
else {
if (!$getStatus) {
// PCP not enabled for this contribution page. Forward everyone to source page
CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url($urlBase,
- "reset=1&id=" . $pcpInfo['page_id'],
- FALSE, NULL, FALSE, TRUE
- ));
+ "reset=1&id=" . $pcpInfo['page_id'],
+ FALSE, NULL, FALSE, TRUE
+ ));
}
}
$page_class = 'CRM_Event_DAO_Event';
$this->assign('pageName', CRM_Event_PseudoConstant::event($pcpInfo['page_id']));
CRM_Core_DAO::commonRetrieveAll($page_class, 'id',
- $pcpInfo['page_id'], $default, array('start_date', 'end_date', 'registration_start_date', 'registration_end_date')
+ $pcpInfo['page_id'], $default, array(
+ 'start_date',
+ 'end_date',
+ 'registration_start_date',
+ 'registration_end_date'
+ )
);
}
elseif ($pcpBlock->entity_table == 'civicrm_contribution_page') {
$fileInfo = reset($entityFile);
$fileId = $fileInfo['fileID'];
$image = '<img src="' . CRM_Utils_System::url('civicrm/file',
- "reset=1&id=$fileId&eid={$this->_id}"
- ) . '" />';
+ "reset=1&id=$fileId&eid={$this->_id}"
+ ) . '" />';
$this->assign('image', $image);
}
switch ($action) {
case CRM_Core_Action::BROWSE:
$subForm = 'PCPAccount';
- $form = "CRM_PCP_Form_$subForm";
- $single = TRUE;
+ $form = "CRM_PCP_Form_$subForm";
+ $single = TRUE;
break;
case CRM_Core_Action::UPDATE:
$subForm = 'Campaign';
- $form = "CRM_PCP_Form_$subForm";
- $single = TRUE;
+ $form = "CRM_PCP_Form_$subForm";
+ $single = TRUE;
break;
}
//building payment params
$paymentParams['pledge_id'] = $pledge->id;
$paymentKeys = array(
- 'amount', 'installments', 'scheduled_date', 'frequency_unit', 'currency',
- 'frequency_day', 'frequency_interval', 'contribution_id', 'installment_amount', 'actual_amount',
+ 'amount',
+ 'installments',
+ 'scheduled_date',
+ 'frequency_unit',
+ 'currency',
+ 'frequency_day',
+ 'frequency_interval',
+ 'contribution_id',
+ 'installment_amount',
+ 'actual_amount',
);
foreach ($paymentKeys as $key) {
$paymentParams[$key] = CRM_Utils_Array::value($key, $params, NULL);
$payment->delete();
}
- $dao = new CRM_Pledge_DAO_Pledge();
+ $dao = new CRM_Pledge_DAO_Pledge();
$dao->id = $id;
$results = $dao->delete();
WHERE $whereCond AND is_test=0
GROUP BY currency
";
- $start = substr($startDate, 0, 8);
- $end = substr($endDate, 0, 8);
- $pCount = 0;
+ $start = substr($startDate, 0, 8);
+ $end = substr($endDate, 0, 8);
+ $pCount = 0;
$pamount = array();
- $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
+ $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
while ($dao->fetch()) {
$pCount += $dao->pledge_count;
$pamount[] = CRM_Utils_Money::format($dao->pledge_amount, $dao->currency);
}
$pledge_amount = array(
- 'pledge_amount' => implode(', ', $pamount),
+ 'pledge_amount' => implode(', ', $pamount),
'pledge_count' => $pCount,
'purl' => CRM_Utils_System::url('civicrm/pledge/search',
"reset=1&force=1&pstatus={$statusId}&pstart={$start}&pend={$end}&test=0"
$statusId = array_search($status, $allStatus);
switch ($status) {
case 'Completed':
- $select = 'sum( total_amount ) as received_pledge , count( cd.id ) as received_count';
- $where[] = 'cp.status_id = ' . $statusId . ' AND cp.contribution_id = cd.id AND cd.is_test=0';
+ $select = 'sum( total_amount ) as received_pledge , count( cd.id ) as received_count';
+ $where[] = 'cp.status_id = ' . $statusId . ' AND cp.contribution_id = cd.id AND cd.is_test=0';
$queryDate = 'receive_date';
- $from = ' civicrm_contribution cd, civicrm_pledge_payment cp';
+ $from = ' civicrm_contribution cd, civicrm_pledge_payment cp';
break;
case 'Cancelled':
- $select = 'sum( total_amount ) as received_pledge , count( cd.id ) as received_count';
- $where[] = 'cp.status_id = ' . $statusId . ' AND cp.contribution_id = cd.id AND cd.is_test=0';
+ $select = 'sum( total_amount ) as received_pledge , count( cd.id ) as received_count';
+ $where[] = 'cp.status_id = ' . $statusId . ' AND cp.contribution_id = cd.id AND cd.is_test=0';
$queryDate = 'receive_date';
- $from = ' civicrm_contribution cd, civicrm_pledge_payment cp';
+ $from = ' civicrm_contribution cd, civicrm_pledge_payment cp';
break;
case 'Pending':
- $select = 'sum( scheduled_amount )as received_pledge , count( cp.id ) as received_count';
- $where[] = 'cp.status_id = ' . $statusId . ' AND pledge.is_test=0';
+ $select = 'sum( scheduled_amount )as received_pledge , count( cp.id ) as received_count';
+ $where[] = 'cp.status_id = ' . $statusId . ' AND pledge.is_test=0';
$queryDate = 'scheduled_date';
- $from = ' civicrm_pledge_payment cp INNER JOIN civicrm_pledge pledge on cp.pledge_id = pledge.id';
+ $from = ' civicrm_pledge_payment cp INNER JOIN civicrm_pledge pledge on cp.pledge_id = pledge.id';
break;
case 'Overdue':
- $select = 'sum( scheduled_amount ) as received_pledge , count( cp.id ) as received_count';
- $where[] = 'cp.status_id = ' . $statusId . ' AND pledge.is_test=0';
+ $select = 'sum( scheduled_amount ) as received_pledge , count( cp.id ) as received_count';
+ $where[] = 'cp.status_id = ' . $statusId . ' AND pledge.is_test=0';
$queryDate = 'scheduled_date';
- $from = ' civicrm_pledge_payment cp INNER JOIN civicrm_pledge pledge on cp.pledge_id = pledge.id';
+ $from = ' civicrm_pledge_payment cp INNER JOIN civicrm_pledge pledge on cp.pledge_id = pledge.id';
break;
}
GROUP BY cp.currency
";
if ($select) {
- $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
+ $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
$amount = array();
- $count = 0;
+ $count = 0;
while ($dao->fetch()) {
$count += $dao->received_count;
if ($count) {
return array_merge($pledge_amount, array(
- 'received_amount' => implode(', ', $amount),
- 'received_count' => $count,
- 'url' => CRM_Utils_System::url('civicrm/pledge/search',
- "reset=1&force=1&status={$statusId}&start={$start}&end={$end}&test=0"
- ),
- ));
+ 'received_amount' => implode(', ', $amount),
+ 'received_count' => $count,
+ 'url' => CRM_Utils_System::url('civicrm/pledge/search',
+ "reset=1&force=1&status={$statusId}&start={$start}&end={$end}&test=0"
+ ),
+ ));
}
}
else {
}
$payments[$payID] = array_merge($contributionValue,
array(
- 'amount' => CRM_Utils_Array::value('scheduled_amount', $values),
+ 'amount' => CRM_Utils_Array::value('scheduled_amount', $values),
'due_date' => CRM_Utils_Array::value('scheduled_date', $values),
)
);
//get the first valid payment id.
if (!isset($form->paymentId) && ($paymentStatusTypes[$values['status_id']] == 'Pending' ||
$paymentStatusTypes[$values['status_id']] == 'Overdue'
- )) {
+ )
+ ) {
$form->paymentId = $values['id'];
}
}
//assign pledge fields value to template.
$pledgeFields = array(
- 'create_date', 'total_pledge_amount', 'frequency_interval', 'frequency_unit',
- 'installments', 'frequency_day', 'scheduled_amount', 'currency',
+ 'create_date',
+ 'total_pledge_amount',
+ 'frequency_interval',
+ 'frequency_unit',
+ 'installments',
+ 'frequency_day',
+ 'scheduled_amount',
+ 'currency',
);
foreach ($pledgeFields as $field) {
if (!empty($params[$field])) {
//handle domain token values
$domain = CRM_Core_BAO_Domain::getDomain();
$tokens = array(
- 'domain' => array('name', 'phone', 'address', 'email'),
+ 'domain' => array('name', 'phone', 'address', 'email'),
'contact' => CRM_Core_SelectValues::contactTokens(),
);
$domainValues = array();
//handle custom data.
if (!empty($params['hidden_custom'])) {
- $groupTree = CRM_Core_BAO_CustomGroup::getTree('Pledge', CRM_Core_DAO::$_nullObject, $params['id']);
+ $groupTree = CRM_Core_BAO_CustomGroup::getTree('Pledge', CRM_Core_DAO::$_nullObject, $params['id']);
$pledgeParams = array(array('pledge_id', '=', $params['id'], 0, 0));
- $customGroup = array();
+ $customGroup = array();
// retrieve custom data
foreach ($groupTree as $groupID => $group) {
$customFields = $customValues = array();
//handle acknowledgment email stuff.
list($pledgerDisplayName,
$pledgerEmail
- ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($params['contact_id']);
+ ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($params['contact_id']);
//check for online pledge.
$session = CRM_Core_Session::singleton();
//set title to calculated fields
$calculatedFields = array(
- 'pledge_total_paid' => array('title' => ts('Total Paid')),
+ 'pledge_total_paid' => array('title' => ts('Total Paid')),
'pledge_balance_amount' => array('title' => ts('Balance Amount')),
'pledge_next_pay_date' => array('title' => ts('Next Payment Date')),
'pledge_next_pay_amount' => array('title' => ts('Next Payment Amount')),
'pledge_payment_paid_amount' => array('title' => ts('Paid Amount')),
'pledge_payment_paid_date' => array('title' => ts('Paid Date')),
'pledge_payment_status' => array(
- 'title' => ts('Pledge Payment Status'),
+ 'title' => ts('Pledge Payment Status'),
'name' => 'pledge_payment_status',
'data_type' => CRM_Utils_Type::T_STRING,
),
$pledgeFields = array(
'pledge_status' => array(
- 'title' => 'Pledge Status',
+ 'title' => 'Pledge Status',
'name' => 'pledge_status',
'data_type' => CRM_Utils_Type::T_STRING,
),
//get pending and in progress status
foreach (array(
- 'Pending', 'In Progress', 'Overdue') as $name) {
+ 'Pending',
+ 'In Progress',
+ 'Overdue'
+ ) as $name) {
if ($statusId = array_search($name, $pledgeStatuses)) {
$status[] = $statusId;
}
//unset statues that we never use for pledges
foreach (array(
- 'Completed', 'Cancelled', 'Failed') as $statusKey) {
+ 'Completed',
+ 'Cancelled',
+ 'Failed'
+ ) as $statusKey) {
if ($key = CRM_Utils_Array::key($statusKey, $allStatus)) {
unset($allStatus[$key]);
}
if (CRM_Utils_Date::overdue(CRM_Utils_Date::customFormat($dao->scheduled_date, '%Y%m%d'),
$now
- ) && $dao->payment_status != array_search('Overdue', $allStatus)) {
+ ) && $dao->payment_status != array_search('Overdue', $allStatus)
+ ) {
$pledgePayments[$dao->pledge_id][$dao->payment_id] = $dao->payment_id;
}
}
// retrieve domain tokens
$domain = CRM_Core_BAO_Domain::getDomain();
$tokens = array(
- 'domain' => array('name', 'phone', 'address', 'email'),
+ 'domain' => array('name', 'phone', 'address', 'email'),
'contact' => CRM_Core_SelectValues::contactTokens(),
);
return TRUE;
}
- return civicrm_api3('pledge_payment', 'getcount', array('pledge_id' => $pledgeID, 'status_id' => array('IN' => self::getTransactionalStatus())));
+ return civicrm_api3('pledge_payment', 'getcount', array(
+ 'pledge_id' => $pledgeID,
+ 'status_id' => array('IN' => self::getTransactionalStatus())
+ ));
}
/**
$results = NULL;
- $dao = new CRM_Pledge_DAO_PledgeBlock();
+ $dao = new CRM_Pledge_DAO_PledgeBlock();
$dao->id = $id;
$results = $dao->delete();
public static function getPledgeBlock($pageID) {
$pledgeBlock = array();
- $dao = new CRM_Pledge_DAO_PledgeBlock();
+ $dao = new CRM_Pledge_DAO_PledgeBlock();
$dao->entity_table = 'civicrm_contribution_page';
- $dao->entity_id = $pageID;
+ $dao->entity_id = $pageID;
if ($dao->find(TRUE)) {
CRM_Core_DAO::storeValues($dao, $pledgeBlock);
}
//get all status
$allStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
- $nextPayment = array();
- $isNextPayment = FALSE;
+ $nextPayment = array();
+ $isNextPayment = FALSE;
$overduePayments = array();
- $now = date('Ymd');
+ $now = date('Ymd');
foreach ($allPayments as $payID => $value) {
if ($allStatus[$value['status_id']] == 'Overdue') {
$overduePayments[$payID] = array(
if (!empty($overduePayments)) {
foreach ($overduePayments as $id => $payment) {
$key = ts("%1 - due on %2 (overdue)", array(
- 1 => CRM_Utils_Money::format(CRM_Utils_Array::value('scheduled_amount', $payment), CRM_Utils_Array::value('scheduled_amount_currency', $payment)),
- 2 => CRM_Utils_Array::value('scheduled_date', $payment),
- ));
+ 1 => CRM_Utils_Money::format(CRM_Utils_Array::value('scheduled_amount', $payment), CRM_Utils_Array::value('scheduled_amount_currency', $payment)),
+ 2 => CRM_Utils_Array::value('scheduled_date', $payment),
+ ));
$payments[$key] = CRM_Utils_Array::value('id', $payment);
}
}
if (!empty($nextPayment)) {
$key = ts("%1 - due on %2", array(
- 1 => CRM_Utils_Money::format(CRM_Utils_Array::value('scheduled_amount', $nextPayment), CRM_Utils_Array::value('scheduled_amount_currency', $nextPayment)),
- 2 => CRM_Utils_Array::value('scheduled_date', $nextPayment),
- ));
+ 1 => CRM_Utils_Money::format(CRM_Utils_Array::value('scheduled_amount', $nextPayment), CRM_Utils_Array::value('scheduled_amount_currency', $nextPayment)),
+ 2 => CRM_Utils_Array::value('scheduled_date', $nextPayment),
+ ));
$payments[$key] = CRM_Utils_Array::value('id', $nextPayment);
}
//give error if empty or build form for payment.
//build form for pledge creation.
$pledgeOptions = array(
- '0' => ts('I want to make a one-time contribution'),
+ '0' => ts('I want to make a one-time contribution'),
'1' => ts('I pledge to contribute this amount every'),
);
$form->addRadio('is_pledge', ts('Pledge Frequency Interval'), $pledgeOptions,
$form->add('hidden', 'pledge_frequency_interval', 1);
}
//Frequency unit drop-down label suffixes switch from *ly to *(s)
- $freqUnitVals = explode(CRM_Core_DAO::VALUE_SEPARATOR, $pledgeBlock['pledge_frequency_unit']);
- $freqUnits = array();
+ $freqUnitVals = explode(CRM_Core_DAO::VALUE_SEPARATOR, $pledgeBlock['pledge_frequency_unit']);
+ $freqUnits = array();
$frequencyUnits = CRM_Core_OptionGroup::values('recur_frequency_units');
foreach ($freqUnitVals as $key => $val) {
if (array_key_exists($val, $frequencyUnits)) {
*/
static function updatePledgePayments(
$pledgeId,
- $paymentStatusId,
- $paymentIds = NULL,
- $actualAmount = 0,
- $contributionId = NULL,
- $isScriptUpdate = FALSE
+ $paymentStatusId,
+ $paymentIds = NULL,
+ $actualAmount = 0,
+ $contributionId = NULL,
+ $isScriptUpdate = FALSE
) {
$allStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$paymentClause = NULL;
}
if (!empty($query->_returnProperties['pledge_financial_type'])) {
- $query->_select['pledge_financial_type'] = "(SELECT civicrm_financial_type.name FROM civicrm_financial_type WHERE civicrm_financial_type.id = civicrm_pledge.financial_type_id) as pledge_financial_type";
+ $query->_select['pledge_financial_type'] = "(SELECT civicrm_financial_type.name FROM civicrm_financial_type WHERE civicrm_financial_type.id = civicrm_pledge.financial_type_id) as pledge_financial_type";
$query->_element['pledge_financial_type'] = 1;
$query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
}
* $Id$
*
*/
-class CRM_Pledge_Config extends CRM_Core_Component_Config {}
+class CRM_Pledge_Config extends CRM_Core_Component_Config {
+}
);
$optionTypes = array(
- '1' => ts('Adjust Pledge Payment Schedule?'),
+ '1' => ts('Adjust Pledge Payment Schedule?'),
'2' => ts('Adjust Total Pledge Amount?'),
);
$element = $this->addRadio('option_type',
if ($this->_contactID) {
list($this->userDisplayName,
$this->userEmail
- ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
+ ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
$this->assign('displayName', $this->userDisplayName);
}
$defaults['max_reminders'] = 1;
$defaults['additional_reminder_day'] = 5;
$defaults['frequency_unit'] = array_search('month', $this->_freqUnits);
- $defaults['financial_type_id'] = array_search('Donation', CRM_Contribute_PseudoConstant::financialType());
+ $defaults['financial_type_id'] = array_search('Donation', CRM_Contribute_PseudoConstant::financialType());
}
$pledgeStatus = CRM_Contribute_PseudoConstant::contributionStatus();
//assign status.
$this->assign('status', CRM_Utils_Array::value(CRM_Utils_Array::value('status_id', $this->_values),
- $pledgeStatus,
- $defaultPledgeStatus
- ));
+ $pledgeStatus,
+ $defaultPledgeStatus
+ ));
if (isset($this->userEmail)) {
$this->assign('email', $this->userEmail);
}
if ($this->_context == 'standalone') {
- $this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE, 'api' => array('extra' => array('email'))), TRUE);
+ $this->addEntityRef('contact_id', ts('Contact'), array(
+ 'create' => TRUE,
+ 'api' => array('extra' => array('email'))
+ ), TRUE);
}
$showAdditionalInfo = FALSE;
foreach ($paneNames as $name => $type) {
$urlParams = "snippet=4&formType={$type}";
$allPanes[$name] = array(
- 'url' => CRM_Utils_System::url('civicrm/contact/view/pledge', $urlParams),
+ 'url' => CRM_Utils_System::url('civicrm/contact/view/pledge', $urlParams),
'open' => 'false',
'id' => $type,
);
$element = &$this->add('select', 'frequency_unit',
ts('Frequency'),
array(
- '' => ts('- select -')) + $freqUnitsDisplay,
+ '' => ts('- select -')
+ ) + $freqUnitsDisplay,
TRUE
);
$element->freeze();
}
- $this->add('text', 'eachPaymentAmount', ts('each'), array('size' => 10, 'style' => "background-color:#EBECE4", 'READONLY'));
+ $this->add('text', 'eachPaymentAmount', ts('each'), array(
+ 'size' => 10,
+ 'style' => "background-color:#EBECE4",
+ 'READONLY'
+ ));
//add various dates
if (!$this->_id || $this->_isPending) {
$this->addDate('acknowledge_date', ts('Acknowledgment Date'));
$this->add('select', 'financial_type_id',
- ts('Financial Type'),
- array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType(),
+ ts('Financial Type'),
+ array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType(),
TRUE
);
}
$ele = $this->add('select', 'contribution_page_id', ts('Self-service Payments Page'),
array(
- '' => ts('- select -')) + $pledgePages
+ '' => ts('- select -')
+ ) + $pledgePages
);
$mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
if (!isset($this->userEmail)) {
list($this->userDisplayName,
$this->userEmail
- ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
+ ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
}
$statusMsg .= ' ' . ts("An acknowledgment email has been sent to %1.<br />", array(1 => $this->userEmail));
"billing_mode IN ( 1, 3 )"
);
if (count($processors) > 0) {
- $statusMsg .= ' ' . ts("If a payment is due now, you can record <a href='%1'>a check, EFT, or cash payment for this pledge</a> OR <a href='%2'>submit a credit card payment</a>.", array(1 => $contribURL, 2 => $creditURL));
+ $statusMsg .= ' ' . ts("If a payment is due now, you can record <a href='%1'>a check, EFT, or cash payment for this pledge</a> OR <a href='%2'>submit a credit card payment</a>.", array(
+ 1 => $contribURL,
+ 2 => $creditURL
+ ));
}
else {
$statusMsg .= ' ' . ts("If a payment is due now, you can record <a href='%1'>a check, EFT, or cash payment for this pledge</a>.", array(1 => $contribURL));
if ($this->_context == 'standalone') {
if ($buttonName == $this->getButtonName('upload', 'new')) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/pledge/add',
- 'reset=1&action=add&context=standalone'
- ));
+ 'reset=1&action=add&context=standalone'
+ ));
}
else {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view',
- "reset=1&cid={$this->_contactID}&selectedChild=pledge"
- ));
+ "reset=1&cid={$this->_contactID}&selectedChild=pledge"
+ ));
}
}
elseif ($buttonName == $this->getButtonName('upload', 'new')) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view/pledge',
- "reset=1&action=add&context=pledge&cid={$this->_contactID}"
- ));
+ "reset=1&action=add&context=pledge&cid={$this->_contactID}"
+ ));
}
}
}
* we allow the controller to set force/reset externally, useful when we are being
* driven by the wizard framework
*/
- $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
- $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
+ $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
+ $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
+ $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'search');
$this->assign("context", $this->_context);
else {
$queryParams = $form->get('queryParams');
$sortOrder = NULL;
- if ($form->get(CRM_Utils_Sort::SORT_ORDER )) {
+ if ($form->get(CRM_Utils_Sort::SORT_ORDER)) {
$sortOrder = $form->get(CRM_Utils_Sort::SORT_ORDER);
}
$query = new CRM_Contact_BAO_Query($queryParams, NULL, NULL, FALSE, FALSE,
}
}
- $status = ts('Deleted Pledge(s): %1 (Total Selected: %2) ', array(1 => $deletedPledges, 2 => count($this->_pledgeIds)));
+ $status = ts('Deleted Pledge(s): %1 (Total Selected: %2) ', array(
+ 1 => $deletedPledges,
+ 2 => count($this->_pledgeIds)
+ ));
CRM_Core_Session::setStatus($status, '', 'info');
}
}
*/
public function getUserDashboardElement() {
return array(
- 'name' => ts('Pledges'),
+ 'name' => ts('Pledges'),
'title' => ts('Your Pledge(s)'),
// we need to check this permission since you can click on contribution page link for making payment
'perm' => array('make online contributions'),
*/
public function registerTab() {
return array(
- 'title' => ts('Pledges'),
+ 'title' => ts('Pledges'),
'url' => 'pledge',
'weight' => 25,
);
*/
public function registerAdvancedSearchPane() {
return array(
- 'title' => ts('Pledges'),
+ 'title' => ts('Pledges'),
'weight' => 25,
);
}
) {
$shortCuts = array_merge($shortCuts, array(
array(
- 'path' => 'civicrm/pledge/add',
- 'query' => 'reset=1&action=add&context=standalone',
- 'ref' => 'new-pledge',
- 'title' => ts('Pledge'),
- )));
+ 'path' => 'civicrm/pledge/add',
+ 'query' => 'reset=1&action=add&context=standalone',
+ 'ref' => 'new-pledge',
+ 'title' => ts('Pledge'),
+ )
+ ));
}
}
}
$getRecords = FALSE;
if (isset($_GET['name']) && $_GET['name']) {
- $name = CRM_Utils_Type::escape($_GET['name'], 'String');
- $name = str_replace('*', '%', $name);
+ $name = CRM_Utils_Type::escape($_GET['name'], 'String');
+ $name = str_replace('*', '%', $name);
$whereClause = "p.creator_pledge_desc LIKE '%$name%' ";
- $getRecords = TRUE;
+ $getRecords = TRUE;
}
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
- $pledgeId = CRM_Utils_Type::escape($_GET['id'], 'Integer');
+ $pledgeId = CRM_Utils_Type::escape($_GET['id'], 'Integer');
$whereClause = "p.id = {$pledgeId} ";
- $getRecords = TRUE;
+ $getRecords = TRUE;
}
if ($getRecords) {
$name = $_GET['id'];
}
$elements[] = array(
- 'name' => trim($name, '*'),
+ 'name' => trim($name, '*'),
'value' => trim($name, '*'),
);
}
echo CRM_Utils_JSON::encode($elements, 'value');
CRM_Utils_System::civiExit();
}
+
/**
* Function to setDefaults according to Pledge Id
* for batch entry pledges
public function preProcess() {
CRM_Utils_System::setTitle(ts('CiviPledge'));
- $startToDate = array();
- $yearToDate = array();
- $monthToDate = array();
+ $startToDate = array();
+ $yearToDate = array();
+ $monthToDate = array();
$previousToDate = array();
$prefixes = array('start', 'month', 'year', 'previous');
$startDateEnd = NULL;
// current year - prefix = 'year'
- $config = CRM_Core_Config::singleton();
+ $config = CRM_Core_Config::singleton();
$yearDate = $config->fiscalYearStart;
- $year = array('Y' => date('Y'));
+ $year = array('Y' => date('Y'));
$this->assign('curYear', $year['Y']);
- $yearDate = array_merge($year, $yearDate);
- $yearDate = CRM_Utils_Date::format($yearDate);
- $yearDate = $yearDate . '000000';
+ $yearDate = array_merge($year, $yearDate);
+ $yearDate = CRM_Utils_Date::format($yearDate);
+ $yearDate = $yearDate . '000000';
$yearDateEnd = $year['Y'] . '1231235959';
// current month - prefix = 'month'
$monthDateEnd = CRM_Utils_Date::customFormat(date("Y-m-t", mktime(0, 0, 0, date("m"), 01, date("Y"))), '%Y%m%d') . '235959';
// previous month - prefix = 'previous'
- $previousDate = CRM_Utils_Date::customFormat(date("Y-m-d", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))), '%Y%m%d') . '000000';
+ $previousDate = CRM_Utils_Date::customFormat(date("Y-m-d", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))), '%Y%m%d') . '000000';
$previousDateEnd = CRM_Utils_Date::customFormat(date("Y-m-t", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))), '%Y%m%d') . '235959';
- $previousMonth = date("F Y", mktime(0, 0, 0, date("m") - 1, 01, date("Y")));
+ $previousMonth = date("F Y", mktime(0, 0, 0, date("m") - 1, 01, date("Y")));
$this->assign('previousMonthYear', $previousMonth);
foreach ($prefixes as $prefix) {
- $aName = $prefix . 'ToDate';
+ $aName = $prefix . 'ToDate';
$startName = $prefix . 'Date';
- $endName = $prefix . 'DateEnd';
+ $endName = $prefix . 'DateEnd';
foreach ($status as $s) {
${$aName}[str_replace(" ", "", $s)] = CRM_Pledge_BAO_Pledge::getTotalAmountAndCount($s, $$startName, $$endName);
}
}
public function preProcess() {
- $context = CRM_Utils_Request::retrieve('context', 'String', $this);
+ $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);
+ $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
if ($context == 'standalone') {
$this->_action = CRM_Core_Action::ADD;
// submitted form values
$this->_queryParams = &$queryParams;
- $this->_single = $single;
- $this->_limit = $limit;
+ $this->_single = $single;
+ $this->_limit = $limit;
$this->_context = $context;
$this->_additionalClause = $additionalClause;
public static function &tasks() {
if (!self::$_tasks) {
self::$_tasks = array(
- 1 => array(
- 'title' => ts('Delete Pledges'),
+ 1 => array(
+ 'title' => ts('Delete Pledges'),
'class' => 'CRM_Pledge_Form_Task_Delete',
'result' => FALSE,
),
* to the price set used for particular event
* @param array $values
* Reference to the values array(.
- this is
+ * this is
* lineItem array)
*
* @return void
$params['is_quick_config'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $setID, 'is_quick_config');
}
if (!empty($params['is_quick_config']) && array_key_exists('total_amount', $params)
- && $totalEntityId == 1) {
+ && $totalEntityId == 1
+ ) {
$values['line_total'] = $values['unit_price'] = $params['total_amount'];
}
$values['id'] = $key;
}
if (CRM_Utils_Array::value($index, CRM_Utils_Array::value('option_financial_type_id', $params))) {
- $options['financial_type_id'] = $params['option_financial_type_id'][$index];
+ $options['financial_type_id'] = $params['option_financial_type_id'][$index];
}
elseif (!empty($params['financial_type_id'])) {
$options['financial_type_id'] = $params['financial_type_id'];
$otherAmount = $qf->get('values');
$config = CRM_Core_Config::singleton();
- $currencySymbol = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_Currency',$config->defaultCurrency,'symbol','name');
+ $currencySymbol = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_Currency', $config->defaultCurrency, 'symbol', 'name');
$qf->assign('currencySymbol', $currencySymbol);
// get currency name for price field and option attributes
$currencyName = $config->defaultCurrency;
$qf->assign('taxTerm', $taxTerm);
$qf->assign('invoicing', $invoicing);
}
- $priceVal = implode($seperator, array($customOption[$optionKey][$valueFieldName] + $taxAmount, $count, $max_value));
+ $priceVal = implode($seperator, array(
+ $customOption[$optionKey][$valueFieldName] + $taxAmount,
+ $count,
+ $max_value
+ ));
$extra = array();
if (!empty($qf->_quickConfig) && !empty($qf->_contributionAmount)) {
}
$element = &$qf->add('text', $elementName, $label,
- array_merge($extra,
- array(
- 'price' => json_encode(array($optionKey, $priceVal)),
- 'size' => '4',
- )
- ),
- $useRequired && $field->is_required
+ array_merge($extra,
+ array(
+ 'price' => json_encode(array($optionKey, $priceVal)),
+ 'size' => '4',
+ )
+ ),
+ $useRequired && $field->is_required
);
if ($is_pay_later) {
- $qf->add('text', 'txt-'.$elementName, $label, array('size' => '4'));
+ $qf->add('text', 'txt-' . $elementName, $label, array('size' => '4'));
}
// CRM-6902 - Add "max" option for a price set field
$opt['label'] = !empty($opt['label']) ? $opt['label'] . ' - ' : '';
if (isset($taxAmount) && $invoicing) {
if ($displayOpt == 'Do_not_show') {
- $opt['label'] = '<span class="crm-price-amount-label">' . $opt['label'] . '</span>' . '<span class="crm-price-amount-amount">' . CRM_Utils_Money::format($opt[$valueFieldName] + $taxAmount) . '</span>';
+ $opt['label'] = '<span class="crm-price-amount-label">' . $opt['label'] . '</span>' . '<span class="crm-price-amount-amount">' . CRM_Utils_Money::format($opt[$valueFieldName] + $taxAmount) . '</span>';
}
elseif ($displayOpt == 'Inclusive') {
$opt['label'] = '<span class="crm-price-amount-label">' . $opt['label'] . '</span>' . '<span class="crm-price-amount-amount">' . CRM_Utils_Money::format($opt[$valueFieldName] + $taxAmount) . '</span>';
$opt['label'] .= '<span class="crm-price-amount-tax"> (includes ' . $taxTerm . ' of ' . CRM_Utils_Money::format($opt['tax_amount']) . ')</span>';
}
else {
- $opt['label'] = '<span class="crm-price-amount-label">' . $opt['label'] . '</span>' . '<span class="crm-price-amount-amount">' . CRM_Utils_Money::format($opt[$valueFieldName]) . '</span>';
+ $opt['label'] = '<span class="crm-price-amount-label">' . $opt['label'] . '</span>' . '<span class="crm-price-amount-amount">' . CRM_Utils_Money::format($opt[$valueFieldName]) . '</span>';
$opt['label'] .= '<span class="crm-price-amount-tax"> + ' . CRM_Utils_Money::format($opt['tax_amount']) . ' ' . $taxTerm . '</span>';
}
}
$max_value = CRM_Utils_Array::value('max_value', $opt, '');
$priceVal = implode($seperator, array($opt[$valueFieldName] + $taxAmount, $count, $max_value));
$extra = array(
- 'price' => json_encode(array($elementName, $priceVal)),
- 'data-amount' => $opt[$valueFieldName],
- 'data-currency' => $currencyName,
+ 'price' => json_encode(array($elementName, $priceVal)),
+ 'data-amount' => $opt[$valueFieldName],
+ 'data-currency' => $currencyName,
);
if (!empty($qf->_quickConfig) && $field->name == 'contribution_amount') {
$extra += array('onclick' => 'clearAmountOther();');
'onclick' => "return showHideAutoRenew({$opt['membership_type_id']});",
'membership-type' => $opt['membership_type_id'],
);
- $qf->assign('membershipFieldID',$field->id);
+ $qf->assign('membershipFieldID', $field->id);
}
$choice[$opId] = $qf->createElement('radio', NULL, '', $opt['label'], $opt['id'], $extra);
if ($is_pay_later) {
- $qf->add('text', 'txt-'.$elementName, $label, array('size' => '4'));
+ $qf->add('text', 'txt-' . $elementName, $label, array('size' => '4'));
}
// CRM-6902 - Add "max" option for a price set field
// make contribution field required for quick config when membership block is enabled
if (($field->name == 'membership_amount' || $field->name == 'contribution_amount')
- && !empty($qf->_membershipBlock) && !$field->is_required) {
+ && !empty($qf->_membershipBlock) && !$field->is_required
+ ) {
$useRequired = $field->is_required = TRUE;
}
if ($field->is_display_amounts) {
$opt['label'] .= ' - ';
- if (isset($taxAmount) && $invoicing) {
+ if (isset($taxAmount) && $invoicing) {
$opt['label'] = $opt['label'] . self::getTaxLabel($opt, $valueFieldName, $displayOpt, $taxTerm);
}
else {
$selectOption[$opt['id']] = $opt['label'];
if ($is_pay_later) {
- $qf->add('text', 'txt-'.$elementName, $label, array('size' => '4'));
+ $qf->add('text', 'txt-' . $elementName, $label, array('size' => '4'));
}
}
$element = &$qf->add('select', $elementName, $label,
array(
- '' => ts('- select -')) + $selectOption,
- $useRequired && $field->is_required,
- array('price' => json_encode($priceVal))
- );
+ '' => ts('- select -')
+ ) + $selectOption,
+ $useRequired && $field->is_required,
+ array('price' => json_encode($priceVal))
+ );
// CRM-6902 - Add "max" option for a price set field
$button = substr($qf->controller->getButtonName(), -4);
$priceVal = implode($seperator, array($opt[$valueFieldName] + $taxAmount, $count, $max_value));
$check[$opId] = &$qf->createElement('checkbox', $opt['id'], NULL, $opt['label'],
array(
- 'price' => json_encode(array($opt['id'], $priceVal)),
- 'data-amount' => $opt[$valueFieldName],
- 'data-currency' => $currencyName,
+ 'price' => json_encode(array($opt['id'], $priceVal)),
+ 'data-amount' => $opt[$valueFieldName],
+ 'data-currency' => $currencyName,
)
);
if ($is_pay_later) {
if (isset($priceFieldValues['financial_type_id']) && array_key_exists($priceFieldValues['financial_type_id'], $taxRates)) {
$options[$fieldId][$priceFieldId]['tax_rate'] = $taxRates[$priceFieldValues['financial_type_id']];
$taxAmount = CRM_Contribute_BAO_Contribution_Utils::calculateTaxAmount($priceFieldValues['amount'], $options[$fieldId][$priceFieldId]['tax_rate']);
- $options[$fieldId][$priceFieldId]['tax_amount'] = round($taxAmount['tax_amount'],2);
+ $options[$fieldId][$priceFieldId]['tax_amount'] = round($taxAmount['tax_amount'], 2);
}
}
}
AND option_group.id = option_value.option_group_id
AND option_value.label = %2";
- $dao = CRM_Core_DAO::executeQuery($query, array(1 => array($optionGroupName, 'String'), 2 => array($optionLabel, 'String')));
+ $dao = CRM_Core_DAO::executeQuery($query, array(
+ 1 => array($optionGroupName, 'String'),
+ 2 => array($optionLabel, 'String')
+ ));
while ($dao->fetch()) {
return $dao->id;
$params['name'] = strtolower(CRM_Utils_String::munge($params['label'], '_', 242));
}
- if ($id && !empty($params['weight'])) {
+ if ($id && !empty($params['weight'])) {
if (isset($params['name'])) {
unset($params['name']);
}
self::$_defaultPriceSet[$entity] = array();
while ($dao->fetch()) {
self::$_defaultPriceSet[$entity][$dao->priceFieldValueID] = array(
- 'setID' => $dao->setID,
- 'priceFieldID' => $dao->priceFieldID,
- 'name' => $dao->name,
- 'label' => $dao->label,
- 'priceFieldValueID' => $dao->priceFieldValueID,
- 'membership_type_id' => $dao->membership_type_id,
- 'amount' => $dao->amount,
- 'financial_type_id' => $dao->financial_type_id,
+ 'setID' => $dao->setID,
+ 'priceFieldID' => $dao->priceFieldID,
+ 'name' => $dao->name,
+ 'label' => $dao->label,
+ 'priceFieldValueID' => $dao->priceFieldValueID,
+ 'membership_type_id' => $dao->membership_type_id,
+ 'amount' => $dao->amount,
+ 'financial_type_id' => $dao->financial_type_id,
);
}
* @return mixed
*/
public static function removeFrom($entityTable, $entityId) {
- $dao = new CRM_Price_DAO_PriceSetEntity();
+ $dao = new CRM_Price_DAO_PriceSetEntity();
$dao->entity_table = $entityTable;
- $dao->entity_id = $entityId;
+ $dao->entity_id = $entityId;
return $dao->delete();
}
$sql .= ' AND ps.is_quick_config = 0 ';
}
$params = array(
- 1 => array($entityTable, 'String'),
- 2 => array($entityId, 'Integer'),
+ 1 => array($entityTable, 'String'),
+ 2 => array($entityId, 'Integer'),
);
if ($usedFor) {
$sql .= " AND ps.extends LIKE '%%3%' ";
$select = 'SELECT ' . implode(',', $priceFields);
$from = ' FROM civicrm_price_field';
- $params = array();
+ $params = array();
$params[1] = array($setID, 'Integer');
- $where = '
+ $where = '
WHERE price_set_id = %1
AND is_active = 1
';
$params['amount_priceset_level_checkbox']["{$field['options'][$optionId]['id']}"] = $optionLabel;
if (isset($checkboxLevel)) {
$checkboxLevel = array_unique(array_merge(
- $checkboxLevel,
- array_keys($params['amount_priceset_level_checkbox'])
+ $checkboxLevel,
+ array_keys($params['amount_priceset_level_checkbox'])
)
);
}
$validFieldsOnly = TRUE;
$className = CRM_Utils_System::getClassName($form);
if (in_array($className, array(
- 'CRM_Contribute_Form_Contribution', 'CRM_Member_Form_Membership'))) {
+ 'CRM_Contribute_Form_Contribution',
+ 'CRM_Member_Form_Membership'
+ ))) {
$validFieldsOnly = FALSE;
}
- $priceSet = self::getSetDetail($priceSetId, TRUE, $validFieldsOnly);
- $form->_priceSet = CRM_Utils_Array::value($priceSetId, $priceSet);
+ $priceSet = self::getSetDetail($priceSetId, TRUE, $validFieldsOnly);
+ $form->_priceSet = CRM_Utils_Array::value($priceSetId, $priceSet);
$validPriceFieldIds = array_keys($form->_priceSet['fields']);
$form->_quickConfig = $quickConfig = 0;
if (CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config')) {
//}
}
}
+
/**
* Get field ids of a price set
*
$title = ts('[Copy id %1]', array(1 => $maxId + 1));
$fieldsFix = array(
'suffix' => array(
- 'title' => ' ' . $title,
- 'name' => '__Copy_id_' . ($maxId + 1) . '_',
+ 'title' => ' ' . $title,
+ 'name' => '__Copy_id_' . ($maxId + 1) . '_',
),
);
$copy = &CRM_Core_DAO::copyGeneric('CRM_Price_DAO_PriceSet',
- array('id' => $id),
- NULL,
- $fieldsFix
+ array('id' => $id),
+ NULL,
+ $fieldsFix
);
//copying all the blocks pertaining to the price set
$copyPriceField = &CRM_Core_DAO::copyGeneric('CRM_Price_DAO_PriceField',
- array('price_set_id' => $id),
- array('price_set_id' => $copy->id)
+ array('price_set_id' => $id),
+ array('price_set_id' => $copy->id)
);
if (!empty($copyPriceField)) {
$price = array_combine(self::getFieldIds($id), self::getFieldIds($copy->id));
$params = array(1 => array($priceSetId, 'Integer'));
- $dao = CRM_Core_DAO::executeQuery($query, $params);
+ $dao = CRM_Core_DAO::executeQuery($query, $params);
$autoRenewOption = 2;
- $interval = $unit = array();
+ $interval = $unit = array();
while ($dao->fetch()) {
if (!$dao->auto_renew) {
$autoRenewOption = 0;
*/
public static function checkMembershipPriceSet($id) {
$query =
- "
+ "
SELECT pfv.id, pfv.price_field_id, pfv.name, pfv.membership_type_id, pf.html_type, mt.auto_renew
FROM civicrm_price_field_value pfv
LEFT JOIN civicrm_price_field pf ON pf.id = pfv.price_field_id
public function postProcess() {
if (CRM_Price_BAO_PriceSet::deleteSet($this->_sid)) {
CRM_Core_Session::setStatus(ts('The Price Set \'%1\' has been deleted.',
- array(1 => $this->_title), ts('Deleted'), 'success'
- ));
+ array(1 => $this->_title), ts('Deleted'), 'success'
+ ));
}
else {
CRM_Core_Session::setStatus(ts('The Price Set \'%1\' has not been deleted! You must delete all price fields in this set prior to deleting the set.',
- array(1 => $this->_title)
- ), 'Unable to Delete', 'error');
+ array(1 => $this->_title)
+ ), 'Unable to Delete', 'error');
}
}
}
$this->_sid = CRM_Utils_Request::retrieve('sid', 'Positive', $this, FALSE, NULL, 'REQUEST');
$this->_fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this, FALSE, NULL, 'REQUEST');
- $url = CRM_Utils_System::url('civicrm/admin/price/field', "reset=1&action=browse&sid={$this->_sid}");
+ $url = CRM_Utils_System::url('civicrm/admin/price/field', "reset=1&action=browse&sid={$this->_sid}");
$breadCrumb = array(array('title' => ts('Price Set Fields'), 'url' => $url));
$this->_extendComponentId = array();
if (!empty($defaults['active_on'])) {
list($defaults['active_on'],
$defaults['active_on_time']
- ) = CRM_Utils_Date::setDateDefaults($defaults['active_on'], 'activityDateTime');
+ ) = CRM_Utils_Date::setDateDefaults($defaults['active_on'], 'activityDateTime');
}
if (!empty($defaults['expire_on'])) {
list($defaults['expire_on'],
$defaults['expire_on_time']
- ) = CRM_Utils_Date::setDateDefaults($defaults['expire_on'], 'activityDateTime');
+ ) = CRM_Utils_Date::setDateDefaults($defaults['expire_on'], 'activityDateTime');
}
}
else {
$enabledComponents = CRM_Core_Component::getEnabledComponents();
$eventComponentId = NULL;
if (array_key_exists('CiviEvent', $enabledComponents)) {
- $eventComponentId = CRM_Core_Component::getComponentID('CiviEvent');
+ $eventComponentId = CRM_Core_Component::getComponentID('CiviEvent');
}
if (isset($this->_sid) && $this->_action == CRM_Core_Action::ADD) {
$enabledComponents = CRM_Core_Component::getEnabledComponents();
$eventComponentId = $memberComponentId = NULL;
if (array_key_exists('CiviEvent', $enabledComponents)) {
- $eventComponentId = CRM_Core_Component::getComponentID('CiviEvent');
+ $eventComponentId = CRM_Core_Component::getComponentID('CiviEvent');
}
if (array_key_exists('CiviMember', $enabledComponents)) {
$memberComponentId = CRM_Core_Component::getComponentID('CiviMember');
}
- $attributes = CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceFieldValue');
+ $attributes = CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceFieldValue');
$this->add('select', 'financial_type_id',
ts('Financial Type'),
$this->add('select', 'membership_type_id[' . $i . ']', ts('Membership Type'),
array(
- '' => ' ') + $membershipTypes, FALSE, $js
- );
+ '' => ' '
+ ) + $membershipTypes, FALSE, $js
+ );
$this->add('text', 'membership_num_terms[' . $i . ']', ts('Number of Terms'), CRM_Utils_Array::value('membership_num_terms', $attributes));
}
}
if (($form->_action & CRM_Core_Action::ADD || $form->_action & CRM_Core_Action::UPDATE) &&
- $fields['html_type'] == 'Text' && $fields['financial_type_id'] == '') {
+ $fields['html_type'] == 'Text' && $fields['financial_type_id'] == ''
+ ) {
$errors['financial_type_id'] = ts('Financial Type is a required field');
}
$params['is_display_amounts'] = CRM_Utils_Array::value('is_display_amounts', $params, FALSE);
$params['is_required'] = CRM_Utils_Array::value('is_required', $params, FALSE);
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
- $params['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $params, FALSE);
+ $params['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $params, FALSE);
if (isset($params['active_on'])) {
$params['active_on'] = CRM_Utils_Date::processDate($params['active_on'],
CRM_Utils_Array::value('active_on_time', $params),
return;
}
else {
- $attributes = CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceFieldValue');
+ $attributes = CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceFieldValue');
// lets trim all the whitespace
$this->applyFilter('__ALL__', 'trim');
$this->assign('showMember', TRUE);
$membershipTypes = CRM_Member_PseudoConstant::membershipType();
$this->add('select', 'membership_type_id', ts('Membership Type'), array(
- '' => ' ') + $membershipTypes, FALSE,
+ '' => ' '
+ ) + $membershipTypes, FALSE,
array('onClick' => "calculateRowValues( );")
);
$this->add('text', 'membership_num_terms', ts('Number of Terms'), $attributes['membership_num_terms']);
public function postProcess() {
if ($this->_action == CRM_Core_Action::DELETE) {
$fieldValues = array('price_field_id' => $this->_fid);
- $wt = CRM_Utils_Weight::delWeight('CRM_Price_DAO_PriceFieldValue', $this->_oid, $fieldValues);
- $label = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue',
+ $wt = CRM_Utils_Weight::delWeight('CRM_Price_DAO_PriceFieldValue', $this->_oid, $fieldValues);
+ $label = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue',
$this->_oid,
'label', 'id'
);
return;
}
else {
- $params = $ids = array();
- $params = $this->controller->exportValues('Option');
+ $params = $ids = array();
+ $params = $this->controller->exportValues('Option');
$fieldLabel = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $this->_fid, 'label');
$params['amount'] = CRM_Utils_Rule::cleanMoney(trim($params['amount']));
$this->_groupTree[$groupId]['fields'][$fieldId] = $groupTree[$groupId]['fields'][$fieldId];
$this->assign('preview_type', 'field');
$url = CRM_Utils_System::url('civicrm/admin/price/field', "reset=1&action=browse&sid={$groupId}");
- $breadCrumb = array(array(
- 'title' => ts('Price Set Fields'),
+ $breadCrumb = array(
+ array(
+ 'title' => ts('Price Set Fields'),
'url' => $url,
- ));
+ )
+ );
}
else {
// group preview
$this->assign('preview_type', 'group');
$this->assign('setTitle', CRM_Price_BAO_PriceSet::getTitle($groupId));
$url = CRM_Utils_System::url('civicrm/admin/price', 'reset=1');
- $breadCrumb = array(array(
- 'title' => ts('Price Sets'),
+ $breadCrumb = array(
+ array(
+ 'title' => ts('Price Sets'),
'url' => $url,
- ));
+ )
+ );
}
CRM_Utils_System::appendBreadCrumb($breadCrumb);
}
*/
public function setDefaultValues() {
$defaults = array();
- $groupId = $this->get('groupId');
- $fieldId = $this->get('fieldId');
+ $groupId = $this->get('groupId');
+ $fieldId = $this->get('fieldId');
if (!empty($this->_groupTree[$groupId]['fields'])) {
foreach ($this->_groupTree[$groupId]['fields'] as $key => $val) {
foreach ($val['options'] as $keys => $values) {
CRM_Utils_System::setTitle($title);
$url = CRM_Utils_System::url('civicrm/admin/price', 'reset=1');
- $breadCrumb = array(array(
- 'title' => ts('Price Sets'),
+ $breadCrumb = array(
+ array(
+ 'title' => ts('Price Sets'),
'url' => $url,
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadCrumb);
}
$priceSetUsedTables = CRM_Price_BAO_PriceSet::getUsedBy($this->_sid, 'table');
}
- $config = CRM_Core_Config::singleton();
+ $config = CRM_Core_Config::singleton();
$showContribution = FALSE;
$enabledComponents = CRM_Core_Component::getEnabledComponents();
$this->add('select', 'financial_type_id',
ts('Default Financial Type'),
- array('' => ts('- select -')) + $financialType, 'required'
+ array('' => ts('- select -')) + $financialType, 'required'
);
// help text
else {
// Jump directly to adding a field if popups are disabled
$action = CRM_Core_Resources::singleton()->ajaxPopupsEnabled ? 'browse' : 'add';
- $url = CRM_Utils_System::url('civicrm/admin/price/field', array('reset' => 1, 'action' => $action, 'sid' => $set->id, 'new' => 1));
+ $url = CRM_Utils_System::url('civicrm/admin/price/field', array(
+ 'reset' => 1,
+ 'action' => $action,
+ 'sid' => $set->id,
+ 'new' => 1
+ ));
CRM_Core_Session::setStatus(ts("Your Set '%1' has been added. You can add fields to this set now.",
- array(1 => $set->title)
- ), ts('Saved'), 'success');
+ array(1 => $set->title)
+ ), ts('Saved'), 'success');
$session = CRM_Core_Session::singleton();
$session->replaceUserContext($url);
}
$resourceManager->addScriptFile('civicrm', 'js/crm.addNew.js', 999, 'html-header');
}
- $priceField = array();
+ $priceField = array();
$priceFieldBAO = new CRM_Price_BAO_PriceField();
// fkey is sid
*
* @param string $action
* The action to be invoked.
-
*
* @return void
*/
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/admin/price/field/option',
- "reset=1&action=browse&fid={$this->_fid}&sid={$this->_sid}"
- ));
+ "reset=1&action=browse&fid={$this->_fid}&sid={$this->_sid}"
+ ));
$controller = new CRM_Core_Controller_Simple('CRM_Price_Form_Option', ts('Price Field Option'), $action);
$controller->set('fid', $this->_fid);
$controller->setEmbedded(TRUE);
$this->assign('isReserved', $this->_isSetReserved);
}
//as url contain $sid so append breadcrumb dynamically.
- $breadcrumb = array(array(
- 'title' => ts('Price Fields'),
+ $breadcrumb = array(
+ array(
+ 'title' => ts('Price Fields'),
'url' => CRM_Utils_System::url('civicrm/admin/price/field', 'reset=1&sid=' . $this->_sid),
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadcrumb);
if ($this->_fid) {
// what action to take ?
if ($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD |
CRM_Core_Action::VIEW | CRM_Core_Action::DELETE
- ) && !$this->_isSetReserved) {
+ ) && !$this->_isSetReserved
+ ) {
// no browse for edit/update/view
$this->edit($action);
}
*/
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);
+ $session = CRM_Core_Session::singleton();
+ $context = CRM_Utils_Request::retrieve('context', 'String', $this);
if ($context == 'field') {
$session->pushUserContext(CRM_Utils_System::url('civicrm/admin/price/field', "action=browse&sid={$sid}"));
}
// get all price sets
$priceSet = array();
$comps = array(
- 'CiviEvent' => ts('Event'),
+ 'CiviEvent' => ts('Event'),
'CiviContribute' => ts('Contribution'),
'CiviMember' => ts('Membership'),
);
class CRM_Profile_Form extends CRM_Core_Form {
const
MODE_REGISTER = 1,
- MODE_SEARCH = 2,
- MODE_CREATE = 4,
- MODE_EDIT = 8;
+ MODE_SEARCH = 2,
+ MODE_CREATE = 4,
+ MODE_EDIT = 8;
protected $_mode;
protected $_customGroupId = NULL;
protected $_currentUserID = NULL;
- protected $_session = NULL;
+ protected $_session = NULL;
/**
* Pre processing work done here.
* @return void
*/
public function preProcess() {
- $this->_id = $this->get('id');
+ $this->_id = $this->get('id');
$this->_profileIds = $this->get('profileIds');
- $this->_grid = CRM_Utils_Request::retrieve('grid', 'Integer', $this);
- $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
+ $this->_grid = CRM_Utils_Request::retrieve('grid', 'Integer', $this);
+ $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
//unset from session when $_GET doesn't have it
//except when the form is submitted
}
if ($this->_multiRecord &&
- !in_array($this->_multiRecord, array(CRM_Core_Action::UPDATE, CRM_Core_Action::ADD, CRM_Core_Action::DELETE))) {
+ !in_array($this->_multiRecord, array(CRM_Core_Action::UPDATE, CRM_Core_Action::ADD, CRM_Core_Action::DELETE))
+ ) {
CRM_Core_Error::fatal(ts('Proper action not specified for this custom value record profile'));
}
}
}
//record id is neccessary for _multiRecord view and update/edit action
if (!$this->_recordId
- && ($this->_multiRecord == CRM_Core_Action::UPDATE || $this->_multiRecord == CRM_Core_Action::DELETE)) {
+ && ($this->_multiRecord == CRM_Core_Action::UPDATE || $this->_multiRecord == CRM_Core_Action::DELETE)
+ ) {
CRM_Core_Error::fatal(ts('The requested Profile (gid=%1) requires record id while performing this action',
array(1 => $this->_gid)
));
}
elseif (!empty($this->_multiRecordFields)
- && (!$this->_multiRecord || !in_array($this->_multiRecord, array(CRM_Core_Action::DELETE, CRM_Core_Action::UPDATE)))) {
+ && (!$this->_multiRecord || !in_array($this->_multiRecord, array(
+ CRM_Core_Action::DELETE,
+ CRM_Core_Action::UPDATE
+ )))
+ ) {
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js', 1, 'html-header');
//multirecord listing page
$multiRecordFieldListing = TRUE;
if ($htmlType == 'File') {
$entityId = $this->_id;
if (CRM_Utils_Array::value('field_type', $field) == 'Activity' &&
- $this->_activityId
- ) {
+ $this->_activityId
+ ) {
$entityId = $this->_activityId;
}
$url = CRM_Core_BAO_CustomField::getFileURL($entityId, $key);
$customFiles[$name]['displayURL'] = ts("Attached File") . ": {$url['file_url']}";
$deleteExtra = ts("Are you sure you want to delete attached file?");
- $fileId = $url['file_id'];
- $deleteURL = CRM_Utils_System::url('civicrm/file',
- "reset=1&id={$fileId}&eid=$entityId&fid={$key}&action=delete"
- );
+ $fileId = $url['file_id'];
+ $deleteURL = CRM_Utils_System::url('civicrm/file',
+ "reset=1&id={$fileId}&eid=$entityId&fid={$key}&action=delete"
+ );
$text = ts("Delete Attached File");
$customFiles[$field['name']]['deleteURL'] = "<a href=\"{$deleteURL}\" onclick = \"if (confirm( ' $deleteExtra ' )) this.href+='&confirmed=1'; else return false;\">$text</a>";
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
$htmlType = $field['html_type'];
if ((!isset($this->_defaults[$name]) || $htmlType == 'File') &&
- (CRM_Utils_Array::value('field_type', $field) != 'Activity')
- ) {
+ (CRM_Utils_Array::value('field_type', $field) != 'Activity')
+ ) {
CRM_Core_BAO_CustomField::setProfileDefaults($customFieldID,
$name,
$this->_defaults,
$customFiles[$field['name']]['displayURL'] = ts("Attached File") . ": {$url['file_url']}";
$deleteExtra = ts("Are you sure you want to delete attached file?");
- $fileId = $url['file_id'];
- $deleteURL = CRM_Utils_System::url('civicrm/file',
- "reset=1&id={$fileId}&eid=$entityId&fid={$customFieldID}&action=delete"
+ $fileId = $url['file_id'];
+ $deleteURL = CRM_Utils_System::url('civicrm/file',
+ "reset=1&id={$fileId}&eid=$entityId&fid={$customFieldID}&action=delete"
);
$text = ts("Delete Attached File");
$customFiles[$field['name']]['deleteURL'] = "<a href=\"{$deleteURL}\" onclick = \"if (confirm( ' $deleteExtra ' )) this.href+='&confirmed=1'; else return false;\">$text</a>";
if ($this->_id) {
$contactTypes = CRM_Contact_BAO_Contact::getContactTypes($this->_id);
- $contactType = $contactTypes[0];
+ $contactType = $contactTypes[0];
array_shift($contactTypes);
$contactSubtypes = $contactTypes;
}
if (
- in_array(
- $profileType,
- array("Membership", "Participant", "Contribution")
- )
+ in_array(
+ $profileType,
+ array("Membership", "Participant", "Contribution")
+ )
) {
$return = TRUE;
if (!$statusMessage) {
if (!$this->_currentUserID) {
$defaultLocationType = CRM_Core_BAO_LocationType::getDefault();
$primaryLocationType = $defaultLocationType->id;
- $anonUser = TRUE;
+ $anonUser = TRUE;
}
$this->assign('anonUser', $anonUser);
$contactLinks = CRM_Contact_BAO_Contact_Utils::formatContactIDSToLinks($ids, TRUE, TRUE);
$duplicateContactsLinks = '<div class="matching-contacts-found">';
- $duplicateContactsLinks .= ts('One matching contact was found. ', array('count' => count($contactLinks['rows']), 'plural' => '%count matching contacts were found.<br />'));
+ $duplicateContactsLinks .= ts('One matching contact was found. ', array(
+ 'count' => count($contactLinks['rows']),
+ 'plural' => '%count matching contacts were found.<br />'
+ ));
if ($contactLinks['msg'] == 'view') {
- $duplicateContactsLinks .= ts('You can View the existing contact.', array('count' => count($contactLinks['rows']), 'plural' => 'You can View the existing contacts.'));
+ $duplicateContactsLinks .= ts('You can View the existing contact.', array(
+ 'count' => count($contactLinks['rows']),
+ 'plural' => 'You can View the existing contacts.'
+ ));
}
else {
- $duplicateContactsLinks .= ts('You can View or Edit the existing contact.', array('count' => count($contactLinks['rows']), 'plural' => 'You can View or Edit the existing contacts.'));
+ $duplicateContactsLinks .= ts('You can View or Edit the existing contact.', array(
+ 'count' => count($contactLinks['rows']),
+ 'plural' => 'You can View or Edit the existing contacts.'
+ ));
}
$duplicateContactsLinks .= '</div>';
$duplicateContactsLinks .= '<table class="matching-contacts-actions">';
if ($stateProvinceDAO->country_id != $countryId) {
// country mismatch hence display error
$stateProvinces = CRM_Core_PseudoConstant::stateProvince();
- $countries = CRM_Core_PseudoConstant::country();
- $errors[$key] = "State/Province " . $stateProvinces[$stateProvinceId] . " is not part of " . $countries[$countryId] . ". It belongs to " . $countries[$stateProvinceDAO->country_id] . ".";
+ $countries = CRM_Core_PseudoConstant::country();
+ $errors[$key] = "State/Province " . $stateProvinces[$stateProvinceId] . " is not part of " . $countries[$countryId] . ". It belongs to " . $countries[$stateProvinceDAO->country_id] . ".";
}
}
}
if ($countyDAO->state_province_id != $stateProvinceId) {
// state province mismatch hence display error
$stateProvinces = CRM_Core_PseudoConstant::stateProvince();
- $counties = CRM_Core_PseudoConstant::county();
- $errors[$key] = "County " . $counties[$countyId] . " is not part of " . $stateProvinces[$stateProvinceId] . ". It belongs to " . $stateProvinces[$countyDAO->state_province_id] . ".";
+ $counties = CRM_Core_PseudoConstant::county();
+ $errors[$key] = "County " . $counties[$countyId] . " is not part of " . $stateProvinces[$stateProvinceId] . ". It belongs to " . $stateProvinces[$countyDAO->state_province_id] . ".";
}
}
}
if ($tableName = CRM_Utils_Array::value('table_name', $returnValues)) {
$sql = "DELETE FROM {$tableName} WHERE id = %1 AND entity_id = %2";
$sqlParams = array(
- 1 => array($this->_recordId, 'Integer'),
- 2 => array($this->_id, 'Integer'),
- );
+ 1 => array($this->_recordId, 'Integer'),
+ 2 => array($this->_id, 'Integer'),
+ );
CRM_Core_DAO::executeQuery($sql, $sqlParams);
CRM_Core_Session::setStatus(ts('Your record has been deleted.'), ts('Deleted'), 'success');
}
$details = $contactDetails[0][$this->_id];
}
if (!(!empty($details['addressee_id']) || !empty($details['email_greeting_id']) ||
- CRM_Utils_Array::value('postal_greeting_id', $details)
- )) {
+ CRM_Utils_Array::value('postal_greeting_id', $details)
+ )
+ ) {
$profileType = CRM_Core_BAO_UFField::getProfileType($this->_gid);
//Though Profile type is contact we need
CRM_Core_Error::debug_log_message("Rolling back transaction as CMSUser Create failed in Profile_Form for contact " . $params['contactID']);
$transaction->rollback();
return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/profile/create',
- 'reset=1&gid=' . $this->_gid
- ));
+ 'reset=1&gid=' . $this->_gid
+ ));
}
}
if ($this->get('edit')) {
// make sure we have right permission to edit this user
$session = CRM_Core_Session::singleton();
- $userID = $session->get('userID');
- $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, $userID);
+ $userID = $session->get('userID');
+ $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, $userID);
if ($id) {
// this is edit mode.
}
}
elseif (in_array($key, array(
- 'birth_date', 'deceased_date'))) {
+ 'birth_date',
+ 'deceased_date'
+ ))) {
list($value) = CRM_Utils_Date::setDateDefaults($value);
}
}
$this->addButtons(array(
- array(
- 'type' => 'refresh',
- 'name' => ts('Search'),
- 'isDefault' => TRUE,
- ),
- ));
+ array(
+ 'type' => 'refresh',
+ 'name' => ts('Search'),
+ 'isDefault' => TRUE,
+ ),
+ ));
parent::buildQuickForm();
}
}
if ($this->_multiRecord & CRM_Core_Action::VIEW) {
- $this->_recordId = CRM_Utils_Request::retrieve('recordId', 'Positive', $this);
+ $this->_recordId = CRM_Utils_Request::retrieve('recordId', 'Positive', $this);
$this->_allFields = CRM_Utils_Request::retrieve('allFields', 'Integer', $this);
}
if ($limitListingsGroupsID) {
if (!CRM_Contact_BAO_GroupContact::isContactInGroup($this->_id,
- $limitListingsGroupsID
- )) {
+ $limitListingsGroupsID
+ )
+ ) {
CRM_Utils_System::setTitle(ts('Profile View - Permission Denied'));
return CRM_Core_Session::setStatus(ts('You do not have permission to view this contact record. Contact the site administrator if you need assistance.'), ts('Permission Denied'), 'error');
}
$this->_params = array();
$resetArray = array(
- 'group', 'tag', 'preferred_communication_method', 'do_not_phone',
- 'do_not_email', 'do_not_mail', 'do_not_sms', 'do_not_trade', 'gender',
+ 'group',
+ 'tag',
+ 'preferred_communication_method',
+ 'do_not_phone',
+ 'do_not_email',
+ 'do_not_mail',
+ 'do_not_sms',
+ 'do_not_trade',
+ 'gender',
);
foreach ($this->_fields as $name => $field) {
) == 'TextArea')
) {
$value = trim(CRM_Utils_Request::retrieve($name, 'String',
- $this, FALSE, NULL, 'REQUEST'
- ));
+ $this, FALSE, NULL, 'REQUEST'
+ ));
if (!empty($value) &&
!((substr($value, 0, 1) == '%') &&
(substr($value, -1, 1) == '%')
if ($customField) {
// reset checkbox/radio because a form does not send null checkbox values
if (in_array($customField['html_type'],
- array('Multi-Select', 'CheckBox', 'Multi-Select State/Province', 'Multi-Select Country', 'Radio')
- )) {
+ array('Multi-Select', 'CheckBox', 'Multi-Select State/Province', 'Multi-Select Country', 'Radio')
+ )) {
// only reset on a POST submission if we dont see any value
$value = NULL;
$this->set($name, $value);
// set the prox params
// need to ensure proximity searching is enabled
$proximityVars = array(
- 'street_address', 'city', 'postal_code', 'state_province_id',
- 'country_id', 'distance', 'distance_unit',
+ 'street_address',
+ 'city',
+ 'postal_code',
+ 'state_province_id',
+ 'country_id',
+ 'distance',
+ 'distance_unit',
);
foreach ($proximityVars as $var) {
$value = CRM_Utils_Request::retrieve("prox_{$var}",
$gidString = implode(',', $this->_profileIds);
}
- $map = 0;
+ $map = 0;
$linkToUF = 0;
$editLink = FALSE;
if ($this->_gid) {
- $map = $ufgroupDAO->is_map;
+ $map = $ufgroupDAO->is_map;
$linkToUF = $ufgroupDAO->is_uf_link;
$editLink = $ufgroupDAO->is_edit_link;
}
}
if ($fieldIDs && !empty($fieldIDs) && $this->_contactId) {
$options = array();
- $returnProperities = array('html_type', 'data_type', 'date_format', 'time_format', 'default_value', 'is_required');
+ $returnProperities = array(
+ 'html_type',
+ 'data_type',
+ 'date_format',
+ 'time_format',
+ 'default_value',
+ 'is_required'
+ );
foreach ($fieldIDs as $key => $fieldID) {
$fieldIDs[$key] = !is_numeric($fieldID) ? CRM_Core_BAO_CustomField::getKeyID($fieldID) : $fieldID;
$param = array('id' => $fieldIDs[$key]);
$options[$fieldIDs[$key]]['attributes']['default_value'] = CRM_Utils_Array::value('default_value', $returnValues);
$options[$fieldIDs[$key]]['attributes']['format'] =
- $options[$fieldIDs[$key]]['attributes']['date_format'] = CRM_Utils_Array::value('date_format', $returnValues);
+ $options[$fieldIDs[$key]]['attributes']['date_format'] = CRM_Utils_Array::value('date_format', $returnValues);
$options[$fieldIDs[$key]]['attributes']['time_format'] = CRM_Utils_Array::value('time_format', $returnValues);
}
$singleField = CRM_Core_BAO_CustomField::getKeyID($nonListingFieldIds[0]);
$fieldIdInput = $singleField;
$singleField = array($singleField);
- $fieldInput = $singleField;
+ $fieldInput = $singleField;
}
$customGroupInfo = CRM_Core_BAO_CustomGroup::getGroupTitles($fieldInput);
$this->_customGroupTitle = $customGroupInfo[$fieldIdInput]['groupTitle'];
$op = NULL;
if ($this->_pageViewType == 'profileDataView') {
$actionParams = array(
- 'recordId' => $recId,
- 'gid' => $this->_profileId,
- 'id' => $this->_contactId);
+ 'recordId' => $recId,
+ 'gid' => $this->_profileId,
+ 'id' => $this->_contactId
+ );
$op = 'profile.multiValue.row';
}
else {
);
}
if (CRM_Core_Permission::ufGroupValid($this->_gid,
- CRM_Core_Permission::SEARCH
- )) {
+ CRM_Core_Permission::SEARCH
+ )
+ ) {
$this->assign('listingURL',
CRM_Utils_System::url("civicrm/profile",
"force=1&gid={$gidString}"
$this->_gid = $ufGroupIds;
}
- $this->_map = $map;
+ $this->_map = $map;
$this->_editLink = $editLink;
$this->_linkToUF = $linkToUF;
$returnProperties['contact_sub_type'] = 1;
$returnProperties['sort_name'] = 1;
- $queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_params, 1);
- $this->_query = new CRM_Contact_BAO_Query($queryParams, $returnProperties, $this->_fields);
+ $queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_params, 1);
+ $this->_query = new CRM_Contact_BAO_Query($queryParams, $returnProperties, $this->_fields);
//the below is done for query building for multirecord custom field listing
//to show all the custom field multi valued records of a particular contact
public function getPagerParams($action, &$params) {
$status =
CRM_Utils_System::isNull($this->_multiRecordTableName) ? ts('Contact %%StatusMessage%%') : ts('Contact Multi Records %%StatusMessage%%');
- $params['status'] = $status;
+ $params['status'] = $status;
$params['csvString'] = NULL;
- $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
+ $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
$params['buttonTop'] = 'PagerTopButton';
$params['buttonBottom'] = 'PagerBottomButton';
public function &getColumnHeaders($action = NULL, $output = NULL) {
static $skipFields = array('group', 'tag');
$multipleFields = array('url');
- $direction = CRM_Utils_Sort::ASCENDING;
- $empty = TRUE;
+ $direction = CRM_Utils_Sort::ASCENDING;
+ $empty = TRUE;
if (!isset(self::$_columnHeaders)) {
- self::$_columnHeaders = array(array('name' => ''),
+ self::$_columnHeaders = array(
+ array('name' => ''),
array(
'name' => ts('Name'),
'sort' => 'sort_name',
) {
if (strpos($name, '-') !== FALSE) {
- $value = explode('-', $name);
+ $value = explode('-', $name);
$fieldName = CRM_Utils_Array::value(0, $value);
- $lType = CRM_Utils_Array::value(1, $value);
- $type = CRM_Utils_Array::value(2, $value);
+ $lType = CRM_Utils_Array::value(1, $value);
+ $type = CRM_Utils_Array::value(2, $value);
if (!in_array($fieldName, $multipleFields)) {
if ($lType == 'Primary') {
}
if (in_array($fieldName, array(
- 'phone', 'im', 'email'))) {
+ 'phone',
+ 'im',
+ 'email'
+ ))) {
if ($type) {
$name = "`$locationTypeName-$fieldName-$type`";
}
$returnQuery = NULL;
if ($this->_multiRecordTableName &&
- !array_key_exists($this->_multiRecordTableName, $this->_query->_whereTables)) {
+ !array_key_exists($this->_multiRecordTableName, $this->_query->_whereTables)
+ ) {
$additionalFromClause = CRM_Utils_Array::value($this->_multiRecordTableName, $this->_query->_tables);
$returnQuery = TRUE;
}
$vars = $sort->_vars;
$varArray = array();
foreach ($vars as $key => $field) {
- $field = $vars[$key];
+ $field = $vars[$key];
$fieldArray = explode('-', $field['name']);
- $fieldType = CRM_Utils_Array::value('2', $fieldArray);
+ $fieldType = CRM_Utils_Array::value('2', $fieldArray);
if (is_numeric(CRM_Utils_Array::value('1', $fieldArray))) {
if (!in_array($fieldType, $multipleFields)) {
$locationType = new CRM_Core_DAO_LocationType();
if ($returnQuery) {
$resQuery = preg_replace('/GROUP BY contact_a.id[\s]+ORDER BY/', ' ORDER BY', $result);
- $result = CRM_Core_DAO::executeQuery($resQuery);
+ $result = CRM_Core_DAO::executeQuery($resQuery);
}
// process the result of the query
!in_array($key, $skipFields)
) {
if (strpos($key, '-') !== FALSE) {
- $value = explode('-', $key);
+ $value = explode('-', $key);
$fieldName = CRM_Utils_Array::value(0, $value);
- $id = CRM_Utils_Array::value(1, $value);
- $type = CRM_Utils_Array::value(2, $value);
+ $id = CRM_Utils_Array::value(1, $value);
+ $type = CRM_Utils_Array::value(2, $value);
if (!in_array($fieldName, $multipleFields)) {
$locationTypeName = NULL;
}
$locationTypeName = str_replace(' ', '_', $locationTypeName);
if (in_array($fieldName, array(
- 'phone', 'im', 'email'))) {
+ 'phone',
+ 'im',
+ 'email'
+ ))) {
if ($type) {
$names[] = "{$locationTypeName}-{$fieldName}-{$type}";
}
$i18n = CRM_Core_I18n::singleton();
$result->country = $i18n->translate($result->country);
}
- $row = array();
+ $row = array();
$empty = TRUE;
$row[] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type,
FALSE,
elseif (substr($name, -4) == '-url' &&
!empty($result->$name)
) {
- $url = CRM_Utils_System::fixURL($result->$name);
- $typeId = substr($name, 0, -4) . "-website_type_id";
+ $url = CRM_Utils_System::fixURL($result->$name);
+ $typeId = substr($name, 0, -4) . "-website_type_id";
$typeName = CRM_Core_PseudoConstant::getLabel('CRM_Core_DAO_Website', 'website_type_id', $result->$typeId);
if ($typeName) {
$row[] = "<a href=\"$url\">{$result->$name} (${typeName})</a>";
}
elseif (strpos($name, '-im')) {
if (!empty($result->$name)) {
- $providerId = $name . "-provider_id";
+ $providerId = $name . "-provider_id";
$providerName = CRM_Core_PseudoConstant::getLabel('CRM_Core_DAO_IM', 'provider_id', $result->$providerId);
- $row[] = $result->$name . " ({$providerName})";
+ $row[] = $result->$name . " ({$providerName})";
}
else {
$row[] = '';
}
}
elseif (in_array($name, array(
- 'addressee', 'email_greeting', 'postal_greeting'))) {
+ 'addressee',
+ 'email_greeting',
+ 'postal_greeting'
+ ))) {
$dname = $name . '_display';
$row[] = $result->$dname;
}
elseif (in_array($name, array(
- 'birth_date', 'deceased_date'))) {
+ 'birth_date',
+ 'deceased_date'
+ ))) {
$row[] = CRM_Utils_Date::customFormat($result->$name);
}
elseif (isset($result->$name)) {
$this->active = TRUE;
$this->backup = array();
foreach (array(
- 'display_errors', 'html_errors', 'xmlrpc_errors') as $key) {
+ 'display_errors',
+ 'html_errors',
+ 'xmlrpc_errors'
+ ) as $key) {
$this->backup[$key] = ini_get($key);
ini_set($key, 0);
}
$this->errorScope = NULL;
restore_error_handler();
foreach (array(
- 'display_errors', 'html_errors', 'xmlrpc_errors') as $key) {
+ 'display_errors',
+ 'html_errors',
+ 'xmlrpc_errors'
+ ) as $key) {
ini_set($key, $this->backup[$key]);
}
$this->active = FALSE;
try {
$result = $callable();
}
- catch(Exception$e) {
+ catch (Exception$e) {
$this->reportException($e);
}
$this->deactivate();
if (empty($this->releaseTimes[$id]) || $this->releaseTimes[$id] < $nowEpoch) {
$this->releaseTimes[$id] = $nowEpoch + $leaseTime;
- $item = new stdClass();
- $item->id = $id;
+ $item = new stdClass();
+ $item->id = $id;
$item->data = unserialize($data);
return $item;
}
$nowEpoch = CRM_Utils_Time::getTimeRaw();
$this->releaseTimes[$id] = $nowEpoch + $leaseTime;
- $item = new stdClass();
- $item->id = $id;
+ $item = new stdClass();
+ $item->id = $id;
$item->data = unserialize($data);
return $item;
}
return $singleton;
}
- /**
- * Get or build the list of search objects (via hook)
- *
- * @return array
+ /**
+ * Get or build the list of search objects (via hook)
+ *
+ * @return array
* of CRM_Report_BAO_Hook_Interface objects
- */
+ */
public function getSearchQueryObjects() {
if ($this->_queryObjects === NULL) {
$this->_queryObjects = array();
$instance->id = $instanceID;
}
- if (! $instanceID) {
+ if (!$instanceID) {
if ($reportID = CRM_Utils_Array::value('report_id', $params)) {
$instance->report_id = $reportID;
}
*/
public static function &create(&$params) {
if (isset($params['report_header'])) {
- $params['header'] = CRM_Utils_Array::value('report_header',$params);
+ $params['header'] = CRM_Utils_Array::value('report_header', $params);
}
if (isset($params['report_footer'])) {
- $params['footer'] = CRM_Utils_Array::value('report_footer',$params);
+ $params['footer'] = CRM_Utils_Array::value('report_footer', $params);
}
// build navigation parameters
$navigationParams['permission'] = array();
$navigationParams['label'] = $params['title'];
- $navigationParams['name'] = $params['title'];
+ $navigationParams['name'] = $params['title'];
$navigationParams['current_parent_id'] = CRM_Utils_Array::value('parent_id', $navigationParams);
$navigationParams['parent_id'] = CRM_Utils_Array::value('parent_id', $params);
// add to dashlet
if (!empty($dashletParams)) {
$section = 2;
- $chart = '';
+ $chart = '';
if (!empty($params['charts'])) {
$section = 1;
- $chart = "&charts=" . $params['charts'];
+ $chart = "&charts=" . $params['charts'];
}
$limitResult = NULL;
if (CRM_Utils_Array::value('row_count', $params)) {
* $Id$
*
*/
-class CRM_Report_Config extends CRM_Core_Component_Config {}
+class CRM_Report_Config extends CRM_Core_Component_Config {
+}
protected $_tagFilter = FALSE;
/**
-<<<<<<< HEAD
+ * <<<<<<< HEAD
* Build groups filter
-=======
+ * =======
* specify entity table for tags filter
*
*/
/**
* build groups filter
*
->>>>>>> 098a61330d0fe12153370741ec98cb1172ece849
+ * >>>>>>> 098a61330d0fe12153370741ec98cb1172ece849
*/
protected $_groupFilter = FALSE;
'fields' => array(// so we have $this->_alias populated
),
'status_id' =>
- array('title' => ts('Activity Status'),
- 'default' => TRUE,
- 'type' => CRM_Utils_Type::T_STRING,
- ),
+ array(
+ 'title' => ts('Activity Status'),
+ 'default' => TRUE,
+ 'type' => CRM_Utils_Type::T_STRING,
+ ),
'duration' =>
- array('title' => ts('Duration'),
- 'type' => CRM_Utils_Type::T_INT,
- ),
+ array(
+ 'title' => ts('Duration'),
+ 'type' => CRM_Utils_Type::T_INT,
+ ),
'location' =>
- array('title' => ts('Location'),
- 'type' => CRM_Utils_Type::T_STRING,
- ),
+ array(
+ 'title' => ts('Location'),
+ 'type' => CRM_Utils_Type::T_STRING,
+ ),
'details' => array(
'title' => ts('Activity Details'),
)
'operatorType' => CRM_Report_Form::OP_DATE,
),
'activity_subject' =>
- array('title' => ts('Activity Subject')),
+ array('title' => ts('Activity Subject')),
'location' =>
- array('title' => ts('Location'),
- 'type' => CRM_Utils_Type::T_TEXT,
- ),
+ array(
+ 'title' => ts('Location'),
+ 'type' => CRM_Utils_Type::T_TEXT,
+ ),
'activity_type_id' =>
- array('title' => ts('Activity Type'),
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => $this->activityTypes,
- ),
+ array(
+ 'title' => ts('Activity Type'),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => $this->activityTypes,
+ ),
'status_id' =>
- array('title' => ts('Activity Status'),
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Core_PseudoConstant::activityStatus(),
- ),
+ array(
+ 'title' => ts('Activity Status'),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => CRM_Core_PseudoConstant::activityStatus(),
+ ),
'details' => array(
'title' => ts('Activity Details'),
'type' => CRM_Utils_Type::T_TEXT,
),
'group_bys' => array(
'activity_date_time' => array(
- 'title' => ts('Activity Date'),
- 'frequency' => TRUE,
- ),
+ 'title' => ts('Activity Date'),
+ 'frequency' => TRUE,
+ ),
'activity_type_id' => array(
'title' => ts('Activity Type'),
'default' => TRUE,
public function postProcess() {
// get the acl clauses built before we assemble the query
$this->buildACLClause(array(
- $this->_aliases['civicrm_contact'],
- $this->_aliases['civicrm_employer'],
- ));
+ $this->_aliases['civicrm_contact'],
+ $this->_aliases['civicrm_employer'],
+ ));
parent::postProcess();
}
/**
*/
public function __construct() {
- $logging = new CRM_Logging_Schema;
+ $logging = new CRM_Logging_Schema;
$this->tables[] = 'civicrm_contact';
- $this->tables = array_merge($this->tables, array_keys($logging->customDataLogTables()));
+ $this->tables = array_merge($this->tables, array_keys($logging->customDataLogTables()));
$this->tables[] = 'civicrm_email';
$this->tables[] = 'civicrm_phone';
$this->tables[] = 'civicrm_im';
'name' => 'id',
'no_display' => TRUE,
'required' => TRUE,
- 'alias' => 'modified_contact_civireport',
+ 'alias' => 'modified_contact_civireport',
),
'log_conn_id' => array(
'no_display' => TRUE,
'type' => CRM_Utils_Type::T_STRING,
),
'log_type_table' => array(
- 'name' => 'log_type',
+ 'name' => 'log_type',
'title' => ts('Log Type Table'),
'type' => CRM_Utils_Type::T_STRING,
),
),
),
'altered_by_contact' => array(
- 'dao' => 'CRM_Contact_DAO_Contact',
+ 'dao' => 'CRM_Contact_DAO_Contact',
'alias' => 'altered_by_contact',
'fields' => array(
'display_name' => array(
public function alterDisplay(&$rows) {
// cache for id → is_deleted mapping
$isDeleted = array();
- $newRows = array();
+ $newRows = array();
foreach ($rows as $key => &$row) {
if (!isset($isDeleted[$row['log_civicrm_entity_altered_contact_id']])) {
}
if (!empty($row['log_civicrm_entity_altered_contact']) &&
- !$isDeleted[$row['log_civicrm_entity_altered_contact_id']]) {
+ !$isDeleted[$row['log_civicrm_entity_altered_contact_id']]
+ ) {
$row['log_civicrm_entity_altered_contact_link'] =
CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $row['log_civicrm_entity_altered_contact_id']);
$row['log_civicrm_entity_altered_contact_hover'] = ts("Go to contact summary");
}
if ('Contact' == CRM_Utils_Array::value('log_type', $this->_logTables[$row['log_civicrm_entity_log_type']]) &&
- CRM_Utils_Array::value('log_civicrm_entity_log_action', $row) == 'Insert') {
+ CRM_Utils_Array::value('log_civicrm_entity_log_action', $row) == 'Insert'
+ ) {
$row['log_civicrm_entity_log_action'] = ts('Update');
}
if ($newAction = $this->getEntityAction($row['log_civicrm_entity_id'],
- $row['log_civicrm_entity_log_conn_id'],
- $row['log_civicrm_entity_log_type'],
- CRM_Utils_Array::value('log_civicrm_entity_log_action', $row))) {
+ $row['log_civicrm_entity_log_conn_id'],
+ $row['log_civicrm_entity_log_type'],
+ CRM_Utils_Array::value('log_civicrm_entity_log_action', $row))
+ ) {
$row['log_civicrm_entity_log_action'] = $newAction;
}
$row['log_civicrm_entity_log_action'] = "<a href='{$url1}' class='crm-summary-link'><div class='icon ui-icon-zoomin'></div></a> <a title='View details for this update' href='{$url2}'>" . ts('Update') . '</a>';
}
- $key = $date . '_' .
+ $key = $date . '_' .
$row['log_civicrm_entity_log_type'] . '_' .
$row['log_civicrm_entity_log_conn_id'] . '_' .
$row['log_civicrm_entity_log_user_id'] . '_' .
$entity = $logTable;
}
- $detail = $this->_logTables[$entity];
+ $detail = $this->_logTables[$entity];
$tableName = CRM_Utils_Array::value('table_name', $detail, $entity);
$clause = CRM_Utils_Array::value('entity_table', $detail);
$clause = $clause ? "AND entity_log_civireport.entity_table = 'civicrm_contact'" : NULL;
}
$this->buildACLClause(array(
- $this->_aliases['civicrm_contact'],
- $this->_aliases['civicrm_contact_b'],
- ));
+ $this->_aliases['civicrm_contact'],
+ $this->_aliases['civicrm_contact_b'],
+ ));
$sql = $this->buildQuery();
$this->buildRows($sql, $rows);
while ($dao->fetch()) {
$amount[] = CRM_Utils_Money::format($dao->amount, $dao->currency);
$avg[] = CRM_Utils_Money::format(round(($dao->amount /
- $dao->count), 2), $dao->currency);
+ $dao->count), 2), $dao->currency);
}
$statistics['counts']['amount'] = array(
$this->beginPostProcess();
$this->buildACLClause(array(
- $this->_aliases['civicrm_contact'],
- $this->_aliases['civicrm_contact_household'],
- ));
+ $this->_aliases['civicrm_contact'],
+ $this->_aliases['civicrm_contact_household'],
+ ));
$sql = $this->buildQuery(TRUE);
$rows = array();
/**
*/
public function __construct() {
- $logging = new CRM_Logging_Schema;
+ $logging = new CRM_Logging_Schema;
$this->tables[] = 'civicrm_contribution';
- $this->tables = array_merge($this->tables, array_keys($logging->customDataLogTables()));
+ $this->tables = array_merge($this->tables, array_keys($logging->customDataLogTables()));
$this->detail = 'logging/contribute/detail';
$this->summary = 'logging/contribute/summary';
),
),
)
- + $this->addAddressFields()
- + array(
+ + $this->addAddressFields()
+ + array(
'civicrm_contribution' => array(
'dao' => 'CRM_Contribute_DAO_Contribution',
'fields' => array(
'financial_type_id' => array(
'title' => ts('Financial Type'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Contribute_PseudoConstant::financialType(),
+ 'options' => CRM_Contribute_PseudoConstant::financialType(),
'type' => CRM_Utils_Type::T_INT,
),
'frequency_unit' => array(
$this->_currencyColumn = 'civicrm_contribution_recur_currency';
parent::__construct();
}
+
public function getTemplateName() {
return 'CRM/Report/Form.tpl';
}
$start_date_db_alias = $this->_columns['civicrm_contribution_recur']['filters']['start_date']['dbAlias'];
// The end date clause is simple to construct
- $end_date_clause = $this->dateClause($end_date_db_alias, $relative, $from, $to, $end_date_type, NULL, NULL);
+ $end_date_clause = $this->dateClause($end_date_db_alias, $relative, $from, $to, $end_date_type, NULL, NULL);
// NOTE: For the calculation based on installment, there doesn't
// seem to be a way to include the interval unit (e.g. month,
$installment_clause = '(' .
$this->dateClause("DATE_ADD($start_date_db_alias, INTERVAL $installments_db_alias * COALESCE($frequency_interval_db_alias,1) month)",
- $relative, $from, $to, $start_date_type, NULL, NULL);
+ $relative, $from, $to, $start_date_type, NULL, NULL);
$installment_clause .= " AND $frequency_unit_db_alias = 'month' ) OR \n";
$installment_clause .= '(' .
$this->dateClause("DATE_ADD($start_date_db_alias, INTERVAL $installments_db_alias * COALESCE($frequency_interval_db_alias,1) day)",
- $relative, $from, $to, $start_date_type, NULL, NULL);
+ $relative, $from, $to, $start_date_type, NULL, NULL);
$installment_clause .= " AND $frequency_unit_db_alias = 'day' ) OR \n";
$installment_clause .= '(' .
$this->dateClause("DATE_ADD($start_date_db_alias, INTERVAL $installments_db_alias * COALESCE($frequency_interval_db_alias, 1) week)",
- $relative, $from, $to, $start_date_type, NULL, NULL);
+ $relative, $from, $to, $start_date_type, NULL, NULL);
$installment_clause .= " AND $frequency_unit_db_alias = 'week' ) OR \n";
$installment_clause .= '(' .
$this->dateClause("DATE_ADD($start_date_db_alias, INTERVAL $installments_db_alias * COALESCE($frequency_interval_db_alias, 1) year)",
- $relative, $from, $to, $start_date_type, NULL, NULL);
+ $relative, $from, $to, $start_date_type, NULL, NULL);
$installment_clause .= " AND $frequency_unit_db_alias = 'year' )\n";
$this->_where .= " AND ";
if (!$found) {
$erorrGrps = implode(',', $invlidGroups);
$tempErrors[] = ts("Do not select field %1 with Group by %2.", array(
- 1 => $idMapping[$fld_id],
- 2 => $erorrGrps,
- ));
+ 1 => $idMapping[$fld_id],
+ 2 => $erorrGrps,
+ ));
}
}
}
),
),
)
- + $this->addAddressFields()
- + array(
+ + $this->addAddressFields()
+ + array(
'civicrm_contribution' => array(
'dao' => 'CRM_Contribute_DAO_Contribution',
'fields' => array(
),
),
)
- + $this->getAddressColumns()
- + array(
+ + $this->getAddressColumns()
+ + array(
'civicrm_contribution' => array(
'dao' => 'CRM_Contribute_DAO_Contribution',
'fields' => array(
$eventID = implode(',', $eventIDs);
- $participantStatus = CRM_Event_PseudoConstant::participantStatus(NULL, "is_counted = 1");
- $participantRole = CRM_Event_PseudoConstant::participantRole();
+ $participantStatus = CRM_Event_PseudoConstant::participantStatus(NULL, "is_counted = 1");
+ $participantRole = CRM_Event_PseudoConstant::participantRole();
$paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
$rows = $eventSummary = $roleRows = $statusRows = $instrumentRows = $count = array();
$this->setPager();
$showEvents = array();
- $count = 0;
- $numRows = $this->_limit;
+ $count = 0;
+ $numRows = $this->_limit;
if (CRM_Utils_Array::value('id_op', $this->_params, 'in') == 'in' || $noSelection) {
while ($count < self::ROW_COUNT_LIMIT) {
'row_count',
ts('Limit Dashboard Results'),
array(
- 'maxlength' => 64,
+ 'maxlength' => 64,
'size' => 5,
)
);
// unset params from $formValues that doesn't match with DB columns of instance tables, and also not required in form-values for sure
$unsetFields = array(
- 'title', 'to_emails', 'cc_emails', 'header', 'footer',
- 'qfKey', 'id', '_qf_default', 'report_header', 'report_footer', 'grouprole',
+ 'title',
+ 'to_emails',
+ 'cc_emails',
+ 'header',
+ 'footer',
+ 'qfKey',
+ 'id',
+ '_qf_default',
+ 'report_header',
+ 'report_footer',
+ 'grouprole',
);
foreach ($unsetFields as $field) {
unset($formValues[$field]);
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
$clause = $this->dateClause($this->_aliases[$tableName] . '.' . $field['name'], $relative, $from, $to, $field['type']);
}
*/
public static function getChartCriteria() {
return array(
- 'count' => array(
- 'civicrm_mailing_event_delivered_delivered_count' => ts('Delivered'),
+ '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'),
'civicrm_mailing_event_trackable_url_open_click_count' => ts('Clicks'),
'civicrm_mailing_event_unsubscribe_unsubscribe_count' => ts('Unsubscribe'),
),
'rate' => array(
- 'civicrm_mailing_event_delivered_accepted_rate' => ts('Accepted Rate'),
+ 'civicrm_mailing_event_delivered_accepted_rate' => ts('Accepted Rate'),
'civicrm_mailing_event_bounce_bounce_rate' => ts('Bounce Rate'),
'civicrm_mailing_event_opened_open_rate' => ts('Confirmed Open Rate'),
'civicrm_mailing_event_trackable_url_open_CTR' => ts('Click through Rate'),
$isError = TRUE;
foreach ($fields['fields'] as $fld => $isActive) {
if (in_array($fld, array(
- 'delivered_count', 'bounce_count', 'open_count', 'click_count', 'unsubscribe_count', 'accepted_rate', 'bounce_rate', 'open_rate', 'CTR', 'CTO'))) {
+ 'delivered_count',
+ 'bounce_count',
+ 'open_count',
+ 'click_count',
+ 'unsubscribe_count',
+ 'accepted_rate',
+ 'bounce_rate',
+ 'open_rate',
+ 'CTR',
+ 'CTO'
+ ))) {
$isError = FALSE;
}
}
if ($isError) {
- $errors['_qf_default'] = ts('For Chart view, please select at least one field from %1 OR %2.', array(1 => implode(', ', $criterias['count']), 2 => implode(', ', $criterias['rate'])));
+ $errors['_qf_default'] = ts('For Chart view, please select at least one field from %1 OR %2.', array(
+ 1 => implode(', ', $criterias['count']),
+ 2 => implode(', ', $criterias['rate'])
+ ));
}
return $errors;
$criterias = self::getChartCriteria();
$chartInfo = array(
- 'legend' => ts('Mail Summary'),
+ 'legend' => ts('Mail Summary'),
'xname' => ts('Mailing'),
'yname' => ts('Statistics'),
'xLabelAngle' => 20,
),
),
)
- + $this->getAddressColumns(array('group_by' => FALSE))
- + $this->getPhoneColumns();
+ + $this->getAddressColumns(array('group_by' => FALSE))
+ + $this->getPhoneColumns();
// If we have a campaign, build out the relevant elements
$this->_tagFilter = TRUE;
if ($campaignEnabled && !empty($this->activeCampaigns)) {
$groupParams = array('name' => ('report_template'));
$optionValue = CRM_Core_OptionValue::addOptionValue($params, $groupParams, $this->_action, $this->_id);
- CRM_Core_Session::setStatus(ts('The %1 \'%2\' has been saved.', array(1 => 'Report Template', 2 => $optionValue->label)), ts('Saved'), 'success');
+ CRM_Core_Session::setStatus(ts('The %1 \'%2\' has been saved.', array(
+ 1 => 'Report Template',
+ 2 => $optionValue->label
+ )), ts('Saved'), 'success');
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/report/options/report_template', "reset=1"));
}
}
if (!$instanceId) {
$instanceId = CRM_Report_Utils_Report::getInstanceIDForPath();
}
- $action = CRM_Utils_Request::retrieve('action', 'String', $this);
+ $action = CRM_Utils_Request::retrieve('action', 'String', $this);
$optionVal = CRM_Report_Utils_Report::getValueFromUrl($instanceId);
$reportUrl = CRM_Utils_System::url('civicrm/report/list', "reset=1");
*/
public function run() {
//Filters by source report template or by component
- $this->ovID = CRM_Utils_Request::retrieve('ovid', 'Positive', $this);
+ $this->ovID = CRM_Utils_Request::retrieve('ovid', 'Positive', $this);
$this->compID = CRM_Utils_Request::retrieve('compid', 'Positive', $this);
$this->grouping = CRM_Utils_Request::retrieve('grp', 'String', $this);
- $rows = $this->info();
+ $rows = $this->info();
$this->assign('list', $rows);
if ($this->ovID OR $this->compID) {
public function browse() {
$groupParams = array('name' => self::$_gName);
$optionValue = CRM_Core_OptionValue::getRows($groupParams, $this->links(), 'weight');
- $gName = self::$_gName;
- $returnURL = CRM_Utils_System::url("civicrm/admin/report/options/$gName",
+ $gName = self::$_gName;
+ $returnURL = CRM_Utils_System::url("civicrm/admin/report/options/$gName",
"reset=1"
);
$filter = "option_group_id = " . self::$_gId;
}
$sql .= " ORDER BY v.weight ";
- $dao = CRM_Core_DAO::executeQuery($sql);
- $rows = array();
+ $dao = CRM_Core_DAO::executeQuery($sql);
+ $rows = array();
$config = CRM_Core_Config::singleton();
while ($dao->fetch()) {
if ($dao->component_name != 'Contact' && $dao->component_name != $dao->grouping &&
public static function processChart(&$defaults) {
$chartType = CRM_Utils_Array::value("charts", $_GET);
if (in_array($chartType, array(
- 'barChart', 'pieChart'))) {
+ 'barChart',
+ 'pieChart'
+ ))) {
$defaults["charts"] = $chartType;
}
}
list($domainEmailName,
$domainEmailAddress
- ) = CRM_Core_BAO_Domain::getNameAndEmail();
+ ) = CRM_Core_BAO_Domain::getNameAndEmail();
$params = array('id' => $instanceID);
$instanceInfo = array();
$instanceInfo
);
- $params = array();
+ $params = array();
$params['groupName'] = 'Report Email Sender';
- $params['from'] = '"' . $domainEmailName . '" <' . $domainEmailAddress . '>';
+ $params['from'] = '"' . $domainEmailName . '" <' . $domainEmailAddress . '>';
//$domainEmailName;
- $params['toName'] = "";
+ $params['toName'] = "";
$params['toEmail'] = CRM_Utils_Array::value('email_to', $instanceInfo);
- $params['cc'] = CRM_Utils_Array::value('email_cc', $instanceInfo);
+ $params['cc'] = CRM_Utils_Array::value('email_cc', $instanceInfo);
$params['subject'] = CRM_Utils_Array::value('email_subject', $instanceInfo);
if (empty($instanceInfo['attachments'])) {
$instanceInfo['attachments'] = array();
}
// Add the headers.
$csv .= implode($config->fieldSeparator,
- $headers
- ) . "\r\n";
+ $headers
+ ) . "\r\n";
$displayRows = array();
$value = NULL;
}
// Add the data row.
$csv .= implode($config->fieldSeparator,
- $displayRows
- ) . "\r\n";
+ $displayRows
+ ) . "\r\n";
}
return $csv;
if (!empty($instanceValues['permission']) &&
(!(CRM_Core_Permission::check($instanceValues['permission']) ||
- CRM_Core_Permission::check('administer Reports')
- ))
+ CRM_Core_Permission::check('administer Reports')
+ ))
) {
return FALSE;
}
$messages = array("Report Mail Triggered...");
$templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', $optionVal, 'value');
- $obj = new CRM_Report_Page_Instance();
- $is_error = 0;
+ $obj = new CRM_Report_Page_Instance();
+ $is_error = 0;
if (strstr(CRM_Utils_Array::value('name', $templateInfo), '_Form')) {
$instanceInfo = array();
CRM_Report_BAO_ReportInstance::retrieve(array('id' => $instanceId), $instanceInfo);
// (in other words, there's no point in propagating blank filters).
foreach ($process_params as $field_name => $field_value) {
$suffix_position = strrpos($field_name, '_');
- $suffix = substr($field_name, $suffix_position);
- $basename = substr($field_name, 0, $suffix_position);
+ $suffix = substr($field_name, $suffix_position);
+ $basename = substr($field_name, 0, $suffix_position);
if ($suffix == '_min' || $suffix == '_max' ||
$suffix == '_from' || $suffix == '_to' ||
$suffix == '_relative'
public static function getProviders($selectArr = NULL, $filter = NULL, $getActive = TRUE, $orderBy = 'id') {
$providers = array();
- $temp = array();
- $dao = new CRM_SMS_DAO_Provider();
+ $temp = array();
+ $dao = new CRM_SMS_DAO_Provider();
if ($filter && !array_key_exists('is_active', $filter) && $getActive) {
$dao->is_active = 1;
}
$groups = array();
foreach (array(
- 'name', 'group_id', 'is_sms') as $n) {
+ 'name',
+ 'group_id',
+ 'is_sms'
+ ) as $n) {
if (!empty($values[$n])) {
$params[$n] = $values[$n];
}
$qf_Group_submit = $this->controller->exportValue($this->_name, '_qf_Group_submit');
$this->set('name', $params['name']);
- $inGroups = $values['includeGroups'];
- $outGroups = $values['excludeGroups'];
- $inMailings = $values['includeMailings'];
+ $inGroups = $values['includeGroups'];
+ $outGroups = $values['excludeGroups'];
+ $inMailings = $values['includeMailings'];
$outMailings = $values['excludeMailings'];
if (is_array($inGroups)) {
}
}
- $session = CRM_Core_Session::singleton();
- $params['groups'] = $groups;
+ $session = CRM_Core_Session::singleton();
+ $params['groups'] = $groups;
$params['mailings'] = $mailings;
- $ids = array();
+ $ids = array();
if ($this->get('mailing_id')) {
// don't create a new mass sms if already exists
// delete previous includes/excludes, if mailing already existed
foreach (array(
- 'groups', 'mailings') as $entity) {
- $mg = new CRM_Mailing_DAO_MailingGroup();
- $mg->mailing_id = $ids['mailing_id'];
+ 'groups',
+ 'mailings'
+ ) as $entity) {
+ $mg = new CRM_Mailing_DAO_MailingGroup();
+ $mg->mailing_id = $ids['mailing_id'];
$mg->entity_table = ($entity == 'groups') ? $groupTableName : $mailingTableName;
$mg->find();
while ($mg->fetch()) {
$attributes['title'], TRUE
);
- $this->addRule('title', ts('This Title already exists in Database.'), 'objectExists', array('CRM_SMS_DAO_Provider', $this->_id));
+ $this->addRule('title', ts('This Title already exists in Database.'), 'objectExists', array(
+ 'CRM_SMS_DAO_Provider',
+ $this->_id
+ ));
$this->add('text', 'username', ts('Username'),
$attributes['username'], TRUE
$this->addButtons($buttons);
- $preview = array();
- $preview['type'] = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingID, 'body_html') ? 'html' : 'text';
+ $preview = array();
+ $preview['type'] = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingID, 'body_html') ? 'html' : 'text';
$preview['viewURL'] = CRM_Utils_System::url('civicrm/mailing/view', "reset=1&id={$this->_mailingID}");
$this->assign_by_ref('preview', $preview);
}
}
if (CRM_Utils_Date::format(CRM_Utils_Date::processDate($params['start_date'],
- $params['start_date_time']
- )) < CRM_Utils_Date::format(date('YmdHi00'))) {
+ $params['start_date_time']
+ )) < CRM_Utils_Date::format(date('YmdHi00'))
+ ) {
return array(
'start_date' => ts('Start date cannot be earlier than the current time.'),
);
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/mailing/browse/scheduled',
- 'reset=1&scheduled=true&sms=1'
- ));
+ 'reset=1&scheduled=true&sms=1'
+ ));
}
/**
*/
public function buildQuickForm() {
$session = CRM_Core_Session::singleton();
- $config = CRM_Core_Config::singleton();
+ $config = CRM_Core_Config::singleton();
$options = array();
$tempVar = FALSE;
$session = CRM_Core_Session::singleton();
$params['contact_id'] = $session->get('userID');
$composeFields = array(
- 'SMStemplate', 'SMSsaveTemplate',
- 'SMSupdateTemplate', 'SMSsaveTemplateName',
+ 'SMStemplate',
+ 'SMSsaveTemplate',
+ 'SMSupdateTemplate',
+ 'SMSsaveTemplateName',
);
$msgTemplate = NULL;
//mail template is composed
// be a suggestion from someone on how to
// make it a bit more elegant
- $dummy_mail = new CRM_Mailing_BAO_Mailing();
- $mess = "body_text";
+ $dummy_mail = new CRM_Mailing_BAO_Mailing();
+ $mess = "body_text";
$dummy_mail->$mess = $str;
- $tokens = $dummy_mail->getTokens();
+ $tokens = $dummy_mail->getTokens();
$str = CRM_Utils_Token::replaceSubscribeInviteTokens($str);
$str = CRM_Utils_Token::replaceDomainTokens($str, $domain, NULL, $tokens['text']);
}
if (!empty($dataErrors)) {
$errors['textFile'] = ts('The following errors were detected in %1:', array(
- 1 => $name)) . ' <ul>' . implode('', $dataErrors) . '</ul>';
+ 1 => $name
+ )) . ' <ul>' . implode('', $dataErrors) . '</ul>';
}
}
* $Id$
*
*/
-
class CRM_SMS_Page_Callback {
public function run() {
$provider = CRM_SMS_Provider::singleton($_REQUEST);
- if (array_key_exists('status',$_REQUEST)) {
+ if (array_key_exists('status', $_REQUEST)) {
$provider->callback();
}
else {
public function run() {
// set title and breadcrumb
CRM_Utils_System::setTitle(ts('Settings - SMS Provider'));
- $breadCrumb = array(array(
+ $breadCrumb = array(
+ array(
'title' => ts('SMS Provider'),
'url' => CRM_Utils_System::url('civicrm/admin/sms/provider',
'reset=1'
),
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadCrumb);
$this->_id = CRM_Utils_Request::retrieve('id', 'String',
* $Id$
*
*/
-
abstract class CRM_SMS_Provider {
/**
* @static
*/
public static function &singleton($providerParams = array(), $force = FALSE) {
- $mailingID = CRM_Utils_Array::value('mailing_id', $providerParams);
- $providerID = CRM_Utils_Array::value('provider_id', $providerParams);
+ $mailingID = CRM_Utils_Array::value('mailing_id', $providerParams);
+ $providerID = CRM_Utils_Array::value('provider_id', $providerParams);
$providerName = CRM_Utils_Array::value('provider', $providerParams);
if (!$providerID && $mailingID) {
}
$providerName = CRM_Utils_Type::escape($providerName, 'String');
- $cacheKey = "{$providerName}_" . (int) $providerID . "_" . (int) $mailingID;
+ $cacheKey = "{$providerName}_" . (int) $providerID . "_" . (int) $mailingID;
if (!isset(self::$_singleton[$cacheKey]) || $force) {
$ext = CRM_Extension_System::singleton()->getMapper();
INNER JOIN civicrm_mailing_job mj ON mj.mailing_id = m.id AND mj.id = %1";
$sourceContactID = CRM_Core_DAO::singleValueQuery($sql, array(1 => array($jobID, 'Integer')));
}
- elseif($userID) {
+ elseif ($userID) {
$sourceContactID = $userID;
}
else {
* @throws CRM_Core_Exception
*/
public function processInbound($from, $body, $to = NULL, $trackID = NULL) {
- $formatFrom = $this->formatPhone($this->stripPhone($from), $like, "like");
- $escapedFrom = CRM_Utils_Type::escape($formatFrom, 'String');
+ $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 . '"');
- if (! $fromContactID) {
+ if (!$fromContactID) {
// unknown mobile sender -- create new contact
// use fake @mobile.sms email address for new contact since civi
// requires email or name for all contacts
$contactparams = array(
'contact_type' => 'Individual',
'email' => array(
- 1 => array(
- 'location_type_id' => $phoneloc,
- 'email' => $stripFrom . '@mobile.sms',
- )),
+ 1 => array(
+ 'location_type_id' => $phoneloc,
+ 'email' => $stripFrom . '@mobile.sms',
+ )
+ ),
'phone' => array(
- 1 => array(
- 'phone_type_id' => $phonetype,
- 'location_type_id' => $phoneloc,
- 'phone' => $stripFrom,
- )),
+ 1 => array(
+ 'phone_type_id' => $phonetype,
+ 'location_type_id' => $phoneloc,
+ 'phone' => $stripFrom,
+ )
+ ),
);
$fromContact = CRM_Contact_BAO_Contact::create($contactparams, FALSE, TRUE, FALSE);
$fromContactID = $fromContact->id;
$area = "";
$exch = "";
$uniq = "";
- $ext = $phoneA[1];
+ $ext = $phoneA[1];
break;
case 7:
$area = "";
$exch = substr($phone, 0, 3);
$uniq = substr($phone, 3, 4);
- $ext = $phoneA[1];
+ $ext = $phoneA[1];
break;
case 10:
$area = substr($phone, 0, 3);
$exch = substr($phone, 3, 3);
$uniq = substr($phone, 6, 4);
- $ext = $phoneA[1];
+ $ext = $phoneA[1];
break;
default:
$form->addElement('checkbox', 'is_map', ts('Enable mapping for this profile?'));
// should we allow updates on a exisitng contact
- $options = array();
+ $options = array();
$options[] = $form->createElement('radio', NULL, NULL, ts('Issue warning and do not save'), 0);
$options[] = $form->createElement('radio', NULL, NULL, ts('Update the matching contact'), 1);
$options[] = $form->createElement('radio', NULL, NULL, ts('Allow duplicate contact to be created'), 2);
// add select for groups
$group = array(
- '' => ts('- select -')) + $form->_group;
+ '' => ts('- select -')
+ ) + $form->_group;
$form->_groupElement = &$form->addElement('select', 'group', ts('Limit listings to a specific Group?'), $group);
//add notify field
$form->_cmsId = TRUE;
}
- $options = array();
+ $options = array();
$options[] = $form->createElement('radio', NULL, NULL, ts('No account create option'), 0);
$options[] = $form->createElement('radio', NULL, NULL, ts('Give option, but not required'), 1);
$options[] = $form->createElement('radio', NULL, NULL, ts('Account creation required'), 2);
$form->addGroup($options, 'is_cms_user', ts('%1 user account registration option?', array(1 => $config->userFramework)));
// options for including Proximity Search in the profile search form
- $proxOptions = array();
+ $proxOptions = array();
$proxOptions[] = $form->createElement('radio', NULL, NULL, ts('None'), 0);
$proxOptions[] = $form->createElement('radio', NULL, NULL, ts('Optional'), 1);
$proxOptions[] = $form->createElement('radio', NULL, NULL, ts('Required'), 2);
$session = CRM_Core_Session::singleton();
$session->pushUserContext($url);
- $breadCrumb = array(array(
- 'title' => ts('CiviCRM Profile Fields'),
+ $breadCrumb = array(
+ array(
+ 'title' => ts('CiviCRM Profile Fields'),
'url' => $url,
- ));
+ )
+ );
CRM_Utils_System::appendBreadCrumb($breadCrumb);
}
$defaultLocation = $this->_location_types[$defaultLocationType->id];
unset($this->_location_types[$defaultLocationType->id]);
$this->_location_types = array(
- $defaultLocationType->id => $defaultLocation) + $this->_location_types;
+ $defaultLocationType->id => $defaultLocation
+ ) + $this->_location_types;
}
$this->_location_types = array('Primary') + $this->_location_types;
}
$this->_defaults = array();
- $js = "<script type='text/javascript'>\n";
- $formName = "document.{$this->_name}";
+ $js = "<script type='text/javascript'>\n";
+ $formName = "document.{$this->_name}";
$alreadyMixProfile = FALSE;
if (CRM_Core_BAO_UFField::checkProfileType($this->_gid)) {
if ($this->_action & CRM_Core_Action::DELETE) {
$fieldValues = array('uf_group_id' => $this->_gid);
CRM_Utils_Weight::delWeight('CRM_Core_DAO_UFField', $this->_id, $fieldValues);
- $deleted = CRM_Core_BAO_UFField::del($this->_id);
+ $deleted = CRM_Core_BAO_UFField::del($this->_id);
//update group_type every time. CRM-3608
if ($this->_gid && $deleted) {
$config = CRM_Core_Config::singleton();
$showBestResult = FALSE;
if (in_array($ufField->field_name, array(
- 'country', 'state_province')) && count($config->countryLimit) > 1) {
+ 'country',
+ 'state_province'
+ )) && count($config->countryLimit) > 1
+ ) {
// get state or country field weight if exists
$field = 'state_province';
if ($ufField->field_name == 'state_province') {
CRM_Core_BAO_UFGroup::updateGroupTypes($this->_gid, $fieldsType);
}
CRM_Core_Session::setStatus(ts('Your CiviCRM Profile Field \'%1\' has been saved to \'%2\'.',
- array(1 => $name, 2 => $this->_title)
- ), ts('Profile Field Saved'), 'success');
+ array(1 => $name, 2 => $this->_title)
+ ), ts('Profile Field Saved'), 'success');
}
$buttonName = $this->controller->getButtonName();
if ($buttonName == $this->getButtonName('next', 'new')) {
CRM_Core_Session::setStatus(ts(' You can add another profile field.'), '', 'info');
$session->replaceUserContext(CRM_Utils_System::url('civicrm/admin/uf/group/field/add',
- "reset=1&action=add&gid={$this->_gid}&sbr={$showBestResult}"
- ));
+ "reset=1&action=add&gid={$this->_gid}&sbr={$showBestResult}"
+ ));
}
else {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/admin/uf/group/field',
- "reset=1&action=browse&gid={$this->_gid}"
- ));
+ "reset=1&action=browse&gid={$this->_gid}"
+ ));
$session->set('showBestResult', $showBestResult);
}
}
*/
public static function formRuleSubType($fieldType, $groupType, $errors) {
if (in_array($fieldType, array(
- 'Participant', 'Contribution', 'Membership', 'Activity'))) {
+ 'Participant',
+ 'Contribution',
+ 'Membership',
+ 'Activity'
+ ))) {
$individualSubTypes = CRM_Contact_BAO_ContactType::subTypes('Individual');
foreach ($groupType as $value) {
if (!in_array($value, $individualSubTypes) &&
!in_array($value, array(
- 'Participant', 'Contribution', 'Membership',
- 'Individual', 'Contact', 'Activity',
- ))
+ 'Participant',
+ 'Contribution',
+ 'Membership',
+ 'Individual',
+ 'Contact',
+ 'Activity',
+ ))
) {
$errors['field_name'] = ts('Cannot add or update profile field "%1" with combination of Household or Organization or any subtypes of Household or Organisation.', array(1 => $fieldType));
break;
public static function formRuleCustomDataExtentColumnValue($customField, $gid, $fieldType, &$errors) {
// fix me : check object $customField
if (in_array($fieldType, array(
- 'Participant', 'Contribution', 'Membership', 'Activity', 'Case'))) {
+ 'Participant',
+ 'Contribution',
+ 'Membership',
+ 'Activity',
+ 'Case'
+ ))) {
$params = array('id' => $customField->custom_group_id);
$customGroup = array();
CRM_Core_BAO_CustomGroup::retrieve($params, $customGroup);
* @static
*/
public static function formRule($fields, $files, $self) {
- $is_required = CRM_Utils_Array::value('is_required', $fields, FALSE);
+ $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);
- $in_selector = CRM_Utils_Array::value('in_selector', $fields, FALSE);
- $is_active = CRM_Utils_Array::value('is_active', $fields, FALSE);
+ $is_view = CRM_Utils_Array::value('is_view', $fields, FALSE);
+ $in_selector = CRM_Utils_Array::value('in_selector', $fields, FALSE);
+ $is_active = CRM_Utils_Array::value('is_active', $fields, FALSE);
$errors = array();
if ($is_view && $is_registration) {
}
if ($in_selector && in_array($entityName, array(
- 'Contribution', 'Participant', 'Membership', 'Activity'))) {
+ 'Contribution',
+ 'Participant',
+ 'Membership',
+ 'Activity'
+ ))
+ ) {
$errors['in_selector'] = ts("'In Selector' cannot be checked for %1 fields.", array(1 => $entityName));
}
if (CRM_Contact_BAO_ContactType::isaSubType($fieldType)) {
if (CRM_Contact_BAO_ContactType::isaSubType($profileType)) {
if ($fieldType != $profileType) {
- $errors['field_name'] = ts('Cannot add or update profile field type "%1" with combination of "%2".', array(1 => $fieldType, 2 => $profileType));
+ $errors['field_name'] = ts('Cannot add or update profile field type "%1" with combination of "%2".', array(
+ 1 => $fieldType,
+ 2 => $profileType
+ ));
}
}
else {
$profileType != $basicType &&
$profileType != 'Contact'
) {
- $errors['field_name'] = ts('Cannot add or update profile field type "%1" with combination of "%2".', array(1 => $fieldType, 2 => $profileType));
+ $errors['field_name'] = ts('Cannot add or update profile field type "%1" with combination of "%2".', array(
+ 1 => $fieldType,
+ 2 => $profileType
+ ));
}
}
}
}
elseif ($this->_action & (CRM_Core_Action::DISABLE | CRM_Core_Action::DELETE)) {
$ufGroup['module'] = implode(' , ', CRM_Core_BAO_UFGroup::getUFJoinRecord($this->_id, TRUE));
- $status = 0;
- $status = CRM_Core_BAO_UFGroup::usedByModule($this->_id);
+ $status = 0;
+ $status = CRM_Core_BAO_UFGroup::usedByModule($this->_id);
if ($this->_action & (CRM_Core_Action::DISABLE)) {
if ($status) {
$message = 'This profile is currently used for ' . $ufGroup['module'] . '. If you disable the profile - it will be removed from these forms and/or modules. Do you want to continue?';
$showAdvanced = 0;
$advFields = array(
- 'group', 'post_URL', 'cancel_URL',
- 'add_captcha', 'is_map', 'is_uf_link', 'is_edit_link',
- 'is_update_dupe', 'is_cms_user', 'is_proximity_search',
+ 'group',
+ 'post_URL',
+ 'cancel_URL',
+ 'add_captcha',
+ 'is_map',
+ 'is_uf_link',
+ 'is_edit_link',
+ 'is_update_dupe',
+ 'is_cms_user',
+ 'is_proximity_search',
);
foreach ($advFields as $key) {
if (!empty($defaults[$key])) {
$name .= $self->_id ? '_' . $self->_id : '';
$query = 'select count(*) from civicrm_uf_group where ( name like %1 ) and id != %2';
$pCnt = CRM_Core_DAO::singleValueQuery($query, array(
- 1 => array($name, 'String'),
- 2 => array((int) $self->_id, 'Integer'),
- ));
+ 1 => array($name, 'String'),
+ 2 => array((int) $self->_id, 'Integer'),
+ ));
if ($pCnt) {
$errors['title'] = ts('Profile \'%1\' already exists in Database.', array(1 => $title));
}
$action = CRM_Core_Resources::singleton()->ajaxPopupsEnabled ? '' : '/add';
$url = CRM_Utils_System::url("civicrm/admin/uf/group/field$action", 'reset=1&new=1&gid=' . $ufGroup->id . '&action=' . ($action ? 'add' : 'browse'));
CRM_Core_Session::setStatus(ts('Your CiviCRM Profile \'%1\' has been added. You can add fields to this profile now.',
- array(1 => $ufGroup->title)
- ), ts('Profile Added'), 'success');
+ array(1 => $ufGroup->title)
+ ), ts('Profile Added'), 'success');
}
$session = CRM_Core_Session::singleton();
$session->replaceUserContext($url);
// set the userContext stack
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/admin/uf/group/field',
- 'reset=1&action=browse&gid=' . $this->_gid
- ));
+ 'reset=1&action=browse&gid=' . $this->_gid
+ ));
$controller->set('gid', $this->_gid);
$controller->setEmbedded(TRUE);
$controller->process();
$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',
- 'reset=1&action=browse&gid=' . $this->_gid
- ));
+ 'reset=1&action=browse&gid=' . $this->_gid
+ ));
$controller->set('fieldId', $fieldId);
$controller->set('id', $groupId);
$controller->setEmbedded(TRUE);
$loaded = TRUE;
CRM_Core_Resources::singleton()
- ->addSettingsFactory(function() {
+ ->addSettingsFactory(function () {
return array(
'PseudoConstant' => array(
'locationType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'),
case 'Household':
if ($field['field_type'] != $extends && $field['field_type'] != 'Contact'
//CRM-15595 check if subtype
- && !in_array($field['field_type'], CRM_Contact_BAO_ContactType::subTypes($extends))) {
+ && !in_array($field['field_type'], CRM_Contact_BAO_ContactType::subTypes($extends))
+ ) {
continue 2;
}
break;
public function processSQL($rev) {
$sqlFile = implode(DIRECTORY_SEPARATOR,
array(
- dirname(__FILE__), 'Incremental',
- 'sql', $rev . '.mysql',
+ dirname(__FILE__),
+ 'Incremental',
+ 'sql',
+ $rev . '.mysql',
)
);
$tplFile = "$sqlFile.tpl";
$minPhpVersion = '5.3.3';
if (version_compare($phpVersion, $minPhpVersion) < 0) {
$error = ts('CiviCRM %3 requires PHP version %1 (or newer), but the current system uses %2 ',
- array(
- 1 => $minPhpVersion,
- 2 => $phpVersion,
- 3 => $latestVer,
- ));
+ array(
+ 1 => $minPhpVersion,
+ 2 => $phpVersion,
+ 3 => $latestVer,
+ ));
}
// check for mysql trigger privileges
if (!CRM_Core_DAO::checkTriggerViewPermission(FALSE, TRUE)) {
$error = ts('CiviCRM %1 requires MySQL trigger privileges.',
- array(1 => $latestVer));
+ array(1 => $latestVer));
}
if (CRM_Core_DAO::getGlobalSetting('thread_stack', 0) < (1024 * self::MINIMUM_THREAD_STACK)) {
CRM_Core_Error::fatal(ts('Failed to find or create queueing table'));
}
$queue = CRM_Queue_Service::singleton()->create(array(
- 'name' => self::QUEUE_NAME,
- 'type' => 'Sql',
- 'reset' => TRUE,
- ));
+ 'name' => self::QUEUE_NAME,
+ 'type' => 'Sql',
+ 'reset' => TRUE,
+ ));
$revisions = $upgrade->getRevisionSequence();
foreach ($revisions as $rev) {
// proceed only if $currentVer < $rev
if (version_compare($currentVer, $rev) < 0) {
$beginTask = new CRM_Queue_Task(
- // callback
+ // callback
array('CRM_Upgrade_Form', 'doIncrementalUpgradeStart'),
// arguments
array($rev),
$queue->createItem($beginTask);
$task = new CRM_Queue_Task(
- // callback
+ // callback
array('CRM_Upgrade_Form', 'doIncrementalUpgradeStep'),
// arguments
array($rev, $currentVer, $latestVer, $postUpgradeMessageFile),
$queue->createItem($task);
$task = new CRM_Queue_Task(
- // callback
+ // callback
array('CRM_Upgrade_Form', 'doIncrementalUpgradeFinish'),
// arguments
array($rev, $currentVer, $latestVer, $postUpgradeMessageFile),
// pre-db check for major release.
if ($upgrade->checkVersionRelease($rev, 'alpha1')) {
if (!(is_callable(array(
- $versionObject, 'verifyPreDBstate')))) {
+ $versionObject,
+ 'verifyPreDBstate'
+ )))
+ ) {
CRM_Core_Error::fatal("verifyPreDBstate method was not found for $rev");
}
$upgrade->setSchemaStructureTables($rev);
if (is_callable(array(
- $versionObject, $phpFunctionName))) {
+ $versionObject,
+ $phpFunctionName
+ ))) {
$versionObject->$phpFunctionName($rev, $originalVer, $latestVer);
}
else {
// set post-upgrade-message if any
if (is_callable(array(
- $versionObject, 'setPostUpgradeMessage'))) {
+ $versionObject,
+ 'setPostUpgradeMessage'
+ ))) {
$postUpgradeMessage = file_get_contents($postUpgradeMessageFile);
$versionObject->setPostUpgradeMessage($postUpgradeMessage, $rev);
file_put_contents($postUpgradeMessageFile, $postUpgradeMessage);
) {
$versionObject = $this->incrementalPhpObject($rev);
if (is_callable(array(
- $versionObject, 'setPreUpgradeMessage'))) {
+ $versionObject,
+ 'setPreUpgradeMessage'
+ ))) {
$versionObject->setPreUpgradeMessage($preUpgradeMessage, $rev, $currentVer);
}
}
$postUpgradeMessageFile = CRM_Utils_File::tempnam('civicrm-post-upgrade');
$queueRunner = new CRM_Queue_Runner(array(
- 'title' => ts('CiviCRM Upgrade Tasks'),
- 'queue' => CRM_Upgrade_Form::buildQueue($currentVer, $latestVer, $postUpgradeMessageFile),
- ));
+ 'title' => ts('CiviCRM Upgrade Tasks'),
+ 'queue' => CRM_Upgrade_Form::buildQueue($currentVer, $latestVer, $postUpgradeMessageFile),
+ ));
$queueResult = $queueRunner->runAll();
if ($queueResult !== TRUE) {
$errorMessage = CRM_Core_Error::formatTextException($queueResult['exception']);
version_compare($upgradeTo, '3.4.beta3') >= 0
) {
$config = CRM_Core_Config::singleton();
- $preUpgradeMessage .= '<br />' . ts("As per <a href='%1'>the related blog post</a>, we are making contact names, addresses and mailings monolingual; the values entered for the default locale (%2) will be preserved and values for other locales removed.", array(1 => 'http://civicrm.org/blogs/shot/multilingual-civicrm-3440-making-some-fields-monolingual', 2 => $config->lcMessages));
+ $preUpgradeMessage .= '<br />' . ts("As per <a href='%1'>the related blog post</a>, we are making contact names, addresses and mailings monolingual; the values entered for the default locale (%2) will be preserved and values for other locales removed.", array(
+ 1 => 'http://civicrm.org/blogs/shot/multilingual-civicrm-3440-making-some-fields-monolingual',
+ 2 => $config->lcMessages
+ ));
}
if (version_compare($currentVer, '3.4.6') == -1 &&
if (file_exists($ofcFile)) {
if (@unlink($ofcFile)) {
$preUpgradeMessage .= '<br />' . ts('This system included an outdated, insecure script (%1). The file was automatically deleted.', array(
- 1 => $ofcFile,
- ));
+ 1 => $ofcFile,
+ ));
}
else {
$preUpgradeMessage .= '<br />' . ts('This system includes an outdated, insecure script (%1). Please delete it.', array(
- 1 => $ofcFile,
- ));
+ 1 => $ofcFile,
+ ));
}
}
return;
}
- $html = NULL;
+ $html = NULL;
$pathName = dirname(dirname(__FILE__));
- $flag = FALSE;
+ $flag = FALSE;
foreach ($workflows as $workflow => $title) {
$name = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue',
$workflow,
if ($flag == TRUE) {
$html = "<ul>" . $html . "<ul>";
- $message .= '<br />' . ts("The default copies of the message templates listed below will be updated to handle new features or correct a problem. Your installation has customized versions of these message templates, and you will need to apply the updates manually after running this upgrade. <a href='%1' style='color:white; text-decoration:underline; font-weight:bold;' target='_blank'>Click here</a> for detailed instructions. %2", array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Message+Templates#MessageTemplates-UpgradesandCustomizedSystemWorkflowTemplates', 2 => $html));
+ $message .= '<br />' . ts("The default copies of the message templates listed below will be updated to handle new features or correct a problem. Your installation has customized versions of these message templates, and you will need to apply the updates manually after running this upgrade. <a href='%1' style='color:white; text-decoration:underline; font-weight:bold;' target='_blank'>Click here</a> for detailed instructions. %2", array(
+ 1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Message+Templates#MessageTemplates-UpgradesandCustomizedSystemWorkflowTemplates',
+ 2 => $html
+ ));
}
}
if (!empty($subTypeTemplates)) {
$subTypeTemplates = implode(',', $subTypeTemplates);
- $postUpgradeMessage .= '<br />' . ts('You are using custom template for contact subtypes: %1.', array(1 => $subTypeTemplates)) . '<br />' . ts('You need to move these subtype templates to the SubType directory in %1 and %2 respectively.', array(1 => 'CRM/Contact/Form/Edit', 2 => 'CRM/Contact/Page/View'));
+ $postUpgradeMessage .= '<br />' . ts('You are using custom template for contact subtypes: %1.', array(1 => $subTypeTemplates)) . '<br />' . ts('You need to move these subtype templates to the SubType directory in %1 and %2 respectively.', array(
+ 1 => 'CRM/Contact/Form/Edit',
+ 2 => 'CRM/Contact/Page/View'
+ ));
}
}
}
$template = CRM_Core_Smarty::singleton();
$eventFees = array();
- $query = "SELECT og.id ogid FROM civicrm_option_group og WHERE og.name LIKE %1";
- $params = array(1 => array('civicrm_event_page.amount%', 'String'));
- $dao = CRM_Core_DAO::executeQuery($query, $params);
+ $query = "SELECT og.id ogid FROM civicrm_option_group og WHERE og.name LIKE %1";
+ $params = array(1 => array('civicrm_event_page.amount%', 'String'));
+ $dao = CRM_Core_DAO::executeQuery($query, $params);
while ($dao->fetch()) {
$eventFees[$dao->ogid] = $dao->ogid;
}
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'
- )) {
+ 'CRM_Contact_Form_Search_Custom_ZipCodeRange', 'id', 'name'
+ )
+ ) {
$template->assign('customSearchAbsentAll', TRUE);
}
elseif (!CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue',
- 'CRM_Contact_Form_Search_Custom_MultipleValues', 'id', 'name'
- )) {
+ 'CRM_Contact_Form_Search_Custom_MultipleValues', 'id', 'name'
+ )
+ ) {
$template->assign('customSearchAbsent', TRUE);
}
$upgrade = new CRM_Upgrade_Form();
// newly added permission 'edit_all_events', CRM-5472
$config = CRM_Core_Config::singleton();
if (is_callable(array(
- $config->userSystem, 'replacePermission'))) {
+ $config->userSystem,
+ 'replacePermission'
+ ))) {
$config->userSystem->replacePermission('access CiviEvent', array('access CiviEvent', 'edit all events'));
}
$dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, NULL, FALSE, FALSE);
if ($dao->fetch()) {
if ($dao->CONSTRAINT_NAME == 'FK_civicrm_msg_template_pdf_format_id' ||
- $dao->CONSTRAINT_NAME == 'pdf_format_id') {
+ $dao->CONSTRAINT_NAME == 'pdf_format_id'
+ ) {
$sqlDropFK = "ALTER TABLE `civicrm_msg_template`
DROP FOREIGN KEY `{$dao->CONSTRAINT_NAME}`,
DROP KEY `{$dao->CONSTRAINT_NAME}`";
FROM {$tableName}")->getDatabaseResult()->fetchRow();
for ($startId = $minId; $startId <= $maxId; $startId += self::BATCH_SIZE) {
$endId = $startId + self::BATCH_SIZE - 1;
- $title = ts("Upgrade DB to 4.5.beta9: Fix line items for {$label} (%1 => %2)", array(1 => $startId, 2 => $endId));
+ $title = ts("Upgrade DB to 4.5.beta9: Fix line items for {$label} (%1 => %2)", array(
+ 1 => $startId,
+ 2 => $endId
+ ));
$this->addTask($title, 'task_4_5_0_fixLineItem', $startId, $endId, $label);
}
}
}
if ($oversizedEntries > 0) {
$preUpgradeMessage .= '<br/>' . ts("WARNING: There are %1 word-replacement entries which will not be valid in v4.4+ (eg with over 255 characters). They will be dropped during upgrade. For details, consult the CiviCRM log.", array(
- 1 => $oversizedEntries,
- ));
+ 1 => $oversizedEntries,
+ ));
}
}
}
WHERE ceft.entity_table = 'civicrm_contribution' AND cft.payment_instrument_id IS NULL;";
$dao = CRM_Core_DAO::executeQuery($query);
if ($dao->N) {
- $postUpgradeMessage .= '<br /><br /><strong>' . ts('Your database contains %1 financial transaction records with no payment instrument (Paid By is empty). If you use the Accounting Batches feature this may result in unbalanced transactions. If you do not use this feature, you can ignore the condition (although you will be required to select a Paid By value for new transactions). <a href="%2" target="_blank">You can review steps to correct transactions with missing payment instruments on the wiki.</a>', array(1 => $dao->N, 2 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Fixing+Transactions+Missing+a+Payment+Instrument+-+4.4.3+Upgrades')) . '</strong>';
+ $postUpgradeMessage .= '<br /><br /><strong>' . ts('Your database contains %1 financial transaction records with no payment instrument (Paid By is empty). If you use the Accounting Batches feature this may result in unbalanced transactions. If you do not use this feature, you can ignore the condition (although you will be required to select a Paid By value for new transactions). <a href="%2" target="_blank">You can review steps to correct transactions with missing payment instruments on the wiki.</a>', array(
+ 1 => $dao->N,
+ 2 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Fixing+Transactions+Missing+a+Payment+Instrument+-+4.4.3+Upgrades'
+ )) . '</strong>';
}
}
if ($rev == '4.4.6') {
// For anyone who upgraded 4.4.6 release (eg 4.4.0=>4.4.6), the $newImageUrl incorrectly used backend URLs.
// For anyone who skipped 4.4.6 (eg 4.4.0=>4.4.7), the $newImageUrl correctly uses frontend URLs
self::setContactImageUrl($dao->id,
- CRM_Utils_System::url('civicrm/contact/imagefile', 'photo=' . $photo, TRUE, NULL, TRUE, TRUE));
+ CRM_Utils_System::url('civicrm/contact/imagefile', 'photo=' . $photo, TRUE, NULL, TRUE, TRUE));
}
else {
$failures[$dao->id] = $dao->image_url;
// add civicrm_report_instance.name
$sql = "SELECT count(*) FROM information_schema.columns "
- . "WHERE table_schema = database() AND table_name = 'civicrm_report_instance' AND COLUMN_NAME = 'name' ";
+ . "WHERE table_schema = database() AND table_name = 'civicrm_report_instance' AND COLUMN_NAME = 'name' ";
$res = CRM_Core_DAO::singleValueQuery($sql);
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)
*/
if ($count > 0) {
$error = ts("There is a data integrity issue with this CiviCRM database. It contains %1 contribution records which are linked to contact records that have been deleted. You will need to correct this manually before you can run the upgrade. Use the following MySQL query to identify the problem records: %2 These records will need to be deleted or linked to an existing contact record.", array(
- 1 => $count,
- 2 => '<em>SELECT ct.* FROM civicrm_contribution ct LEFT JOIN civicrm_contact c ON ct.contact_id = c.id WHERE c.id IS NULL;</em>',
- ));
+ 1 => $count,
+ 2 => '<em>SELECT ct.* FROM civicrm_contribution ct LEFT JOIN civicrm_contact c ON ct.contact_id = c.id WHERE c.id IS NULL;</em>',
+ ));
CRM_Core_Error::fatal($error);
return FALSE;
}
// note: error conditions are also checked in upgrade_4_2_beta2()
if (!defined('CIVICRM_SETTINGS_PATH')) {
$preUpgradeMessage .= '<br />' . ts('Could not determine path to civicrm.settings.php. Please manually locate it and add these lines at the bottom: <pre>%1</pre>', array(
- 1 => self::SETTINGS_SNIPPET,
- ));
+ 1 => self::SETTINGS_SNIPPET,
+ ));
}
elseif (preg_match(self::SETTINGS_SNIPPET_PATTERN, file_get_contents(CIVICRM_SETTINGS_PATH))) {
// OK, nothing to do
}
elseif (!is_writable(CIVICRM_SETTINGS_PATH)) {
$preUpgradeMessage .= '<br />' . ts('The settings file (%1) must be updated. Please make it writable or manually add these lines:<pre>%2</pre>', array(
- 1 => CIVICRM_SETTINGS_PATH,
- 2 => self::SETTINGS_SNIPPET,
- ));
+ 1 => CIVICRM_SETTINGS_PATH,
+ 2 => self::SETTINGS_SNIPPET,
+ ));
}
}
if ($rev == '4.2.2' && version_compare($currentVer, '3.3.alpha1') >= 0) {
$config = CRM_Core_Config::singleton();
if (!empty($config->extensionsDir)) {
$postUpgradeMessage .= '<br />' . ts('Please <a href="%1" target="_blank">configure the Extension Resource URL</a>.', array(
- 1 => CRM_Utils_System::url('civicrm/admin/setting/url', 'reset=1'),
- ));
+ 1 => CRM_Utils_System::url('civicrm/admin/setting/url', 'reset=1'),
+ ));
}
}
if ($rev == '4.2.7') {
//drop foreign key queries of CRM-9850
$params = array();
$tables = array(
- 'civicrm_contribution_page' => 'FK_civicrm_contribution_page_payment_processor_id',
- 'civicrm_event' => 'FK_civicrm_event_payment_processor_id',
- 'civicrm_group' => 'FK_civicrm_group_saved_search_id',
- );
+ 'civicrm_contribution_page' => 'FK_civicrm_contribution_page_payment_processor_id',
+ 'civicrm_event' => 'FK_civicrm_event_payment_processor_id',
+ 'civicrm_group' => 'FK_civicrm_group_saved_search_id',
+ );
foreach ($tables as $tableName => $fKey) {
$foreignKeyExists = CRM_Core_DAO::checkConstraintExists($tableName, $fKey);
if ($foreignKeyExists) {
public static function task_4_2_alpha1_createPriceSets(CRM_Queue_TaskContext $ctx, $rev) {
$upgrade = new CRM_Upgrade_Form();
$daoName = array(
- 'civicrm_contribution_page' => array(
- 'CRM_Contribute_BAO_ContributionPage',
- CRM_Core_Component::getComponentID('CiviContribute'),
- ),
- 'civicrm_event' => array(
- 'CRM_Event_BAO_Event',
- CRM_Core_Component::getComponentID('CiviEvent'),
- ),
- );
+ 'civicrm_contribution_page' => array(
+ 'CRM_Contribute_BAO_ContributionPage',
+ CRM_Core_Component::getComponentID('CiviContribute'),
+ ),
+ 'civicrm_event' => array(
+ 'CRM_Event_BAO_Event',
+ CRM_Core_Component::getComponentID('CiviEvent'),
+ ),
+ );
// get all option group used for event and contribution page
$query = "
while ($dao->fetch()) {
$addTo[2] = $dao->contribution_page_id;
$options = array(
- 'otherAmount' => $dao->is_allow_other_amount,
- 'membership' => $dao->membership_block_id);
+ 'otherAmount' => $dao->is_allow_other_amount,
+ 'membership' => $dao->membership_block_id
+ );
self::createPriceSet($daoName, $addTo, $options);
}
*/
public static function createPriceSet($daoName, $addTo, $options = array()) {
$query = "SELECT title FROM {$addTo[0]} where id =%1";
- $setParams['title'] = CRM_Core_DAO::singleValueQuery($query,
+ $setParams['title'] = CRM_Core_DAO::singleValueQuery($query,
array(1 => array($addTo[2], 'Integer'))
);
$pageTitle = strtolower(CRM_Utils_String::munge($setParams['title'], '_', 245));
return;
}
- if (! CRM_Core_DAO::getFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_BAO_Set', $pageTitle, 'id', 'name', TRUE)) {
+ if (!CRM_Core_DAO::getFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_BAO_Set', $pageTitle, 'id', 'name', TRUE)) {
$setParams['name'] = $pageTitle;
}
else {
}
if (!empty($options['membership'])) {
- $dao = new CRM_Member_DAO_MembershipBlock();
+ $dao = new CRM_Member_DAO_MembershipBlock();
$dao->entity_table = 'civicrm_contribution_page';
- $dao->entity_id = $addTo[2];
+ $dao->entity_id = $addTo[2];
if ($dao->find(TRUE)) {
if ($dao->membership_types) {
$fieldParams = array(
- 'name' => strtolower(CRM_Utils_String::munge("Membership Amount", '_', 245)),
- 'label' => "Membership Amount",
- 'is_required' => $dao->is_required,
+ 'name' => strtolower(CRM_Utils_String::munge("Membership Amount", '_', 245)),
+ 'label' => "Membership Amount",
+ 'is_required' => $dao->is_required,
'is_display_amounts' => $dao->display_min_fee,
- 'is_active' => $dao->is_active,
- 'price_set_id' => $priceSet->id,
- 'html_type' => 'Radio',
- 'weight' => 1,
+ 'is_active' => $dao->is_active,
+ 'price_set_id' => $priceSet->id,
+ 'html_type' => 'Radio',
+ 'weight' => 1,
);
$membershipTypes = unserialize($dao->membership_types);
$rowcount = 0;
foreach ($membershipTypes as $membershipType => $autoRenew) {
$membershipTypeDetail = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($membershipType);
$rowcount++;
- $fieldParams['option_label'][$rowcount] = $membershipTypeDetail['name'];
+ $fieldParams['option_label'][$rowcount] = $membershipTypeDetail['name'];
$fieldParams['option_amount'][$rowcount] = $membershipTypeDetail['minimum_fee'];
$fieldParams['option_weight'][$rowcount] = $rowcount;
$fieldParams['membership_type_id'][$rowcount] = $membershipType;
$priceField = CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field::create($fieldParams);
$setParams = array(
- 'id' => $priceSet->id,
- 'extends' => CRM_Core_Component::getComponentID('CiviMember'),
+ 'id' => $priceSet->id,
+ 'extends' => CRM_Core_Component::getComponentID('CiviMember'),
'contribution_type_id' => CRM_Core_DAO::getFieldValue($daoName[$addTo[0]][0], $addTo[2], 'contribution_type_id'),
);
CRM_Upgrade_Snapshot_V4p2_Price_BAO_Set::create($setParams);
if (!empty($options['otherAmount'])) {
$fieldParams = array(
- 'name' => strtolower(CRM_Utils_String::munge("Other Amount", '_', 245)),
- 'label' => "Other Amount",
- 'is_required' => 0,
+ 'name' => strtolower(CRM_Utils_String::munge("Other Amount", '_', 245)),
+ 'label' => "Other Amount",
+ 'is_required' => 0,
'is_display_amounts' => 0,
- 'is_active' => 1,
- 'price_set_id' => $priceSet->id,
- 'html_type' => 'Text',
- 'weight' => 3,
+ 'is_active' => 1,
+ 'price_set_id' => $priceSet->id,
+ 'html_type' => 'Text',
+ 'weight' => 3,
);
- $fieldParams['option_label'][1] = "Other Amount";
+ $fieldParams['option_label'][1] = "Other Amount";
$fieldParams['option_amount'][1] = 1;
$fieldParams['option_weight'][1] = 1;
$priceField = CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field::create($fieldParams);
$params = array(
'1' => array($result->price_set_id, 'Integer'),
'2' => array('membership_amount', 'String'),
- '3' => array(CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $result->membership_id, 'membership_type_id'), 'Integer'),
+ '3' => array(
+ CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $result->membership_id, 'membership_type_id'),
+ 'Integer'
+ ),
);
$res = CRM_Core_DAO::executeQuery($sql, $params);
if ($res->fetch()) {
FROM civicrm_uf_join
WHERE entity_id = {$events->id} AND module = 'CiviEvent'
ORDER BY weight DESC LIMIT 1";
- $weights = CRM_Core_DAO::executeQuery($sql);
+ $weights = CRM_Core_DAO::executeQuery($sql);
$weights->fetch();
if (isset($weights->weight)) {
$nextMainWeight += $weights->weight;
LEFT JOIN $tempTableName2 temp2 ON temp1.payment_id = temp2.payment_id";
$dao = CRM_Core_DAO::executeQuery($sql);
if ($dao->N) {
- $membershipType = CRM_Member_PseudoConstant::membershipType();
+ $membershipType = CRM_Member_PseudoConstant::membershipType();
$membershipStatus = CRM_Member_PseudoConstant::membershipStatus();
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
while ($dao->fetch()) {
- $status = $dao->retain_id ? 'Retained' : 'Un-linked';
- $memType = CRM_Utils_Array::value($dao->membership_type_id, $membershipType);
- $memStatus = CRM_Utils_Array::value($dao->status_id, $membershipStatus);
- $contribStatus = CRM_Utils_Array::value($dao->contribution_status_id, $contributionStatus);
- $processedRecords[] = array($dao->contact_id, $dao->contribution_id, $contribStatus, $dao->membership_id,
- $memType, $dao->start_date, $dao->end_date, $memStatus, $status);
+ $status = $dao->retain_id ? 'Retained' : 'Un-linked';
+ $memType = CRM_Utils_Array::value($dao->membership_type_id, $membershipType);
+ $memStatus = CRM_Utils_Array::value($dao->status_id, $membershipStatus);
+ $contribStatus = CRM_Utils_Array::value($dao->contribution_status_id, $contributionStatus);
+ $processedRecords[] = array(
+ $dao->contact_id,
+ $dao->contribution_id,
+ $contribStatus,
+ $dao->membership_id,
+ $memType,
+ $dao->start_date,
+ $dao->end_date,
+ $memStatus,
+ $status
+ );
}
}
*/
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');
+ $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'
+ );
$instances = CRM_Core_DAO::executeQuery("SELECT id, form_values, report_id FROM civicrm_report_instance WHERE report_id IN ('" . implode("','", $modifiedReportIds) . "')");
}
// save updated instance criteria
- $dao = new CRM_Report_DAO_ReportInstance();
- $dao->id = $instances->id;
+ $dao = new CRM_Report_DAO_ReportInstance();
+ $dao->id = $instances->id;
$dao->form_values = serialize($formValues);
$dao->save();
$dao->free();
// CRM-8147, update group_type for uf groups, check and add component field types
$ufGroups = new CRM_Core_DAO_UFGroup();
$ufGroups->find();
- $skipGroupTypes = array('Individual,Contact', 'Organization,Contact', 'Household,Contact', 'Contact', 'Individual', 'Organization', 'Household');
+ $skipGroupTypes = array(
+ 'Individual,Contact',
+ 'Organization,Contact',
+ 'Household,Contact',
+ 'Contact',
+ 'Individual',
+ 'Organization',
+ 'Household'
+ );
while ($ufGroups->fetch()) {
if (!in_array($ufGroups->group_type, $skipGroupTypes)) {
$groupTypes = CRM_Core_BAO_UFGroup::calculateGroupType($ufGroups->id, TRUE);
}
// save updated instance criteria
- $dao = new CRM_Report_DAO_ReportInstance();
- $dao->id = $instances->id;
+ $dao = new CRM_Report_DAO_ReportInstance();
+ $dao->id = $instances->id;
$dao->form_values = serialize($formValues);
$dao->save();
$dao->free();
switch ($instances->report_id) {
case 'event/summary':
- $eventDates = array('event_start_date_from', 'event_start_date_to', 'event_end_date_from', 'event_end_date_to');
+ $eventDates = array(
+ 'event_start_date_from',
+ 'event_start_date_to',
+ 'event_end_date_from',
+ 'event_end_date_to'
+ );
foreach ($eventDates as $date) {
if (isset($formValues[$date]) && $formValues[$date] == ' ') {
$formValues[$date] = '';
}
// save updated instance criteria
- $dao = new CRM_Report_DAO_ReportInstance();
- $dao->id = $instances->id;
+ $dao = new CRM_Report_DAO_ReportInstance();
+ $dao->id = $instances->id;
$dao->form_values = serialize($formValues);
$dao->save();
$dao->free();
AND g.name = %1
AND g.is_active = 1
AND v.name = %2", array(
- 1 => array('activity_type', 'String'),
- 2 => array('Bulk Email', 'String'),
- ));
+ 1 => array('activity_type', 'String'),
+ 2 => array('Bulk Email', 'String'),
+ ));
// CRM-8852, reset contact field cache
CRM_Core_BAO_Cache::deleteGroup('contact fields');
(1, 'OnBehalf', 'civicrm_contribution_page', %1, 1, %2)";
$params = array(
- 1 => array($pages->id, 'Integer'),
+ 1 => array($pages->id, 'Integer'),
2 => array($onBehalfProfileId, 'Integer'),
);
CRM_Core_DAO::executeQuery($query, $params);
$name = CRM_Utils_String::munge($customField->label, '_', 64);
$fldCnt = CRM_Core_DAO::singleValueQuery($customFldCntQuery,
array(
- 1 => array($name, 'String'),
+ 1 => array($name, 'String'),
2 => array($customField->id, 'Integer'),
), TRUE, FALSE
);
WHERE id = %2
";
$customFieldParams = array(
- 1 => array($name, 'String'),
+ 1 => array($name, 'String'),
2 => array($customField->id, 'Integer'),
);
CRM_Core_DAO::executeQuery($customFieldQuery, $customFieldParams, TRUE, NULL, FALSE, FALSE);
$name = CRM_Utils_String::munge($customGroup->title, '_', 64);
$grpCnt = CRM_Core_DAO::singleValueQuery($customGrpCntQuery,
array(
- 1 => array($name, 'String'),
+ 1 => array($name, 'String'),
2 => array($customGroup->id, 'Integer'),
)
);
$name = CRM_Utils_String::munge($ufGroup->title, '_', 64);
$ufGrpCnt = CRM_Core_DAO::singleValueQuery($ufGrpCntQuery,
array(
- 1 => array($name, 'String'),
+ 1 => array($name, 'String'),
2 => array($ufGroup->id, 'Integer'),
)
);
// Used query to avoid line by line update.
if ($labelFound || $priceFound) {
$lineItemParams = array(
- 1 => array($fieldValueDAO->id, 'Integer'),
+ 1 => array($fieldValueDAO->id, 'Integer'),
2 => array($opValueDAO->label, 'String'),
);
$updateLineItems = "UPDATE civicrm_line_item SET price_field_value_id = %1 WHERE label = %2";
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');
- $mainLineItem = new CRM_Price_BAO_LineItem();
+ $fields = array('entity_table', 'entity_id', 'price_field_id', 'price_field_value_id');
+ $mainLineItem = new CRM_Price_BAO_LineItem();
$mainLineItem->find(TRUE);
while ($mainLineItem->fetch()) {
$dupeLineItem = new CRM_Price_BAO_LineItem();
if (CRM_Mailing_Info::workflowEnabled()) {
$config = CRM_Core_Config::singleton();
if (is_callable(array(
- $config->userSystem, 'replacePermission'))) {
- $config->userSystem->replacePermission('access CiviMail', array('access CiviMail', 'create mailings', 'approve mailings', 'schedule mailings'));
+ $config->userSystem,
+ 'replacePermission'
+ ))) {
+ $config->userSystem->replacePermission('access CiviMail', array(
+ 'access CiviMail',
+ 'create mailings',
+ 'approve mailings',
+ 'schedule mailings'
+ ));
}
}
$config = CRM_Core_Config::singleton();
if ($config->userSystem->is_drupal) {
- $config->userSystem->replacePermission('access CiviCase', array('access my cases and activities', 'access all cases and activities', 'administer CiviCase'));
+ $config->userSystem->replacePermission('access CiviCase', array(
+ 'access my cases and activities',
+ 'access all cases and activities',
+ 'administer CiviCase'
+ ));
//insert core acls.
$casePermissions = array(
$locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales);
// optimal: an English locale
foreach (array(
- 'en_US', 'en_GB', 'en_AU') as $loc) {
+ 'en_US',
+ 'en_GB',
+ 'en_AU'
+ ) as $loc) {
if (in_array($loc, $locales)) {
$seedLocale = $loc;
break;
/**
* Class CRM_Upgrade_Page_Cleanup
*/
-class CRM_Upgrade_Page_Cleanup extends CRM_Core_Page {
+class CRM_Upgrade_Page_Cleanup extends CRM_Core_Page {
public function cleanup425() {
- $rows = CRM_Upgrade_Incremental_php_FourTwo::deleteInvalidPairs();
+ $rows = CRM_Upgrade_Incremental_php_FourTwo::deleteInvalidPairs();
$template = CRM_Core_Smarty::singleton();
- $columnHeaders = array("Contact ID", "ContributionID", "Contribution Status", "MembershipID",
- "Membership Type", "Start Date", "End Date", "Membership Status", "Action");
+ $columnHeaders = array(
+ "Contact ID",
+ "ContributionID",
+ "Contribution Status",
+ "MembershipID",
+ "Membership Type",
+ "Start Date",
+ "End Date",
+ "Membership Status",
+ "Action"
+ );
$template->assign('columnHeaders', $columnHeaders);
$template->assign('rows', $rows);
$template->assign('preMessage', $preMessage);
$postMessage = ts('You can <a href="%1">click here</a> to try running the 4.2 upgrade script again. <a href="%2" target="_blank">(Review upgrade documentation)</a>',
- array(
- 1 => CRM_Utils_System::url('civicrm/upgrade', 'reset=1'),
- 2 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Installation+and+Upgrades'));
+ array(
+ 1 => CRM_Utils_System::url('civicrm/upgrade', 'reset=1'),
+ 2 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Installation+and+Upgrades'
+ ));
$template->assign('postMessage', $postMessage);
$content = $template->fetch('CRM/common/upgradeCleanup.tpl');
'pathPrefix' => 'civicrm/upgrade/queue',
'onEndUrl' => CRM_Utils_System::url('civicrm/upgrade', 'action=finish', FALSE, NULL, FALSE),
'buttons' => array('retry' => $config->debug, 'skip' => $config->debug),
- ));
+ ));
$queueRunner->runAllViaWeb();
CRM_Core_Error::fatal(ts('Upgrade failed to redirect'));
}
for ($index = 1; $index <= $maxIndex; $index++) {
if (array_key_exists('option_amount', $params) &&
- array_key_exists($index, $params['option_amount']) &&
- (CRM_Utils_Array::value($index, CRM_Utils_Array::value('option_label', $params)) || !empty($params['is_quick_config'])) &&
- !CRM_Utils_System::isNull($params['option_amount'][$index])
- ) {
+ array_key_exists($index, $params['option_amount']) &&
+ (CRM_Utils_Array::value($index, CRM_Utils_Array::value('option_label', $params)) || !empty($params['is_quick_config'])) &&
+ !CRM_Utils_System::isNull($params['option_amount'][$index])
+ ) {
$options = array(
'price_field_id' => $priceField->id,
'label' => trim($params['option_label'][$index]),
switch ($field->html_type) {
case 'Text':
$optionKey = key($customOption);
- $count = CRM_Utils_Array::value('count', $customOption[$optionKey], '');
+ $count = CRM_Utils_Array::value('count', $customOption[$optionKey], '');
$max_value = CRM_Utils_Array::value('max_value', $customOption[$optionKey], '');
- $priceVal = implode($seperator, array($customOption[$optionKey][$valueFieldName], $count, $max_value));
+ $priceVal = implode($seperator, array($customOption[$optionKey][$valueFieldName], $count, $max_value));
$extra = array();
if (property_exists($qf, '_quickConfig') && $qf->_quickConfig && property_exists($qf, '_contributionAmount') && $qf->_contributionAmount) {
$element = &$qf->add('text', $elementName, $label,
array_merge($extra,
array(
- 'price' => json_encode(array($optionKey, $priceVal)),
+ 'price' => json_encode(array($optionKey, $priceVal)),
'size' => '4',
)
),
$opt['label'] = !empty($opt['label']) ? $opt['label'] . ' - ' : '';
$opt['label'] .= CRM_Utils_Money::format($opt[$valueFieldName]);
}
- $count = CRM_Utils_Array::value('count', $opt, '');
+ $count = CRM_Utils_Array::value('count', $opt, '');
$max_value = CRM_Utils_Array::value('max_value', $opt, '');
- $priceVal = implode($seperator, array($opt[$valueFieldName], $count, $max_value));
+ $priceVal = implode($seperator, array($opt[$valueFieldName], $count, $max_value));
$extra = array(
- 'price' => json_encode(array($elementName, $priceVal)),
- 'data-amount' => $opt[$valueFieldName],
- 'data-currency' => $currencyName,
- );
+ 'price' => json_encode(array($elementName, $priceVal)),
+ 'data-amount' => $opt[$valueFieldName],
+ 'data-currency' => $currencyName,
+ );
if (property_exists($qf, '_quickConfig') && $qf->_quickConfig && $field->name == 'contribution_amount') {
$extra += array('onclick' => 'clearAmountOther();');
}
elseif (property_exists($qf, '_quickConfig') && $qf->_quickConfig && $field->name == 'membership_amount') {
$extra += array(
- 'onclick' => "return showHideAutoRenew({$opt['membership_type_id']});",
- 'membership-type' => $opt['membership_type_id'],
- );
+ 'onclick' => "return showHideAutoRenew({$opt['membership_type_id']});",
+ 'membership-type' => $opt['membership_type_id'],
+ );
$qf->assign('membershipFieldID', $field->id);
}
$choice[$opId] = $qf->createElement('radio', NULL, '', $opt['label'], $opt['id'], $extra);
}
$element = &$qf->add('select', $elementName, $label,
array(
- '' => ts('- select -')) + $selectOption,
+ '' => ts('- select -')
+ ) + $selectOption,
$useRequired && $field->is_required,
array('price' => json_encode($priceVal))
);
$check = array();
foreach ($customOption as $opId => $opt) {
- $count = CRM_Utils_Array::value('count', $opt, '');
+ $count = CRM_Utils_Array::value('count', $opt, '');
$max_value = CRM_Utils_Array::value('max_value', $opt, '');
- $priceVal = implode($seperator, array($opt[$valueFieldName], $count, $max_value));
+ $priceVal = implode($seperator, array($opt[$valueFieldName], $count, $max_value));
if ($field->is_display_amounts) {
$opt['label'] .= ' - ';
}
$check[$opId] = &$qf->createElement('checkbox', $opt['id'], NULL, $opt['label'],
array(
- 'price' => json_encode(array($opt['id'], $priceVal)),
+ 'price' => json_encode(array($opt['id'], $priceVal)),
'data-amount' => $opt[$valueFieldName],
'data-currency' => $currencyName,
)
AND option_group.id = option_value.option_group_id
AND option_value.label = %2";
- $dao = CRM_Core_DAO::executeQuery($query, array(1 => array($optionGroupName, 'String'), 2 => array($optionLabel, 'String')));
+ $dao = CRM_Core_DAO::executeQuery($query, array(
+ 1 => array($optionGroupName, 'String'),
+ 2 => array($optionLabel, 'String')
+ ));
while ($dao->fetch()) {
return $dao->id;
* to the price set used for particular event
* @param array $values
* Reference to the values array(.
- this is
+ * this is
* lineItem array)
*
* @return void
* @return mixed
*/
public static function removeFrom($entityTable, $entityId) {
- $dao = new CRM_Upgrade_Snapshot_V4p2_Price_DAO_SetEntity();
+ $dao = new CRM_Upgrade_Snapshot_V4p2_Price_DAO_SetEntity();
$dao->entity_table = $entityTable;
- $dao->entity_id = $entityId;
+ $dao->entity_id = $entityId;
return $dao->delete();
}
$sql .= " AND ps.is_quick_config = 0 ";
}
$params = array(
- 1 => array($entityTable, 'String'),
+ 1 => array($entityTable, 'String'),
2 => array($entityId, 'Integer'),
);
if ($usedFor) {
$select = 'SELECT ' . implode(',', $priceFields);
$from = ' FROM civicrm_price_field';
- $params = array();
+ $params = array();
$params[1] = array($setID, 'Integer');
- $where = '
+ $where = '
WHERE price_set_id = %1
AND is_active = 1
';
$params['amount_priceset_level_radio'][$optionValueId] = $optionLabel;
if (isset($radioLevel)) {
$radioLevel = array_merge($radioLevel,
- array_keys($params['amount_priceset_level_radio'])
+ array_keys($params['amount_priceset_level_radio'])
);
}
else {
$params['amount_priceset_level_checkbox']["{$field['options'][$optionId]['id']}"] = $optionLabel;
if (isset($checkboxLevel)) {
$checkboxLevel = array_unique(array_merge(
- $checkboxLevel,
- array_keys($params['amount_priceset_level_checkbox'])
- )
+ $checkboxLevel,
+ array_keys($params['amount_priceset_level_checkbox'])
+ )
);
}
else {
$validFieldsOnly = TRUE;
$className = CRM_Utils_System::getClassName($form);
if (in_array($className, array(
- 'CRM_Contribute_Form_Contribution', 'CRM_Member_Form_Membership'))) {
+ 'CRM_Contribute_Form_Contribution',
+ 'CRM_Member_Form_Membership'
+ ))) {
$validFieldsOnly = FALSE;
}
- $priceSet = self::getSetDetail($priceSetId, TRUE, $validFieldsOnly);
- $form->_priceSet = CRM_Utils_Array::value($priceSetId, $priceSet);
+ $priceSet = self::getSetDetail($priceSetId, TRUE, $validFieldsOnly);
+ $form->_priceSet = CRM_Utils_Array::value($priceSetId, $priceSet);
$form->_quickConfig = $quickConfig = 0;
if (CRM_Core_DAO::getFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set', $priceSetId, 'is_quick_config')) {
$quickConfig = 1;
foreach ($feeBlock as $field) {
if (CRM_Utils_Array::value('visibility', $field) == 'public' ||
-!$validFieldsOnly
-) {
+ !$validFieldsOnly
+ ) {
$options = CRM_Utils_Array::value('options', $field);
if ($className == 'CRM_Contribute_Form_Contribution_Main' && $component = 'membership') {
$checklifetime = self::checkCurrentMembership($options, $userid);
continue;
}
CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field::addQuickFormElement($form,
- 'price_' . $field['id'],
- $field['id'],
- FALSE,
- CRM_Utils_Array::value('is_required', $field, FALSE),
- NULL,
- $options
+ 'price_' . $field['id'],
+ $field['id'],
+ FALSE,
+ CRM_Utils_Array::value('is_required', $field, FALSE),
+ NULL,
+ $options
);
}
}
$title = ts('[Copy id %1]', array(1 => $maxId + 1));
$fieldsFix = array(
- 'suffix' => array(
- 'title' => ' ' . $title,
- 'name' => '__Copy_id_' . ($maxId + 1) . '_',
- ),
+ 'suffix' => array(
+ 'title' => ' ' . $title,
+ 'name' => '__Copy_id_' . ($maxId + 1) . '_',
+ ),
);
$copy = &CRM_Core_DAO::copyGeneric('CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set',
- array('id' => $id),
- NULL,
- $fieldsFix
+ array('id' => $id),
+ NULL,
+ $fieldsFix
);
//copying all the blocks pertaining to the price set
$copyPriceField = &CRM_Core_DAO::copyGeneric('CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field',
- array('price_set_id' => $id),
- array('price_set_id' => $copy->id)
+ array('price_set_id' => $id),
+ array('price_set_id' => $copy->id)
);
if (!empty($copyPriceField)) {
$price = array_combine(self::getFieldIds($id), self::getFieldIds($copy->id));
//copy option group and values
foreach ($price as $originalId => $copyId) {
CRM_Core_DAO::copyGeneric('CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue',
- array('price_field_id' => $originalId),
- array('price_field_id' => $copyId)
+ array('price_field_id' => $originalId),
+ array('price_field_id' => $copyId)
);
}
}
*/
function checkPermission($sid) {
if ($sid &&
-self::eventPriceSetDomainID()
-) {
+ self::eventPriceSetDomainID()
+ ) {
$domain_id = CRM_Core_DAO::getFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set', $sid, 'domain_id', 'id');
if (CRM_Core_Config::domainID() != $domain_id) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
$params = array(1 => array($priceSetId, 'Integer'));
- $dao = CRM_Core_DAO::executeQuery($query, $params);
+ $dao = CRM_Core_DAO::executeQuery($query, $params);
$autoRenewOption = 2;
- $interval = $unit = array();
+ $interval = $unit = array();
while ($dao->fetch()) {
if (!$dao->auto_renew) {
$autoRenewOption = 0;
*/
public static function eventPriceSetDomainID() {
return CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME,
- 'event_price_set_domain_id',
- NULL, FALSE
- );
+ 'event_price_set_domain_id',
+ NULL, FALSE
+ );
}
/**
/**
* Class CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field
*/
-class CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field extends CRM_Core_DAO
-{
- /**
- * static instance to hold the table name
- *
- * @var string
- * @static
- */
- static $_tableName = 'civicrm_price_field';
- /**
- * static instance to hold the field values
- *
- * @var array
- * @static
- */
- static $_fields = null;
- /**
- * static instance to hold the FK relationships
- *
- * @var string
- * @static
- */
- static $_links = null;
- /**
- * static instance to hold the values that can
- * be imported
- *
- * @var array
- * @static
- */
- static $_import = null;
- /**
- * static instance to hold the values that can
- * be exported
- *
- * @var array
- * @static
- */
- static $_export = null;
- /**
- * static value to see if we should log any modifications to
- * this table in the civicrm_log table
- *
- * @var boolean
- * @static
- */
- static $_log = true;
- /**
- * Price Field
- *
- * @var int unsigned
- */
- public $id;
- /**
- * FK to civicrm_price_set
- *
- * @var int unsigned
- */
- public $price_set_id;
- /**
- * Variable name/programmatic handle for this field.
- *
- * @var string
- */
- public $name;
- /**
- * Text for form field label (also friendly name for administering this field).
- *
- * @var string
- */
- public $label;
- /**
- *
- * @var enum('Text', 'Select', 'Radio', 'CheckBox')
- */
- public $html_type;
- /**
- * Enter a quantity for this field?
- *
- * @var boolean
- */
- public $is_enter_qty;
- /**
- * Description and/or help text to display before this field.
- *
- * @var text
- */
- public $help_pre;
- /**
- * Description and/or help text to display after this field.
- *
- * @var text
- */
- public $help_post;
- /**
- * Order in which the fields should appear
- *
- * @var int
- */
- public $weight;
- /**
- * Should the price be displayed next to the label for each option?
- *
- * @var boolean
- */
- public $is_display_amounts;
- /**
- * number of options per line for checkbox and radio
- *
- * @var int unsigned
- */
- public $options_per_line;
- /**
- * Is this price field active
- *
- * @var boolean
- */
- public $is_active;
- /**
- * Is this price field required (value must be > 1)
- *
- * @var boolean
- */
- public $is_required;
- /**
- * If non-zero, do not show this field before the date specified
- *
- * @var datetime
- */
- public $active_on;
- /**
- * If non-zero, do not show this field after the date specified
- *
- * @var datetime
- */
- public $expire_on;
- /**
- * Optional scripting attributes for field
- *
- * @var string
- */
- public $javascript;
- /**
- * Implicit FK to civicrm_option_group with name = \'visibility\'
- *
- * @var int unsigned
- */
- public $visibility_id;
+class CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field extends CRM_Core_DAO {
+ /**
+ * static instance to hold the table name
+ *
+ * @var string
+ * @static
+ */
+ static $_tableName = 'civicrm_price_field';
+ /**
+ * static instance to hold the field values
+ *
+ * @var array
+ * @static
+ */
+ static $_fields = NULL;
+ /**
+ * static instance to hold the FK relationships
+ *
+ * @var string
+ * @static
+ */
+ static $_links = NULL;
+ /**
+ * static instance to hold the values that can
+ * be imported
+ *
+ * @var array
+ * @static
+ */
+ static $_import = NULL;
+ /**
+ * static instance to hold the values that can
+ * be exported
+ *
+ * @var array
+ * @static
+ */
+ static $_export = NULL;
+ /**
+ * static value to see if we should log any modifications to
+ * this table in the civicrm_log table
+ *
+ * @var boolean
+ * @static
+ */
+ static $_log = TRUE;
+ /**
+ * Price Field
+ *
+ * @var int unsigned
+ */
+ public $id;
+ /**
+ * FK to civicrm_price_set
+ *
+ * @var int unsigned
+ */
+ public $price_set_id;
+ /**
+ * Variable name/programmatic handle for this field.
+ *
+ * @var string
+ */
+ public $name;
+ /**
+ * Text for form field label (also friendly name for administering this field).
+ *
+ * @var string
+ */
+ public $label;
+ /**
+ *
+ * @var enum('Text', 'Select', 'Radio', 'CheckBox')
+ */
+ public $html_type;
+ /**
+ * Enter a quantity for this field?
+ *
+ * @var boolean
+ */
+ public $is_enter_qty;
+ /**
+ * Description and/or help text to display before this field.
+ *
+ * @var text
+ */
+ public $help_pre;
+ /**
+ * Description and/or help text to display after this field.
+ *
+ * @var text
+ */
+ public $help_post;
+ /**
+ * Order in which the fields should appear
+ *
+ * @var int
+ */
+ public $weight;
+ /**
+ * Should the price be displayed next to the label for each option?
+ *
+ * @var boolean
+ */
+ public $is_display_amounts;
+ /**
+ * number of options per line for checkbox and radio
+ *
+ * @var int unsigned
+ */
+ public $options_per_line;
+ /**
+ * Is this price field active
+ *
+ * @var boolean
+ */
+ public $is_active;
+ /**
+ * Is this price field required (value must be > 1)
+ *
+ * @var boolean
+ */
+ public $is_required;
+ /**
+ * If non-zero, do not show this field before the date specified
+ *
+ * @var datetime
+ */
+ public $active_on;
+ /**
+ * If non-zero, do not show this field after the date specified
+ *
+ * @var datetime
+ */
+ public $expire_on;
+ /**
+ * Optional scripting attributes for field
+ *
+ * @var string
+ */
+ public $javascript;
+ /**
+ * Implicit FK to civicrm_option_group with name = \'visibility\'
+ *
+ * @var int unsigned
+ */
+ public $visibility_id;
/**
* Class constructor
*
* @return \CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field
*/
- public function __construct()
- {
- $this->__table = 'civicrm_price_field';
- parent::__construct();
- }
- /**
- * return foreign links
- *
- * @return array
- */
- public function links()
- {
- if (!(self::$_links)) {
- self::$_links = array(
- 'price_set_id' => 'civicrm_price_set:id',
- );
- }
- return self::$_links;
- }
- /**
- * returns all the column names of this table
- *
- * @return array
- */
- static function &fields()
- {
- if (!(self::$_fields)) {
- self::$_fields = array(
- 'id' => array(
- 'name' => 'id',
- 'type' => CRM_Utils_Type::T_INT,
- 'required' => true,
- ) ,
- 'price_set_id' => array(
- 'name' => 'price_set_id',
- 'type' => CRM_Utils_Type::T_INT,
- 'required' => true,
- 'FKClassName' => 'Snapshot_v4p2_Price_DAO_Set',
- ) ,
- 'name' => array(
- 'name' => 'name',
- 'type' => CRM_Utils_Type::T_STRING,
- 'title' => ts('Name') ,
- 'required' => true,
- 'maxlength' => 255,
- 'size' => CRM_Utils_Type::HUGE,
- ) ,
- 'label' => array(
- 'name' => 'label',
- 'type' => CRM_Utils_Type::T_STRING,
- 'title' => ts('Label') ,
- 'required' => true,
- 'maxlength' => 255,
- 'size' => CRM_Utils_Type::HUGE,
- ) ,
- 'html_type' => array(
- 'name' => 'html_type',
- 'type' => CRM_Utils_Type::T_ENUM,
- 'title' => ts('Html Type') ,
- 'required' => true,
- 'enumValues' => 'Text, Select, Radio, CheckBox',
- ) ,
- 'is_enter_qty' => array(
- 'name' => 'is_enter_qty',
- 'type' => CRM_Utils_Type::T_BOOLEAN,
- ) ,
- 'help_pre' => array(
- 'name' => 'help_pre',
- 'type' => CRM_Utils_Type::T_TEXT,
- 'title' => ts('Help Pre') ,
- 'rows' => 4,
- 'cols' => 80,
- ) ,
- 'help_post' => array(
- 'name' => 'help_post',
- 'type' => CRM_Utils_Type::T_TEXT,
- 'title' => ts('Help Post') ,
- 'rows' => 4,
- 'cols' => 80,
- ) ,
- 'weight' => array(
- 'name' => 'weight',
- 'type' => CRM_Utils_Type::T_INT,
- 'title' => ts('Weight') ,
- 'default' => '',
- ) ,
- 'is_display_amounts' => array(
- 'name' => 'is_display_amounts',
- 'type' => CRM_Utils_Type::T_BOOLEAN,
- 'default' => '',
- ) ,
- 'options_per_line' => array(
- 'name' => 'options_per_line',
- 'type' => CRM_Utils_Type::T_INT,
- 'title' => ts('Options Per Line') ,
- 'default' => '',
- ) ,
- 'is_active' => array(
- 'name' => 'is_active',
- 'type' => CRM_Utils_Type::T_BOOLEAN,
- 'default' => '',
- ) ,
- 'is_required' => array(
- 'name' => 'is_required',
- 'type' => CRM_Utils_Type::T_BOOLEAN,
- 'default' => '',
- ) ,
- 'active_on' => array(
- 'name' => 'active_on',
- 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
- 'title' => ts('Active On') ,
- 'default' => 'UL',
- ) ,
- 'expire_on' => array(
- 'name' => 'expire_on',
- 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
- 'title' => ts('Expire On') ,
- 'default' => 'UL',
- ) ,
- 'javascript' => array(
- 'name' => 'javascript',
- 'type' => CRM_Utils_Type::T_STRING,
- 'title' => ts('Javascript') ,
- 'maxlength' => 255,
- 'size' => CRM_Utils_Type::HUGE,
- ) ,
- 'visibility_id' => array(
- 'name' => 'visibility_id',
- 'type' => CRM_Utils_Type::T_INT,
- 'default' => '',
- ) ,
- );
- }
- return self::$_fields;
- }
- /**
- * returns the names of this table
- *
- * @static
- * @return string
- */
- public static function getTableName()
- {
- return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
+ public function __construct() {
+ $this->__table = 'civicrm_price_field';
+ parent::__construct();
+ }
+
+ /**
+ * return foreign links
+ *
+ * @return array
+ */
+ public function links() {
+ if (!(self::$_links)) {
+ self::$_links = array(
+ 'price_set_id' => 'civicrm_price_set:id',
+ );
}
- /**
- * returns if this table needs to be logged
- *
- * @return boolean
- */
- public function getLog()
- {
- return self::$_log;
+ return self::$_links;
+ }
+
+ /**
+ * returns all the column names of this table
+ *
+ * @return array
+ */
+ static function &fields() {
+ if (!(self::$_fields)) {
+ self::$_fields = array(
+ 'id' => array(
+ 'name' => 'id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'required' => TRUE,
+ ),
+ 'price_set_id' => array(
+ 'name' => 'price_set_id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'required' => TRUE,
+ 'FKClassName' => 'Snapshot_v4p2_Price_DAO_Set',
+ ),
+ 'name' => array(
+ 'name' => 'name',
+ 'type' => CRM_Utils_Type::T_STRING,
+ 'title' => ts('Name'),
+ 'required' => TRUE,
+ 'maxlength' => 255,
+ 'size' => CRM_Utils_Type::HUGE,
+ ),
+ 'label' => array(
+ 'name' => 'label',
+ 'type' => CRM_Utils_Type::T_STRING,
+ 'title' => ts('Label'),
+ 'required' => TRUE,
+ 'maxlength' => 255,
+ 'size' => CRM_Utils_Type::HUGE,
+ ),
+ 'html_type' => array(
+ 'name' => 'html_type',
+ 'type' => CRM_Utils_Type::T_ENUM,
+ 'title' => ts('Html Type'),
+ 'required' => TRUE,
+ 'enumValues' => 'Text, Select, Radio, CheckBox',
+ ),
+ 'is_enter_qty' => array(
+ 'name' => 'is_enter_qty',
+ 'type' => CRM_Utils_Type::T_BOOLEAN,
+ ),
+ 'help_pre' => array(
+ 'name' => 'help_pre',
+ 'type' => CRM_Utils_Type::T_TEXT,
+ 'title' => ts('Help Pre'),
+ 'rows' => 4,
+ 'cols' => 80,
+ ),
+ 'help_post' => array(
+ 'name' => 'help_post',
+ 'type' => CRM_Utils_Type::T_TEXT,
+ 'title' => ts('Help Post'),
+ 'rows' => 4,
+ 'cols' => 80,
+ ),
+ 'weight' => array(
+ 'name' => 'weight',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'title' => ts('Weight'),
+ 'default' => '',
+ ),
+ 'is_display_amounts' => array(
+ 'name' => 'is_display_amounts',
+ 'type' => CRM_Utils_Type::T_BOOLEAN,
+ 'default' => '',
+ ),
+ 'options_per_line' => array(
+ 'name' => 'options_per_line',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'title' => ts('Options Per Line'),
+ 'default' => '',
+ ),
+ 'is_active' => array(
+ 'name' => 'is_active',
+ 'type' => CRM_Utils_Type::T_BOOLEAN,
+ 'default' => '',
+ ),
+ 'is_required' => array(
+ 'name' => 'is_required',
+ 'type' => CRM_Utils_Type::T_BOOLEAN,
+ 'default' => '',
+ ),
+ 'active_on' => array(
+ 'name' => 'active_on',
+ 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
+ 'title' => ts('Active On'),
+ 'default' => 'UL',
+ ),
+ 'expire_on' => array(
+ 'name' => 'expire_on',
+ 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
+ 'title' => ts('Expire On'),
+ 'default' => 'UL',
+ ),
+ 'javascript' => array(
+ 'name' => 'javascript',
+ 'type' => CRM_Utils_Type::T_STRING,
+ 'title' => ts('Javascript'),
+ 'maxlength' => 255,
+ 'size' => CRM_Utils_Type::HUGE,
+ ),
+ 'visibility_id' => array(
+ 'name' => 'visibility_id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'default' => '',
+ ),
+ );
}
- /**
- * returns the list of fields that can be imported
- *
- * return array
- * @static
- */
- static function &import($prefix = false)
- {
- if (!(self::$_import)) {
- self::$_import = array();
- $fields = self::fields();
- foreach($fields as $name => $field) {
- if (!empty($field['import'])) {
- if ($prefix) {
- self::$_import['price_field'] = & $fields[$name];
- }
- else {
- self::$_import[$name] = & $fields[$name];
- }
- }
- }
+ return self::$_fields;
+ }
+
+ /**
+ * returns the names of this table
+ *
+ * @static
+ * @return string
+ */
+ public static function getTableName() {
+ return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
+ }
+
+ /**
+ * returns if this table needs to be logged
+ *
+ * @return boolean
+ */
+ public function getLog() {
+ return self::$_log;
+ }
+
+ /**
+ * returns the list of fields that can be imported
+ *
+ * return array
+ * @static
+ */
+ static function &import($prefix = FALSE) {
+ if (!(self::$_import)) {
+ self::$_import = array();
+ $fields = self::fields();
+ foreach ($fields as $name => $field) {
+ if (!empty($field['import'])) {
+ if ($prefix) {
+ self::$_import['price_field'] = &$fields[$name];
+ }
+ else {
+ self::$_import[$name] = &$fields[$name];
+ }
}
- return self::$_import;
+ }
}
- /**
- * returns the list of fields that can be exported
- *
- * return array
- * @static
- */
- static function &export($prefix = false)
- {
- if (!(self::$_export)) {
- self::$_export = array();
- $fields = self::fields();
- foreach($fields as $name => $field) {
- if (!empty($field['export'])) {
- if ($prefix) {
- self::$_export['price_field'] = & $fields[$name];
- }
- else {
- self::$_export[$name] = & $fields[$name];
- }
- }
- }
+ return self::$_import;
+ }
+
+ /**
+ * returns the list of fields that can be exported
+ *
+ * return array
+ * @static
+ */
+ static function &export($prefix = FALSE) {
+ if (!(self::$_export)) {
+ self::$_export = array();
+ $fields = self::fields();
+ foreach ($fields as $name => $field) {
+ if (!empty($field['export'])) {
+ if ($prefix) {
+ self::$_export['price_field'] = &$fields[$name];
+ }
+ else {
+ self::$_export[$name] = &$fields[$name];
+ }
}
- return self::$_export;
+ }
}
- /**
- * returns an array containing the enum fields of the civicrm_price_field table
- *
- * @return array
+ return self::$_export;
+ }
+
+ /**
+ * returns an array containing the enum fields of the civicrm_price_field table
+ *
+ * @return array
* (reference) the array of enum fields
- */
- static function &getEnums()
- {
- static $enums = array(
- 'html_type',
- );
- return $enums;
- }
- /**
- * returns a ts()-translated enum value for display purposes
- *
- * @param string $field
- * The enum field in question.
- * @param string $value
- * The enum value up for translation.
- *
- * @return string
+ */
+ static function &getEnums() {
+ static $enums = array(
+ 'html_type',
+ );
+ return $enums;
+ }
+
+ /**
+ * returns a ts()-translated enum value for display purposes
+ *
+ * @param string $field
+ * The enum field in question.
+ * @param string $value
+ * The enum value up for translation.
+ *
+ * @return string
* the display value of the enum
- */
- public static function tsEnum($field, $value)
- {
- static $translations = null;
- if (!$translations) {
- $translations = array(
- 'html_type' => array(
- 'Text' => ts('Text') ,
- 'Select' => ts('Select') ,
- 'Radio' => ts('Radio') ,
- 'CheckBox' => ts('CheckBox') ,
- ) ,
- );
- }
- return $translations[$field][$value];
+ */
+ public static function tsEnum($field, $value) {
+ static $translations = NULL;
+ if (!$translations) {
+ $translations = array(
+ 'html_type' => array(
+ 'Text' => ts('Text'),
+ 'Select' => ts('Select'),
+ 'Radio' => ts('Radio'),
+ 'CheckBox' => ts('CheckBox'),
+ ),
+ );
}
- /**
- * adds $value['foo_display'] for each $value['foo'] enum from civicrm_price_field
- *
- * @param array $values
- * (reference) the array up for enhancing.
- * @return void
- */
- public static function addDisplayEnums(&$values)
- {
- $enumFields = & Snapshot_v4p2_Price_DAO_Field::getEnums();
- foreach($enumFields as $enum) {
- if (isset($values[$enum])) {
- $values[$enum . '_display'] = Snapshot_v4p2_Price_DAO_Field::tsEnum($enum, $values[$enum]);
- }
- }
+ return $translations[$field][$value];
+ }
+
+ /**
+ * adds $value['foo_display'] for each $value['foo'] enum from civicrm_price_field
+ *
+ * @param array $values
+ * (reference) the array up for enhancing.
+ * @return void
+ */
+ public static function addDisplayEnums(&$values) {
+ $enumFields = &Snapshot_v4p2_Price_DAO_Field::getEnums();
+ foreach ($enumFields as $enum) {
+ if (isset($values[$enum])) {
+ $values[$enum . '_display'] = Snapshot_v4p2_Price_DAO_Field::tsEnum($enum, $values[$enum]);
+ }
}
+ }
}
/**
* Class CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue
*/
-class CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue extends CRM_Core_DAO
-{
- /**
- * static instance to hold the table name
- *
- * @var string
- * @static
- */
- static $_tableName = 'civicrm_price_field_value';
- /**
- * static instance to hold the field values
- *
- * @var array
- * @static
- */
- static $_fields = null;
- /**
- * static instance to hold the FK relationships
- *
- * @var string
- * @static
- */
- static $_links = null;
- /**
- * static instance to hold the values that can
- * be imported
- *
- * @var array
- * @static
- */
- static $_import = null;
- /**
- * static instance to hold the values that can
- * be exported
- *
- * @var array
- * @static
- */
- static $_export = null;
- /**
- * static value to see if we should log any modifications to
- * this table in the civicrm_log table
- *
- * @var boolean
- * @static
- */
- static $_log = false;
- /**
- * Price Field Value
- *
- * @var int unsigned
- */
- public $id;
- /**
- * FK to civicrm_price_field
- *
- * @var int unsigned
- */
- public $price_field_id;
- /**
- * Price field option name
- *
- * @var string
- */
- public $name;
- /**
- * Price field option label
- *
- * @var string
- */
- public $label;
- /**
- * >Price field option description.
- *
- * @var text
- */
- public $description;
- /**
- * Price field option amount
- *
- * @var string
- */
- public $amount;
- /**
- * Number of participants per field option
- *
- * @var int unsigned
- */
- public $count;
- /**
- * Max number of participants per field options
- *
- * @var int unsigned
- */
- public $max_value;
- /**
- * Order in which the field options should appear
- *
- * @var int
- */
- public $weight;
- /**
- * FK to Membership Type
- *
- * @var int unsigned
- */
- public $membership_type_id;
- /**
- * Is this default price field option
- *
- * @var boolean
- */
- public $is_default;
- /**
- * Is this price field value active
- *
- * @var boolean
- */
- public $is_active;
+class CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue extends CRM_Core_DAO {
+ /**
+ * static instance to hold the table name
+ *
+ * @var string
+ * @static
+ */
+ static $_tableName = 'civicrm_price_field_value';
+ /**
+ * static instance to hold the field values
+ *
+ * @var array
+ * @static
+ */
+ static $_fields = NULL;
+ /**
+ * static instance to hold the FK relationships
+ *
+ * @var string
+ * @static
+ */
+ static $_links = NULL;
+ /**
+ * static instance to hold the values that can
+ * be imported
+ *
+ * @var array
+ * @static
+ */
+ static $_import = NULL;
+ /**
+ * static instance to hold the values that can
+ * be exported
+ *
+ * @var array
+ * @static
+ */
+ static $_export = NULL;
+ /**
+ * static value to see if we should log any modifications to
+ * this table in the civicrm_log table
+ *
+ * @var boolean
+ * @static
+ */
+ static $_log = FALSE;
+ /**
+ * Price Field Value
+ *
+ * @var int unsigned
+ */
+ public $id;
+ /**
+ * FK to civicrm_price_field
+ *
+ * @var int unsigned
+ */
+ public $price_field_id;
+ /**
+ * Price field option name
+ *
+ * @var string
+ */
+ public $name;
+ /**
+ * Price field option label
+ *
+ * @var string
+ */
+ public $label;
+ /**
+ * >Price field option description.
+ *
+ * @var text
+ */
+ public $description;
+ /**
+ * Price field option amount
+ *
+ * @var string
+ */
+ public $amount;
+ /**
+ * Number of participants per field option
+ *
+ * @var int unsigned
+ */
+ public $count;
+ /**
+ * Max number of participants per field options
+ *
+ * @var int unsigned
+ */
+ public $max_value;
+ /**
+ * Order in which the field options should appear
+ *
+ * @var int
+ */
+ public $weight;
+ /**
+ * FK to Membership Type
+ *
+ * @var int unsigned
+ */
+ public $membership_type_id;
+ /**
+ * Is this default price field option
+ *
+ * @var boolean
+ */
+ public $is_default;
+ /**
+ * Is this price field value active
+ *
+ * @var boolean
+ */
+ public $is_active;
/**
* Class constructor
*
* @return \CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue
*/
- public function __construct()
- {
- $this->__table = 'civicrm_price_field_value';
- parent::__construct();
- }
- /**
- * return foreign links
- *
- * @return array
- */
- public function links()
- {
- if (!(self::$_links)) {
- self::$_links = array(
- 'price_field_id' => 'civicrm_price_field:id',
- 'membership_type_id' => 'civicrm_membership_type:id',
- );
- }
- return self::$_links;
- }
- /**
- * returns all the column names of this table
- *
- * @return array
- */
- static function &fields()
- {
- if (!(self::$_fields)) {
- self::$_fields = array(
- 'id' => array(
- 'name' => 'id',
- 'type' => CRM_Utils_Type::T_INT,
- 'required' => true,
- ) ,
- 'price_field_id' => array(
- 'name' => 'price_field_id',
- 'type' => CRM_Utils_Type::T_INT,
- 'required' => true,
- 'FKClassName' => 'Snapshot_v4p2_Price_DAO_Field',
- ) ,
- 'name' => array(
- 'name' => 'name',
- 'type' => CRM_Utils_Type::T_STRING,
- 'title' => ts('Name') ,
- 'maxlength' => 255,
- 'size' => CRM_Utils_Type::HUGE,
- ) ,
- 'label' => array(
- 'name' => 'label',
- 'type' => CRM_Utils_Type::T_STRING,
- 'title' => ts('Label') ,
- 'maxlength' => 255,
- 'size' => CRM_Utils_Type::HUGE,
- ) ,
- 'description' => array(
- 'name' => 'description',
- 'type' => CRM_Utils_Type::T_TEXT,
- 'title' => ts('Description') ,
- 'rows' => 2,
- 'cols' => 60,
- 'default' => 'UL',
- ) ,
- 'amount' => array(
- 'name' => 'amount',
- 'type' => CRM_Utils_Type::T_STRING,
- 'title' => ts('Amount') ,
- 'required' => true,
- 'maxlength' => 512,
- 'size' => CRM_Utils_Type::HUGE,
- ) ,
- 'count' => array(
- 'name' => 'count',
- 'type' => CRM_Utils_Type::T_INT,
- 'title' => ts('Count') ,
- 'default' => 'UL',
- ) ,
- 'max_value' => array(
- 'name' => 'max_value',
- 'type' => CRM_Utils_Type::T_INT,
- 'title' => ts('Max Value') ,
- 'default' => 'UL',
- ) ,
- 'weight' => array(
- 'name' => 'weight',
- 'type' => CRM_Utils_Type::T_INT,
- 'title' => ts('Weight') ,
- 'default' => '',
- ) ,
- 'membership_type_id' => array(
- 'name' => 'membership_type_id',
- 'type' => CRM_Utils_Type::T_INT,
- 'default' => 'UL',
- 'FKClassName' => 'CRM_Member_DAO_MembershipType',
- ) ,
- 'is_default' => array(
- 'name' => 'is_default',
- 'type' => CRM_Utils_Type::T_BOOLEAN,
- ) ,
- 'is_active' => array(
- 'name' => 'is_active',
- 'type' => CRM_Utils_Type::T_BOOLEAN,
- 'default' => '',
- ) ,
- );
- }
- return self::$_fields;
- }
- /**
- * returns the names of this table
- *
- * @static
- * @return string
- */
- public static function getTableName()
- {
- return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
+ public function __construct() {
+ $this->__table = 'civicrm_price_field_value';
+ parent::__construct();
+ }
+
+ /**
+ * return foreign links
+ *
+ * @return array
+ */
+ public function links() {
+ if (!(self::$_links)) {
+ self::$_links = array(
+ 'price_field_id' => 'civicrm_price_field:id',
+ 'membership_type_id' => 'civicrm_membership_type:id',
+ );
}
- /**
- * returns if this table needs to be logged
- *
- * @return boolean
- */
- public function getLog()
- {
- return self::$_log;
+ return self::$_links;
+ }
+
+ /**
+ * returns all the column names of this table
+ *
+ * @return array
+ */
+ static function &fields() {
+ if (!(self::$_fields)) {
+ self::$_fields = array(
+ 'id' => array(
+ 'name' => 'id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'required' => TRUE,
+ ),
+ 'price_field_id' => array(
+ 'name' => 'price_field_id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'required' => TRUE,
+ 'FKClassName' => 'Snapshot_v4p2_Price_DAO_Field',
+ ),
+ 'name' => array(
+ 'name' => 'name',
+ 'type' => CRM_Utils_Type::T_STRING,
+ 'title' => ts('Name'),
+ 'maxlength' => 255,
+ 'size' => CRM_Utils_Type::HUGE,
+ ),
+ 'label' => array(
+ 'name' => 'label',
+ 'type' => CRM_Utils_Type::T_STRING,
+ 'title' => ts('Label'),
+ 'maxlength' => 255,
+ 'size' => CRM_Utils_Type::HUGE,
+ ),
+ 'description' => array(
+ 'name' => 'description',
+ 'type' => CRM_Utils_Type::T_TEXT,
+ 'title' => ts('Description'),
+ 'rows' => 2,
+ 'cols' => 60,
+ 'default' => 'UL',
+ ),
+ 'amount' => array(
+ 'name' => 'amount',
+ 'type' => CRM_Utils_Type::T_STRING,
+ 'title' => ts('Amount'),
+ 'required' => TRUE,
+ 'maxlength' => 512,
+ 'size' => CRM_Utils_Type::HUGE,
+ ),
+ 'count' => array(
+ 'name' => 'count',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'title' => ts('Count'),
+ 'default' => 'UL',
+ ),
+ 'max_value' => array(
+ 'name' => 'max_value',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'title' => ts('Max Value'),
+ 'default' => 'UL',
+ ),
+ 'weight' => array(
+ 'name' => 'weight',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'title' => ts('Weight'),
+ 'default' => '',
+ ),
+ 'membership_type_id' => array(
+ 'name' => 'membership_type_id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'default' => 'UL',
+ 'FKClassName' => 'CRM_Member_DAO_MembershipType',
+ ),
+ 'is_default' => array(
+ 'name' => 'is_default',
+ 'type' => CRM_Utils_Type::T_BOOLEAN,
+ ),
+ 'is_active' => array(
+ 'name' => 'is_active',
+ 'type' => CRM_Utils_Type::T_BOOLEAN,
+ 'default' => '',
+ ),
+ );
}
- /**
- * returns the list of fields that can be imported
- *
- * return array
- * @static
- */
- static function &import($prefix = false)
- {
- if (!(self::$_import)) {
- self::$_import = array();
- $fields = self::fields();
- foreach($fields as $name => $field) {
- if (!empty($field['import'])) {
- if ($prefix) {
- self::$_import['price_field_value'] = & $fields[$name];
- }
- else {
- self::$_import[$name] = & $fields[$name];
- }
- }
- }
+ return self::$_fields;
+ }
+
+ /**
+ * returns the names of this table
+ *
+ * @static
+ * @return string
+ */
+ public static function getTableName() {
+ return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
+ }
+
+ /**
+ * returns if this table needs to be logged
+ *
+ * @return boolean
+ */
+ public function getLog() {
+ return self::$_log;
+ }
+
+ /**
+ * returns the list of fields that can be imported
+ *
+ * return array
+ * @static
+ */
+ static function &import($prefix = FALSE) {
+ if (!(self::$_import)) {
+ self::$_import = array();
+ $fields = self::fields();
+ foreach ($fields as $name => $field) {
+ if (!empty($field['import'])) {
+ if ($prefix) {
+ self::$_import['price_field_value'] = &$fields[$name];
+ }
+ else {
+ self::$_import[$name] = &$fields[$name];
+ }
}
- return self::$_import;
+ }
}
- /**
- * returns the list of fields that can be exported
- *
- * return array
- * @static
- */
- static function &export($prefix = false)
- {
- if (!(self::$_export)) {
- self::$_export = array();
- $fields = self::fields();
- foreach($fields as $name => $field) {
- if (!empty($field['export'])) {
- if ($prefix) {
- self::$_export['price_field_value'] = & $fields[$name];
- }
- else {
- self::$_export[$name] = & $fields[$name];
- }
- }
- }
+ return self::$_import;
+ }
+
+ /**
+ * returns the list of fields that can be exported
+ *
+ * return array
+ * @static
+ */
+ static function &export($prefix = FALSE) {
+ if (!(self::$_export)) {
+ self::$_export = array();
+ $fields = self::fields();
+ foreach ($fields as $name => $field) {
+ if (!empty($field['export'])) {
+ if ($prefix) {
+ self::$_export['price_field_value'] = &$fields[$name];
+ }
+ else {
+ self::$_export[$name] = &$fields[$name];
+ }
}
- return self::$_export;
+ }
}
+ return self::$_export;
+ }
}
/**
* Class CRM_Upgrade_Snapshot_V4p2_Price_DAO_LineItem
*/
-class CRM_Upgrade_Snapshot_V4p2_Price_DAO_LineItem extends CRM_Core_DAO
-{
- /**
- * static instance to hold the table name
- *
- * @var string
- * @static
- */
- static $_tableName = 'civicrm_line_item';
- /**
- * static instance to hold the field values
- *
- * @var array
- * @static
- */
- static $_fields = null;
- /**
- * static instance to hold the FK relationships
- *
- * @var string
- * @static
- */
- static $_links = null;
- /**
- * static instance to hold the values that can
- * be imported
- *
- * @var array
- * @static
- */
- static $_import = null;
- /**
- * static instance to hold the values that can
- * be exported
- *
- * @var array
- * @static
- */
- static $_export = null;
- /**
- * static value to see if we should log any modifications to
- * this table in the civicrm_log table
- *
- * @var boolean
- * @static
- */
- static $_log = true;
- /**
- * Line Item
- *
- * @var int unsigned
- */
- public $id;
- /**
- * table which has the transaction
- *
- * @var string
- */
- public $entity_table;
- /**
- * entry in table
- *
- * @var int unsigned
- */
- public $entity_id;
- /**
- * FK to price_field
- *
- * @var int unsigned
- */
- public $price_field_id;
- /**
- * descriptive label for item - from price_field_value.label
- *
- * @var string
- */
- public $label;
- /**
- * How many items ordered
- *
- * @var int unsigned
- */
- public $qty;
- /**
- * price of each item
- *
- * @var float
- */
- public $unit_price;
- /**
- * qty * unit_price
- *
- * @var float
- */
- public $line_total;
- /**
- * Participant count for field
- *
- * @var int unsigned
- */
- public $participant_count;
- /**
- * Implicit FK to civicrm_option_value
- *
- * @var int unsigned
- */
- public $price_field_value_id;
+class CRM_Upgrade_Snapshot_V4p2_Price_DAO_LineItem extends CRM_Core_DAO {
+ /**
+ * static instance to hold the table name
+ *
+ * @var string
+ * @static
+ */
+ static $_tableName = 'civicrm_line_item';
+ /**
+ * static instance to hold the field values
+ *
+ * @var array
+ * @static
+ */
+ static $_fields = NULL;
+ /**
+ * static instance to hold the FK relationships
+ *
+ * @var string
+ * @static
+ */
+ static $_links = NULL;
+ /**
+ * static instance to hold the values that can
+ * be imported
+ *
+ * @var array
+ * @static
+ */
+ static $_import = NULL;
+ /**
+ * static instance to hold the values that can
+ * be exported
+ *
+ * @var array
+ * @static
+ */
+ static $_export = NULL;
+ /**
+ * static value to see if we should log any modifications to
+ * this table in the civicrm_log table
+ *
+ * @var boolean
+ * @static
+ */
+ static $_log = TRUE;
+ /**
+ * Line Item
+ *
+ * @var int unsigned
+ */
+ public $id;
+ /**
+ * table which has the transaction
+ *
+ * @var string
+ */
+ public $entity_table;
+ /**
+ * entry in table
+ *
+ * @var int unsigned
+ */
+ public $entity_id;
+ /**
+ * FK to price_field
+ *
+ * @var int unsigned
+ */
+ public $price_field_id;
+ /**
+ * descriptive label for item - from price_field_value.label
+ *
+ * @var string
+ */
+ public $label;
+ /**
+ * How many items ordered
+ *
+ * @var int unsigned
+ */
+ public $qty;
+ /**
+ * price of each item
+ *
+ * @var float
+ */
+ public $unit_price;
+ /**
+ * qty * unit_price
+ *
+ * @var float
+ */
+ public $line_total;
+ /**
+ * Participant count for field
+ *
+ * @var int unsigned
+ */
+ public $participant_count;
+ /**
+ * Implicit FK to civicrm_option_value
+ *
+ * @var int unsigned
+ */
+ public $price_field_value_id;
/**
* Class constructor
*
* @return \CRM_Upgrade_Snapshot_V4p2_Price_DAO_LineItem
*/
- public function __construct()
- {
- $this->__table = 'civicrm_line_item';
- parent::__construct();
- }
- /**
- * return foreign links
- *
- * @return array
- */
- public function links()
- {
- if (!(self::$_links)) {
- self::$_links = array(
- 'price_field_id' => 'civicrm_price_field:id',
- 'price_field_value_id' => 'civicrm_price_field_value:id',
- );
- }
- return self::$_links;
- }
- /**
- * returns all the column names of this table
- *
- * @return array
- */
- static function &fields()
- {
- if (!(self::$_fields)) {
- self::$_fields = array(
- 'id' => array(
- 'name' => 'id',
- 'type' => CRM_Utils_Type::T_INT,
- 'required' => true,
- ) ,
- 'entity_table' => array(
- 'name' => 'entity_table',
- 'type' => CRM_Utils_Type::T_STRING,
- 'title' => ts('Entity Table') ,
- 'required' => true,
- 'maxlength' => 64,
- 'size' => CRM_Utils_Type::BIG,
- ) ,
- 'entity_id' => array(
- 'name' => 'entity_id',
- 'type' => CRM_Utils_Type::T_INT,
- 'required' => true,
- ) ,
- 'price_field_id' => array(
- 'name' => 'price_field_id',
- 'type' => CRM_Utils_Type::T_INT,
- 'required' => true,
- 'FKClassName' => 'Snapshot_v4p2_Price_DAO_Field',
- ) ,
- 'label' => array(
- 'name' => 'label',
- 'type' => CRM_Utils_Type::T_STRING,
- 'title' => ts('Label') ,
- 'maxlength' => 255,
- 'size' => CRM_Utils_Type::HUGE,
- 'default' => 'UL',
- ) ,
- 'qty' => array(
- 'name' => 'qty',
- 'type' => CRM_Utils_Type::T_INT,
- 'title' => ts('Qty') ,
- 'required' => true,
- ) ,
- 'unit_price' => array(
- 'name' => 'unit_price',
- 'type' => CRM_Utils_Type::T_MONEY,
- 'title' => ts('Unit Price') ,
- 'required' => true,
- ) ,
- 'line_total' => array(
- 'name' => 'line_total',
- 'type' => CRM_Utils_Type::T_MONEY,
- 'title' => ts('Line Total') ,
- 'required' => true,
- ) ,
- 'participant_count' => array(
- 'name' => 'participant_count',
- 'type' => CRM_Utils_Type::T_INT,
- 'title' => ts('Participant Count') ,
- 'default' => 'UL',
- ) ,
- 'price_field_value_id' => array(
- 'name' => 'price_field_value_id',
- 'type' => CRM_Utils_Type::T_INT,
- 'default' => 'UL',
- 'FKClassName' => 'Snapshot_v4p2_Price_DAO_FieldValue',
- ) ,
- );
- }
- return self::$_fields;
- }
- /**
- * returns the names of this table
- *
- * @static
- * @return string
- */
- public static function getTableName()
- {
- return self::$_tableName;
+ public function __construct() {
+ $this->__table = 'civicrm_line_item';
+ parent::__construct();
+ }
+
+ /**
+ * return foreign links
+ *
+ * @return array
+ */
+ public function links() {
+ if (!(self::$_links)) {
+ self::$_links = array(
+ 'price_field_id' => 'civicrm_price_field:id',
+ 'price_field_value_id' => 'civicrm_price_field_value:id',
+ );
}
- /**
- * returns if this table needs to be logged
- *
- * @return boolean
- */
- public function getLog()
- {
- return self::$_log;
+ return self::$_links;
+ }
+
+ /**
+ * returns all the column names of this table
+ *
+ * @return array
+ */
+ static function &fields() {
+ if (!(self::$_fields)) {
+ self::$_fields = array(
+ 'id' => array(
+ 'name' => 'id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'required' => TRUE,
+ ),
+ 'entity_table' => array(
+ 'name' => 'entity_table',
+ 'type' => CRM_Utils_Type::T_STRING,
+ 'title' => ts('Entity Table'),
+ 'required' => TRUE,
+ 'maxlength' => 64,
+ 'size' => CRM_Utils_Type::BIG,
+ ),
+ 'entity_id' => array(
+ 'name' => 'entity_id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'required' => TRUE,
+ ),
+ 'price_field_id' => array(
+ 'name' => 'price_field_id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'required' => TRUE,
+ 'FKClassName' => 'Snapshot_v4p2_Price_DAO_Field',
+ ),
+ 'label' => array(
+ 'name' => 'label',
+ 'type' => CRM_Utils_Type::T_STRING,
+ 'title' => ts('Label'),
+ 'maxlength' => 255,
+ 'size' => CRM_Utils_Type::HUGE,
+ 'default' => 'UL',
+ ),
+ 'qty' => array(
+ 'name' => 'qty',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'title' => ts('Qty'),
+ 'required' => TRUE,
+ ),
+ 'unit_price' => array(
+ 'name' => 'unit_price',
+ 'type' => CRM_Utils_Type::T_MONEY,
+ 'title' => ts('Unit Price'),
+ 'required' => TRUE,
+ ),
+ 'line_total' => array(
+ 'name' => 'line_total',
+ 'type' => CRM_Utils_Type::T_MONEY,
+ 'title' => ts('Line Total'),
+ 'required' => TRUE,
+ ),
+ 'participant_count' => array(
+ 'name' => 'participant_count',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'title' => ts('Participant Count'),
+ 'default' => 'UL',
+ ),
+ 'price_field_value_id' => array(
+ 'name' => 'price_field_value_id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'default' => 'UL',
+ 'FKClassName' => 'Snapshot_v4p2_Price_DAO_FieldValue',
+ ),
+ );
}
- /**
- * returns the list of fields that can be imported
- *
- * return array
- * @static
- */
- static function &import($prefix = false)
- {
- if (!(self::$_import)) {
- self::$_import = array();
- $fields = self::fields();
- foreach($fields as $name => $field) {
- if (!empty($field['import'])) {
- if ($prefix) {
- self::$_import['line_item'] = & $fields[$name];
- }
- else {
- self::$_import[$name] = & $fields[$name];
- }
- }
- }
+ return self::$_fields;
+ }
+
+ /**
+ * returns the names of this table
+ *
+ * @static
+ * @return string
+ */
+ public static function getTableName() {
+ return self::$_tableName;
+ }
+
+ /**
+ * returns if this table needs to be logged
+ *
+ * @return boolean
+ */
+ public function getLog() {
+ return self::$_log;
+ }
+
+ /**
+ * returns the list of fields that can be imported
+ *
+ * return array
+ * @static
+ */
+ static function &import($prefix = FALSE) {
+ if (!(self::$_import)) {
+ self::$_import = array();
+ $fields = self::fields();
+ foreach ($fields as $name => $field) {
+ if (!empty($field['import'])) {
+ if ($prefix) {
+ self::$_import['line_item'] = &$fields[$name];
+ }
+ else {
+ self::$_import[$name] = &$fields[$name];
+ }
}
- return self::$_import;
+ }
}
- /**
- * returns the list of fields that can be exported
- *
- * return array
- * @static
- */
- static function &export($prefix = false)
- {
- if (!(self::$_export)) {
- self::$_export = array();
- $fields = self::fields();
- foreach($fields as $name => $field) {
- if (!empty($field['export'])) {
- if ($prefix) {
- self::$_export['line_item'] = & $fields[$name];
- }
- else {
- self::$_export[$name] = & $fields[$name];
- }
- }
- }
+ return self::$_import;
+ }
+
+ /**
+ * returns the list of fields that can be exported
+ *
+ * return array
+ * @static
+ */
+ static function &export($prefix = FALSE) {
+ if (!(self::$_export)) {
+ self::$_export = array();
+ $fields = self::fields();
+ foreach ($fields as $name => $field) {
+ if (!empty($field['export'])) {
+ if ($prefix) {
+ self::$_export['line_item'] = &$fields[$name];
+ }
+ else {
+ self::$_export[$name] = &$fields[$name];
+ }
}
- return self::$_export;
+ }
}
+ return self::$_export;
+ }
}
/**
* Class CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set
*/
-class CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set extends CRM_Core_DAO
-{
- /**
- * static instance to hold the table name
- *
- * @var string
- * @static
- */
- static $_tableName = 'civicrm_price_set';
- /**
- * static instance to hold the field values
- *
- * @var array
- * @static
- */
- static $_fields = null;
- /**
- * static instance to hold the FK relationships
- *
- * @var string
- * @static
- */
- static $_links = null;
- /**
- * static instance to hold the values that can
- * be imported
- *
- * @var array
- * @static
- */
- static $_import = null;
- /**
- * static instance to hold the values that can
- * be exported
- *
- * @var array
- * @static
- */
- static $_export = null;
- /**
- * static value to see if we should log any modifications to
- * this table in the civicrm_log table
- *
- * @var boolean
- * @static
- */
- static $_log = true;
- /**
- * Price Set
- *
- * @var int unsigned
- */
- public $id;
- /**
- * Which Domain is this price-set for
- *
- * @var int unsigned
- */
- public $domain_id;
- /**
- * Variable name/programmatic handle for this set of price fields.
- *
- * @var string
- */
- public $name;
- /**
- * Displayed title for the Price Set.
- *
- * @var string
- */
- public $title;
- /**
- * Is this price set active
- *
- * @var boolean
- */
- public $is_active;
- /**
- * Description and/or help text to display before fields in form.
- *
- * @var text
- */
- public $help_pre;
- /**
- * Description and/or help text to display after fields in form.
- *
- * @var text
- */
- public $help_post;
- /**
- * Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional
- *
- * @var string
- */
- public $javascript;
- /**
- * What components are using this price set?
- *
- * @var string
- */
- public $extends;
- /**
- * FK to Contribution Type(for membership price sets only).
- *
- * @var int unsigned
- */
- public $contribution_type_id;
- /**
- * Is set if edited on Contribution or Event Page rather than through Manage Price Sets
- *
- * @var boolean
- */
- public $is_quick_config;
- /**
- * Is this a predefined system price set (i.e. it can not be deleted, edited)?
- *
- * @var boolean
- */
- public $is_reserved;
+class CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set extends CRM_Core_DAO {
+ /**
+ * static instance to hold the table name
+ *
+ * @var string
+ * @static
+ */
+ static $_tableName = 'civicrm_price_set';
+ /**
+ * static instance to hold the field values
+ *
+ * @var array
+ * @static
+ */
+ static $_fields = NULL;
+ /**
+ * static instance to hold the FK relationships
+ *
+ * @var string
+ * @static
+ */
+ static $_links = NULL;
+ /**
+ * static instance to hold the values that can
+ * be imported
+ *
+ * @var array
+ * @static
+ */
+ static $_import = NULL;
+ /**
+ * static instance to hold the values that can
+ * be exported
+ *
+ * @var array
+ * @static
+ */
+ static $_export = NULL;
+ /**
+ * static value to see if we should log any modifications to
+ * this table in the civicrm_log table
+ *
+ * @var boolean
+ * @static
+ */
+ static $_log = TRUE;
+ /**
+ * Price Set
+ *
+ * @var int unsigned
+ */
+ public $id;
+ /**
+ * Which Domain is this price-set for
+ *
+ * @var int unsigned
+ */
+ public $domain_id;
+ /**
+ * Variable name/programmatic handle for this set of price fields.
+ *
+ * @var string
+ */
+ public $name;
+ /**
+ * Displayed title for the Price Set.
+ *
+ * @var string
+ */
+ public $title;
+ /**
+ * Is this price set active
+ *
+ * @var boolean
+ */
+ public $is_active;
+ /**
+ * Description and/or help text to display before fields in form.
+ *
+ * @var text
+ */
+ public $help_pre;
+ /**
+ * Description and/or help text to display after fields in form.
+ *
+ * @var text
+ */
+ public $help_post;
+ /**
+ * Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional
+ *
+ * @var string
+ */
+ public $javascript;
+ /**
+ * What components are using this price set?
+ *
+ * @var string
+ */
+ public $extends;
+ /**
+ * FK to Contribution Type(for membership price sets only).
+ *
+ * @var int unsigned
+ */
+ public $contribution_type_id;
+ /**
+ * Is set if edited on Contribution or Event Page rather than through Manage Price Sets
+ *
+ * @var boolean
+ */
+ public $is_quick_config;
+ /**
+ * Is this a predefined system price set (i.e. it can not be deleted, edited)?
+ *
+ * @var boolean
+ */
+ public $is_reserved;
/**
* Class constructor
*
* @return \CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set
*/
- public function __construct()
- {
- $this->__table = 'civicrm_price_set';
- parent::__construct();
- }
- /**
- * return foreign links
- *
- * @return array
- */
- public function links()
- {
- if (!(self::$_links)) {
- self::$_links = array(
- 'domain_id' => 'civicrm_domain:id',
- 'contribution_type_id' => 'civicrm_contribution_type:id',
- );
- }
- return self::$_links;
- }
- /**
- * returns all the column names of this table
- *
- * @return array
- */
- static function &fields()
- {
- if (!(self::$_fields)) {
- self::$_fields = array(
- 'id' => array(
- 'name' => 'id',
- 'type' => CRM_Utils_Type::T_INT,
- 'required' => true,
- ) ,
- 'domain_id' => array(
- 'name' => 'domain_id',
- 'type' => CRM_Utils_Type::T_INT,
- 'FKClassName' => 'CRM_Core_DAO_Domain',
- ) ,
- 'name' => array(
- 'name' => 'name',
- 'type' => CRM_Utils_Type::T_STRING,
- 'title' => ts('Name') ,
- 'required' => true,
- 'maxlength' => 255,
- 'size' => CRM_Utils_Type::HUGE,
- ) ,
- 'title' => array(
- 'name' => 'title',
- 'type' => CRM_Utils_Type::T_STRING,
- 'title' => ts('Title') ,
- 'required' => true,
- 'maxlength' => 255,
- 'size' => CRM_Utils_Type::HUGE,
- ) ,
- 'is_active' => array(
- 'name' => 'is_active',
- 'type' => CRM_Utils_Type::T_BOOLEAN,
- 'default' => '',
- ) ,
- 'help_pre' => array(
- 'name' => 'help_pre',
- 'type' => CRM_Utils_Type::T_TEXT,
- 'title' => ts('Help Pre') ,
- 'rows' => 4,
- 'cols' => 80,
- ) ,
- 'help_post' => array(
- 'name' => 'help_post',
- 'type' => CRM_Utils_Type::T_TEXT,
- 'title' => ts('Help Post') ,
- 'rows' => 4,
- 'cols' => 80,
- ) ,
- 'javascript' => array(
- 'name' => 'javascript',
- 'type' => CRM_Utils_Type::T_STRING,
- 'title' => ts('Javascript') ,
- 'maxlength' => 64,
- 'size' => CRM_Utils_Type::BIG,
- ) ,
- 'extends' => array(
- 'name' => 'extends',
- 'type' => CRM_Utils_Type::T_STRING,
- 'title' => ts('Extends') ,
- 'required' => true,
- 'maxlength' => 255,
- 'size' => CRM_Utils_Type::HUGE,
- ) ,
- 'contribution_type_id' => array(
- 'name' => 'contribution_type_id',
- 'type' => CRM_Utils_Type::T_INT,
- 'default' => 'UL',
- 'FKClassName' => 'CRM_Contribute_DAO_ContributionType',
- ) ,
- 'is_quick_config' => array(
- 'name' => 'is_quick_config',
- 'type' => CRM_Utils_Type::T_BOOLEAN,
- ) ,
- 'is_reserved' => array(
- 'name' => 'is_reserved',
- 'type' => CRM_Utils_Type::T_BOOLEAN,
- ) ,
- );
- }
- return self::$_fields;
- }
- /**
- * returns the names of this table
- *
- * @static
- * @return string
- */
- public static function getTableName()
- {
- return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
+ public function __construct() {
+ $this->__table = 'civicrm_price_set';
+ parent::__construct();
+ }
+
+ /**
+ * return foreign links
+ *
+ * @return array
+ */
+ public function links() {
+ if (!(self::$_links)) {
+ self::$_links = array(
+ 'domain_id' => 'civicrm_domain:id',
+ 'contribution_type_id' => 'civicrm_contribution_type:id',
+ );
}
- /**
- * returns if this table needs to be logged
- *
- * @return boolean
- */
- public function getLog()
- {
- return self::$_log;
+ return self::$_links;
+ }
+
+ /**
+ * returns all the column names of this table
+ *
+ * @return array
+ */
+ static function &fields() {
+ if (!(self::$_fields)) {
+ self::$_fields = array(
+ 'id' => array(
+ 'name' => 'id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'required' => TRUE,
+ ),
+ 'domain_id' => array(
+ 'name' => 'domain_id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'FKClassName' => 'CRM_Core_DAO_Domain',
+ ),
+ 'name' => array(
+ 'name' => 'name',
+ 'type' => CRM_Utils_Type::T_STRING,
+ 'title' => ts('Name'),
+ 'required' => TRUE,
+ 'maxlength' => 255,
+ 'size' => CRM_Utils_Type::HUGE,
+ ),
+ 'title' => array(
+ 'name' => 'title',
+ 'type' => CRM_Utils_Type::T_STRING,
+ 'title' => ts('Title'),
+ 'required' => TRUE,
+ 'maxlength' => 255,
+ 'size' => CRM_Utils_Type::HUGE,
+ ),
+ 'is_active' => array(
+ 'name' => 'is_active',
+ 'type' => CRM_Utils_Type::T_BOOLEAN,
+ 'default' => '',
+ ),
+ 'help_pre' => array(
+ 'name' => 'help_pre',
+ 'type' => CRM_Utils_Type::T_TEXT,
+ 'title' => ts('Help Pre'),
+ 'rows' => 4,
+ 'cols' => 80,
+ ),
+ 'help_post' => array(
+ 'name' => 'help_post',
+ 'type' => CRM_Utils_Type::T_TEXT,
+ 'title' => ts('Help Post'),
+ 'rows' => 4,
+ 'cols' => 80,
+ ),
+ 'javascript' => array(
+ 'name' => 'javascript',
+ 'type' => CRM_Utils_Type::T_STRING,
+ 'title' => ts('Javascript'),
+ 'maxlength' => 64,
+ 'size' => CRM_Utils_Type::BIG,
+ ),
+ 'extends' => array(
+ 'name' => 'extends',
+ 'type' => CRM_Utils_Type::T_STRING,
+ 'title' => ts('Extends'),
+ 'required' => TRUE,
+ 'maxlength' => 255,
+ 'size' => CRM_Utils_Type::HUGE,
+ ),
+ 'contribution_type_id' => array(
+ 'name' => 'contribution_type_id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'default' => 'UL',
+ 'FKClassName' => 'CRM_Contribute_DAO_ContributionType',
+ ),
+ 'is_quick_config' => array(
+ 'name' => 'is_quick_config',
+ 'type' => CRM_Utils_Type::T_BOOLEAN,
+ ),
+ 'is_reserved' => array(
+ 'name' => 'is_reserved',
+ 'type' => CRM_Utils_Type::T_BOOLEAN,
+ ),
+ );
}
- /**
- * returns the list of fields that can be imported
- *
- * return array
- * @static
- */
- static function &import($prefix = false)
- {
- if (!(self::$_import)) {
- self::$_import = array();
- $fields = self::fields();
- foreach($fields as $name => $field) {
- if (!empty($field['import'])) {
- if ($prefix) {
- self::$_import['price_set'] = & $fields[$name];
- }
- else {
- self::$_import[$name] = & $fields[$name];
- }
- }
- }
+ return self::$_fields;
+ }
+
+ /**
+ * returns the names of this table
+ *
+ * @static
+ * @return string
+ */
+ public static function getTableName() {
+ return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
+ }
+
+ /**
+ * returns if this table needs to be logged
+ *
+ * @return boolean
+ */
+ public function getLog() {
+ return self::$_log;
+ }
+
+ /**
+ * returns the list of fields that can be imported
+ *
+ * return array
+ * @static
+ */
+ static function &import($prefix = FALSE) {
+ if (!(self::$_import)) {
+ self::$_import = array();
+ $fields = self::fields();
+ foreach ($fields as $name => $field) {
+ if (!empty($field['import'])) {
+ if ($prefix) {
+ self::$_import['price_set'] = &$fields[$name];
+ }
+ else {
+ self::$_import[$name] = &$fields[$name];
+ }
}
- return self::$_import;
+ }
}
- /**
- * returns the list of fields that can be exported
- *
- * return array
- * @static
- */
- static function &export($prefix = false)
- {
- if (!(self::$_export)) {
- self::$_export = array();
- $fields = self::fields();
- foreach($fields as $name => $field) {
- if (!empty($field['export'])) {
- if ($prefix) {
- self::$_export['price_set'] = & $fields[$name];
- }
- else {
- self::$_export[$name] = & $fields[$name];
- }
- }
- }
+ return self::$_import;
+ }
+
+ /**
+ * returns the list of fields that can be exported
+ *
+ * return array
+ * @static
+ */
+ static function &export($prefix = FALSE) {
+ if (!(self::$_export)) {
+ self::$_export = array();
+ $fields = self::fields();
+ foreach ($fields as $name => $field) {
+ if (!empty($field['export'])) {
+ if ($prefix) {
+ self::$_export['price_set'] = &$fields[$name];
+ }
+ else {
+ self::$_export[$name] = &$fields[$name];
+ }
}
- return self::$_export;
+ }
}
+ return self::$_export;
+ }
}
/**
* Class CRM_Upgrade_Snapshot_V4p2_Price_DAO_SetEntity
*/
-class CRM_Upgrade_Snapshot_V4p2_Price_DAO_SetEntity extends CRM_Core_DAO
-{
- /**
- * static instance to hold the table name
- *
- * @var string
- * @static
- */
- static $_tableName = 'civicrm_price_set_entity';
- /**
- * static instance to hold the field values
- *
- * @var array
- * @static
- */
- static $_fields = null;
- /**
- * static instance to hold the FK relationships
- *
- * @var string
- * @static
- */
- static $_links = null;
- /**
- * static instance to hold the values that can
- * be imported
- *
- * @var array
- * @static
- */
- static $_import = null;
- /**
- * static instance to hold the values that can
- * be exported
- *
- * @var array
- * @static
- */
- static $_export = null;
- /**
- * static value to see if we should log any modifications to
- * this table in the civicrm_log table
- *
- * @var boolean
- * @static
- */
- static $_log = true;
- /**
- * Price Set Entity
- *
- * @var int unsigned
- */
- public $id;
- /**
- * Table which uses this price set
- *
- * @var string
- */
- public $entity_table;
- /**
- * Item in table
- *
- * @var int unsigned
- */
- public $entity_id;
- /**
- * price set being used
- *
- * @var int unsigned
- */
- public $price_set_id;
+class CRM_Upgrade_Snapshot_V4p2_Price_DAO_SetEntity extends CRM_Core_DAO {
+ /**
+ * static instance to hold the table name
+ *
+ * @var string
+ * @static
+ */
+ static $_tableName = 'civicrm_price_set_entity';
+ /**
+ * static instance to hold the field values
+ *
+ * @var array
+ * @static
+ */
+ static $_fields = NULL;
+ /**
+ * static instance to hold the FK relationships
+ *
+ * @var string
+ * @static
+ */
+ static $_links = NULL;
+ /**
+ * static instance to hold the values that can
+ * be imported
+ *
+ * @var array
+ * @static
+ */
+ static $_import = NULL;
+ /**
+ * static instance to hold the values that can
+ * be exported
+ *
+ * @var array
+ * @static
+ */
+ static $_export = NULL;
+ /**
+ * static value to see if we should log any modifications to
+ * this table in the civicrm_log table
+ *
+ * @var boolean
+ * @static
+ */
+ static $_log = TRUE;
+ /**
+ * Price Set Entity
+ *
+ * @var int unsigned
+ */
+ public $id;
+ /**
+ * Table which uses this price set
+ *
+ * @var string
+ */
+ public $entity_table;
+ /**
+ * Item in table
+ *
+ * @var int unsigned
+ */
+ public $entity_id;
+ /**
+ * price set being used
+ *
+ * @var int unsigned
+ */
+ public $price_set_id;
/**
* Class constructor
*
* @return \CRM_Upgrade_Snapshot_V4p2_Price_DAO_SetEntity
*/
- public function __construct()
- {
- $this->__table = 'civicrm_price_set_entity';
- parent::__construct();
- }
- /**
- * return foreign links
- *
- * @return array
- */
- public function links()
- {
- if (!(self::$_links)) {
- self::$_links = array(
- 'price_set_id' => 'civicrm_price_set:id',
- );
- }
- return self::$_links;
- }
- /**
- * returns all the column names of this table
- *
- * @return array
- */
- static function &fields()
- {
- if (!(self::$_fields)) {
- self::$_fields = array(
- 'id' => array(
- 'name' => 'id',
- 'type' => CRM_Utils_Type::T_INT,
- 'required' => true,
- ) ,
- 'entity_table' => array(
- 'name' => 'entity_table',
- 'type' => CRM_Utils_Type::T_STRING,
- 'title' => ts('Entity Table') ,
- 'required' => true,
- 'maxlength' => 64,
- 'size' => CRM_Utils_Type::BIG,
- ) ,
- 'entity_id' => array(
- 'name' => 'entity_id',
- 'type' => CRM_Utils_Type::T_INT,
- 'required' => true,
- ) ,
- 'price_set_id' => array(
- 'name' => 'price_set_id',
- 'type' => CRM_Utils_Type::T_INT,
- 'required' => true,
- 'FKClassName' => 'Snapshot_v4p2_Price_DAO_Set',
- ) ,
- );
- }
- return self::$_fields;
- }
- /**
- * returns the names of this table
- *
- * @static
- * @return string
- */
- public static function getTableName()
- {
- return self::$_tableName;
+ public function __construct() {
+ $this->__table = 'civicrm_price_set_entity';
+ parent::__construct();
+ }
+
+ /**
+ * return foreign links
+ *
+ * @return array
+ */
+ public function links() {
+ if (!(self::$_links)) {
+ self::$_links = array(
+ 'price_set_id' => 'civicrm_price_set:id',
+ );
}
- /**
- * returns if this table needs to be logged
- *
- * @return boolean
- */
- public function getLog()
- {
- return self::$_log;
+ return self::$_links;
+ }
+
+ /**
+ * returns all the column names of this table
+ *
+ * @return array
+ */
+ static function &fields() {
+ if (!(self::$_fields)) {
+ self::$_fields = array(
+ 'id' => array(
+ 'name' => 'id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'required' => TRUE,
+ ),
+ 'entity_table' => array(
+ 'name' => 'entity_table',
+ 'type' => CRM_Utils_Type::T_STRING,
+ 'title' => ts('Entity Table'),
+ 'required' => TRUE,
+ 'maxlength' => 64,
+ 'size' => CRM_Utils_Type::BIG,
+ ),
+ 'entity_id' => array(
+ 'name' => 'entity_id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'required' => TRUE,
+ ),
+ 'price_set_id' => array(
+ 'name' => 'price_set_id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'required' => TRUE,
+ 'FKClassName' => 'Snapshot_v4p2_Price_DAO_Set',
+ ),
+ );
}
- /**
- * returns the list of fields that can be imported
- *
- * return array
- * @static
- */
- static function &import($prefix = false)
- {
- if (!(self::$_import)) {
- self::$_import = array();
- $fields = self::fields();
- foreach($fields as $name => $field) {
- if (!empty($field['import'])) {
- if ($prefix) {
- self::$_import['price_set_entity'] = & $fields[$name];
- }
- else {
- self::$_import[$name] = & $fields[$name];
- }
- }
- }
+ return self::$_fields;
+ }
+
+ /**
+ * returns the names of this table
+ *
+ * @static
+ * @return string
+ */
+ public static function getTableName() {
+ return self::$_tableName;
+ }
+
+ /**
+ * returns if this table needs to be logged
+ *
+ * @return boolean
+ */
+ public function getLog() {
+ return self::$_log;
+ }
+
+ /**
+ * returns the list of fields that can be imported
+ *
+ * return array
+ * @static
+ */
+ static function &import($prefix = FALSE) {
+ if (!(self::$_import)) {
+ self::$_import = array();
+ $fields = self::fields();
+ foreach ($fields as $name => $field) {
+ if (!empty($field['import'])) {
+ if ($prefix) {
+ self::$_import['price_set_entity'] = &$fields[$name];
+ }
+ else {
+ self::$_import[$name] = &$fields[$name];
+ }
}
- return self::$_import;
+ }
}
- /**
- * returns the list of fields that can be exported
- *
- * return array
- * @static
- */
- static function &export($prefix = false)
- {
- if (!(self::$_export)) {
- self::$_export = array();
- $fields = self::fields();
- foreach($fields as $name => $field) {
- if (!empty($field['export'])) {
- if ($prefix) {
- self::$_export['price_set_entity'] = & $fields[$name];
- }
- else {
- self::$_export[$name] = & $fields[$name];
- }
- }
- }
+ return self::$_import;
+ }
+
+ /**
+ * returns the list of fields that can be exported
+ *
+ * return array
+ * @static
+ */
+ static function &export($prefix = FALSE) {
+ if (!(self::$_export)) {
+ self::$_export = array();
+ $fields = self::fields();
+ foreach ($fields as $name => $field) {
+ if (!empty($field['export'])) {
+ if ($prefix) {
+ self::$_export['price_set_entity'] = &$fields[$name];
+ }
+ else {
+ self::$_export[$name] = &$fields[$name];
+ }
}
- return self::$_export;
+ }
}
+ return self::$_export;
+ }
}
* $Id$
*
*/
-
class CRM_Utils_API_HTMLInputCoder extends CRM_Utils_API_AbstractFieldCoder {
private $skipFields = NULL;
else {
// remove \n from each line and only add at the end
// this hack solves formatting issue, when we convert nl2br
- $lines = array();
- $count = 1;
+ $lines = array();
+ $count = 1;
$finalFormatted = NULL;
$formattedArray = explode("\n", $formatted);
$formattedArray = array_filter($formattedArray);
}
$this->returnMessages[] = ts("Addresses Evaluated: %1", array(
- 1 => $totalAddresses)) . "\n";
+ 1 => $totalAddresses
+ )) . "\n";
if ($processGeocode) {
$this->returnMessages[] = ts("Addresses Geocoded: %1", array(
- 1 => $totalGeocoded)) . "\n";
+ 1 => $totalGeocoded
+ )) . "\n";
}
if ($parseStreetAddress) {
$this->returnMessages[] = ts("Street Addresses Parsed: %1", array(
- 1 => $totalAddressParsed)) . "\n";
+ 1 => $totalAddressParsed
+ )) . "\n";
if ($unparseableContactAddress) {
$this->returnMessages[] = "<br />\n" . ts("Following is the list of contacts whose address is not parsed:") . "<br />\n";
foreach ($unparseableContactAddress as $contactLink) {
* @return array
*/
public function returnResult() {
- $result = array();
+ $result = array();
$result['is_error'] = $this->returnError;
$result['messages'] = implode("", $this->returnMessages);
return $result;
$code = $request->getResponseCode();
if ($code != 200) {
$session->setStatus(ts('USPS Address Lookup Failed with HTTP status code: %1',
- array(1 => $code)
- ));
+ array(1 => $code)
+ ));
return FALSE;
}
*/
class CRM_Utils_Cache_APCcache {
const DEFAULT_TIMEOUT = 3600;
- const DEFAULT_PREFIX = '';
+ const DEFAULT_PREFIX = '';
/**
* The default timeout to use
*
*/
class CRM_Utils_Cache_Memcache {
- const DEFAULT_HOST = 'localhost';
- const DEFAULT_PORT = 11211;
+ const DEFAULT_HOST = 'localhost';
+ const DEFAULT_PORT = 11211;
const DEFAULT_TIMEOUT = 3600;
- const DEFAULT_PREFIX = '';
+ const DEFAULT_PREFIX = '';
/**
* The host name of the memcached server
*
*/
class CRM_Utils_Cache_Memcached {
- const DEFAULT_HOST = 'localhost';
- const DEFAULT_PORT = 11211;
+ const DEFAULT_HOST = 'localhost';
+ const DEFAULT_PORT = 11211;
const DEFAULT_TIMEOUT = 3600;
- const DEFAULT_PREFIX = '';
- const MAX_KEY_LEN = 62;
+ const DEFAULT_PREFIX = '';
+ const MAX_KEY_LEN = 62;
/**
* The host name of the memcached server
* $Id$
*
*/
-
class CRM_Utils_Cache_NoCache implements CRM_Utils_Cache_Interface {
/**
*
* @return string
*/
- public function fileName ($key) {
+ public function fileName($key) {
if (strlen($key) > 50) {
return CIVICRM_TEMPLATE_COMPILEDIR . "CRM_" . md5($key) . ".php";
}
*
* @return mixed
*/
- public function get ($key) {
+ public function get($key) {
if (array_key_exists($key, $this->_cache)) {
return $this->_cache[$key];
}
* @return mixed
*/
public function get($key) {
- if (! array_key_exists($key, $this->frontCache)) {
+ if (!array_key_exists($key, $this->frontCache)) {
$this->frontCache[$key] = CRM_Core_BAO_Cache::getItem($this->group, $key, $this->componentID);
}
return $this->frontCache[$key];
/**
* @param CRM_Case_XMLRepository $xmlRepo
- * @param array<string> $caseTypeNames
+ * @param array <string> $caseTypeNames
*/
public function __construct($xmlRepo, $caseTypeNames) {
$this->caseTypeNames = $caseTypeNames;
$messages[] = new CRM_Utils_Check_Message(
'checkUploadsAreNotAccessible',
ts('Files in the data directory (<a href="%3">%2</a>) should not be downloadable.'
- . '<br />'
- . '<a href="%1">Read more about this warning</a>',
+ . '<br />'
+ . '<a href="%1">Read more about this warning</a>',
array(
1 => $this->createDocUrl('checkUploadsAreNotAccessible'),
2 => $privateDir,
) {
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_ECB, '');
// ECB mode - iv not needed - CRM-8198
- $iv = '00000000000000000000000000000000';
- $ks = mcrypt_enc_get_key_size($td);
+ $iv = '00000000000000000000000000000000';
+ $ks = mcrypt_enc_get_key_size($td);
$key = substr(sha1(CIVICRM_SITE_KEY), 0, $ks);
mcrypt_generic_init($td, $key, $iv);
) {
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_ECB, '');
// ECB mode - iv not needed - CRM-8198
- $iv = '00000000000000000000000000000000';
- $ks = mcrypt_enc_get_key_size($td);
+ $iv = '00000000000000000000000000000000';
+ $ks = mcrypt_enc_get_key_size($td);
$key = substr(sha1(CIVICRM_SITE_KEY), 0, $ks);
mcrypt_generic_init($td, $key, $iv);
if (!CRM_Utils_System::isNull($dateString)) {
if (strpos($dateString, '-')) {
- $year = (int) substr($dateString, 0, 4);
+ $year = (int) substr($dateString, 0, 4);
$month = (int) substr($dateString, 5, 2);
- $day = (int) substr($dateString, 8, 2);
+ $day = (int) substr($dateString, 8, 2);
$hour24 = (int) substr($dateString, 11, 2);
$minute = (int) substr($dateString, 14, 2);
}
else {
- $year = (int) substr($dateString, 0, 4);
+ $year = (int) substr($dateString, 0, 4);
$month = (int) substr($dateString, 4, 2);
- $day = (int) substr($dateString, 6, 2);
+ $day = (int) substr($dateString, 6, 2);
$hour24 = (int) substr($dateString, 8, 2);
$minute = (int) substr($dateString, 10, 2);
* @static
*/
public static function mysqlToIso($mysql) {
- $year = substr($mysql, 0, 4);
- $month = substr($mysql, 4, 2);
- $day = substr($mysql, 6, 2);
- $hour = substr($mysql, 8, 2);
+ $year = substr($mysql, 0, 4);
+ $month = substr($mysql, 4, 2);
+ $day = substr($mysql, 6, 2);
+ $hour = substr($mysql, 8, 2);
$minute = substr($mysql, 10, 2);
$second = substr($mysql, 12, 2);
* @static
*/
public static function convertToDefaultDate(&$params, $dateType, $dateParam) {
- $now = getdate();
- $cen = substr($now['year'], 0, 2);
+ $now = getdate();
+ $cen = substr($now['year'], 0, 2);
$prevCen = $cen - 1;
$value = NULL;
if ($dateType == 1) {
$formattedDate = explode("-", $value);
if (count($formattedDate) == 3) {
- $year = (int) $formattedDate[0];
+ $year = (int) $formattedDate[0];
$month = (int) $formattedDate[1];
- $day = (int) $formattedDate[2];
+ $day = (int) $formattedDate[2];
}
elseif (count($formattedDate) == 1 && (strlen($value) == 8)) {
return TRUE;
$formattedDate = explode("-", $value);
}
if (count($formattedDate) == 3) {
- $year = (int) $formattedDate[2];
+ $year = (int) $formattedDate[2];
$month = (int) $formattedDate[0];
- $day = (int) $formattedDate[1];
+ $day = (int) $formattedDate[1];
}
else {
return FALSE;
}
}
}
- $year = (int) $dateArray[2];
- $day = (int) $dateArray[1];
+ $year = (int) $dateArray[2];
+ $day = (int) $dateArray[1];
$month = (int) $monthInt;
}
if ($dateType == 16) {
$monthInt = $dateArray[1];
}
- $year = (int) $dateArray[2];
- $day = (int) $dateArray[0];
+ $year = (int) $dateArray[2];
+ $day = (int) $dateArray[0];
$month = (int) $monthInt;
}
else {
if ($dateType == 32) {
$formattedDate = explode("/", $value);
if (count($formattedDate) == 3) {
- $year = (int) $formattedDate[2];
+ $year = (int) $formattedDate[2];
$month = (int) $formattedDate[1];
- $day = (int) $formattedDate[0];
+ $day = (int) $formattedDate[0];
}
else {
return FALSE;
* actuall today pass 'dayParams' as null. or else pass the day,
* month, year values as array values
* Example: $dayParams = array(
- 'day' => '25', 'month' => '10',
+ * 'day' => '25', 'month' => '10',
* 'year' => '2007' );
*
* @param array $dayParamsArray of the day, month, year.
}
else {
$today = date($format, mktime(0, 0, 0,
- $dayParams['month'],
- $dayParams['day'],
- $dayParams['year']
- ));
+ $dayParams['month'],
+ $dayParams['day'],
+ $dayParams['year']
+ ));
}
return $today;
* @static
*/
public static function getRange($startDate, $endDate) {
- $today = date("Y-m-d");
+ $today = date("Y-m-d");
$mysqlStartDate = self::isoToMysql($startDate);
- $mysqlEndDate = self::isoToMysql($endDate);
- $mysqlToday = self::isoToMysql($today);
+ $mysqlEndDate = self::isoToMysql($endDate);
+ $mysqlToday = self::isoToMysql($today);
if ((isset($mysqlStartDate) && isset($mysqlEndDate)) && (($mysqlToday >= $mysqlStartDate) && ($mysqlToday <= $mysqlEndDate))) {
return TRUE;
$results = array();
$formatedBirthDate = CRM_Utils_Date::customFormat($birthDate, '%Y-%m-%d');
- $bDate = explode('-', $formatedBirthDate);
- $birthYear = $bDate[0];
+ $bDate = explode('-', $formatedBirthDate);
+ $birthYear = $bDate[0];
$birthMonth = $bDate[1];
- $birthDay = $bDate[2];
- $year_diff = date("Y") - $birthYear;
+ $birthDay = $bDate[2];
+ $year_diff = date("Y") - $birthYear;
// don't calculate age CRM-3143
if ($birthYear == '1902') {
*/
public static function intervalAdd($unit, $interval, $date, $dontCareTime = FALSE) {
if (is_array($date)) {
- $hour = CRM_Utils_Array::value('H', $date);
+ $hour = CRM_Utils_Array::value('H', $date);
$minute = CRM_Utils_Array::value('i', $date);
$second = CRM_Utils_Array::value('s', $date);
- $month = CRM_Utils_Array::value('M', $date);
- $day = CRM_Utils_Array::value('d', $date);
- $year = CRM_Utils_Array::value('Y', $date);
+ $month = CRM_Utils_Array::value('M', $date);
+ $day = CRM_Utils_Array::value('d', $date);
+ $year = CRM_Utils_Array::value('Y', $date);
}
else {
extract(date_parse($date));
$scheduleDate = explode("-", date("n-j-Y-H-i-s", $date));
- $date = array();
+ $date = array();
$date['M'] = $scheduleDate[0];
$date['d'] = $scheduleDate[1];
$date['Y'] = $scheduleDate[2];
* @static
*/
public static function relativeToAbsolute($relativeTerm, $unit) {
- $now = getdate();
- $from = $to = $dateRange = array();
+ $now = getdate();
+ $from = $to = $dateRange = array();
$from['H'] = $from['i'] = $from['s'] = 0;
switch ($unit) {
switch ($relativeTerm) {
case 'this':
$from['d'] = $from['M'] = 1;
- $to['d'] = 31;
- $to['M'] = 12;
- $to['Y'] = $from['Y'] = $now['year'];
+ $to['d'] = 31;
+ $to['M'] = 12;
+ $to['Y'] = $from['Y'] = $now['year'];
break;
case 'previous':
$from['M'] = $from['d'] = 1;
- $to['d'] = 31;
- $to['M'] = 12;
- $to['Y'] = $from['Y'] = $now['year'] - 1;
+ $to['d'] = 31;
+ $to['M'] = 12;
+ $to['Y'] = $from['Y'] = $now['year'] - 1;
break;
case 'previous_before':
$from['M'] = $from['d'] = 1;
- $to['d'] = 31;
- $to['M'] = 12;
- $to['Y'] = $from['Y'] = $now['year'] - 2;
+ $to['d'] = 31;
+ $to['M'] = 12;
+ $to['Y'] = $from['Y'] = $now['year'] - 2;
break;
case 'previous_2':
$from['M'] = $from['d'] = 1;
- $to['d'] = 31;
- $to['M'] = 12;
+ $to['d'] = 31;
+ $to['M'] = 12;
$from['Y'] = $now['year'] - 2;
- $to['Y'] = $now['year'] - 1;
+ $to['Y'] = $now['year'] - 1;
break;
case 'earlier':
$to['Y'] = $now['year'];
$to['H'] = 23;
$to['i'] = $to['s'] = 59;
- $from = self::intervalAdd('year', -1, $to);
- $from = self::intervalAdd('second', 1, $from);
+ $from = self::intervalAdd('year', -1, $to);
+ $from = self::intervalAdd('second', 1, $from);
break;
case 'current':
$to['Y'] = $now['year'];
$to['H'] = 23;
$to['i'] = $to['s'] = 59;
- $from = self::intervalAdd('year', -2, $to);
- $from = self::intervalAdd('second', 1, $from);
+ $from = self::intervalAdd('year', -2, $to);
+ $from = self::intervalAdd('second', 1, $from);
break;
case 'ending_3':
$to['Y'] = $now['year'];
$to['H'] = 23;
$to['i'] = $to['s'] = 59;
- $from = self::intervalAdd('year', -3, $to);
- $from = self::intervalAdd('second', 1, $from);
+ $from = self::intervalAdd('year', -3, $to);
+ $from = self::intervalAdd('second', 1, $from);
break;
case 'less':
- $to['d'] = 31;
- $to['M'] = 12;
- $to['Y'] = $now['year'];
+ $to['d'] = 31;
+ $to['M'] = 12;
+ $to['Y'] = $now['year'];
unset($from);
break;
case 'next':
$from['M'] = $from['d'] = 1;
- $to['d'] = 31;
- $to['M'] = 12;
- $to['Y'] = $from['Y'] = $now['year'] + 1;
+ $to['d'] = 31;
+ $to['M'] = 12;
+ $to['Y'] = $from['Y'] = $now['year'] + 1;
break;
case 'starting':
break;
case 'fiscal_year':
- $config = CRM_Core_Config::singleton();
+ $config = CRM_Core_Config::singleton();
$from['d'] = $config->fiscalYearStart['d'];
$from['M'] = $config->fiscalYearStart['M'];
- $fYear = self::calculateFiscalYear($from['d'], $from['M']);
+ $fYear = self::calculateFiscalYear($from['d'], $from['M']);
switch ($relativeTerm) {
case 'this':
- $from['Y'] = $fYear;
+ $from['Y'] = $fYear;
$fiscalYear = mktime(0, 0, 0, $from['M'], $form['d'], $from['Y'] + 1);
- $fiscalEnd = explode('-', date("Y-m-d", $fiscalYear));
+ $fiscalEnd = explode('-', date("Y-m-d", $fiscalYear));
$to['d'] = $fiscalEnd['2'];
$to['M'] = $fiscalEnd['1'];
break;
case 'previous':
- $from['Y'] = $fYear - 1;
+ $from['Y'] = $fYear - 1;
$fiscalYear = mktime(0, 0, 0, $from['M'], $form['d'], $from['Y'] + 1);
- $fiscalEnd = explode('-', date("Y-m-d", $fiscalYear));
+ $fiscalEnd = explode('-', date("Y-m-d", $fiscalYear));
$to['d'] = $fiscalEnd['2'];
$to['M'] = $fiscalEnd['1'];
$to['Y'] = $fiscalEnd['0'];
break;
case 'next':
- $from['Y'] = $fYear + 1;
+ $from['Y'] = $fYear + 1;
$fiscalYear = mktime(0, 0, 0, $from['M'], $from['d'], $from['Y'] + 1);
- $fiscalEnd = explode('-', date("Y-m-d", $fiscalYear));
+ $fiscalEnd = explode('-', date("Y-m-d", $fiscalYear));
$to['d'] = $fiscalEnd['2'];
$to['M'] = $fiscalEnd['1'];
$to['Y'] = $fiscalEnd['0'];
switch ($relativeTerm) {
case 'this':
- $quarter = ceil($now['mon'] / 3);
+ $quarter = ceil($now['mon'] / 3);
$from['d'] = 1;
$from['M'] = (3 * $quarter) - 2;
- $to['M'] = 3 * $quarter;
- $to['Y'] = $from['Y'] = $now['year'];
- $to['d'] = date('t', mktime(0, 0, 0, $to['M'], 1, $now['year']));
+ $to['M'] = 3 * $quarter;
+ $to['Y'] = $from['Y'] = $now['year'];
+ $to['d'] = date('t', mktime(0, 0, 0, $to['M'], 1, $now['year']));
break;
case 'previous':
- $difference = 1;
- $quarter = ceil($now['mon'] / 3);
- $quarter = $quarter - $difference;
+ $difference = 1;
+ $quarter = ceil($now['mon'] / 3);
+ $quarter = $quarter - $difference;
$subtractYear = 0;
if ($quarter <= 0) {
$subtractYear = 1;
}
$from['d'] = 1;
$from['M'] = (3 * $quarter) - 2;
- $to['M'] = 3 * $quarter;
- $to['Y'] = $from['Y'] = $now['year'] - $subtractYear;
- $to['d'] = date('t', mktime(0, 0, 0, $to['M'], 1, $to['Y']));
+ $to['M'] = 3 * $quarter;
+ $to['Y'] = $from['Y'] = $now['year'] - $subtractYear;
+ $to['d'] = date('t', mktime(0, 0, 0, $to['M'], 1, $to['Y']));
break;
case 'previous_before':
$difference = 2;
- $quarter = ceil($now['mon'] / 3);
- $quarter = $quarter - $difference;
+ $quarter = ceil($now['mon'] / 3);
+ $quarter = $quarter - $difference;
$subtractYear = 0;
if ($quarter <= 0) {
$subtractYear = 1;
}
$from['d'] = 1;
$from['M'] = (3 * $quarter) - 2;
- $to['M'] = 3 * $quarter;
- $to['Y'] = $from['Y'] = $now['year'] - $subtractYear;
- $to['d'] = date('t', mktime(0, 0, 0, $to['M'], 1, $to['Y']));
+ $to['M'] = 3 * $quarter;
+ $to['Y'] = $from['Y'] = $now['year'] - $subtractYear;
+ $to['d'] = date('t', mktime(0, 0, 0, $to['M'], 1, $to['Y']));
break;
case 'previous_2':
- $difference = 2;
- $quarter = ceil($now['mon'] / 3);
+ $difference = 2;
+ $quarter = ceil($now['mon'] / 3);
$current_quarter = $quarter;
- $quarter = $quarter - $difference;
- $subtractYear = 0;
+ $quarter = $quarter - $difference;
+ $subtractYear = 0;
if ($quarter <= 0) {
$subtractYear = 1;
$quarter += 4;
break;
case 'greater':
- $quarter = ceil($now['mon'] / 3);
+ $quarter = ceil($now['mon'] / 3);
$from['d'] = 1;
$from['M'] = (3 * $quarter) - 2;
$from['Y'] = $now['year'];
case 'greater_previous':
$quarter = ceil($now['mon'] / 3) - 1;
- $subtractYear = 0;
+ $subtractYear = 0;
if ($quarter <= 0) {
$subtractYear = 1;
$quarter += 4;
$to['Y'] = $now['year'];
$to['H'] = 23;
$to['i'] = $to['s'] = 59;
- $from = self::intervalAdd('month', -3, $to);
- $from = self::intervalAdd('second', 1, $from);
+ $from = self::intervalAdd('month', -3, $to);
+ $from = self::intervalAdd('second', 1, $from);
break;
case 'current':
- $quarter = ceil($now['mon'] / 3);
+ $quarter = ceil($now['mon'] / 3);
$from['d'] = 1;
$from['M'] = (3 * $quarter) - 2;
$from['Y'] = $now['year'];
break;
case 'less':
- $quarter = ceil($now['mon'] / 3);
- $to['M'] = 3 * $quarter;
- $to['Y'] = $now['year'];
- $to['d'] = date('t', mktime(0, 0, 0, $to['M'], 1, $now['year']));
+ $quarter = ceil($now['mon'] / 3);
+ $to['M'] = 3 * $quarter;
+ $to['Y'] = $now['year'];
+ $to['d'] = date('t', mktime(0, 0, 0, $to['M'], 1, $now['year']));
unset($from);
break;
case 'next':
$difference = -1;
$subtractYear = 0;
- $quarter = ceil($now['mon'] / 3);
- $quarter = $quarter - $difference;
+ $quarter = ceil($now['mon'] / 3);
+ $quarter = $quarter - $difference;
//CRM-14550 QA Fix
if ($quarter > 4) {
$now['year'] = $now['year'] + 1;
}
$from['d'] = 1;
$from['M'] = (3 * $quarter) - 2;
- $to['M'] = 3 * $quarter;
- $to['Y'] = $from['Y'] = $now['year'] - $subtractYear;
- $to['d'] = date('t', mktime(0, 0, 0, $to['M'], 1, $to['Y']));
+ $to['M'] = 3 * $quarter;
+ $to['Y'] = $from['Y'] = $now['year'] - $subtractYear;
+ $to['d'] = date('t', mktime(0, 0, 0, $to['M'], 1, $to['Y']));
break;
}
break;
switch ($relativeTerm) {
case 'this':
$from['d'] = 1;
- $to['d'] = date('t', mktime(0, 0, 0, $now['mon'], 1, $now['year']));
+ $to['d'] = date('t', mktime(0, 0, 0, $now['mon'], 1, $now['year']));
$from['M'] = $to['M'] = $now['mon'];
$from['Y'] = $to['Y'] = $now['year'];
break;
$to['Y'] = $now['year'];
$to['H'] = 23;
$to['i'] = $to['s'] = 59;
- $from = self::intervalAdd('month', -1, $to);
- $from = self::intervalAdd('second', 1, $from);
+ $from = self::intervalAdd('month', -1, $to);
+ $from = self::intervalAdd('second', 1, $from);
break;
case 'current':
$from['Y'] = $now['year'];
$from['H'] = 00;
$from['i'] = $to['s'] = 00;
- $to = self::intervalAdd('month', + 1, $from);
- $to = self::intervalAdd('second', -1, $to);
+ $to = self::intervalAdd('month', +1, $from);
+ $to = self::intervalAdd('second', -1, $to);
break;
}
break;
$from['d'] = $now['mday'];
$from['M'] = $now['mon'];
$from['Y'] = $now['year'];
- $from = self::intervalAdd('day', -1 * ($now['wday']), $from);
- $to = self::intervalAdd('day', 6, $from);
+ $from = self::intervalAdd('day', -1 * ($now['wday']), $from);
+ $to = self::intervalAdd('day', 6, $from);
break;
case 'previous':
$from['d'] = $now['mday'];
$from['M'] = $now['mon'];
$from['Y'] = $now['year'];
- $from = self::intervalAdd('day', -1 * ($now['wday']) - 7, $from);
- $to = self::intervalAdd('day', 6, $from);
+ $from = self::intervalAdd('day', -1 * ($now['wday']) - 7, $from);
+ $to = self::intervalAdd('day', 6, $from);
break;
case 'previous_before':
$from['d'] = $now['mday'];
$from['M'] = $now['mon'];
$from['Y'] = $now['year'];
- $from = self::intervalAdd('day', -1 * ($now['wday']) - 14, $from);
- $to = self::intervalAdd('day', 6, $from);
+ $from = self::intervalAdd('day', -1 * ($now['wday']) - 14, $from);
+ $to = self::intervalAdd('day', 6, $from);
break;
case 'previous_2':
$from['d'] = $now['mday'];
$from['M'] = $now['mon'];
$from['Y'] = $now['year'];
- $from = self::intervalAdd('day', -1 * ($now['wday']) - 14, $from);
- $to = self::intervalAdd('day', 13, $from);
+ $from = self::intervalAdd('day', -1 * ($now['wday']) - 14, $from);
+ $to = self::intervalAdd('day', 13, $from);
break;
case 'earlier':
$to['d'] = $now['mday'];
$to['M'] = $now['mon'];
$to['Y'] = $now['year'];
- $to = self::intervalAdd('day', -1 * ($now['wday']) - 1, $to);
+ $to = self::intervalAdd('day', -1 * ($now['wday']) - 1, $to);
unset($from);
break;
$from['d'] = $now['mday'];
$from['M'] = $now['mon'];
$from['Y'] = $now['year'];
- $from = self::intervalAdd('day', -1 * ($now['wday']), $from);
+ $from = self::intervalAdd('day', -1 * ($now['wday']), $from);
unset($to);
break;
$from['d'] = $now['mday'];
$from['M'] = $now['mon'];
$from['Y'] = $now['year'];
- $from = self::intervalAdd('day', -1 * ($now['wday']) - 1, $from);
+ $from = self::intervalAdd('day', -1 * ($now['wday']) - 1, $from);
unset($to);
break;
$to['Y'] = $now['year'];
$to['H'] = 23;
$to['i'] = $to['s'] = 59;
- $from = self::intervalAdd('day', -7, $to);
- $from = self::intervalAdd('second', 1, $from);
+ $from = self::intervalAdd('day', -7, $to);
+ $from = self::intervalAdd('second', 1, $from);
break;
case 'current':
$from['d'] = $now['mday'];
$from['M'] = $now['mon'];
$from['Y'] = $now['year'];
- $from = self::intervalAdd('day', -1 * ($now['wday']), $from);
+ $from = self::intervalAdd('day', -1 * ($now['wday']), $from);
$to['d'] = $now['mday'];
$to['M'] = $now['mon'];
$to['Y'] = $now['year'];
$from['d'] = $now['mday'];
$from['M'] = $now['mon'];
$from['Y'] = $now['year'];
- $from = self::intervalAdd('day', -1 * ($now['wday']) + 7, $from);
- $to = self::intervalAdd('day', + 6, $from);
+ $from = self::intervalAdd('day', -1 * ($now['wday']) + 7, $from);
+ $to = self::intervalAdd('day', +6, $from);
break;
case 'starting':
$from['Y'] = $now['year'];
$from['H'] = 00;
$from['i'] = $to['s'] = 00;
- $to = self::intervalAdd('day', + 7, $from);
- $to = self::intervalAdd('second', -1, $to);
+ $to = self::intervalAdd('day', +7, $from);
+ $to = self::intervalAdd('second', -1, $to);
break;
}
break;
$from['d'] = $now['mday'];
$from['M'] = $now['mon'];
$from['Y'] = $now['year'];
- $from = self::intervalAdd('day', -1, $from);
- $to['d'] = $from['d'];
- $to['M'] = $from['M'];
- $to['Y'] = $from['Y'];
+ $from = self::intervalAdd('day', -1, $from);
+ $to['d'] = $from['d'];
+ $to['M'] = $from['M'];
+ $to['Y'] = $from['Y'];
break;
case 'previous_before':
$from['d'] = $now['mday'];
$from['M'] = $now['mon'];
$from['Y'] = $now['year'];
- $from = self::intervalAdd('day', -2, $from);
- $to['d'] = $from['d'];
- $to['M'] = $from['M'];
- $to['Y'] = $from['Y'];
+ $from = self::intervalAdd('day', -2, $from);
+ $to['d'] = $from['d'];
+ $to['M'] = $from['M'];
+ $to['Y'] = $from['Y'];
break;
case 'previous_2':
$from['d'] = $to['d'] = $now['mday'];
$from['M'] = $to['M'] = $now['mon'];
$from['Y'] = $to['Y'] = $now['year'];
- $from = self::intervalAdd('day', -2, $from);
- $to = self::intervalAdd('day', -1, $to);
+ $from = self::intervalAdd('day', -2, $from);
+ $to = self::intervalAdd('day', -1, $to);
break;
case 'earlier':
break;
case 'starting':
- $to['d'] = $now['mday'];
- $to['M'] = $now['mon'];
- $to['Y'] = $now['year'];
- $to = self::intervalAdd('day', + 1, $to);
+ $to['d'] = $now['mday'];
+ $to['M'] = $now['mon'];
+ $to['Y'] = $now['year'];
+ $to = self::intervalAdd('day', +1, $to);
$from['d'] = $to['d'];
$from['M'] = $to['M'];
$from['Y'] = $to['Y'];
}
foreach (array(
- 'from', 'to') as $item) {
+ 'from',
+ 'to'
+ ) as $item) {
if (!empty($$item)) {
$dateRange[$item] = self::format($$item);
}
$currentYear = date("Y");
//recalculate the date because month 4::04 make the difference
- $fiscalYear = explode('-', date("Y-m-d", mktime(0, 0, 0, $fyMonth, $fyDate, $currentYear)));
- $fyDate = $fiscalYear[2];
- $fyMonth = $fiscalYear[1];
+ $fiscalYear = explode('-', date("Y-m-d", mktime(0, 0, 0, $fyMonth, $fyDate, $currentYear)));
+ $fyDate = $fiscalYear[2];
+ $fyMonth = $fiscalYear[1];
$fyStartDate = date("Y-m-d", mktime(0, 0, 0, $fyMonth, $fyDate, $currentYear));
if ($fyStartDate > $date) {
$format = NULL;
if ($formatType) {
$format = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_PreferencesDate',
- $formatType, 'date_format', 'name'
+ $formatType, 'date_format', 'name'
);
}
}
foreach (array(
- 'Phone', 'Email', 'IM', 'OpenID', 'Phone_Ext') as $block) {
+ 'Phone',
+ 'Email',
+ 'IM',
+ 'OpenID',
+ 'Phone_Ext'
+ ) as $block) {
$name = strtolower($block);
if (!array_key_exists($name, $values)) {
continue;
foreach ($mulValues as $v1) {
foreach ($customOption as $v2) {
if ((strtolower($v2['label']) == strtolower(trim($v1))) ||
- (strtolower($v2['value']) == strtolower(trim($v1)))) {
+ (strtolower($v2['value']) == strtolower(trim($v1)))
+ ) {
if ($htmlType == 'CheckBox') {
$newValues[$key][$v2['value']] = 1;
}
_civicrm_api3_store_values($fields['Address'], $values, $params['address'][$addressCnt]);
$addressFields = array(
- 'county', 'country', 'state_province',
- 'supplemental_address_1', 'supplemental_address_2',
+ 'county',
+ 'country',
+ 'state_province',
+ 'supplemental_address_1',
+ 'supplemental_address_2',
'StateProvince.name',
);
* @param <type> $params
*
* @return array
- * <type>
+ * <type>
*/
function _civicrm_api3_deprecated_duplicate_formatted_contact($params) {
$id = CRM_Utils_Array::value('id', $params);
* Contact subtype if exists/passed.
*
* @return null
- * on success, error message otherwise
+ * on success, error message otherwise
*/
function _civicrm_api3_deprecated_contact_check_custom_params($params, $csType = NULL) {
empty($csType) ? $onlyParent = TRUE : $onlyParent = FALSE;
* @param int $activityTypeID
*
* @return array
- * <type> $params
+ * <type> $params
*/
function _civicrm_api3_deprecated_activity_buildmailparams($result, $activityTypeID) {
// get ready for collecting data about activity to be created
// allow html/htm extension ONLY if the user is admin
// and/or has access CiviMail
if (!(CRM_Core_Permission::check('access CiviMail') ||
- CRM_Core_Permission::check('administer CiviCRM') ||
- (CRM_Mailing_Info::workflowEnabled() &&
- CRM_Core_Permission::check('create mailings')
- )
- )) {
+ CRM_Core_Permission::check('administer CiviCRM') ||
+ (CRM_Mailing_Info::workflowEnabled() &&
+ CRM_Core_Permission::check('create mailings')
+ )
+ )
+ ) {
unset($extensions['html']);
unset($extensions['htm']);
}
* @return string
*/
public static function makeFileName($name) {
- $uniqID = md5(uniqid(rand(), TRUE));
- $info = pathinfo($name);
+ $uniqID = md5(uniqid(rand(), TRUE));
+ $info = pathinfo($name);
$basename = substr($info['basename'],
0, -(strlen(CRM_Utils_Array::value('extension', $info)) + (CRM_Utils_Array::value('extension', $info) == '' ? 0 : 1))
);
* @return array
*/
public static function getFilesByExtension($path, $ext) {
- $path = self::addTrailingSlash($path);
+ $path = self::addTrailingSlash($path);
$files = array();
if ($dh = opendir($path)) {
while (FALSE !== ($elem = readdir($dh))) {
*/
public static function preProcess($formName, &$form) {
return self::singleton()
- ->invoke(2, $formName, $form, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_preProcess');
+ ->invoke(2, $formName, $form, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_preProcess');
}
/**
*/
function invoke(
$numParams,
- &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
- $fnSuffix
+ &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
+ $fnSuffix
) {
// ensure that we are running in a joomla context
// we've not yet figured out how to bootstrap joomla, so we should
*/
// distinguish between types of hook
- if (! in_array($fnSuffix, $this->hooksThatReturn)) {
+ if (!in_array($fnSuffix, $this->hooksThatReturn)) {
// only pass the arguments that have values
$args = array_slice(
}
-
/**
* Build the list of plugins ("modules" in CiviCRM terminology) to be processed for hooks.
* We need to do this to preserve the CiviCRM hook signatures for hooks that require
}
-
}
$sOutput .= '"' . addcslashes(str_replace(array("\r\n", "\n", "\r"), '<br />', $value[$element]), '"\\') . '"';
//remove extra spaces and tab character that breaks dataTable CRM-12551
- $sOutput = preg_replace("/\s+/", " ", $sOutput);
+ $sOutput = preg_replace("/\s+/", " ", $sOutput);
$addcomma = TRUE;
}
$sOutput .= "],";
* true if a mail was sent, else false
*/
public static function send(&$params) {
- $returnPath = CRM_Core_BAO_MailSettings::defaultReturnPath();
+ $returnPath = CRM_Core_BAO_MailSettings::defaultReturnPath();
$includeMessageId = CRM_Core_BAO_MailSettings::includeMessageId();
- $emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
- $from = CRM_Utils_Array::value('from', $params);
+ $emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
+ $from = CRM_Utils_Array::value('from', $params);
if (!$returnPath) {
$returnPath = self::pluckEmailFromHeader($from);
}
$htmlMessage = FALSE;
}
- $headers = array();
+ $headers = array();
// CRM-10699 support custom email headers
if (!empty($params['headers'])) {
$headers = array_merge($headers, $params['headers']);
}
$headers['From'] = $params['from'];
- $headers['To'] =
+ $headers['To'] =
self::formatRFC822Email(
CRM_Utils_Array::value('toName', $params),
CRM_Utils_Array::value('toEmail', $params),
*/
public static function errorMessage($mailer, $result) {
$message = '<p>' . ts('An error occurred when CiviCRM attempted to send an email (via %1). If you received this error after submitting on online contribution or event registration - the transaction was completed, but we were unable to send the email receipt.', array(
- 1 => 'SMTP')) . '</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>';
+ 1 => 'SMTP'
+ )) . '</p>' . '<p>' . ts('The mail library returned the following error message:') . '<br /><span class="font-red"><strong>' . $result->getMessage() . '</strong></span></p>' . '<p>' . ts('This is probably related to a problem in your Outbound Email Settings (Administer CiviCRM » System Settings » Outbound Email), OR the FROM email address specifically configured for your contribution page or event. Possible causes are:') . '</p>';
if (is_a($mailer, 'Mail_smtp')) {
$message .= '<ul>' . '<li>' . ts('Your SMTP Username or Password are incorrect.') . '</li>' . '<li>' . ts('Your SMTP Server (machine) name is incorrect.') . '</li>' . '<li>' . ts('You need to use a Port other than the default port 25 in your environment.') . '</li>' . '<li>' . ts('Your SMTP server is just not responding right now (it is down for some reason).') . '</li>';
}
$message .= '<li>' . ts('The FROM Email Address configured for this feature may not be a valid sender based on your email service provider rules.') . '</li>' . '</ul>' . '<p>' . ts('Check <a href="%1">this page</a> for more information.', array(
- 1 => CRM_Utils_System::docURL2('user/advanced-configuration/email-system-configuration', TRUE))) . '</p>';
+ 1 => CRM_Utils_System::docURL2('user/advanced-configuration/email-system-configuration', TRUE)
+ )) . '</p>';
return $message;
}
$html = preg_replace('/(<html)(.+?xmlns=["\'].[^\s]+["\'])(.+)?(>)/', '\1\3\4', $html);
file_put_contents($pdf_filename, CRM_Utils_PDF_Utils::html2pdf($html,
- $fileName,
- TRUE,
- $format)
+ $fileName,
+ TRUE,
+ $format)
);
return array(
'fullPath' => $pdf_filename,
* fix this to return true on success / false on failure etc
*/
public static function processBounces() {
- $dao = new CRM_Core_DAO_MailSettings;
- $dao->domain_id = CRM_Core_Config::domainID();
+ $dao = new CRM_Core_DAO_MailSettings;
+ $dao->domain_id = CRM_Core_Config::domainID();
$dao->is_default = TRUE;
$dao->find();
* @return void
*/
public static function processActivities() {
- $dao = new CRM_Core_DAO_MailSettings;
- $dao->domain_id = CRM_Core_Config::domainID();
+ $dao = new CRM_Core_DAO_MailSettings;
+ $dao->domain_id = CRM_Core_Config::domainID();
$dao->is_default = FALSE;
$dao->find();
$found = FALSE;
$emailActivityTypeId =
(defined('EMAIL_ACTIVITY_TYPE_ID') && EMAIL_ACTIVITY_TYPE_ID) ? EMAIL_ACTIVITY_TYPE_ID : CRM_Core_OptionGroup::getValue(
'activity_type',
- 'Inbound Email',
- 'name'
- );
+ 'Inbound Email',
+ 'name'
+ );
if (!$emailActivityTypeId) {
CRM_Core_Error::fatal(ts('Could not find a valid Activity Type ID for Inbound Email'));
}
- $config = CRM_Core_Config::singleton();
- $verpSeperator = preg_quote($config->verpSeparator);
+ $config = CRM_Core_Config::singleton();
+ $verpSeperator = preg_quote($config->verpSeparator);
$twoDigitStringMin = $verpSeperator . '(\d+)' . $verpSeperator . '(\d+)';
- $twoDigitString = $twoDigitStringMin . $verpSeperator;
- $threeDigitString = $twoDigitString . '(\d+)' . $verpSeperator;
+ $twoDigitString = $twoDigitStringMin . $verpSeperator;
+ $threeDigitString = $twoDigitString . '(\d+)' . $verpSeperator;
// FIXME: legacy regexen to handle CiviCRM 2.1 address patterns, with domain id and possible VERP part
$commonRegex = '/^' . preg_quote($dao->localpart) . '(b|bounce|c|confirm|o|optOut|r|reply|re|e|resubscribe|u|unsubscribe)' . $threeDigitString . '([0-9a-f]{16})(-.*)?@' . preg_quote($dao->domain) . '$/';
try {
$store = CRM_Mailing_MailStore::getStore($dao->name);
}
- catch(Exception$e) {
+ catch (Exception$e) {
$message = ts('Could not connect to MailStore for ') . $dao->username . '@' . $dao->server . '<p>';
$message .= ts('Error message: ');
$message .= '<pre>' . $e->getMessage() . '</pre><p>';
!trim(file_get_contents($file))
) {
return CRM_Core_Error::createAPIError(ts('%1 does not exists or is empty',
- array(1 => $file)
- ));
+ array(1 => $file)
+ ));
}
require_once 'ezc/Base/src/ezc_bootstrap.php';
require_once 'ezc/autoload/mail_autoload.php';
// explode email to digestable format
- $set = new ezcMailFileSet(array($file));
+ $set = new ezcMailFileSet(array($file));
$parser = new ezcMailParser();
- $mail = $parser->parseMail($set);
+ $mail = $parser->parseMail($set);
if (!$mail) {
return CRM_Core_Error::createAPIError(ts('%1 could not be parsed',
- array(1 => $file)
- ));
+ array(1 => $file)
+ ));
}
// since we only have one fileset
$config = CRM_Core_Config::singleton();
for ($i = 0; $i < count($attachments); $i++) {
$attachNum = $i + 1;
- $fileName = basename($attachments[$i]['fullName']);
- $newName = CRM_Utils_File::makeFileName($fileName);
- $location = $config->uploadDir . $newName;
+ $fileName = basename($attachments[$i]['fullName']);
+ $newName = CRM_Utils_File::makeFileName($fileName);
+ $location = $config->uploadDir . $newName;
// move file to the civicrm upload directory
rename($attachments[$i]['fullName'], $location);
* @return array
*/
public function exportDAO($objectName, $object, $mappedFields) {
- $dbFields = & $object->fields();
+ $dbFields = &$object->fields();
// Filter the list of keys and values so that we only export interesting stuff
$keyValues = array();
if (isset($object->$name) && $object->$name !== NULL) {
// hack for extends_entity_column_value
if ($name == 'extends_entity_column_value') {
- if (in_array($object->extends, array('Event', 'Activity', 'Relationship', 'Individual', 'Organization', 'Household', 'Case'))) {
+ if (in_array($object->extends, array(
+ 'Event',
+ 'Activity',
+ 'Relationship',
+ 'Individual',
+ 'Organization',
+ 'Household',
+ 'Case'
+ ))) {
if ($object->extends == 'Event') {
$key = 'event_type';
}
elseif ($object->extends == 'Relationship') {
$key = 'relationship_type';
}
- elseif($object->extends == 'Case') {
+ elseif ($object->extends == 'Case') {
$key = 'case_type';
}
$types = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($object->$name, 1, -1));
*/
public function auxTable($tables) {
foreach ($tables as $tableName => $daoName) {
- $fields = & $this->dbFields($daoName, TRUE);
+ $fields = &$this->dbFields($daoName, TRUE);
$sql = "SELECT * from $tableName";
$this->sql($sql, $tableName, $fields);
FROM civicrm_option_group
WHERE name IN ( $nameString )
";
- $fields = & $this->dbFields('CRM_Core_DAO_OptionGroup', TRUE);
+ $fields = &$this->dbFields('CRM_Core_DAO_OptionGroup', TRUE);
$this->sql($sql, 'civicrm_option_group', $fields);
$sql = "
INNER JOIN civicrm_option_group g ON v.option_group_id = g.id
WHERE g.name IN ( $nameString )
";
- $fields = & $this->dbFields('CRM_Core_DAO_OptionValue', TRUE);
+ $fields = &$this->dbFields('CRM_Core_DAO_OptionValue', TRUE);
$this->sql($sql, 'civicrm_option_value', $fields);
}
* @param $fields
*/
public function sql($sql, $tableName, &$fields) {
- $dao = & CRM_Core_DAO::executeQuery($sql);
+ $dao = &CRM_Core_DAO::executeQuery($sql);
while ($dao->fetch()) {
$value = array();
* @param $contactIDs
*/
public function contact(&$contactIDs) {
- $fields = & $this->dbFields('CRM_Contact_DAO_Contact', TRUE);
+ $fields = &$this->dbFields('CRM_Contact_DAO_Contact', TRUE);
$this->table($contactIDs, 'civicrm_contact', $fields, 'id', NULL);
}
* @param $contactIDs
*/
public function note(&$contactIDs) {
- $fields = & $this->dbFields('CRM_Core_DAO_Note', TRUE);
+ $fields = &$this->dbFields('CRM_Core_DAO_Note', TRUE);
$this->table($contactIDs, 'civicrm_note', $fields, 'entity_id', "entity_table = 'civicrm_contact'");
}
* @param $contactIDs
*/
public function phone(&$contactIDs) {
- $fields = & $this->dbFields('CRM_Core_DAO_Phone', TRUE);
+ $fields = &$this->dbFields('CRM_Core_DAO_Phone', TRUE);
$this->table($contactIDs, 'civicrm_phone', $fields, 'contact_id', NULL);
}
* @param $contactIDs
*/
public function email(&$contactIDs) {
- $fields = & $this->dbFields('CRM_Core_DAO_Email', TRUE);
+ $fields = &$this->dbFields('CRM_Core_DAO_Email', TRUE);
$this->table($contactIDs, 'civicrm_email', $fields, 'contact_id', NULL);
}
* @param $contactIDs
*/
public function im(&$contactIDs) {
- $fields = & $this->dbFields('CRM_Core_DAO_IM', TRUE);
+ $fields = &$this->dbFields('CRM_Core_DAO_IM', TRUE);
$this->table($contactIDs, 'civicrm_im', $fields, 'contact_id', NULL);
}
* @param $contactIDs
*/
public function website(&$contactIDs) {
- $fields = & $this->dbFields('CRM_Core_DAO_Website', TRUE);
+ $fields = &$this->dbFields('CRM_Core_DAO_Website', TRUE);
$this->table($contactIDs, 'civicrm_website', $fields, 'contact_id', NULL);
}
* @param $contactIDs
*/
public function address(&$contactIDs) {
- $fields = & $this->dbFields('CRM_Core_DAO_Email', TRUE);
+ $fields = &$this->dbFields('CRM_Core_DAO_Email', TRUE);
$this->table($contactIDs, 'civicrm_address', $fields, 'contact_id', NULL);
}
* @param $contactIDs
*/
public function groupContact(&$contactIDs) {
- $fields = & $this->dbFields('CRM_Contact_DAO_GroupContact', TRUE);
+ $fields = &$this->dbFields('CRM_Contact_DAO_GroupContact', TRUE);
$this->table($contactIDs, 'civicrm_group_contact', $fields, 'contact_id', NULL);
}
}
}
- $fields = & $this->dbFields('CRM_Contact_DAO_Group', TRUE);
+ $fields = &$this->dbFields('CRM_Contact_DAO_Group', TRUE);
$this->table($groupIDs, 'civicrm_group', $fields, 'id');
$this->savedSearch($groupIDs);
WHERE g.id IN ( $idString )
";
- $fields = & $this->dbFields('CRM_Contact_DAO_SavedSearch', TRUE);
+ $fields = &$this->dbFields('CRM_Contact_DAO_SavedSearch', TRUE);
$this->sql($sql, 'civicrm_saved_search', $fields);
}
* @param $contactIDs
*/
public function entityTag(&$contactIDs) {
- $fields = & $this->dbFields('CRM_Core_DAO_EntityTag', TRUE);
+ $fields = &$this->dbFields('CRM_Core_DAO_EntityTag', TRUE);
$this->table($contactIDs, 'civicrm_entity_tag', $fields, 'entity_id', "entity_table = 'civicrm_contact'");
}
}
}
- $fields = & $this->dbFields('CRM_Core_DAO_Tag', TRUE);
+ $fields = &$this->dbFields('CRM_Core_DAO_Tag', TRUE);
$this->table($tagIDs, 'civicrm_tag', $fields, 'id');
}
";
$fields = $this->dbFields('CRM_Contact_DAO_Relationship', TRUE);
- $dao = & CRM_Core_DAO::executeQuery($sql);
+ $dao = &CRM_Core_DAO::executeQuery($sql);
while ($dao->fetch()) {
if (isset($_relationshipsHandled[$dao->id])) {
continue;
AND (a.activity_type_id != 3 AND a.activity_type_id != 20)
";
- $fields = & $this->dbFields('CRM_Activity_DAO_Activity', TRUE);
+ $fields = &$this->dbFields('CRM_Activity_DAO_Activity', TRUE);
- $dao = & CRM_Core_DAO::executeQuery($sql);
+ $dao = &CRM_Core_DAO::executeQuery($sql);
while ($dao->fetch()) {
// adding source, target and assignee contacts in additional contacts array
$this->addAdditionalContacts(array($dao->contact_id),
if (!isset($_fieldsRetrieved[$daoName])) {
$_fieldsRetrieved[$daoName] = array();
$daoFile = str_replace('_',
- DIRECTORY_SEPARATOR,
- $daoName
- ) . '.php';
+ DIRECTORY_SEPARATOR,
+ $daoName
+ ) . '.php';
include_once $daoFile;
- $daoFields = & $daoName::fields();
+ $daoFields = &$daoName::fields();
foreach ($daoFields as $key => & $value) {
$_fieldsRetrieved[$daoName][$value['name']] = array(
* @param $contactIDs
*/
public function export(&$contactIDs) {
- $chunks = & $this->splitContactIDs($contactIDs);
+ $chunks = &$this->splitContactIDs($contactIDs);
$additionalContactIDs = array();
public function run($file) {
// read xml file
$dom = new DomDocument();
- if (! $dom->load($file)) {
+ if (!$dom->load($file)) {
throw new CRM_Core_Exception("Failed to parse XML file \"$file\"");
}
$dom->xinclude();
}
}
- $fields = & $dao->fields();
+ $fields = &$dao->fields();
foreach ($fields as $name => $dontCare) {
if (isset($xml->$name)) {
$value = (string ) $xml->$name;
// fix extends stuff if it exists
if (isset($customGroupXML->extends_entity_column_value_option_group) &&
- isset($customGroupXML->extends_entity_column_value)) {
+ isset($customGroupXML->extends_entity_column_value)
+ ) {
$valueIDs = array();
$optionValues = explode(",", $customGroupXML->extends_entity_column_value);
$optValues = implode("','", $optionValues);
'String',
),
);
- $dao = & CRM_Core_DAO::executeQuery($sql, $params);
+ $dao = &CRM_Core_DAO::executeQuery($sql, $params);
while ($dao->fetch()) {
$valueIDs[] = $dao->value;
}
if (!empty($valueIDs)) {
$customGroup->extends_entity_column_value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
- $valueIDs
- ) . CRM_Core_DAO::VALUE_SEPARATOR;
+ $valueIDs
+ ) . CRM_Core_DAO::VALUE_SEPARATOR;
unset($valueIDs);
if (is_array($optionIDs) && !empty($optionIDs)) {
$customGroup->extends_entity_column_value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
- array_keys($optionIDs)
- ) . CRM_Core_DAO::VALUE_SEPARATOR;
+ array_keys($optionIDs)
+ ) . CRM_Core_DAO::VALUE_SEPARATOR;
$saveAgain = TRUE;
}
$cfID = CRM_Core_DAO::singleValueQuery($sql, $params);
if (!$cfID) {
CRM_Core_Error::fatal(ts("Could not find custom field for %1, %2, %3",
- array(
- 1 => $profileField->field_name,
- 2 => $tableName,
- 3 => $columnName,
- )
- ) . "<br />");
+ array(
+ 1 => $profileField->field_name,
+ 2 => $tableName,
+ 3 => $columnName,
+ )
+ ) . "<br />");
}
$profileField->field_name = "custom_{$cfID}";
}
* @param null $dateFields
*/
public function restore(&$chunk, $daoName, $lookUpMapping = NULL, $dateFields = NULL) {
- $object = new $daoName();
+ $object = new $daoName();
$tableName = $object->__table;
if (is_array($lookUpMapping)) {
$columns = $chunk[0];
foreach ($chunk as $key => $value) {
if ($key) {
- $object = new $daoName();
+ $object = new $daoName();
foreach ($columns as $k => $column) {
if ($column == 'id') {
$childID = $value[$k];
}
if (!self::$_currencySymbols) {
- self::$_currencySymbols = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', array('keyColumn' => 'name', 'labelColumn' => 'symbol'));
+ self::$_currencySymbols = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', array(
+ 'keyColumn' => 'name',
+ 'labelColumn' => 'symbol'
+ ));
}
if (!$currency) {
* @static
*/
private static $_colours = array(
- "#C3CC38", "#C8B935", "#CEA632", "#D3932F",
- "#D9802C", "#FA6900", "#DC9B57", "#F78F01",
- "#5AB56E", "#6F8069", "#C92200", "#EB6C5C",
+ "#C3CC38",
+ "#C8B935",
+ "#CEA632",
+ "#D3932F",
+ "#D9802C",
+ "#FA6900",
+ "#DC9B57",
+ "#F78F01",
+ "#5AB56E",
+ "#6F8069",
+ "#C92200",
+ "#EB6C5C",
);
/**
$xLabels = new x_axis_labels();
// set_labels function requires xValues array of string or x_axis_label
// so type casting array values to string values
- array_walk($xValues, function(&$value, $index) {
+ array_walk($xValues, function (&$value, $index) {
$value = (string) $value;
});
$xLabels->set_labels($xValues);
// carry some chart params if pass.
foreach (array(
- 'xSize', 'ySize', 'divName') as $f) {
+ 'xSize',
+ 'ySize',
+ 'divName'
+ ) as $f) {
if (!empty($rows[$f])) {
$chartData[$f] = $rows[$f];
}
// carry some chart params if pass.
foreach (array(
- 'xSize', 'ySize', 'divName') as $f) {
+ 'xSize',
+ 'ySize',
+ 'divName'
+ ) as $f) {
if (!empty($rows[$f])) {
$chartData[$f] = $rows[$f];
}
// PDF Page Format ID passed in
$format = CRM_Core_BAO_PdfFormat::getById($pdfFormat);
}
- $paperSize = CRM_Core_BAO_PaperSize::getByName($format['paper_size']);
- $paper_width = self::convertMetric($paperSize['width'], $paperSize['metric'], 'pt');
+ $paperSize = CRM_Core_BAO_PaperSize::getByName($format['paper_size']);
+ $paper_width = self::convertMetric($paperSize['width'], $paperSize['metric'], 'pt');
$paper_height = self::convertMetric($paperSize['height'], $paperSize['metric'], 'pt');
// dompdf requires dimensions in points
- $paper_size = array(0, 0, $paper_width, $paper_height);
+ $paper_size = array(0, 0, $paper_width, $paper_height);
$orientation = CRM_Core_BAO_PdfFormat::getValue('orientation', $format);
- $metric = CRM_Core_BAO_PdfFormat::getValue('metric', $format);
- $t = CRM_Core_BAO_PdfFormat::getValue('margin_top', $format);
- $r = CRM_Core_BAO_PdfFormat::getValue('margin_right', $format);
- $b = CRM_Core_BAO_PdfFormat::getValue('margin_bottom', $format);
- $l = CRM_Core_BAO_PdfFormat::getValue('margin_left', $format);
+ $metric = CRM_Core_BAO_PdfFormat::getValue('metric', $format);
+ $t = CRM_Core_BAO_PdfFormat::getValue('margin_top', $format);
+ $r = CRM_Core_BAO_PdfFormat::getValue('margin_right', $format);
+ $b = CRM_Core_BAO_PdfFormat::getValue('margin_bottom', $format);
+ $l = CRM_Core_BAO_PdfFormat::getValue('margin_left', $format);
- $stationery_path_partial = CRM_Core_BAO_PdfFormat::getValue('stationery', $format);
+ $stationery_path_partial = CRM_Core_BAO_PdfFormat::getValue('stationery', $format);
$stationery_path = NULL;
if (strlen($stationery_path_partial)) {
$stationery_path = $doc_root . "/" . $stationery_path_partial;
}
- $margins = array($metric, $t, $r, $b, $l);
+ $margins = array($metric, $t, $r, $b, $l);
$config = CRM_Core_Config::singleton();
$html = "
require_once 'tcpdf/tcpdf.php';
require_once 'FPDI/fpdi.php'; // This library is only in the 'packages' area as of version 4.5
- $paper_size_arr = array($paper_size[2], $paper_size[3]);
+ $paper_size_arr = array($paper_size[2], $paper_size[3]);
$pdf = new TCPDF($orientation, 'pt', $paper_size_arr);
$pdf->Open();
return $buf;
}
}
- catch(PDFlibException$excp) {
+ catch (PDFlibException$excp) {
CRM_Core_Error::statusBounce('PDFlib Error: Exception' .
"[" . $excp->get_errnum() . "] " . $excp->get_apiname() . ": " .
$excp->get_errmsg()
);
}
- catch(Exception$excp) {
+ catch (Exception$excp) {
CRM_Core_Error::statusBounce("PDFlib Error: " . $excp->get_errmsg());
}
}
* page variable, but a different form element for one at the bottom
*
*/
- $this->_response['titleTop'] = ts('Page %1 of %2', array(1 => '<input size="2" maxlength="3" name="' . self::PAGE_ID . '" type="text" value="' . $this->_response['currentPage'] . '" />', 2 => $this->_response['numPages']));
- $this->_response['titleBottom'] = ts('Page %1 of %2', array(1 => '<input size="2" maxlength="3" name="' . self::PAGE_ID_BOTTOM . '" type="text" value="' . $this->_response['currentPage'] . '" />', 2 => $this->_response['numPages']));
+ $this->_response['titleTop'] = ts('Page %1 of %2', array(
+ 1 => '<input size="2" maxlength="3" name="' . self::PAGE_ID . '" type="text" value="' . $this->_response['currentPage'] . '" />',
+ 2 => $this->_response['numPages']
+ ));
+ $this->_response['titleBottom'] = ts('Page %1 of %2', array(
+ 1 => '<input size="2" maxlength="3" name="' . self::PAGE_ID_BOTTOM . '" type="text" value="' . $this->_response['currentPage'] . '" />',
+ 2 => $this->_response['numPages']
+ ));
}
/**
}
$href = $this->makeURL(self::PAGE_ID, 1);
return $this->formatLink($href, str_replace('%d', 1, $this->_altFirst), $this->_firstPagePre . $this->_firstPageText . $this->_firstPagePost) .
- $this->_spacesBefore . $this->_spacesAfter;
+ $this->_spacesBefore . $this->_spacesAfter;
}
/**
if ($this->_currentPage < $this->_totalPages) {
$href = $this->makeURL(self::PAGE_ID, $this->getNextPageID());
return $this->_spacesAfter .
- $this->formatLink($href, $this->_altNext, $this->_nextImg) .
- $this->_spacesBefore . $this->_spacesAfter;
+ $this->formatLink($href, $this->_altNext, $this->_nextImg) .
+ $this->_spacesBefore . $this->_spacesAfter;
}
return '';
}
* @static
*/
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');
+ $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;
}
* @return string
*/
public static function jsonFormated($json) {
- $tabcount = 0;
- $result = '';
- $inquote = FALSE;
- $inarray = FALSE;
+ $tabcount = 0;
+ $result = '';
+ $inquote = FALSE;
+ $inarray = FALSE;
$ignorenext = FALSE;
$tab = "\t";
'action' => 1,
);
- if (array_key_exists('json', $requestParams) && $requestParams['json'][0] == "{") {
+ if (array_key_exists('json', $requestParams) && $requestParams['json'][0] == "{") {
$params = json_decode($requestParams['json'], TRUE);
if ($params === NULL) {
CRM_Utils_JSON::output(array('is_error' => 1, 'error_message', 'Unable to decode supplied JSON.'));
}
/** used to load a template "inline", eg. for ajax, without having to build a menu for each template */
- static function loadTemplate () {
+ static function loadTemplate() {
$request = CRM_Utils_Request::retrieve('q', 'String');
if (FALSE !== strpos($request, '..')) {
die ("SECURITY FATAL: the url can't contain '..'. Please report the issue on the forum at civicrm.org");
unset($param['q']);
$smarty->assign_by_ref("request", $param);
- if (! array_key_exists('HTTP_X_REQUESTED_WITH', $_SERVER) ||
- $_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest" ) {
+ if (!array_key_exists('HTTP_X_REQUESTED_WITH', $_SERVER) ||
+ $_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest"
+ ) {
$smarty->assign('tplFile', $tpl);
$config = CRM_Core_Config::singleton();
- $content = $smarty->fetch('CRM/common/'. strtolower($config->userFramework) .'.tpl');
+ $content = $smarty->fetch('CRM/common/' . strtolower($config->userFramework) . '.tpl');
if (!defined('CIVICRM_UF_HEAD') && $region = CRM_Core_Region::instance('html-header', FALSE)) {
CRM_Utils_System::addHTMLHead($region->render(''));
// Why is $config undefined -- $config = CRM_Core_Config::singleton();
if (!$config->debug && (!array_key_exists('HTTP_X_REQUESTED_WITH', $_SERVER) ||
$_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest"
- )) {
+ )
+ ) {
$error = civicrm_api3_create_error("SECURITY ALERT: Ajax requests can only be issued by javascript clients, eg. CRM.api3().",
array(
'IP' => $_SERVER['REMOTE_ADDR'],
$entity = CRM_Utils_String::munge(CRM_Utils_Array::value('entity', $requestParams));
$action = CRM_Utils_String::munge(CRM_Utils_Array::value('action', $requestParams));
if (!is_array($params)) {
- CRM_Utils_JSON::output(array('is_error' => 1, 'error_message', 'invalid json format: ?{"param_with_double_quote":"value"}'));
+ CRM_Utils_JSON::output(array(
+ 'is_error' => 1,
+ 'error_message',
+ 'invalid json format: ?{"param_with_double_quote":"value"}'
+ ));
}
$params['check_permissions'] = TRUE;
$uid = NULL;
if (!$uid) {
- $store = NULL;
- $api_key = CRM_Utils_Request::retrieve('api_key', 'String', $store, FALSE, NULL, 'REQUEST');
+ $store = NULL;
+ $api_key = CRM_Utils_Request::retrieve('api_key', 'String', $store, FALSE, NULL, 'REQUEST');
if (empty($api_key)) {
return self::error("FATAL: mandatory param 'api_key' (user key) missing");
}
* Add element to form
*/
public static function add(&$form) {
- $error = NULL;
+ $error = NULL;
$config = CRM_Core_Config::singleton();
$useSSL = FALSE;
if (!function_exists('recaptcha_get_html')) {
// make sure item is not already present in list
for ($i = 0; $i < count($tempRecent); $i++) {
if (!($tempRecent[$i]['id'] == $recentItem['id'] &&
- $tempRecent[$i]['type'] == $recentItem['type']
- )) {
+ $tempRecent[$i]['type'] == $recentItem['type']
+ )
+ ) {
self::$_recent[] = $tempRecent[$i];
}
}
//CRM-14868
$currencySymbols = CRM_Core_PseudoConstant::get(
- 'CRM_Contribute_DAO_Contribution',
- 'currency', array(
- 'keyColumn' => 'name',
- 'labelColumn' => 'symbol',
- ));
+ 'CRM_Contribute_DAO_Contribution',
+ 'currency', array(
+ 'keyColumn' => 'name',
+ 'labelColumn' => 'symbol',
+ ));
$value = str_replace($currencySymbols, '', $value);
if ($config->monetaryThousandSeparator) {
*/
const ASCENDING = 1, DESCENDING = 2, DONTCARE = 4,
- /**
- * The name for the sort GET/POST param
- *
- * @var string
- */
- SORT_ID = 'crmSID', SORT_DIRECTION = 'crmSortDirection', SORT_ORDER = 'crmSortOrder';
+ /**
+ * The name for the sort GET/POST param
+ *
+ * @var string
+ */
+ SORT_ID = 'crmSID', SORT_DIRECTION = 'crmSortDirection', SORT_ORDER = 'crmSortOrder';
/**
* Name of the sort function. Used to isolate session variables
if ($_searchChars == NULL) {
$_searchChars = array(
- '&', ';', ',', '=', '$',
- '"', "'", '\\',
- '<', '>', '(', ')',
- ' ', "\r", "\r\n", "\n", "\t",
+ '&',
+ ';',
+ ',',
+ '=',
+ '$',
+ '"',
+ "'",
+ '\\',
+ '<',
+ '>',
+ '(',
+ ')',
+ ' ',
+ "\r",
+ "\r\n",
+ "\n",
+ "\t",
);
$_replaceChar = '_';
}
$offset = floor(($len - $maskCount) / 2);
$masked = substr($user, 0, $offset)
- . str_repeat($maskChar, $maskCount)
- . substr($user, $maskCount + $offset);
+ . str_repeat($maskChar, $maskCount)
+ . substr($user, $maskCount + $offset);
return ($masked . '@' . $domain);
}
}
if ($request->getResponseCode() != 200) {
CRM_Core_Error::fatal(ts('Invalid response code received from Sunlight servers: %1',
- array(1 => $request->getResponseCode())
- ));
+ array(1 => $request->getResponseCode())
+ ));
}
$string = $request->getResponseBody();
return simplexml_load_string($string);
) {
return NULL;
}
- $key = self::$_apiKey;
+ $key = self::$_apiKey;
$city = urlencode($city);
- $uri = "people.reps.getRepsFromCityState.php?city={$city}&state={$state}&apikey={$key}&output=xml";
+ $uri = "people.reps.getRepsFromCityState.php?city={$city}&state={$state}&apikey={$key}&output=xml";
return self::getPeopleInfo($uri);
}
public static function getLinksUrl($urlVar, $includeReset = FALSE, $includeForce = TRUE, $skipUFVar = TRUE) {
// Sort out query string to prevent messy urls
$querystring = array();
- $qs = array();
- $arrays = array();
+ $qs = array();
+ $arrays = array();
if (!empty($_SERVER['QUERY_STRING'])) {
$qs = explode('&', str_replace('&', '&', $_SERVER['QUERY_STRING']));
$config->userFrameworkResourceURL = str_replace('http://', 'https://', $config->userFrameworkResourceURL);
$config->resourceBase = $config->userFrameworkResourceURL;
- if (! empty($config->extensionsURL)) {
+ if (!empty($config->extensionsURL)) {
$config->extensionsURL = str_replace('http://', 'https://', $config->extensionsURL);
}
$s = ob_get_contents();
ob_end_clean();
- $s = strip_tags($s, '<h2><th><td>');
- $s = preg_replace('/<th[^>]*>([^<]+)<\/th>/', "<info>\\1</info>", $s);
- $s = preg_replace('/<td[^>]*>([^<]+)<\/td>/', "<info>\\1</info>", $s);
- $vTmp = preg_split('/(<h2>[^<]+<\/h2>)/', $s, -1, PREG_SPLIT_DELIM_CAPTURE);
+ $s = strip_tags($s, '<h2><th><td>');
+ $s = preg_replace('/<th[^>]*>([^<]+)<\/th>/', "<info>\\1</info>", $s);
+ $s = preg_replace('/<td[^>]*>([^<]+)<\/td>/', "<info>\\1</info>", $s);
+ $vTmp = preg_split('/(<h2>[^<]+<\/h2>)/', $s, -1, PREG_SPLIT_DELIM_CAPTURE);
$vModules = array();
for ($i = 1; $i < count($vTmp); $i++) {
if (preg_match('/<h2>([^<]+)<\/h2>/', $vTmp[$i], $vMat)) {
$vName = trim($vMat[1]);
$vTmp2 = explode("\n", $vTmp[$i + 1]);
foreach ($vTmp2 as $vOne) {
- $vPat = '<info>([^<]+)<\/info>';
+ $vPat = '<info>([^<]+)<\/info>';
$vPat3 = "/$vPat\s*$vPat\s*$vPat/";
$vPat2 = "/$vPat\s*$vPat/";
// 3cols
if ($abort) {
CRM_Core_Error::fatal(ts('This feature requires PHP Version %1 or greater',
- array(1 => $ver)
- ));
+ array(1 => $ver)
+ ));
}
return FALSE;
}
array(dirname(__FILE__), '..', '..', 'xml', 'version.xml')
);
if (file_exists($verFile)) {
- $str = file_get_contents($verFile);
- $xmlObj = simplexml_load_string($str);
+ $str = file_get_contents($verFile);
+ $xmlObj = simplexml_load_string($str);
$version = (string) $xmlObj->version_no;
}
}
$headers[str_replace(' ',
'-',
ucwords(strtolower(str_replace('_',
- ' ',
- substr($name, 5)
- )
- ))
+ ' ',
+ substr($name, 5)
+ )
+ ))
)] = $value;
}
}
// if db.ver > code.ver, sth really wrong
if (version_compare($dbVersion, $codeVersion) > 0) {
$errorMessage = '<p>' . ts('Your database is marked with an unexpected version number: %1. The v%2 codebase may not be compatible with your database state. You will need to determine the correct version corresponding to your current database state. You may want to revert to the codebase you were using until you resolve this problem.',
- array(1 => $dbVersion, 2 => $codeVersion)
- ) . '</p>';
+ array(1 => $dbVersion, 2 => $codeVersion)
+ ) . '</p>';
$errorMessage .= "<p>" . ts('OR if this is a manual install from git, you might want to fix civicrm-version.php file.') . "</p>";
return FALSE;
}
// reset various static arrays used here
CRM_Contact_BAO_Contact::$_importableFields =
- CRM_Contact_BAO_Contact::$_exportableFields =
- CRM_Contribute_BAO_Contribution::$_importableFields =
- CRM_Contribute_BAO_Contribution::$_exportableFields =
- CRM_Pledge_BAO_Pledge::$_exportableFields =
- CRM_Contribute_BAO_Query::$_contributionFields =
- CRM_Core_BAO_CustomField::$_importFields =
- CRM_Core_BAO_Cache::$_cache =
- CRM_Core_DAO::$_dbColumnValueCache = NULL;
+ CRM_Contact_BAO_Contact::$_exportableFields =
+ CRM_Contribute_BAO_Contribution::$_importableFields =
+ CRM_Contribute_BAO_Contribution::$_exportableFields =
+ CRM_Pledge_BAO_Pledge::$_exportableFields =
+ CRM_Contribute_BAO_Query::$_contributionFields =
+ CRM_Core_BAO_CustomField::$_importFields =
+ CRM_Core_BAO_Cache::$_cache =
+ CRM_Core_DAO::$_dbColumnValueCache = NULL;
CRM_Core_OptionGroup::flushAll();
CRM_Utils_PseudoConstant::flushAll();
DIRECTORY_SEPARATOR . 'sites' .
DIRECTORY_SEPARATOR . 'all' .
DIRECTORY_SEPARATOR . 'modules'
- ) === FALSE) {
+ ) === FALSE
+ ) {
$startPos = strpos($civicrm_root,
DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR
);
public function getUserRecordUrl($contactID) {
return NULL;
}
+
/**
* Is the current user permitted to add a user
* @return bool
public static function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
$config = CRM_Core_Config::singleton();
- $dao = new CRM_Core_DAO();
- $name = $dao->escape(CRM_Utils_Array::value('name', $params));
- $email = $dao->escape(CRM_Utils_Array::value('mail', $params));
+ $dao = new CRM_Core_DAO();
+ $name = $dao->escape(CRM_Utils_Array::value('name', $params));
+ $email = $dao->escape(CRM_Utils_Array::value('mail', $params));
$errors = form_get_errors();
if ($errors) {
// unset drupal messages to avoid twice display of errors
/**
* Add a script file
*
- * @param $url: string, absolute path to file
+ * @param $url : string, absolute path to file
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
/**
* Add an inline script
*
- * @param $code: string, javascript code
+ * @param $code : string, javascript code
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
/**
* Add a css file
*
- * @param $url: string, absolute path to file
+ * @param $url : string, absolute path to file
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
/**
* Add an inline style
*
- * @param $code: string, css code
+ * @param $code : string, css code
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
require_once "$cmsPath/includes/password.inc";
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
- $name = $dbDrupal->escapeSimple($strtolower($name));
- $sql = "
+ $name = $dbDrupal->escapeSimple($strtolower($name));
+ $sql = "
SELECT u.*
FROM {$config->userFrameworkUsersTableName} u
WHERE LOWER(u.name) = '$name'
//kinda hackish but not sure how to do it right
//hope http_build_url() will help at some point.
if (is_array($parseUrl) && !empty($parseUrl)) {
- $urlParts = explode('/', $url);
- $hostKey = array_search($parseUrl['host'], $urlParts);
- $ufUrlParts = parse_url(CIVICRM_UF_BASEURL);
+ $urlParts = explode('/', $url);
+ $hostKey = array_search($parseUrl['host'], $urlParts);
+ $ufUrlParts = parse_url(CIVICRM_UF_BASEURL);
$urlParts[$hostKey] = $ufUrlParts['host'];
- $url = implode('/', $urlParts);
+ $url = implode('/', $urlParts);
}
}
}
}
return $timezone;
}
+
/**
* Reset any system caches that may be required for proper CiviCRM
* integration.
public function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
$config = CRM_Core_Config::singleton();
- $dao = new CRM_Core_DAO();
- $name = $dao->escape(CRM_Utils_Array::value('name', $params));
+ $dao = new CRM_Core_DAO();
+ $name = $dao->escape(CRM_Utils_Array::value('name', $params));
$email = $dao->escape(CRM_Utils_Array::value('mail', $params));
_user_edit_validate(NULL, $params);
$errors = form_get_errors();
/**
* Add a script file
*
- * @param $url: string, absolute path to file
+ * @param $url : string, absolute path to file
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
/**
* Add an inline script
*
- * @param $code: string, javascript code
+ * @param $code : string, javascript code
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
/**
* Add a css file
*
- * @param $url: string, absolute path to file
+ * @param $url : string, absolute path to file
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
/**
* Add an inline style
*
- * @param $code: string, css code
+ * @param $code : string, css code
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
}
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
- $dbpassword = md5($password);
- $name = $dbDrupal->escapeSimple($strtolower($name));
- $sql = 'SELECT u.* FROM ' . $config->userFrameworkUsersTableName . " u WHERE LOWER(u.name) = '$name' AND u.pass = '$dbpassword' AND u.status = 1";
- $query = $dbDrupal->query($sql);
+ $dbpassword = md5($password);
+ $name = $dbDrupal->escapeSimple($strtolower($name));
+ $sql = 'SELECT u.* FROM ' . $config->userFrameworkUsersTableName . " u WHERE LOWER(u.name) = '$name' AND u.pass = '$dbpassword' AND u.status = 1";
+ $query = $dbDrupal->query($sql);
$user = NULL;
// need to change this to make sure we matched only one row
$bootStrapParams = array();
if ($name && $password) {
$bootStrapParams = array(
- 'name' => $name,
- 'pass' => $password,
+ 'name' => $name,
+ 'pass' => $password,
);
}
CRM_Utils_System::loadBootStrap($bootStrapParams, TRUE, TRUE, $realPath);
$language->prefix &&
in_array($mode, array(
LANGUAGE_NEGOTIATION_PATH,
- LANGUAGE_NEGOTIATION_PATH_DEFAULT,
- ))
+ LANGUAGE_NEGOTIATION_PATH_DEFAULT,
+ ))
) {
if ($addLanguagePart) {
//kinda hackish but not sure how to do it right
//hope http_build_url() will help at some point.
if (is_array($parseUrl) && !empty($parseUrl)) {
- $urlParts = explode('/', $url);
- $hostKey = array_search($parseUrl['host'], $urlParts);
- $ufUrlParts = parse_url(CIVICRM_UF_BASEURL);
+ $urlParts = explode('/', $url);
+ $hostKey = array_search($parseUrl['host'], $urlParts);
+ $ufUrlParts = parse_url(CIVICRM_UF_BASEURL);
$urlParts[$hostKey] = $ufUrlParts['host'];
- $url = implode('/', $urlParts);
+ $url = implode('/', $urlParts);
}
}
}
// This checks for both username uniqueness and validity.
$violations = iterator_to_array($user->validate());
// We only care about violations on the username field; discard the rest.
- $violations = array_filter($violations, function ($v) { return $v->getPropertyPath() == 'name.0.value';
+ $violations = array_filter($violations, function ($v) {
+ return $v->getPropertyPath() == 'name.0.value';
});
if (count($violations) > 0) {
$errors['cms_name'] = $violations[0]->getMessage();
// This checks for both email uniqueness.
$violations = iterator_to_array($user->validate());
// We only care about violations on the email field; discard the rest.
- $violations = array_filter($violations, function ($v) { return $v->getPropertyPath() == 'mail.0.value';
+ $violations = array_filter($violations, function ($v) {
+ return $v->getPropertyPath() == 'mail.0.value';
});
if (count($violations) > 0) {
$errors[$emailName] = $violations[0]->getMessage();
/**
* Add a script file
*
- * @param $url: string, absolute path to file
+ * @param $url : string, absolute path to file
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
/**
* Add an inline script
*
- * @param $code: string, javascript code
+ * @param $code : string, javascript code
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
/**
* Add a css file
*
- * @param $url: string, absolute path to file
+ * @param $url : string, absolute path to file
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
/**
* Add an inline style
*
- * @param $code: string, css code
+ * @param $code : string, css code
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
* @var bool
*/
var $supports_UF_Logging = TRUE;
+
/**
*/
public function __construct() {
*/
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'))) {
+ 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);
};
}
}
}
}
+
/**
* Format the url as per language Negotiation.
*
//kinda hackish but not sure how to do it right
//hope http_build_url() will help at some point.
if (is_array($parseUrl) && !empty($parseUrl)) {
- $urlParts = explode('/', $url);
- $hostKey = array_search($parseUrl['host'], $urlParts);
- $ufUrlParts = parse_url(CIVICRM_UF_BASEURL);
+ $urlParts = explode('/', $url);
+ $hostKey = array_search($parseUrl['host'], $urlParts);
+ $ufUrlParts = parse_url(CIVICRM_UF_BASEURL);
$urlParts[$hostKey] = $ufUrlParts['host'];
- $url = implode('/', $urlParts);
+ $url = implode('/', $urlParts);
}
}
}
return CRM_Core_I18n_PseudoConstant::longForShort(substr($language->language, 0, 2));
}
+
/**
* Perform any post login activities required by the UF -
* e.g. for drupal: records a watchdog message about the new session, saves the login timestamp,
require_once $baseDir . '/components/com_users/models/registration.php';
$userParams = JComponentHelper::getParams('com_users');
- $model = new UsersModelRegistration();
- $ufID = NULL;
+ $model = new UsersModelRegistration();
+ $ufID = NULL;
// get the default usertype
$userType = $userParams->get('new_usertype');
}
// Prepare the values for a new Joomla user.
- $values = array();
- $values['name'] = $fullname;
- $values['username'] = trim($params['cms_name']);
+ $values = array();
+ $values['name'] = $fullname;
+ $values['username'] = trim($params['cms_name']);
$values['password1'] = $values['password2'] = $params['cms_pass'];
- $values['email1'] = $values['email2'] = trim($params[$mail]);
+ $values['email1'] = $values['email2'] = trim($params[$mail]);
$lang = JFactory::getLanguage();
$lang->load('com_users', $baseDir);
public function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
$config = CRM_Core_Config::singleton();
- $dao = new CRM_Core_DAO();
- $name = $dao->escape(CRM_Utils_Array::value('name', $params));
+ $dao = new CRM_Core_DAO();
+ $name = $dao->escape(CRM_Utils_Array::value('name', $params));
$email = $dao->escape(CRM_Utils_Array::value('mail', $params));
//don't allow the special characters and min. username length is two
//regex \\ to match a single backslash would become '/\\\\/'
/**
* Add a script file
*
- * @param $url: string, absolute path to file
+ * @param $url : string, absolute path to file
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
/**
* Add an inline script
*
- * @param $code: string, javascript code
+ * @param $code : string, javascript code
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
/**
* Add a css file
*
- * @param $url: string, absolute path to file
+ * @param $url : string, absolute path to file
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
/**
* Add an inline style
*
- * @param $code: string, css code
+ * @param $code : string, css code
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
$fragment = NULL, $htmlize = TRUE,
$frontend = FALSE, $forceBackend = FALSE
) {
- $config = CRM_Core_Config::singleton();
+ $config = CRM_Core_Config::singleton();
$separator = $htmlize ? '&' : '&';
- $Itemid = '';
- $script = '';
- $path = CRM_Utils_String::stripPathChars($path);
+ $Itemid = '';
+ $script = '';
+ $path = CRM_Utils_String::stripPathChars($path);
if ($config->userFrameworkFrontend) {
$script = 'index.php';
*
* @return mixed false if no auth
* array(
- contactID, ufID, unique string ) if success
+ * contactID, ufID, unique string ) if success
*/
public function authenticate($name, $password, $loadCMSBootstrap = FALSE) {
require_once 'DB.php';
// load BootStrap here if needed
// We are a valid Joomla entry point.
- if (! defined('_JEXEC') && $loadDefines) {
+ if (!defined('_JEXEC') && $loadDefines) {
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
define('JPATH_BASE', $joomlaBase . '/administrator');
$user = JFactory::getUser();
return $this->getUniqueIdentifierFromUserObject($user);
}
+
/**
* Get User ID from UserFramework system (Joomla)
* @param object $user
/**
* Add a script file
*
- * @param $url: string, absolute path to file
+ * @param $url : string, absolute path to file
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
/**
* Add an inline script
*
- * @param $code: string, javascript code
+ * @param $code : string, javascript code
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
/**
* Add a css file
*
- * @param $url: string, absolute path to file
+ * @param $url : string, absolute path to file
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
/**
* Add an inline style
*
- * @param $code: string, css code
+ * @param $code : string, css code
* @param string $region
* location within the document: 'html-header', 'page-header', 'page-footer'.
*
$frontend = FALSE,
$forceBackend = FALSE
) {
- $config = CRM_Core_Config::singleton();
- $script = '';
+ $config = CRM_Core_Config::singleton();
+ $script = '';
$separator = $htmlize ? '&' : '&';
- $wpPageParam = '';
+ $wpPageParam = '';
$fragment = isset($fragment) ? ('#' . $fragment) : '';
$path = CRM_Utils_String::stripPathChars($path);
* @return mixed|null|string
*/
private function getBaseUrl($absolute, $frontend, $forceBackend) {
- $config = CRM_Core_Config::singleton();
+ $config = CRM_Core_Config::singleton();
if (!isset($config->useFrameworkRelativeBase)) {
$base = parse_url($config->userFrameworkBaseURL);
public function updateCMSName($ufID, $ufName) {
// CRM-10620
if (function_exists('wp_update_user')) {
- $ufID = CRM_Utils_Type::escape($ufID, 'Integer');
+ $ufID = CRM_Utils_Type::escape($ufID, 'Integer');
$ufName = CRM_Utils_Type::escape($ufName, 'String');
$values = array('ID' => $ufID, 'user_email' => $ufName);
public function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
$config = CRM_Core_Config::singleton();
- $dao = new CRM_Core_DAO();
- $name = $dao->escape(CRM_Utils_Array::value('name', $params));
+ $dao = new CRM_Core_DAO();
+ $name = $dao->escape(CRM_Utils_Array::value('name', $params));
$email = $dao->escape(CRM_Utils_Array::value('mail', $params));
if (!empty($params['name'])) {
*/
public function getLoggedInUserObject() {
if (function_exists('is_user_logged_in') &&
- is_user_logged_in()) {
+ is_user_logged_in()
+ ) {
global $current_user;
}
return $current_user;
}
+
/**
* Get currently logged in user uf id.
*
*/
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'))) {
+ 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;
}
}
) {
$key = 'domain';
if (
- !$knownTokens || empty($knownTokens[$key])) {
+ !$knownTokens || empty($knownTokens[$key])
+ ) {
return $str;
}
$str = preg_replace_callback(
self::tokenRegex($key),
- function ($matches) use(&$domain, $html, $escapeSmarty) {
- return CRM_Utils_Token::getDomainTokenReplacement($matches[1], $domain, $html, $escapeSmarty);
+ function ($matches) use (&$domain, $html, $escapeSmarty) {
+ return CRM_Utils_Token::getDomainTokenReplacement($matches[1], $domain, $html, $escapeSmarty);
},
$str
);
$str = preg_replace_callback(
self::tokenRegex($key),
- function ($matches) use(&$mailing, $escapeSmarty) {
- return CRM_Utils_Token::getMailingTokenReplacement($matches[1], $mailing, $escapeSmarty);
+ function ($matches) use (&$mailing, $escapeSmarty) {
+ return CRM_Utils_Token::getMailingTokenReplacement($matches[1], $mailing, $escapeSmarty);
},
$str
);
$str = preg_replace_callback(
self::tokenRegex($key),
- function ($matches) use(&$addresses, &$urls, $html, $escapeSmarty) {
- return CRM_Utils_Token::getActionTokenReplacement($matches[1], $addresses, $urls, $html, $escapeSmarty);
+ function ($matches) use (&$addresses, &$urls, $html, $escapeSmarty) {
+ return CRM_Utils_Token::getActionTokenReplacement($matches[1], $addresses, $urls, $html, $escapeSmarty);
},
$str
);
$str = preg_replace_callback(
self::tokenRegex($key),
- function ($matches) use(&$contact, $html, $returnBlankToken, $escapeSmarty) {
- return CRM_Utils_Token::getContactTokenReplacement($matches[1], $contact, $html, $returnBlankToken, $escapeSmarty);
+ function ($matches) use (&$contact, $html, $returnBlankToken, $escapeSmarty) {
+ return CRM_Utils_Token::getContactTokenReplacement($matches[1], $contact, $html, $returnBlankToken, $escapeSmarty);
},
$str
);
}
if ($escapeSmarty
- && !($returnBlankToken && $noReplace)) { // $returnBlankToken means the caller wants to do further attempts at processing unreplaced tokens -- so don't escape them yet in this case.
+ && !($returnBlankToken && $noReplace)
+ ) { // $returnBlankToken means the caller wants to do further attempts at processing unreplaced tokens -- so don't escape them yet in this case.
$value = self::tokenEscapeSmarty($value);
}
foreach ($categories as $key) {
$str = preg_replace_callback(
self::tokenRegex($key),
- function ($matches) use(&$contact, $key, $html, $escapeSmarty) {
- return CRM_Utils_Token::getHookTokenReplacement($matches[1], $contact, $key, $html, $escapeSmarty);
+ function ($matches) use (&$contact, $key, $html, $escapeSmarty) {
+ return CRM_Utils_Token::getHookTokenReplacement($matches[1], $contact, $key, $html, $escapeSmarty);
},
$str
);
if (preg_match('/\{action\.subscribe.\d+\}/', $str, $matches)) {
foreach ($matches as $key => $value) {
- $gid = substr($value, 18, -1);
- $config = CRM_Core_Config::singleton();
- $domain = CRM_Core_BAO_MailSettings::defaultDomain();
+ $gid = substr($value, 18, -1);
+ $config = CRM_Core_Config::singleton();
+ $domain = CRM_Core_BAO_MailSettings::defaultDomain();
$localpart = CRM_Core_BAO_MailSettings::defaultLocalpart();
// we add the 0.0000000000000000 part to make this match the other email patterns (with action, two ids and a hash)
$str = preg_replace('/' . preg_quote($value) . '/', "mailto:{$localpart}s.{$gid}.0.0000000000000000@$domain", $str);
$returnProperties = array();
$matches = array();
preg_match_all('/(?<!\{|\\\\)\{(\w+\.\w+)\}(?!\})/',
- $string,
- $matches,
- PREG_PATTERN_ORDER
- );
+ $string,
+ $matches,
+ PREG_PATTERN_ORDER
+ );
if ($matches[1]) {
foreach ($matches[1] as $token) {
list($type, $name) = preg_split('/\./', $token, 2);
* @param $contactIDs
* @param array $returnProperties
* Of required properties.
- * @param bool $skipOnHoldDon't return on_hold contact info also.
+ * @param bool $skipOnHoldDon 't return on_hold contact info also.
* Don't return on_hold contact info also.
- * @param bool $skipDeceasedDon't return deceased contact info.
+ * @param bool $skipDeceasedDon 't return deceased contact info.
* Don't return deceased contact info.
* @param array $extraParams
* Extra params.
foreach ($contactIDs as $key => $contactID) {
$params[] = array(
CRM_Core_Form::CB_PREFIX . $contactID,
- '=', 1, 0, 0,
+ '=',
+ 1,
+ 0,
+ 0,
);
}
//special case for greeting replacement
foreach (array(
- 'email_greeting', 'postal_greeting', 'addressee') as $val) {
+ 'email_greeting',
+ 'postal_greeting',
+ 'addressee'
+ ) as $val) {
if (!empty($contactDetails[$contactID][$val])) {
$contactDetails[$contactID][$val] = $contactDetails[$contactID]["{$val}_display"];
}
* contactDetails with hooks swapped out
*/
public function getAnonymousTokenDetails($contactIDs = array(
- 0),
- $returnProperties = NULL,
- $skipOnHold = TRUE,
- $skipDeceased = TRUE,
- $extraParams = NULL,
- $tokens = array(),
- $className = NULL,
- $jobID = NULL) {
+ 0
+ ),
+ $returnProperties = NULL,
+ $skipOnHold = TRUE,
+ $skipDeceased = TRUE,
+ $extraParams = NULL,
+ $tokens = array(),
+ $className = NULL,
+ $jobID = NULL) {
$details = array(0 => array());
// also call a hook and get token details
CRM_Utils_Hook::tokenValues($details[0],
* Array of membership IDS.
*/
public static function getMembershipTokenDetails($membershipIDs) {
- $memberships = civicrm_api3('membership', 'get', array('options' => array('limit' => 200000), 'membership_id' => array('IN' => (array) $membershipIDs)));
+ $memberships = civicrm_api3('membership', 'get', array(
+ 'options' => array('limit' => 200000),
+ 'membership_id' => array('IN' => (array) $membershipIDs)
+ ));
return $memberships['values'];
}
+
/**
* Replace greeting tokens exists in message/subject
*/
$flattenTokens = array();
foreach (array(
- 'html', 'text', 'subject') as $prop) {
+ 'html',
+ 'text',
+ 'subject'
+ ) as $prop) {
if (!isset($tokens[$prop])) {
continue;
}
$str = preg_replace_callback(
self::tokenRegex($key),
- function ($matches) use($escapeSmarty) {
- return CRM_Utils_Token::getUserTokenReplacement($matches[1], $escapeSmarty);
+ function ($matches) use ($escapeSmarty) {
+ return CRM_Utils_Token::getUserTokenReplacement($matches[1], $escapeSmarty);
},
$str
);
$key = 'contribution';
if (self::$_tokens[$key] == NULL) {
self::$_tokens[$key] = array_keys(array_merge(CRM_Contribute_BAO_Contribution::exportableFields('All'),
- array('campaign', 'financial_type')
- ));
+ array('campaign', 'financial_type')
+ ));
}
}
$str = preg_replace_callback(
self::tokenRegex($key),
- function ($matches) use(&$contribution, $html, $escapeSmarty) {
- return CRM_Utils_Token::getContributionTokenReplacement($matches[1], $contribution, $html, $escapeSmarty);
+ function ($matches) use (&$contribution, $html, $escapeSmarty) {
+ return CRM_Utils_Token::getContributionTokenReplacement($matches[1], $contribution, $html, $escapeSmarty);
},
$str
);
case 'fee':
try {
- $value = civicrm_api3('membership_type', 'getvalue', array('id' => $membership['membership_type_id'], 'return' => 'minimum_fee'));
+ $value = civicrm_api3('membership_type', 'getvalue', array(
+ 'id' => $membership['membership_type_id'],
+ 'return' => 'minimum_fee'
+ ));
}
catch (CiviCRM_API3_Exception $e) {
// we can anticipate we will get an error if the minimum fee is set to 'NULL' because of the way the
* @param array (ref) $parentNode which parent node should we search in ?
*
* @return array(
- ref) | false node if found else false
+ * ref) | false node if found else false
*/
//public function &findNode(&$parentNode, $name)
public function &findNode($name, &$parentNode) {
* Check if node is a leaf node.
* Currently leaf nodes are strings and non-leaf nodes are arrays
*
- * @param array(
- ref) $node node which needs to checked
+ * @param array (
+ * ref) $node node which needs to checked
*
* @return boolean
*/
* (ref)
*/
public function &createNode($name) {
- $node['name'] = $name;
+ $node['name'] = $name;
$node['children'] = array();
- $node['data'] = array();
+ $node['data'] = array();
return $node;
}
*/
class CRM_Utils_Type {
const
- T_INT = 1,
- T_STRING = 2,
- T_ENUM = 2,
- T_DATE = 4,
- T_TIME = 8,
- T_BOOLEAN = 16,
- T_TEXT = 32,
- T_LONGTEXT = 32,
- T_BLOB = 64,
- T_TIMESTAMP = 256,
- T_FLOAT = 512,
- T_MONEY = 1024,
- T_EMAIL = 2048,
- T_URL = 4096,
- T_CCNUM = 8192,
+ T_INT = 1,
+ T_STRING = 2,
+ T_ENUM = 2,
+ T_DATE = 4,
+ T_TIME = 8,
+ T_BOOLEAN = 16,
+ T_TEXT = 32,
+ T_LONGTEXT = 32,
+ T_BLOB = 64,
+ T_TIMESTAMP = 256,
+ T_FLOAT = 512,
+ T_MONEY = 1024,
+ T_EMAIL = 2048,
+ T_URL = 4096,
+ T_CCNUM = 8192,
T_MEDIUMBLOB = 16384;
// @todo What's the point of these constants? Backwards compatibility?
const
- TWO = 2,
- FOUR = 4,
- SIX = 6,
- EIGHT = 8,
- TWELVE = 12,
- SIXTEEN = 16,
- TWENTY = 20,
- MEDIUM = 20,
- THIRTY = 30,
- BIG = 30,
+ TWO = 2,
+ FOUR = 4,
+ SIX = 6,
+ EIGHT = 8,
+ TWELVE = 12,
+ SIXTEEN = 16,
+ TWENTY = 20,
+ MEDIUM = 20,
+ THIRTY = 30,
+ BIG = 30,
FORTYFIVE = 45,
- HUGE = 45;
+ HUGE = 45;
/**
* Gets the string representation for a data type.
return $data;
}
}
- elseif (!is_numeric($data) && CRM_Core_DAO::escapeString($data)) {
+ elseif (!is_numeric($data) && CRM_Core_DAO::escapeString($data)) {
return $data;
}
elseif (CRM_Utils_Rule::positiveInteger($data)) {
public static function &verpdecode($address) {
preg_match('/^(.+)-([^=]+)=([^\@]+)\@(.+)/', $address, $match);
- $slocal = $match[1];
- $rlocal = $match[2];
+ $slocal = $match[1];
+ $rlocal = $match[2];
$rdomain = $match[3];
$sdomain = $match[4];
foreach ($this->versionInfo as $majorVersion) {
foreach ($majorVersion['releases'] as $release) {
if (!empty($release['security']) && $release['date'] > $localVersionDate
- && version_compare($this->localVersion, $release['version']) < 0) {
+ && version_compare($this->localVersion, $release['version']) < 0
+ ) {
if (!$this->ignoreDate || $this->ignoreDate < $release['date']) {
return TRUE;
}
<li><a class="crm-setVersionCheckIgnoreDate" href="' . $settingsUrl . '">' . ts('Suppress this message') . '</a></li>
</ul>';
$session->setStatus($msg, ts('Security Alert'), 'alert');
- CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Admin/Form/Setting/versionCheckOptions.js');
+ CRM_Core_Resources::singleton()
+ ->addScriptFile('civicrm', 'templates/CRM/Admin/Form/Setting/versionCheckOptions.js');
}
}
elseif (CRM_Core_Permission::check('administer CiviCRM') && $versionAlertSetting > 1) {
<li><a class="crm-setVersionCheckIgnoreDate" href="' . $settingsUrl . '">' . ts('Suppress this message') . '</a></li>
</ul>';
$session->setStatus($msg, ts('Update Available'), 'info');
- CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Admin/Form/Setting/versionCheckOptions.js');
+ CRM_Core_Resources::singleton()
+ ->addScriptFile('civicrm', 'templates/CRM/Admin/Form/Setting/versionCheckOptions.js');
}
}
}
if ($minDupeID->dupeId) {
$additionalWhere = "id !=" . $minDupeID->dupeId . " AND $weightField >= " . $minDupeID->dupeWeight;
- $update = "$weightField = $weightField + 1";
- $status = CRM_Utils_Weight::query('UPDATE', $daoName, $fieldValues, $update, $additionalWhere);
+ $update = "$weightField = $weightField + 1";
+ $status = CRM_Utils_Weight::query('UPDATE', $daoName, $fieldValues, $update, $additionalWhere);
}
if ($minDupeID->dupeId && $status) {
// fill the gap
$additionalWhere = "$weightField > $weight";
- $update = "$weightField = $weightField - 1";
- $status = CRM_Utils_Weight::query('UPDATE', $daoName, $fieldValues, $update, $additionalWhere);
+ $update = "$weightField = $weightField - 1";
+ $status = CRM_Utils_Weight::query('UPDATE', $daoName, $fieldValues, $update, $additionalWhere);
return $status;
}
* @return integer
*/
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);
+ $selectField = "id AS fieldID, $weightField AS weight";
+ $field = CRM_Utils_Weight::query('SELECT', $daoName, $fieldValues, $selectField);
$sameWeightCount = 0;
- $weights = array();
+ $weights = array();
while ($field->fetch()) {
if (in_array($field->weight, $weights)) {
$sameWeightCount++;
*/
static function &query(
$queryType,
- $daoName,
- $fieldValues = NULL,
- $queryData,
- $additionalWhere = NULL,
- $orderBy = NULL,
- $groupBy = NULL
- ) {
+ $daoName,
+ $fieldValues = NULL,
+ $queryData,
+ $additionalWhere = NULL,
+ $orderBy = NULL,
+ $groupBy = NULL
+ ) {
require_once str_replace('_', DIRECTORY_SEPARATOR, $daoName) . ".php";
- $dao = new $daoName;
- $table = $dao->getTablename();
- $fields = &$dao->fields();
+ $dao = new $daoName;
+ $table = $dao->getTablename();
+ $fields = &$dao->fields();
$fieldlist = array_keys($fields);
$whereConditions = array();
}
$fieldNum++;
$whereConditions[] = "$fieldName = %$fieldNum";
- $fieldType = $fields[$fieldName]['type'];
+ $fieldType = $fields[$fieldName]['type'];
$params[$fieldNum] = array($value, CRM_Utils_Type::typeToString($fieldType));
}
}
$ids = array_keys($rows);
$numIDs = count($ids);
array_unshift($ids, 0);
- $ids[] = 0;
+ $ids[] = 0;
$firstID = $ids[1];
- $lastID = $ids[$numIDs];
+ $lastID = $ids[$numIDs];
if ($firstID == $lastID) {
$rows[$firstID]['order'] = NULL;
return;
}
- $config = CRM_Core_Config::singleton();
- $imageURL = $config->userFrameworkResourceURL . 'i/arrow';
+ $config = CRM_Core_Config::singleton();
+ $imageURL = $config->userFrameworkResourceURL . 'i/arrow';
$queryParams = array(
'reset' => 1,
$baseURL = CRM_Utils_System::url('civicrm/admin/weight', $queryParams);
for ($i = 1; $i <= $numIDs; $i++) {
- $id = $ids[$i];
+ $id = $ids[$i];
$prevID = $ids[$i - 1];
$nextID = $ids[$i + 1];
$signer = new CRM_Utils_Signer(CRM_Core_Key::privateKey(), self::$SIGNABLE_FIELDS);
// Validate $_GET values b/c subsequent code reads $_GET (via CRM_Utils_Request::retrieve)
- if (! $signer->validate($signature, $_GET)) {
+ if (!$signer->validate($signature, $_GET)) {
CRM_Core_Error::fatal('Request signature is invalid');
}
// Note: Ensure this list matches self::$SIGNABLE_FIELDS
$daoName = CRM_Utils_Request::retrieve('dao', 'String', CRM_Core_DAO::$_nullObject);
- $id = CRM_Utils_Request::retrieve('id', 'Integer', CRM_Core_DAO::$_nullObject);
- $idName = CRM_Utils_Request::retrieve('idName', 'String', CRM_Core_DAO::$_nullObject);
- $url = CRM_Utils_Request::retrieve('url', 'String', CRM_Core_DAO::$_nullObject);
- $filter = CRM_Utils_Request::retrieve('filter', 'String', CRM_Core_DAO::$_nullObject);
- $src = CRM_Utils_Request::retrieve('src', 'Integer', CRM_Core_DAO::$_nullObject);
- $dst = CRM_Utils_Request::retrieve('dst', 'Integer', CRM_Core_DAO::$_nullObject);
- $dir = CRM_Utils_Request::retrieve('dir', 'String', CRM_Core_DAO::$_nullObject);
- $object = new $daoName();
+ $id = CRM_Utils_Request::retrieve('id', 'Integer', CRM_Core_DAO::$_nullObject);
+ $idName = CRM_Utils_Request::retrieve('idName', 'String', CRM_Core_DAO::$_nullObject);
+ $url = CRM_Utils_Request::retrieve('url', 'String', CRM_Core_DAO::$_nullObject);
+ $filter = CRM_Utils_Request::retrieve('filter', 'String', CRM_Core_DAO::$_nullObject);
+ $src = CRM_Utils_Request::retrieve('src', 'Integer', CRM_Core_DAO::$_nullObject);
+ $dst = CRM_Utils_Request::retrieve('dst', 'Integer', CRM_Core_DAO::$_nullObject);
+ $dir = CRM_Utils_Request::retrieve('dir', 'String', CRM_Core_DAO::$_nullObject);
+ $object = new $daoName();
$srcWeight = CRM_Core_DAO::getFieldValue($daoName, $src, 'weight', $idName);
$dstWeight = CRM_Core_DAO::getFieldValue($daoName, $dst, 'weight', $idName);
if ($srcWeight == $dstWeight) {
$query = "UPDATE $tableName SET weight = %1 WHERE $idName = %2";
$params = array(
- 1 => array($dstWeight, 'Integer'),
- 2 => array($src, 'Integer'),
+ 1 => array($dstWeight, 'Integer'),
+ 2 => array($src, 'Integer'),
);
CRM_Core_DAO::executeQuery($query, $params);
if ($dir == 'swap') {
$params = array(
- 1 => array($srcWeight, 'Integer'),
- 2 => array($dst, 'Integer'),
+ 1 => array($srcWeight, 'Integer'),
+ 2 => array($dst, 'Integer'),
);
CRM_Core_DAO::executeQuery($query, $params);
}
$query .= " AND $filter";
}
$params = array(
- 1 => array($src, 'Integer'),
- 2 => array($srcWeight, 'Integer'),
+ 1 => array($src, 'Integer'),
+ 2 => array($srcWeight, 'Integer'),
);
CRM_Core_DAO::executeQuery($query, $params);
}
$query .= " AND $filter";
}
$params = array(
- 1 => array($src, 'Integer'),
- 2 => array($srcWeight, 'Integer'),
+ 1 => array($src, 'Integer'),
+ 2 => array($srcWeight, 'Integer'),
);
CRM_Core_DAO::executeQuery($query, $params);
}
*/
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);
- $addSequence = (bool) CRM_Utils_Array::value('addSequence', $arguments, FALSE);
+ $mode = CRM_Utils_Array::value('mode', $arguments);
+ $imageUpload = (bool) CRM_Utils_Array::value('imageUpload', $arguments, FALSE);
+ $addSequence = (bool) CRM_Utils_Array::value('addSequence', $arguments, FALSE);
$attachUpload = (bool) CRM_Utils_Array::value('attachUpload', $arguments, FALSE);
- $ignoreKey = (bool) CRM_Utils_Array::value('ignoreKey', $arguments, FALSE);
+ $ignoreKey = (bool) CRM_Utils_Array::value('ignoreKey', $arguments, FALSE);
}
else {
- $arguments = array();
- $mode = NULL;
+ $arguments = array();
+ $mode = NULL;
$addSequence = $ignoreKey = $imageUpload = $attachUpload = FALSE;
}
if (array_key_exists('urlToSession', $arguments)) {
if (is_array($arguments['urlToSession'])) {
foreach ($arguments['urlToSession'] as $params) {
- $urlVar = CRM_Utils_Array::value('urlVar', $params);
+ $urlVar = CRM_Utils_Array::value('urlVar', $params);
$sessionVar = CRM_Utils_Array::value('sessionVar', $params);
- $type = CRM_Utils_Array::value('type', $params);
- $default = CRM_Utils_Array::value('default', $params);
- $abort = CRM_Utils_Array::value('abort', $params, FALSE);
+ $type = CRM_Utils_Array::value('type', $params);
+ $default = CRM_Utils_Array::value('default', $params);
+ $abort = CRM_Utils_Array::value('abort', $params, FALSE);
$value = NULL;
$value = CRM_Utils_Request::retrieve(
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*/
-
class CRM_Utils_XML {
/**
$xml = FALSE; // SimpleXMLElement
$error = FALSE; // string
- if (! file_exists($file)) {
+ if (!file_exists($file)) {
$error = 'File ' . $file . ' does not exist.';
}
else {