Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
059b4b62
Unverified
Commit
059b4b62
authored
5 years ago
by
mattwire
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #14336 from eileenmcnaughton/pdfletter
[REF] extract isLiveMode
parents
bcbf95bd
752cee47
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CRM/Contact/Form/Task/PDFLetterCommon.php
+22
-6
22 additions, 6 deletions
CRM/Contact/Form/Task/PDFLetterCommon.php
with
22 additions
and
6 deletions
CRM/Contact/Form/Task/PDFLetterCommon.php
+
22
−
6
View file @
059b4b62
...
...
@@ -126,17 +126,12 @@ class CRM_Contact_Form_Task_PDFLetterCommon extends CRM_Core_Form_Task_PDFLetter
public
static
function
postProcess
(
&
$form
)
{
$formValues
=
$form
->
controller
->
exportValues
(
$form
->
getName
());
list
(
$formValues
,
$categories
,
$html_message
,
$messageToken
,
$returnProperties
)
=
self
::
processMessageTemplate
(
$formValues
);
$buttonName
=
$form
->
controller
->
getButtonName
();
$skipOnHold
=
isset
(
$form
->
skipOnHold
)
?
$form
->
skipOnHold
:
FALSE
;
$skipDeceased
=
isset
(
$form
->
skipDeceased
)
?
$form
->
skipDeceased
:
TRUE
;
$html
=
$activityIds
=
[];
// CRM-21255 - Hrm, CiviCase 4+5 seem to report buttons differently...
$c
=
$form
->
controller
->
container
();
$isLiveMode
=
(
$buttonName
==
'_qf_PDF_upload'
)
||
isset
(
$c
[
'values'
][
'PDF'
][
'buttons'
][
'_qf_PDF_upload'
]);
// CRM-16725 Skip creation of activities if user is previewing their PDF letter(s)
if
(
$
isLiveMode
)
{
if
(
self
::
isLiveMode
(
$form
)
)
{
$activityIds
=
self
::
createActivities
(
$form
,
$html_message
,
$form
->
_contactIds
,
$formValues
[
'subject'
],
CRM_Utils_Array
::
value
(
'campaign_id'
,
$formValues
));
}
...
...
@@ -348,4 +343,25 @@ class CRM_Contact_Form_Task_PDFLetterCommon extends CRM_Core_Form_Task_PDFLetter
return
Civi
::
$statics
[
__CLASS__
][
'token_categories'
];
}
/**
* Is the form in live mode (as opposed to being run as a preview).
*
* Returns true if the user has clicked the Download Document button on a
* Print/Merge Document (PDF Letter) search task form, or false if the Preview
* button was clicked.
*
* @param CRM_Core_Form $form
*
* @return bool
* TRUE if the Download Document button was clicked (also defaults to TRUE
* if the form controller does not exist), else FALSE
*/
protected
static
function
isLiveMode
(
$form
)
{
// CRM-21255 - Hrm, CiviCase 4+5 seem to report buttons differently...
$buttonName
=
$form
->
controller
->
getButtonName
();
$c
=
$form
->
controller
->
container
();
$isLiveMode
=
(
$buttonName
==
'_qf_PDF_upload'
)
||
isset
(
$c
[
'values'
][
'PDF'
][
'buttons'
][
'_qf_PDF_upload'
]);
return
$isLiveMode
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment