Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-20935 Remove related profile links when event deleted #10719

Merged
merged 1 commit into from
Sep 4, 2017

Conversation

JKingsnorth
Copy link
Contributor

@JKingsnorth JKingsnorth commented Jul 21, 2017

1 => array($values['table_name'], 'string'),
2 => array($id, 'integer'),
);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that these lines do nothing - but it seems like the intent was to replace the unescaped variables in the SQL query. I think the better option would be to do so.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I'll take a look at this with a view to fixing escaping the variables in the query.

'entity_id' => $id,
);
CRM_Core_BAO_UFJoin::deleteAll($ufJoinParams);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to replicate the issue and confirm that this successfully fixes the issue.

FROM civicrm_uf_join
LEFT JOIN civicrm_event e on civicrm_uf_join.entity_id = e.id
WHERE (civicrm_uf_join.module = 'CiviEvent' OR civicrm_uf_join.module = 'CiviEvent_Additional')
AND e.id IS NULL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this manually, and also thought through this. This SQL is exactly right, though of course it will need to be moved to 4.7.25.mysql.tpl.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll move this up =]

@eileenmcnaughton
Copy link
Contributor

rc 4.7.25 is due to be cut in one week. If you are able to address fix the mysql by then we can include it.

You get a gold star if you also address Jon's comment

FROM civicrm_uf_join
LEFT JOIN civicrm_event e on civicrm_uf_join.entity_id = e.id
WHERE (civicrm_uf_join.module = 'CiviEvent' OR civicrm_uf_join.module = 'CiviEvent_Additional')
AND e.id IS NULL;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just testing this now before pushing up the changes

@@ -1031,7 +1031,6 @@ public static function &getGroupDetail($groupId = NULL, $searchable = NULL, &$ex
);

// create select
$select = "SELECT";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unused, it is overwritten a few lines further down.

);

CRM_Core_DAO::executeQuery($query);
$query = "DELETE FROM " . $values['table_name'] . " WHERE entity_id = %1";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the pattern used elsewhere. We cannot call the table name a 'string' parameter, because it must not be enclosed in single quotes - otherwise the SQL is invalid. But we are checking the entity ID now.

@JKingsnorth
Copy link
Contributor Author

JKingsnorth commented Sep 4, 2017

Ignore me - I have corrected it to escape both parameters properly. So this is now good for a quick confirmation and merge.

@eileenmcnaughton
Copy link
Contributor

This seems good to me now - although it could do with being squashed into a single commit.

@JKingsnorth
Copy link
Contributor Author

I'm just doing that now

@JKingsnorth
Copy link
Contributor Author

@eileenmcnaughton All cleaned up, sorry for the noise.

@monishdeb
Copy link
Member

Yup, it's good to merge now.

@monishdeb monishdeb merged commit 5dcee00 into civicrm:master Sep 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants