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

Make send letter function available to searchkit, individual contributions #20187

Merged
merged 1 commit into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/Task/TaskTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function getComponentClause(): string {
* @return false
*/
public function isSingle() {
return $this->_single ?? FALSE;
return count($this->getIDs()) === 1;
}

}
5 changes: 5 additions & 0 deletions CRM/Contribute/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ public static function tasks() {
'title' => ts('Thank-you letters - print or email'),
'class' => 'CRM_Contribute_Form_Task_PDFLetter',
'result' => FALSE,
'url' => 'civicrm/contribute/task?reset=1&task=letter',
'key' => 'letter',
'name' => ts('Send Letter'),
'is_single_mode' => TRUE,
'title_single_mode' => ts('Thank-you letter - print or email'),
],
self::PDF_INVOICE => [
'title' => ts('Invoices - print or email'),
Expand Down
18 changes: 10 additions & 8 deletions templates/CRM/Contribute/Form/Task/PDFLetter.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@
<table class="form-layout-compressed">
<tr><td class="label-left">{$form.thankyou_update.html} {$form.thankyou_update.label}</td><td></td></tr>
<tr><td class="label-left">{$form.receipt_update.html} {$form.receipt_update.label}</td><td></td></tr>
<tr>
<td class="label-left">{$form.group_by.label} {help id="id-contribution-grouping"}</td>
<td>{$form.group_by.html}</td>
</tr>
<tr>
<td class="label-left">{$form.group_by_separator.label}</td>
<td>{$form.group_by_separator.html}</td>
</tr>
{if !$single}
<tr>
<td class="label-left">{$form.group_by.label} {help id="id-contribution-grouping"}</td>
<td>{$form.group_by.html}</td>
</tr>
Copy link
Contributor

Choose a reason for hiding this comment

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

If you don't have this on the template then you get a different type of notice in "single" mode: Notice: Undefined index: group_by in CRM_Contribute_Form_Task_PDFLetter->postProcess() (line 177 of .../CRM/Contribute/Form/Task/PDFLetter.php).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@demeritcowboy I hit that enotice writing the test in another PR & added this line to the other PR that addresses https://github.com/civicrm/civicrm-core/pull/20188/files#diff-32b6d0d15de0f43a21f476f94999902d89e3498fc00ee55e4c817ec767a4d42fR179

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok.
The "other issue" referred to in the original description here I think was that an intermediate version of #20161 had more manipulating of contribution ids and it was giving buildContributionArray a null.

<tr>
<td class="label-left">{$form.group_by_separator.label}</td>
<td>{$form.group_by_separator.html}</td>
</tr>
{/if}
<tr>
<td class="label-left">{$form.email_options.label} {help id="id-contribution-email-print"}</td>
<td>{$form.email_options.html}</td>
Expand Down