Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
extensions
cc.tadpole.petitionemail
Commits
4312a80d
Commit
4312a80d
authored
Dec 14, 2014
by
Jamie McClelland
Browse files
ensure working match if using state for matching field.
parent
2ca2143f
Changes
1
Hide whitespace changes
Inline
Side-by-side
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
Supports
Markdown
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