Skip to content

Commit

Permalink
Merge pull request #115 from seamuslee001/issue-110b
Browse files Browse the repository at this point in the history
Resolve #110 Sync repo with CiviCRM-Drupal repo
  • Loading branch information
seamuslee001 authored Oct 12, 2020
2 parents e13ccbe + 5df8351 commit e20f086
Show file tree
Hide file tree
Showing 35 changed files with 630 additions and 71 deletions.
12 changes: 12 additions & 0 deletions civicrm.config.php.backdrop
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function civicrm_conf_init() {
// to the script that invokes it
$moduleDir = 'sites' . DIRECTORY_SEPARATOR . 'all' . DIRECTORY_SEPARATOR . 'modules';
$contribDir = $moduleDir . DIRECTORY_SEPARATOR . 'contrib';
$profileDir = DIRECTORY_SEPARATOR . 'profiles' . DIRECTORY_SEPARATOR;
// check to see if this is under sites/all/modules/contrib or subdir civicrm-core
if (strpos($currentDir, $contribDir) !== FALSE || strpos($currentDir, 'civicrm-core') !== FALSE) {
$confdir = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..';
Expand All @@ -66,6 +67,17 @@ function civicrm_conf_init() {
elseif (strpos($currentDir, $moduleDir) !== FALSE) {
$confdir = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..';
}
// check to see if this is under profiles/[PROFILE]/modules
elseif (strpos($currentDir, $profileDir) !== FALSE) {
// check to see if this is under profiles/[PROFILE]/modules/contrib
if (strpos($currentDir, "contrib") !== FALSE) {
$sublevels = 5;
}
else {
$sublevels = 4;
}
$confdir = $currentDir . str_repeat('..' . DIRECTORY_SEPARATOR, $sublevels) . 'sites';
}
else {
$confdir = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
}
Expand Down
22 changes: 13 additions & 9 deletions civicrm.module
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ define('CIVICRM_UF_HEAD', TRUE);
* on PHP 5.x.)
*
* @see CRM_Upgrade_Incremental_General::MIN_INSTALL_PHP_VER
* @see CiviDrupal\PhpVersionTest::testConstantMatch()
* @see CiviBackdrop\PhpVersionTest::testConstantMatch()
*/
define('CIVICRM_DRUPAL_PHP_MINIMUM', '7.1.0');
define('CIVICRM_BACKDROP_PHP_MINIMUM', '7.1.0');

/**
* Adds CiviCRM CSS and JS resources into the header.
Expand Down Expand Up @@ -173,7 +173,7 @@ function civicrm_menu_alter(&$items) {
* Display profile form in tabs on user account
*/
function civicrm_profile_form($form, &$form_state, $account, $profile_name) {
$output = civicrm_form_data($account, $profile_name, TRUE);
$output = civicrm_form_data($form, $account, $profile_name, TRUE);
if (!empty($output)) {
$form['#attributes']['enctype'] = 'multipart/form-data';
$form = array_merge($form, $output);
Expand Down Expand Up @@ -239,8 +239,8 @@ function civicrm_profile_form_validate($form, &$form_state) {
*/
function civicrm_initialize() {
// Check for php version and ensure its greater than minPhpVersion
if (version_compare(PHP_VERSION, CIVICRM_DRUPAL_PHP_MINIMUM) < 0) {
echo "CiviCRM requires PHP " . CIVICRM_DRUPAL_PHP_MINIMUM . "+. The web server is running PHP " . PHP_VERSION . ".<p>";
if (version_compare(PHP_VERSION, CIVICRM_BACKDROP_PHP_MINIMUM) < 0) {
echo "CiviCRM requires PHP " . CIVICRM_BACKDROP_PHP_MINIMUM . "+. The web server is running PHP " . PHP_VERSION . ".<p>";
exit();
}
_civicrm_registerClassLoader();
Expand Down Expand Up @@ -609,7 +609,7 @@ function civicrm_user_form_validate($form, &$form_state) {
// lets suppress key generation for all validation also
civicrm_key_disable();

static $validated = FALSE;
$validated = &backdrop_static(__FUNCTION__, FALSE);

if ($validated) {
return;
Expand Down Expand Up @@ -646,7 +646,7 @@ function civicrm_user_form_validate($form, &$form_state) {
*
* @return array $output
*/
function civicrm_form_data($account, $profile, $reset, $doNotProcess = FALSE) {
function civicrm_form_data($edit, $account, $profile, $reset, $doNotProcess = FALSE) {
// lets suppress key generation for all CMS forms
civicrm_key_disable();

Expand Down Expand Up @@ -675,10 +675,10 @@ function civicrm_form_data($account, $profile, $reset, $doNotProcess = FALSE) {
// do not allow edit for anon users in joomla frontend, CRM-4668, unless u have checksum CRM-5228
$config = CRM_Core_Config::singleton();
if ($config->userFrameworkFrontend) {
CRM_Contact_BAO_Contact_Permission::validateOnlyChecksum($userID, $this);
CRM_Contact_BAO_Contact_Permission::validateOnlyChecksum($userID, $edit);
}
else {
CRM_Contact_BAO_Contact_Permission::validateChecksumContact($userID, $this);
CRM_Contact_BAO_Contact_Permission::validateChecksumContact($userID, $edit);
}
}
$ctype = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $userID, 'contact_type');
Expand Down Expand Up @@ -881,6 +881,7 @@ function civicrm_autoload_info() {
'civicrm_handler_filter_datetime' => 'modules/views/civicrm/civicrm_handler_filter_datetime.inc',
'civicrm_handler_filter_domain' => 'modules/views/civicrm/civicrm_handler_filter_domain.inc',
'civicrm_handler_filter_encounter_medium' => 'modules/views/civicrm/civicrm_handler_filter_encounter_medium.inc',
'civicrm_handler_filter_group_name' => 'modules/views/civicrm/civicrm_handler_filter_group_name.inc',
'civicrm_handler_filter_group_status' => 'modules/views/civicrm/civicrm_handler_filter_group_status.inc',
'civicrm_handler_filter_option' => 'modules/views/civicrm/civicrm_handler_filter_option.inc',
'civicrm_handler_filter_pseudo_constant' => 'modules/views/civicrm/civicrm_handler_filter_pseudo_constant.inc',
Expand All @@ -892,6 +893,9 @@ function civicrm_autoload_info() {
'civicrm_handler_relationship' => 'modules/views/civicrm/civicrm_handler_relationship.inc',
'civicrm_handler_relationship_address' => 'modules/views/civicrm/civicrm_handler_relationship_address.inc',
'civicrm_handler_relationship_contact2users' => 'modules/views/civicrm/civicrm_handler_relationship_contact2users.inc',
'civicrm_handler_relationship_group' => 'modules/views/civicrm/civicrm_handler_relationship_group.inc',
'civicrm_handler_relationship_standard_group' => 'modules/views/civicrm/civicrm_handler_relationship_standard_group.inc',
'civicrm_handler_relationship_standard_group_contact' => 'modules/views/civicrm/civicrm_handler_relationship_standard_group_contact.inc',
'civicrm_handler_relationship_im' => 'modules/views/civicrm/civicrm_handler_relationship_im.inc',
'civicrm_handler_relationship_location' => 'modules/views/civicrm/civicrm_handler_relationship_location.inc',
'civicrm_handler_relationship_mail' => 'modules/views/civicrm/civicrm_handler_relationship_mail.inc',
Expand Down
4 changes: 2 additions & 2 deletions drush/civicrm.drush.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1426,10 +1426,10 @@ function _civicrm_init($fail = TRUE, $load_config = TRUE) {
return $init;
}

if (!version_compare(phpversion(), CIVICRM_DRUPAL_PHP_MINIMUM, '>=')) {
if (!version_compare(phpversion(), CIVICRM_BACKDROP_PHP_MINIMUM, '>=')) {
return drush_set_error('CIVICRM_PHP_MINIMUM', dt('CiviCRM requires PHP @required+. Drush is running PHP @current.', [
'@current' => phpversion(),
'@required' => CIVICRM_DRUPAL_PHP_MINIMUM,
'@required' => CIVICRM_BACKDROP_PHP_MINIMUM,
]));
}

Expand Down
12 changes: 6 additions & 6 deletions modules/civicrm_engage/Engage/Report/Form/List.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,39 +36,39 @@ class Engage_Report_Form_List extends CRM_Report_Form {

/**
* Address information needed in output
* @var boolean
* @var bool
*/
protected $_addressField = FALSE;

/**
* Email address needed in output
* @var boolean
* @var bool
*/
protected $_emailField = FALSE;

/**
* Demographic information needed in output
* @var boolean
* @var bool
*/
protected $_demoField = FALSE;

protected $_coreField = FALSE;

/**
* Phone number needed in output
* @var boolean
* @var bool
*/
protected $_phoneField = FALSE;

/**
* Group membership information needed in output
* @var boolean
* @var bool
*/
protected $_groupField = FALSE;

/**
* Voter Info information needed in output
* @var boolean
* @var bool
*/
protected $_voterInfoField = FALSE;

Expand Down
2 changes: 1 addition & 1 deletion modules/civicrm_engage/civicrm_engage.info
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = CiviEngage
description = Walklist and Phone-banking support for CiviCRM.
description = DEPRECATED Walklist and Phone-banking support for CiviCRM. This module will not be ported to Drupal 8. Please see: https://civicrm.org/blog/jamie/civicrmengage-is-dead-long-live-civicrmengage
version = 1.x-4.7
backdrop = 1.x
type = module
Expand Down
21 changes: 21 additions & 0 deletions modules/civicrm_rules/civicrm_rules.contact-eval.inc
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,24 @@ function civicrm_rules_options_list() {
$settings['groups'] = _civicrm_get_groups();
return $settings;
}

/**
* Options list callback for listing of CiviCRM Tags
*/
function civicrm_rules_tags_list() {
if (!civicrm_initialize()) {
return array();
}
$result = civicrm_api3('tag', 'get', array(
'used_for' => 'civicrm_contact',
'options' => array(
'limit' => 0,
'sort' => 'name ASC',
),
));
$values = array();
foreach ($result['values'] as $tag) {
$values[$tag['id']] = $tag['name'];
}
return $values;
}
2 changes: 1 addition & 1 deletion modules/civicrm_rules/civicrm_rules_action.inc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ The content of the email is:
'civicrm_tags' => array(
'type' => 'list<integer>',
'label' => t('CiviCRM Tags'),
'options list' => 'civicrm_rules_options_list',
'options list' => 'civicrm_rules_tags_list',
),
),
'group' => t('CiviCRM Contact'),
Expand Down
9 changes: 1 addition & 8 deletions modules/civicrmtheme/civicrmtheme.module
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,10 @@ function civicrmtheme_custom_theme() {
return;
}

// Get the menu items.
$args = explode('?', $_GET['q']);
$path = $args[0];

// Get the menu for above URL.
$item = CRM_Core_Menu::get($path);

// Check for public pages
// If public page and civicrm public theme is set, apply civicrm public theme
// If user does not have access to CiviCRM use the public page for the error message
if (!user_access('access CiviCRM') || CRM_Utils_Array::value('is_public', $item)) {
if (!user_access('access CiviCRM') || CRM_Core_Config::singleton()->userSystem->isFrontEndPage()) {
if ($public_theme) {
return $public_theme;
}
Expand Down
13 changes: 13 additions & 0 deletions modules/views/civicrm.views.inc
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,19 @@ function civicrm_views_custom_data_cache(&$data, $entity_type, $group_id, $sub_t
'field' => 'entity_id',
);
}

// Expose group custom data to group relationship.
if ($join_table == 'civicrm_group') {
$data[$current_group['table_name']]['table']['join']['civicrm_group'] = array(
'left_field' => 'id',
'field' => 'entity_id',
);
$data[$current_group['table_name']]['table']['join']['civicrm_group_contact'] = array(
'left_table' => $join_table,
'left_field' => 'id',
'field' => 'entity_id',
);
}
}

foreach ($current_group['fields'] as $key => $current_field) {
Expand Down
2 changes: 1 addition & 1 deletion modules/views/civicrm/civicrm_handler_field_activity.inc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
class civicrm_handler_field_activity extends civicrm_handler_field {

static $_recordType;
public static $_recordType;

public function construct() {
parent::construct();
Expand Down
4 changes: 2 additions & 2 deletions modules/views/civicrm/civicrm_handler_field_country.inc
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
*/
class civicrm_handler_field_country extends civicrm_handler_field_address {

static $_countries;
static $_countries_full;
public static $_countries;
public static $_countries_full;

public function construct() {
parent::construct();
Expand Down
2 changes: 1 addition & 1 deletion modules/views/civicrm/civicrm_handler_field_county.inc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
class civicrm_handler_field_county extends civicrm_handler_field_address {

static $_counties;
public static $_counties;

public function construct() {
parent::construct();
Expand Down
2 changes: 1 addition & 1 deletion modules/views/civicrm/civicrm_handler_field_email.inc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class civicrm_handler_field_email extends civicrm_handler_field_location {
}

public function render($values) {
if ($this->options['link_to_user'] == 'mailto') {
if ($this->options['link_to_user'] == 'mailto' && !empty($values->{$this->field_alias})) {
return l($values->{$this->field_alias}, "mailto:" . $values->{$this->field_alias});
}
return check_plain($values->{$this->field_alias});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
class civicrm_handler_field_encounter_medium extends views_handler_field {

static $_encounter_medium;
public static $_encounter_medium;

public function construct() {
parent::construct();
Expand Down
5 changes: 5 additions & 0 deletions modules/views/civicrm/civicrm_handler_field_file.inc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ class civicrm_handler_field_file extends views_handler_field {

$path = sprintf('%s/imagefile', $path);
}
//Reset session params as we send only id and eid to retrieve the file.
$file = new CRM_Core_Page_File();
$file->set('filename', NULL);
$file->set('mime-type', NULL);

$fileHash = CRM_Core_BAO_File::generateFileHash($value, $fileId);
return CRM_Utils_System::url($path,
"id={$fileId}&eid={$value}&fcs={$fileHash}",
Expand Down
2 changes: 1 addition & 1 deletion modules/views/civicrm/civicrm_handler_field_option.inc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
class civicrm_handler_field_option extends civicrm_handler_field {

static $_options;
public static $_options;

public function render($values) {
$this->initialize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
class civicrm_handler_field_relationship_type extends views_handler_field {

static $_relationshipType;
public static $_relationshipType;

public function construct() {
parent::construct();
Expand Down
4 changes: 2 additions & 2 deletions modules/views/civicrm/civicrm_handler_field_state.inc
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
*/
class civicrm_handler_field_state extends civicrm_handler_field_address {

static $_states;
static $_states_full;
public static $_states;
public static $_states_full;

public function construct() {
parent::construct();
Expand Down
2 changes: 1 addition & 1 deletion modules/views/civicrm/civicrm_handler_field_website.inc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
class civicrm_handler_field_website extends civicrm_handler_field {

static $_websiteType;
public static $_websiteType;

public function construct() {
parent::construct();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
class civicrm_handler_filter_encounter_medium extends views_handler_filter_in_operator {

static $_encounter_medium;
public static $_encounter_medium;

public function construct() {
parent::construct();
Expand Down
Loading

0 comments on commit e20f086

Please sign in to comment.