Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
extensions
cc.tadpole.petitionemail
Commits
4312a80d
Commit
4312a80d
authored
Dec 14, 2014
by
Jamie McClelland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ensure working match if using state for matching field.
parent
2ca2143f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
petitionemail.php
petitionemail.php
+12
-1
No files found.
petitionemail.php
View file @
4312a80d
...
...
@@ -858,7 +858,7 @@ function petitionemail_get_allowed_matching_fields() {
'street_name'
=>
'civicrm_address'
,
'city'
=>
'civicrm_address'
,
'county_id'
=>
'civicrm_address'
,
'state_province
_id
'
=>
'civicrm_address'
,
'state_province'
=>
'civicrm_address'
,
'postal_code'
=>
'civicrm_address'
,
'postal_code_suffix'
=>
'civicrm_address'
,
'country_id'
=>
'civicrm_address'
,
...
...
@@ -1043,6 +1043,17 @@ function petitionemail_get_recipients($contact_id, $petition_id) {
$from
[]
=
"LEFT JOIN civicrm_address a ON a.contact_id = c.id"
;
$added_tables
[]
=
'civicrm_address'
;
}
// We have to make a special case for states, since the value we get
// from the user is the abbreviation rather than the state_province_id
// that is in the civicrm_address table.
if
(
$field_name
==
'state_province'
)
{
if
(
!
in_array
(
'civicrm_state_province'
,
$added_tables
))
{
$from
[]
=
"LEFT JOIN civicrm_state_province sp ON a.state_province_id = sp.id"
;
$added_tables
[]
=
'civicrm_state_province'
;
}
$field_name
=
'sp.abbreviation'
;
}
$where_fragment
[]
=
$field_name
.
' = %'
.
$id
;
$where_fragment
[]
=
'a.is_primary = 1'
;
$params
[
$id
]
=
array
(
$value
,
'String'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment