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
67dcf790
Unverified
Commit
67dcf790
authored
2 years ago
by
totten
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #25547 from eileenmcnaughton/559
#4080
Fix wrong pdf format selection for invoice, when configured
parents
490bdff6
eb830fb9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CRM/Contribute/Form/Task/Invoice.php
+2
-3
2 additions, 3 deletions
CRM/Contribute/Form/Task/Invoice.php
CRM/Core/BAO/MessageTemplate.php
+19
-1
19 additions, 1 deletion
CRM/Core/BAO/MessageTemplate.php
CRM/Core/BAO/PdfFormat.php
+1
-0
1 addition, 0 deletions
CRM/Core/BAO/PdfFormat.php
with
22 additions
and
4 deletions
CRM/Contribute/Form/Task/Invoice.php
+
2
−
3
View file @
67dcf790
...
...
@@ -233,10 +233,9 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task {
$refundedStatusId
=
CRM_Utils_Array
::
key
(
'Refunded'
,
$contributionStatusID
);
$cancelledStatusId
=
CRM_Utils_Array
::
key
(
'Cancelled'
,
$contributionStatusID
);
$pendingStatusId
=
CRM_Utils_Array
::
key
(
'Pending'
,
$contributionStatusID
);
$pdfFormat
=
CRM_Core_BAO_PdfFormat
::
getByName
(
'default_invoice_pdf_format'
);
$pdfFormat
=
CRM_Core_BAO_MessageTemplate
::
getPDFFormatForTemplate
(
'contribution_invoice_receipt'
);
foreach
(
$elementDetails
as
$contributionID
=>
$detail
)
{
$input
=
$ids
=
[];
$input
=
[];
if
(
in_array
(
$detail
[
'contact'
],
$excludedContactIDs
))
{
continue
;
}
...
...
This diff is collapsed.
Click to expand it.
CRM/Core/BAO/MessageTemplate.php
+
19
−
1
View file @
67dcf790
...
...
@@ -203,7 +203,7 @@ class CRM_Core_BAO_MessageTemplate extends CRM_Core_DAO_MessageTemplate implemen
*/
public
static
function
getMessageTemplates
(
$all
=
TRUE
,
$isSMS
=
FALSE
)
{
$messageTemplates
=
\Civi\Api4\
MessageTemplate
::
get
()
$messageTemplates
=
MessageTemplate
::
get
()
->
addSelect
(
'id'
,
'msg_title'
)
->
addWhere
(
'is_active'
,
'='
,
TRUE
)
->
addWhere
(
'is_sms'
,
'='
,
$isSMS
);
...
...
@@ -218,6 +218,24 @@ class CRM_Core_BAO_MessageTemplate extends CRM_Core_DAO_MessageTemplate implemen
return
$msgTpls
;
}
/**
* Get the appropriate pdf format for the given template.
*
* @param string $workflow
*
* @return array
* @throws \CRM_Core_Exception
*/
public
static
function
getPDFFormatForTemplate
(
string
$workflow
):
array
{
$pdfFormatID
=
MessageTemplate
::
get
(
FALSE
)
->
addWhere
(
'workflow_name'
,
'='
,
$workflow
)
->
addSelect
(
'pdf_format_id'
)
->
execute
()
->
first
()[
'pdf_format_id'
]
??
0
;
// Get by ID will fall back to retrieving the default values if
// it does not find the appropriate ones - hence passing in 0 works.
return
CRM_Core_BAO_PdfFormat
::
getById
(
$pdfFormatID
);
}
/**
* Revert a message template to its default subject+text+HTML state.
*
...
...
This diff is collapsed.
Click to expand it.
CRM/Core/BAO/PdfFormat.php
+
1
−
0
View file @
67dcf790
...
...
@@ -230,6 +230,7 @@ class CRM_Core_BAO_PdfFormat extends CRM_Core_DAO_OptionValue {
* (reference) associative array of name/value pairs
*/
public
static
function
&
getByName
(
$name
)
{
CRM_Core_Error
::
deprecatedFunctionWarning
(
'none'
);
return
self
::
getPdfFormat
(
'name'
,
$name
);
}
...
...
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