Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
justinfreeman (Agileware)
Core
Commits
c91c5542
Commit
c91c5542
authored
11 years ago
by
eileen
Browse files
Options
Downloads
Patches
Plain Diff
CRM-12990 Hook substitution not made on mailing label where there are no other tokens
parent
770d17d9
Branches
Branches containing commit
Tags
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/Label.php
+16
-20
16 additions, 20 deletions
CRM/Contact/Form/Task/Label.php
with
16 additions
and
20 deletions
CRM/Contact/Form/Task/Label.php
+
16
−
20
View file @
c91c5542
...
...
@@ -241,16 +241,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task {
// If location type is not primary, $contact contains
// one more array as "$contact[$locName] = array( values... )"
$found
=
FALSE
;
// we should replace all the tokens that are set in mailing label format
foreach
(
$mailingFormatProperties
as
$key
=>
$dontCare
)
{
if
(
CRM_Utils_Array
::
value
(
$key
,
$contact
))
{
$found
=
TRUE
;
break
;
}
}
if
(
!
$found
)
{
if
(
!
$this
->
tokenIsFound
(
$contact
,
$mailingFormatProperties
,
$tokenFields
))
{
continue
;
}
...
...
@@ -288,16 +279,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task {
}
}
else
{
$found
=
FALSE
;
// we should replace all the tokens that are set in mailing label format
foreach
(
$mailingFormatProperties
as
$key
=>
$dontCare
)
{
if
(
CRM_Utils_Array
::
value
(
$key
,
$contact
))
{
$found
=
TRUE
;
break
;
}
}
if
(
!
$found
)
{
if
(
!
$this
->
tokenIsFound
(
$contact
,
$mailingFormatProperties
,
$tokenFields
))
{
continue
;
}
...
...
@@ -358,6 +340,20 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task {
CRM_Utils_System
::
civiExit
(
1
);
}
/**
* Check for presence of tokens to be swapped out
* @param array $contact
* @param array $mailingFormatProperties
* @param array $tokenFields
*/
function
tokenIsFound
(
$contact
,
$mailingFormatProperties
,
$tokenFields
)
{
foreach
(
array_merge
(
$mailingFormatProperties
,
array_fill_keys
(
$tokenFields
,
1
))
as
$key
=>
$dontCare
)
{
if
(
CRM_Utils_Array
::
value
(
$key
,
$contact
))
{
return
TRUE
;
}
}
return
FALSE
;
}
/**
* function to create labels (pdf)
*
...
...
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