Skip to content

Commit

Permalink
minor bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bjendres committed May 24, 2016
1 parent d97d67f commit f48ff4b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions CRM/Householdmerge/Logic/Checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ function checkHousehold($household_id, $activities_checked = FALSE) {
}

// HEAD related checks
if ('hierarchy' == CRM_Householdmerge_Logic_Configuration::getHouseholdModeOptions()) {
if ('hierarchy' == CRM_Householdmerge_Logic_Configuration::getHouseholdMode()) {
$heads = array();
foreach ($members as $member) {
if ($member['relation'] == 'head') {
if ($member['hh_relation'] == 'head') {
$heads[] = $member;
}
}
Expand All @@ -123,7 +123,7 @@ function checkHousehold($household_id, $activities_checked = FALSE) {
if (count($heads) > 1) {
$problems_identified[] = ts("Household has multiple heads.", array('domain' => 'de.systopia.householdmerge'));
}

// CHECK 4: does the head have a DO NOT mail/phone/sms/email
$donts = CRM_Householdmerge_Logic_Configuration::getDontXXXChecks();
foreach ($heads as $head) {
Expand All @@ -138,7 +138,7 @@ function checkHousehold($household_id, $activities_checked = FALSE) {
// CHECK 5: does the head have certain tags
$bad_tags = CRM_Householdmerge_Logic_Configuration::getBadHeadTags();
foreach ($heads as $head) {
$tags = CRM_Core_BAO_EntityTag::getContactTags($contact_id);
$tags = CRM_Core_BAO_EntityTag::getContactTags($head['id']);
foreach ($tags as $tag) {
if (in_array($tag, $bad_tags)) {
$problems_identified[] = ts("Household head has tag '%1'.", array(1 => $tag, 'domain' => 'de.systopia.householdmerge'));
Expand Down Expand Up @@ -320,7 +320,7 @@ protected function getMembers($household_id) {
*/
protected function getCheckActivityTypeID() {
if ($this->_activity_type_id == NULL) {
$this->_activity_type_id = CRM_Householdmerge_Logic_Configuration::getCheckHouseholdActivityType();
$this->_activity_type_id = CRM_Householdmerge_Logic_Configuration::getCheckHouseholdActivityTypeID();
}

if ($this->_activity_type_id == NULL) {
Expand Down
16 changes: 8 additions & 8 deletions CRM/Householdmerge/Logic/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,27 +114,27 @@ public static function setConfigValue($key, $value) {
/**
* Get/create the activity type to be used for 'Check Household' activities
*/
public static function getCheckHouseholdActivityType() {
public static function getCheckHouseholdActivityTypeID() {
// now make sure that the activity types exist
$option_group = civicrm_api3('OptionGroup', 'getsingle', array('name' => 'activity_type'));
if ($option_group==NULL) {
throw new Exception("Couldn't find activity_type group.");
}

$activity = civicrm_api3('OptionValue', 'getsingle', array('name' => self::$HHMERGE_CHECK_HH_NAME, 'option_group_id' => $option_group['id'], 'option.limit' => 1));
if (empty($activity['id'])) {
$activity = civicrm_api3('OptionValue', 'create', array(
$activities = civicrm_api3('OptionValue', 'get', array('name' => self::$HHMERGE_CHECK_HH_NAME, 'option_group_id' => $option_group['id'], 'option.limit' => 1));
if (empty($activities['id']) || $activities['count'] != 1) {
$activities = civicrm_api3('OptionValue', 'create', array(
'label' => ts("Check Household", array('domain' => 'de.systopia.householdmerge')),
'name' => self::$HHMERGE_CHECK_HH_NAME,
'option_group_id' => $option_group['id'],
'is_default' => 0,
'description' => ts("This activity indicates that there mmight be something wrong with this household, and that (a human) should look into it.", array('domain' => 'de.systopia.householdmerge')),
'description' => ts("This activity indicates that there might be something wrong with this household, and that (a human) should look into it.", array('domain' => 'de.systopia.householdmerge')),
'is_active' => 1,
'is_reserved' => 1
));
$activity = civicrm_api3('OptionValue', 'getsingle', array('id' => $activity['id']));
$activities = civicrm_api3('OptionValue', 'get', array('id' => $activities['id']));
}

return $activity['value'];
return $activities['values'][$activities['id']]['value'];
}
}

0 comments on commit f48ff4b

Please sign in to comment.