Skip to content

Commit

Permalink
upgrade 4.2.6 to 4.2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Jan 6, 2013
1 parent 3a32d90 commit 2d7a7a9
Show file tree
Hide file tree
Showing 184 changed files with 1,753 additions and 1,544 deletions.
4 changes: 3 additions & 1 deletion CRM/Admin/Form/Preferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ public function postProcessCommon() {
);
}
}

CRM_Core_Session::setStatus(ts('Your changes have been saved.'));
}
//end of function

}

5 changes: 2 additions & 3 deletions CRM/Admin/Form/Preferences/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function preProcess() {
CRM_Core_BAO_Setting::ADDRESS_STANDARDIZATION_PREFERENCES_NAME =>
array(
'address_standardization_provider' => array(
'html_type' => NULL,
'html_type' => 'select',
'weight' => 4,
),
'address_standardization_userid' => array(
Expand Down Expand Up @@ -166,8 +166,7 @@ public function buildQuickForm() {
parent::buildQuickForm();
}

static
function formRule($fields) {
static function formRule($fields) {
$p = $fields['address_standardization_provider'];
$u = $fields['address_standardization_userid'];
$w = $fields['address_standardization_url'];
Expand Down
2 changes: 1 addition & 1 deletion CRM/Campaign/Form/SurveyType.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function buildQuickForm() {
if ($this->_action == CRM_Core_Action::UPDATE &&
CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $this->_id, 'is_reserved')
) {
$this->freeze(array('label', 'description', 'is_active' ));
$this->freeze(array('label', 'is_active'));
}
$this->add('text', 'weight', ts('Weight'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'weight'), TRUE);

Expand Down
8 changes: 5 additions & 3 deletions CRM/Campaign/Form/Task/Interview.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,11 @@ function setDefaultValues() {
//load default data for only contact fields.
$contactFields = $defaults = array();
foreach ($this->_surveyFields as $name => $field) {
if ($field['field_type'] == 'Contact') {
$acceptable_types = CRM_Contact_BAO_ContactType::basicTypes();
$acceptable_types[] = 'Contact';
if(in_array($field['field_type'], $acceptable_types)) {
$contactFields[$name] = $field;
}
}
}
if (!empty($contactFields)) {
foreach ($this->_contactIds as $contactId) {
Expand Down Expand Up @@ -420,7 +422,7 @@ function registerInterview($params) {
$activity->selectAdd();
$activity->selectAdd('activity_date_time, status_id, result, subject');
$activity->find(TRUE);
$activity->activity_date_time = date('Ymdhis');
$activity->activity_date_time = date('YmdHis');
$activity->status_id = $statusId;

if (CRM_Utils_Array::value('details', $params)) {
Expand Down
4 changes: 2 additions & 2 deletions CRM/Case/Audit/Audit.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ public function getActivities($printReport = FALSE) {
}

if ($printReport) {
uasort($caseActivities, array($this, "compareActivities"));
@uasort($caseActivities, array($this, "compareActivities"));
}
else {
uasort($retval, array($this, "compareActivities"));
@uasort($retval, array($this, "compareActivities"));
}
}

Expand Down
3 changes: 2 additions & 1 deletion CRM/Contact/BAO/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,8 @@ static function &importableFields($contactType = 'Individual',
$cacheKeyString .= $isProfile ? '_1' : '_0';
$cacheKeyString .= $checkPermission ? '_1' : '_0';

if (!self::$_importableFields || !CRM_Utils_Array::value($cacheKeyString, self::$_importableFields)) {
$fields = CRM_Utils_Array::value($cacheKeyString, self::$_importableFields);
if (!$fields) {
if (!self::$_importableFields) {
self::$_importableFields = array();
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/BAO/GroupOrganization.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function dataExists($params) {
}

static
function &retrieve($groupID, &$defaults) {
function retrieve($groupID, &$defaults) {
$dao = new CRM_Contact_DAO_GroupOrganization();
$dao->group_id = $groupID;
if ($dao->find(TRUE)) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -4231,7 +4231,7 @@ function dateQueryBuilder(&$values,
}

if (!$appendTimeStamp) {
$firstDate = substr($date, 0, 8);
$firstDate = substr($firstDate, 0, 8);
}
$firstDateFormat = CRM_Utils_Date::customFormat($firstDate);

Expand Down
62 changes: 28 additions & 34 deletions CRM/Contact/BAO/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,27 @@ static function getContactRelationshipType($contactId = NULL,
return $relationshipType;
}

static function clearCurrentEmployer($id, $action) {
$relationship = new CRM_Contact_DAO_Relationship();
$relationship->id = $id;
$relationship->find(TRUE);

//to delete relationship between household and individual \
//or between individual and orgnization
if (($action & CRM_Core_Action::DISABLE) || ($action & CRM_Core_Action::DELETE)) {
if ($relationship->relationship_type_id == 4 || $relationship->relationship_type_id == 7) {
$sharedContact = new CRM_Contact_DAO_Contact();
$sharedContact->id = $relationship->contact_id_a;
$sharedContact->find(TRUE);

if ($relationship->relationship_type_id == 4 && $relationship->contact_id_b == $sharedContact->employer_id) {
CRM_Contact_BAO_Contact_Utils::clearCurrentEmployer($relationship->contact_id_a);
}
}
}
return $relationship;
}

/**
* Function to delete the relationship
*
Expand All @@ -402,25 +423,7 @@ static function del($id) {
// delete from relationship table
CRM_Utils_Hook::pre('delete', 'Relationship', $id, CRM_Core_DAO::$_nullArray);

$relationship = new CRM_Contact_DAO_Relationship();
$relationship->id = $id;

$relationship->find(TRUE);

//to delete relationship between household and individual
//or between individual and orgnization
if ($relationship->relationship_type_id == 4 || $relationship->relationship_type_id == 7) {
$sharedContact = new CRM_Contact_DAO_Contact();
$sharedContact->id = $relationship->contact_id_a;
$sharedContact->find(TRUE);

if ($relationship->relationship_type_id == 4 &&
$relationship->contact_id_b == $sharedContact->employer_id
) {
CRM_Contact_BAO_Contact_Utils::clearCurrentEmployer($relationship->contact_id_a);
}
}

$relationship = self::clearCurrentEmployer($id, CRM_Core_Action::DELETE);
if (CRM_Core_Permission::access('CiviMember')) {
// create $params array which isrequired to delete memberships
// of the related contacts.
Expand Down Expand Up @@ -466,16 +469,7 @@ static function del($id) {
* @static
*/
static function disableEnableRelationship($id, $action) {
$relationship = new CRM_Contact_DAO_Relationship();
$relationship->id = $id;

$relationship->find(TRUE);
//get the relationship type id of "Employee of"
$relTypeId = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', 'Employee of', 'id', 'name_a_b');
if ($relTypeId && ($action & CRM_Core_Action::DISABLE)) {
CRM_Contact_BAO_Contact_Utils::clearCurrentEmployer($relationship->contact_id_a);
}

$relationship = self::clearCurrentEmployer($id, $action);
if (CRM_Core_Permission::access('CiviMember')) {
// create $params array which isrequired to delete memberships
// of the related contacts.
Expand Down Expand Up @@ -1266,12 +1260,14 @@ static function relatedMemberships($contactId, &$params, $ids, $action = CRM_Cor
*
*/
function isDeleteRelatedMembership($relTypeIds, $contactId, $mainRelatedContactId, $relTypeId, $relIds) {
if (in_array($relTypeId, $relTypeIds) ||
empty($relIds)
) {
if (in_array($relTypeId, $relTypeIds)) {
return TRUE;
}

if (empty($relIds)) {
return FALSE;
}

$relParamas = array(1 => array($contactId, 'Integer'),
2 => array($mainRelatedContactId, 'Integer'),
);
Expand All @@ -1287,9 +1283,7 @@ function isDeleteRelatedMembership($relTypeIds, $contactId, $mainRelatedContactI
$recordsFound = (int)CRM_Core_DAO::singleValueQuery("SELECT COUNT(*) FROM civicrm_relationship WHERE relationship_type_id IN ( " . implode(',', $relTypeIds) . " ) AND contact_id_a IN ( %1, %2 ) AND contact_id_b IN ( %1, %2 ) AND id NOT IN (" . implode(',', $relIds) . ")", $relParamas);

if ($recordsFound) {

return FALSE;

}

return TRUE;
Expand Down
6 changes: 2 additions & 4 deletions CRM/Contact/Form/Edit/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,7 @@ static function buildQuickForm(&$form, $addressBlockCount = NULL, $sharing = TRU
}
$defaults = array();
CRM_Core_BAO_CustomGroup::setDefaults($groupTree, $defaults);
// For some of the custom fields like checkboxes, the defaults doesn't populate
// in proper format due to the different element-name format - 'address[$blockId][custom-X]'.
// Below eval() fixes this issue.
// Set default values
$address = array();
foreach ($defaults as $key => $val) {
if ( empty( $val ) ) {
Expand All @@ -248,7 +246,7 @@ static function buildQuickForm(&$form, $addressBlockCount = NULL, $sharing = TRU
elseif ( is_array($val) ) {
$val = var_export($val, TRUE);
}
@eval("\${$key} = " .$val . ";" );
$$key = "$val";
}

$defaults = array('address' => $address);
Expand Down
7 changes: 6 additions & 1 deletion CRM/Contact/Form/Edit/TagsAndGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ function buildQuickForm(&$form,
$form->_tagGroup = array();
}

$type = (int ) $type;
// NYSS 5670
if (!$contactId && !empty($form->_contactId)) {
$contactId = $form->_contactId;
}

$type = (int) $type;
if ($type & CRM_Contact_Form_Edit_TagsandGroups::GROUP) {

$fName = 'group';
Expand Down
1 change: 1 addition & 0 deletions CRM/Contact/Form/Inline/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ public function postProcess() {
'status' => 'save',
'addressId' => $address[0]->id
);
$this->postProcessHook();
echo json_encode($response);
CRM_Utils_System::civiExit();
}
Expand Down
8 changes: 7 additions & 1 deletion CRM/Contact/Form/Inline/CommunicationPreferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CRM_Contact_Form_Inline_CommunicationPreferences extends CRM_Core_Form {
/**
* contact id of the contact that is been viewed
*/
private $_contactId;
public $_contactId;

/**
* contact type of the contact that is been viewed
Expand All @@ -55,6 +55,11 @@ public function preProcess() {
//get all the existing email addresses
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE, NULL, $_REQUEST);
$this->assign('contactId', $this->_contactId);

// Get contact type if not set
if (empty($this->_contactType)) {
$this->_contactType = CRM_Contact_BAO_Contact::getContactType($this->_contactId);
}
}

/**
Expand Down Expand Up @@ -144,6 +149,7 @@ public function postProcess() {
CRM_Contact_BAO_Contact::create( $params );

$response = array('status' => 'save');
$this->postProcessHook();
echo json_encode($response);
CRM_Utils_System::civiExit();
}
Expand Down
3 changes: 2 additions & 1 deletion CRM/Contact/Form/Inline/CustomData.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CRM_Contact_Form_Inline_CustomData extends CRM_Core_Form {
/**
* contact id of the contact that is been viewed
*/
private $_contactId;
public $_contactId;

/**
* custom group id
Expand Down Expand Up @@ -145,6 +145,7 @@ public function postProcess() {
CRM_Contact_BAO_GroupContactCache::remove();

$response = array('status' => 'save');
$this->postProcessHook();
echo json_encode($response);
CRM_Utils_System::civiExit();
}
Expand Down
3 changes: 2 additions & 1 deletion CRM/Contact/Form/Inline/Demographics.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CRM_Contact_Form_Inline_Demographics extends CRM_Core_Form {
/**
* contact id of the contact that is been viewed
*/
private $_contactId;
public $_contactId;

/**
* call preprocess
Expand Down Expand Up @@ -123,6 +123,7 @@ public function postProcess() {
CRM_Contact_BAO_Contact::create( $params );

$response = array('status' => 'save');
$this->postProcessHook();
echo json_encode($response);
CRM_Utils_System::civiExit();
}
Expand Down
3 changes: 2 additions & 1 deletion CRM/Contact/Form/Inline/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CRM_Contact_Form_Inline_Email extends CRM_Core_Form {
/**
* contact id of the contact that is been viewed
*/
private $_contactId;
public $_contactId;

/**
* email addresses of the contact that is been viewed
Expand Down Expand Up @@ -204,6 +204,7 @@ public function postProcess() {
);

$response = array('status' => 'save');
$this->postProcessHook();
echo json_encode($response);
CRM_Utils_System::civiExit();
}
Expand Down
3 changes: 2 additions & 1 deletion CRM/Contact/Form/Inline/Phone.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CRM_Contact_Form_Inline_Phone extends CRM_Core_Form {
/**
* contact id of the contact that is been viewed
*/
private $_contactId;
public $_contactId;

/**
* phones of the contact that is been viewed
Expand Down Expand Up @@ -207,6 +207,7 @@ public function postProcess() {
);

$response = array('status' => 'save');
$this->postProcessHook();
echo json_encode($response);
CRM_Utils_System::civiExit();
}
Expand Down
Loading

0 comments on commit 2d7a7a9

Please sign in to comment.