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

Convert case activity links to 'actionLinks' #14349

Merged
merged 2 commits into from
Nov 4, 2019

Conversation

mattwire
Copy link
Contributor

@mattwire mattwire commented May 26, 2019

Overview

Convert the case activity links to use the standard "actionLinks()" method instead of hardcoding html and making it impossible to override cleanly.

Before

Really hard to override/edit case activity links. Fixed format.
image

image

After

Overrideable in standard way via hook. Formatted for display via the standard "formatLinks()" function.
image
image

Technical Details

Introduces the concept of "linkButtons" which are currently implemented in a custom way for each form that uses them. This allows the output of actionLinks() to be used to generate the standard set of "extra" links that appear when a table of entities is shown but also show them on the "detail" View/Edit form. So for cases "Move to Case" and "Copy to Case" are now also available on the "View activity" form.

Comments

@civibot
Copy link

civibot bot commented May 26, 2019

(Standard links)

@civibot civibot bot added the master label May 26, 2019
@agh1
Copy link
Contributor

agh1 commented Jun 5, 2019

@mattwire it looks like all the PRs you were waiting for have been merged. If you can do whatever rebase and style cleanup you need I'd be happy to look at it in Brooklyn next week. I've been in case-land recently, and the links hook is my favorite hook.

@mattwire mattwire force-pushed the case_links_refactor_3 branch 3 times, most recently from f02b47f to 71fdee1 Compare June 6, 2019 10:32
@mattwire mattwire marked this pull request as ready for review June 6, 2019 14:40
@mattwire mattwire changed the title WIP Convert case activity links to 'actionLinks' Convert case activity links to 'actionLinks' Jun 6, 2019
@mattwire
Copy link
Contributor Author

mattwire commented Jun 6, 2019

@agh1 Thanks - now rebased and ready for review

Copy link
Contributor

@agh1 agh1 left a comment

Choose a reason for hiding this comment

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

This PR moves a sizable function and heavily reworks it, so @eileenmcnaughton recommended that I do the move as a separate first step. See #14512.

Overall, this is a good change, but it has a couple of issues.

  • General standards
    • (r-explain) PASS
    • (r-user) PASS: the change for the affected pages makes it more consistent with most other parts of CiviCRM.
    • (r-doc) PASS
    • (r-run) ISSUE: See the inline comments about broken links on the Activity Details report and wrong icons for Move To Case, Copy To Case, and Restore.
  • Developer standards
    • (r-tech) PASS: The change preserves compatibility with existing callers/code/downstream.
    • (r-code) PASS: However, while you're fixing things, see the comment about {assign} instead of {capture}{/capture}
    • (r-maint) PASS: It would be nice to have test coverage for getting the right action links in the right situations (permissions, available cases to reassign to, etc.), but that logic is a little outside the scope of this change, which does a lot to make the code more consistent.
    • (r-test) PASS: The test results are all-clear.

CRM/Case/Selector/Search.php Show resolved Hide resolved
);
if (!empty($this->_params['include_case_activities_value'])) {
try {
$caseId = civicrm_api3('Activity', 'getvalue', [
Copy link
Contributor

Choose a reason for hiding this comment

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

A couple of things about this:

  1. if a non-case activity follows a case activity the $caseId never gets set back to null: the API finds no case ID, throws an exception, and the catch never does anything. The result is that this creates broken links that are in the case activity style but for other activities.

  2. This is going to run 50 separate queries against the same table you've already queried. Instead, get the case_id as part of the main query by adding it to the big $this->_columns array and making it no_display and required (like source_record_id).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, makes sense I think. I'll need to come back to this to look at that :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@agh1 That turned into a bit of an effort... but I've now done it! Could you test the reporting side again and confirm if you are happy?

templates/CRM/common/formButtons.tpl Outdated Show resolved Hide resolved
@mattwire mattwire changed the title Convert case activity links to 'actionLinks' WIP Convert case activity links to 'actionLinks' Jun 14, 2019
@mattwire mattwire changed the title WIP Convert case activity links to 'actionLinks' Convert case activity links to 'actionLinks' Jul 5, 2019
@mattwire
Copy link
Contributor Author

I've dropped the troublesome report changes from this PR and put them in #15135 so we can get this merged. If @agh1 is happy with this now? As the only issue before was the reports.

@jitendrapurohit
Copy link
Contributor

I've tested this and confirm that links are loaded correctly on the case manage screen and view activity page. As the comments from @agh1 is resolved now, this is ok to be merged.

@eileenmcnaughton eileenmcnaughton added the merge ready PR will be merged after a few days if there are no objections label Oct 31, 2019
@eileenmcnaughton
Copy link
Contributor

I've added merge-ready based on @jitendrapurohit review - I just want to give @agh1 a last chance to weigh in / comment

@eileenmcnaughton
Copy link
Contributor

erm @jitendrapurohit there are changes since your review - I guess you may need to recheck?

@mattwire
Copy link
Contributor Author

mattwire commented Nov 2, 2019

@eileenmcnaughton @jitendrapurohit Only changes were comments in formButtons.tpl per comment. Annoying that there doesn't seem to be an easy way to show a comparison!

@eileenmcnaughton
Copy link
Contributor

Actually force-pushed is a link - https://github.com/civicrm/civicrm-core/compare/b5c5dd71cd00d10b722349e0adf9d02f712e608f..7bf3b68c5243fccac0a381858d4d2bf8e2c8350a - but since there is a rebase in there it's not readable. I'll take your word on no substantive change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
master merge ready PR will be merged after a few days if there are no objections
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants