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

Add support for receipt task outside the search process #19848

Merged
merged 1 commit into from
Apr 8, 2021

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Mar 19, 2021

Overview

Adds support for url-based receipt sending - eg.

https://dmaster.localhost/civicrm/contribute/task?task=receipt&id=40,41

Before

Receipt functionality deeply tied to search process

After

image

Technical Details

@colemanw this is a first step towards adding more search tasks. I probably need to revisit it a little myself & do more testing but it builds on the cleanup I did a while back towards this

I exposed the action on the contribution tab of a contact - partly because it has been requested in the past but mostly to highlight this change & also the challenges - notably

  1. the action is only available for some statuses - this has been implemented using the contexttualLinks function
  2. when it opens in a pop-up the pdf won't download. This second one is something of a blocker to exposing it (although we can merge with it not exposed - but I suspect it will also be an issue in search-kit)
    image

*** I renamed from Receipt to Send Receipt so the above screenshot is a bit superceded ***

Comments

Remember to do a menu rebuild if you pull locally

@civibot
Copy link

civibot bot commented Mar 19, 2021

(Standard links)

@civibot civibot bot added the master label Mar 19, 2021
@eileenmcnaughton eileenmcnaughton changed the title Add support for receipt task outside the search process [wip] Add support for receipt task outside the search process Mar 19, 2021
@eileenmcnaughton eileenmcnaughton force-pushed the task2 branch 5 times, most recently from 4abdc91 to 012c04c Compare March 25, 2021 06:43
@eileenmcnaughton eileenmcnaughton force-pushed the task2 branch 2 times, most recently from e4dbe69 to ac8d38b Compare April 6, 2021 11:10
@eileenmcnaughton
Copy link
Contributor Author

@colemanw this is now a fairly direct path towards starting to add contribution actions to search kit results. I haven't figured out what to do about the pdf not working in a modal yet though.

@colemanw
Copy link
Member

colemanw commented Apr 7, 2021

Ah, the old pdf-download-from-a-dialogue issue. I remember it well.
The solution is to disable ajax submit in the form, like this:

public function buildQuickForm() {
CRM_Utils_System::setTitle(ts('Make Name Badges'));
// Ajax submit would interfere with file download
$this->preventAjaxSubmit();

(note that setting only affects dialogs)

Adds controller for id based tasks

Supports a url like https://dmaster.localhost:32353/civicrm/contribute/task?task=receipt&id=40,41

Note the pdf option doesn't work in pop-up mode - to discuss

Also note this exposes it as an action on the contribution results. That's optional. I think it has
been requested / would be useful but it's mostly included to make the page accessible for testing
and to work through the issue around filtering - the action only works on some statuses
@eileenmcnaughton eileenmcnaughton changed the title [wip] Add support for receipt task outside the search process Add support for receipt task outside the search process Apr 7, 2021
@eileenmcnaughton
Copy link
Contributor Author

@colemanw that works.

I think this is mergeable now although I think the contract around describing the links (getContextualLinks) could change and we haven't actually had the discussion about exposing the ability to send a receipt from the contribution tab (I tend to see it as a missing feature but I can't assume everyone else would)

I'm open to leaving this until after the rc is cut to give us more flexibility

@colemanw
Copy link
Member

colemanw commented Apr 7, 2021

I'm open to leaving this until after the rc is cut to give us more flexibility

Sounds good

@colemanw
Copy link
Member

colemanw commented Apr 8, 2021

(CiviCRM Review Template WORD-1.2)

* I note that the class structure for this standalone Contribution is different than the standalone Contact actions. They each implemented their own menu route while this uses a generic route with a ?task=receipt argument. Not sure which is better but it's not a blocker to merge.

@colemanw colemanw merged commit 8590f6b into civicrm:master Apr 8, 2021
@colemanw colemanw deleted the task2 branch April 8, 2021 18:11
@MegaphoneJon
Copy link
Contributor

While not directly related to this PR, I imagine that folks reading this later may be interested in Fast Action Links plus Fast Action PDF. I wrote Fast Action PDF to allow generating PDF thank-you letters from the contributions tab.

The difference between this approach and Fast Action PDF is in the number of clicks. If you always use the same 1 or 2 templates, it's valuable to create a PDF in a single click. This PR gives more flexibility at creation time, but takes more clicks.

@eileenmcnaughton
Copy link
Contributor Author

@MegaphoneJon cool yes - that does sound like it would be much appreciated by some users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants