civicrm/civicrm-core — pull request #3097 by eileenmcnaughton (2014-05-01 22:24:17+00:00)
Title: CRM-14109 add test for ajx fns

At some point I needed this patch to make this test pass - but I *think* the problem *may* be fixed & so just adding the test

Patch is pasted below - but my investigation on this is too stale for me to remember the logic. tests are good though

--- a/CRM/Contact/BAO/Group.php
+++ b/CRM/Contact/BAO/Group.php
@@ -1053,6 +1053,8 @@ WHERE id IN $groupIdString
}

static function getGroupCount(&$params) {
+ //@todo - this function returns an incorrect result for contacts with 'access civicrm' permission & no contact access
+ // as the where clause is empty
$whereClause = self::whereClause($params, FALSE);
$query = "SELECT COUNT(*) FROM civicrm_group groups";

diff --git a/CRM/Core/BAO/ActionSchedule.php b/CRM/Core/BAO/ActionSchedule.php
index 17983d2..c94ca13 100755
--- a/CRM/Core/BAO/ActionSchedule.php
+++ b/CRM/Core/BAO/ActionSchedule.php
@@ -1072,12 +1072,13 @@ INSERT INTO civicrm_action_log (contact_id, entity_id, entity_table, action_sche
LEFT JOIN {$reminderJoinClause}
{$whereClause} {$limitWhereClause} AND {$dateClause} {$notINClause}
";
+
CRM_Core_DAO::executeQuery($query, array(1 => array($actionSchedule->id, 'Integer')));

if ($limitTo == 0) {
$additionWhere = ' WHERE ';
if ($actionSchedule->start_action_date) {
- $additionWhere = $whereClause . ' AND ';
+ //$additionWhere = $whereClause . ' AND ';
}
$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";
@@ -1092,12 +1093,12 @@ LEFT JOIN {$reminderJoinClause}
$insertAdditionalSql ="
INSERT INTO civicrm_action_log (contact_id, entity_id, entity_table, action_schedule_id)
{$addSelect}
-FROM ({$contactTable}, {$table})
+FROM ({$contactTable})
LEFT JOIN {$additionReminderClause}
{$addGroup}
{$additionWhere} c.is_deleted = 0 AND c.is_deceased = 0
{$addWhereClause}
-AND {$dateClause}
+
AND c.id NOT IN (
SELECT rem.contact_id