Skip to content

Commit

Permalink
upgrade to 4.2 stable
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Aug 22, 2012
1 parent 8531823 commit 6ccc84f
Show file tree
Hide file tree
Showing 100 changed files with 6,777 additions and 1,063 deletions.
52 changes: 26 additions & 26 deletions CRM/ACL/BAO/ACL.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public static function permissionClause(&$tables, $operation,


if (!empty($acl_id)) {
$where .= " AND ({$t['ACL']}.acl_id IS null
$where .= " AND ({$t['ACL']}.acl_id IS null
OR {$t['ACL']}.acl_id = " . CRM_Utils_Type::escape($acl_id, 'Integer') . ')';
if ($acl_role) {
$where .= " AND {$t['ACL']}.acl_table = '{$t['ACLRole']}'";
Expand All @@ -152,7 +152,7 @@ public static function permissionClause(&$tables, $operation,

$query[] = "SELECT {$t['ACL']}.*, 0 as override
FROM {$t['ACL']}
WHERE {$t['ACL']}.entity_table = '{$t['Domain']}'
AND ($where)";

Expand All @@ -161,16 +161,16 @@ public static function permissionClause(&$tables, $operation,

$query[] = "SELECT {$t['ACL']}.*, 0 as override
FROM {$t['ACL']}
INNER JOIN {$t['ACLEntityRole']}
ON ({$t['ACL']}.entity_table = '{$t['ACLRole']}'
AND {$t['ACL']}.entity_id =
AND {$t['ACL']}.entity_id =
{$t['ACLEntityRole']}.acl_role_id)
INNER JOIN {$t['ACLRole']}
ON {$t['ACL']}.entity_id =
ON {$t['ACL']}.entity_id =
{$t['ACLRole']}.id
WHERE {$t['ACLEntityRole']}.entity_table =
'{$t['Domain']}'
AND {$t['ACLRole']}.is_active = 1
Expand All @@ -181,30 +181,30 @@ public static function permissionClause(&$tables, $operation,

$query[] = "SELECT {$t['ACL']}.*, 1 as override
FROM {$t['ACL']}
INNER JOIN {$t['Contact']}
ON ({$t['ACL']}.entity_table = '{$t['Contact']}'
AND {$t['ACL']}.entity_id = {$t['Contact']}.id)
WHERE {$t['Contact']}.id = $contact_id
WHERE {$t['Contact']}.id = $contact_id
AND ($where)";

/* Query for permissions granted to the contact through an ACL group */


$query[] = "SELECT {$t['ACL']}.*, 1 as override
FROM {$t['ACL']}
INNER JOIN {$t['ACLEntityRole']}
ON ({$t['ACL']}.entity_table = '{$t['ACLRole']}'
AND {$t['ACL']}.entity_id =
{$t['ACLEntityRole']}.acl_role_id)
INNER JOIN {$t['ACLRole']}
ON {$t['ACL']}.entity_id = {$t['ACLRole']}.id
WHERE {$t['ACLEntityRole']}.entity_table =
'{$t['Contact']}'
WHERE {$t['ACLEntityRole']}.entity_table =
'{$t['Contact']}'
AND {$t['ACLRole']}.is_active = 1
AND {$t['ACLEntityRole']}.entity_id = $contact_id
AND ($where)";
Expand All @@ -214,12 +214,12 @@ public static function permissionClause(&$tables, $operation,

$query[] = "SELECT {$t['ACL']}.*, 0 as override
FROM {$t['ACL']}
INNER JOIN {$t['GroupContact']}
ON ({$t['ACL']}.entity_table = '{$t['Group']}'
AND {$t['ACL']}.entity_id =
{$t['GroupContact']}.group_id)
WHERE ($where)
AND {$t['GroupContact']}.contact_id = $contact_id
AND {$t['GroupContact']}.status = 'Added')";
Expand All @@ -231,21 +231,21 @@ public static function permissionClause(&$tables, $operation,

$query[] = "SELECT {$t['ACL']}.*, 0 as override
FROM {$t['ACL']}
INNER JOIN {$t['ACLEntityRole']}
ON ({$t['ACL']}.entity_table = '{$t['ACLRole']}'
AND {$t['ACL']}.entity_id =
AND {$t['ACL']}.entity_id =
{$t['ACLEntityRole']}.acl_role_id)
INNER JOIN {$t['ACLRole']}
ON {$t['ACL']}.entity_id = {$t['ACLRole']}.id
INNER JOIN {$t['GroupContact']}
ON ({$t['ACLEntityRole']}.entity_table =
'{$t['Group']}'
AND {$t['ACLEntityRole']}.entity_id =
{$t['GroupContact']}.group_id)
WHERE ($where)
AND {$t['ACLRole']}.is_active = 1
AND {$t['GroupContact']}.contact_id = $contact_id
Expand Down Expand Up @@ -468,7 +468,7 @@ public static function &getACLRoles($contact_id = NULL, $group_id = NULL) {
$c2g = CRM_Contact_BAO_GroupContact::getTableName();
$group = CRM_Contact_BAO_Group::getTableName();

$query = " SELECT $acl.*
$query = " SELECT $acl.*
FROM $acl
INNER JOIN civicrm_option_group og
ON og.name = 'acl_role'
Expand Down Expand Up @@ -532,7 +532,7 @@ public static function &getGroupACLs($contact_id, $aclRoles = FALSE) {
if ($contact_id) {
$query = "
SELECT $acl.*
FROM $acl
FROM $acl
INNER JOIN $c2g
ON $acl.entity_id = $c2g.group_id
WHERE $acl.entity_table = '$group'
Expand Down Expand Up @@ -576,7 +576,7 @@ public static function &getGroupACLRoles($contact_id) {
$c2g = CRM_Contact_BAO_GroupContact::getTableName();
$group = CRM_Contact_BAO_Group::getTableName();

$query = " SELECT $acl.*
$query = " SELECT $acl.*
FROM $acl
INNER JOIN civicrm_option_group og
ON og.name = 'acl_role'
Expand Down Expand Up @@ -614,7 +614,7 @@ public static function &getGroupACLRoles($contact_id) {

$query = "
SELECT $acl.*
FROM $acl
FROM $acl
WHERE $acl.entity_id IN ( $roles )
AND $acl.entity_table = 'civicrm_acl_role'
";
Expand Down
2 changes: 1 addition & 1 deletion CRM/Admin/Form/RelationshipType.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function setDefaultValues() {
$defaults = $params = array();
$params = array('id' => $this->_id);
eval($this->_BAOName . '::retrieve( $params, $defaults );');
$defaults['contact_types_a'] = $defaults['contact_type_a'];
$defaults['contact_types_a'] = CRM_Utils_Array::value('contact_type_a', $defaults);
if (CRM_Utils_Array::value('contact_sub_type_a', $defaults)) {
$defaults['contact_types_a'] .= CRM_Core_DAO::VALUE_SEPARATOR . $defaults['contact_sub_type_a'];
}
Expand Down
7 changes: 7 additions & 0 deletions CRM/Admin/Form/Setting/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ function formRule($fields) {
}

public function postProcess() {
// if extensions url is set, lets clear session status messages to avoid
// a potentially spurious message which might already have been set. This
// is a bit hackish
// CRM-10629
$session = CRM_Core_Session::singleton( );
$session->getStatus(TRUE);

parent::postProcess();

parent::rebuildMenu();
Expand Down
6 changes: 3 additions & 3 deletions CRM/Admin/Form/WordReplacements.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ public function postProcess() {
for ($i = 1; $i <= $this->_numStrings; $i++) {
if (CRM_Utils_Array::value($i, $params['new']) &&
CRM_Utils_Array::value($i, $params['old'])
) {
if (CRM_Utils_Array::value($i, $params['enabled'])) {
) {
if (isset($params['enabled']) && CRM_Utils_Array::value($i, $params['enabled'])) {
if (CRM_Utils_Array::value('cb', $params) &&
CRM_Utils_Array::value($i, $params['cb'])
) {
Expand All @@ -218,7 +218,7 @@ public function postProcess() {
}
}
else {
if (is_array($params['cb']) && array_key_exists($i, $params['cb'])) {
if (isset($params['cb']) && is_array($params['cb']) && array_key_exists($i, $params['cb'])) {
$disabled['exactMatch'] += array($params['old'][$i] => $params['new'][$i]);
}
else {
Expand Down
22 changes: 11 additions & 11 deletions CRM/Contact/BAO/GroupContact.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ function getGroupList($contactId = 0, $visibility = FALSE) {
$where = " WHERE civicrm_group.is_active = 1 ";
if ($contactId) {
$from .= ' , civicrm_group_contact ';
$where .= " AND civicrm_group.id = civicrm_group_contact.group_id
$where .= " AND civicrm_group.id = civicrm_group_contact.group_id
AND civicrm_group_contact.contact_id = " . CRM_Utils_Type::escape($contactId, 'Integer');
}

Expand Down Expand Up @@ -334,11 +334,11 @@ function &getContactGroup($contactId,
$select = 'SELECT count(DISTINCT civicrm_group_contact.id)';
}
else {
$select = 'SELECT
civicrm_group_contact.id as civicrm_group_contact_id,
$select = 'SELECT
civicrm_group_contact.id as civicrm_group_contact_id,
civicrm_group.title as group_title,
civicrm_group.visibility as visibility,
civicrm_group_contact.status as status,
civicrm_group_contact.status as status,
civicrm_group.id as group_id,
civicrm_group.is_hidden as is_hidden,
civicrm_subscription_history.date as date,
Expand Down Expand Up @@ -540,9 +540,9 @@ function getGroupContacts(&$group,
* @static
*/
function &getMembershipDetail($contactId, $groupID) {
$query = "SELECT *
FROM civicrm_group_contact
LEFT JOIN civicrm_subscription_history ON (civicrm_group_contact.contact_id = civicrm_subscription_history.contact_id)
$query = "SELECT *
FROM civicrm_group_contact
LEFT JOIN civicrm_subscription_history ON (civicrm_group_contact.contact_id = civicrm_subscription_history.contact_id)
WHERE civicrm_group_contact.contact_id = %1
AND civicrm_group_contact.group_id = %2
AND civicrm_subscription_history.method ='Email' ";
Expand Down Expand Up @@ -573,7 +573,7 @@ function updateGroupMembershipStatus($contactId, $groupID, $method = 'Email', $t
return CRM_Core_Error::fatal("$contactId or $groupID should not empty");
}

$query = "UPDATE civicrm_group_contact
$query = "UPDATE civicrm_group_contact
SET civicrm_group_contact.status = 'Added'
WHERE civicrm_group_contact.contact_id = %1
AND civicrm_group_contact.group_id = %2";
Expand Down Expand Up @@ -785,14 +785,14 @@ function mergeGroupContact($mainContactId, $dontCare, $otherContactId) {

// delete all the other group contacts
$sql = "
DELETE
FROM civicrm_group_contact
DELETE
FROM civicrm_group_contact
WHERE contact_id = %2
";
CRM_Core_DAO::executeQuery($sql, $params);

$sql = "
DELETE
DELETE
FROM civicrm_subscription_history
WHERE contact_id = %2
";
Expand Down
Loading

0 comments on commit 6ccc84f

Please sign in to comment.