-
-
Notifications
You must be signed in to change notification settings - Fork 828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRM-18397: Don't add empty billing name to non-existent billing address #8122
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1052,6 +1052,9 @@ public static function fixLocationFields(&$params, &$fields, &$form) { | |
} | ||
} | ||
|
||
// If there's no 'first_name' in the profile then overwrite the names from | ||
// the billing fields (if they are set) | ||
// @todo This logic is flawed, at least check each field?? | ||
if (is_array($fields)) { | ||
if (!array_key_exists('first_name', $fields)) { | ||
$nameFields = array('first_name', 'middle_name', 'last_name'); | ||
|
@@ -1065,11 +1068,12 @@ public static function fixLocationFields(&$params, &$fields, &$form) { | |
} | ||
} | ||
|
||
// also add location name to the array | ||
if ($form->_values['event']['is_monetary']) { | ||
// Add the billing names to the billing address, if a billing name is set | ||
if ($form->_values['event']['is_monetary'] && !empty($params['billing_first_name'])) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd really like to remove the first part of this if - on the basis the decision to record a billing_name should be based on whether we collected it - not a field that probably should not exist anyway. I'd settle for a code comment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ie: remove the event->is_monetary part of the condition? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah - I think it should go - but like I say - at min a comment to suggest that to the next person |
||
$params["address_name-{$form->_bltID}"] = CRM_Utils_Array::value('billing_first_name', $params) . ' ' . CRM_Utils_Array::value('billing_middle_name', $params) . ' ' . CRM_Utils_Array::value('billing_last_name', $params); | ||
$fields["address_name-{$form->_bltID}"] = 1; | ||
} | ||
|
||
$fields["email-{$form->_bltID}"] = 1; | ||
$fields['email-Primary'] = 1; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is largely a duplicate of the contribution function
$fields = $this->formatParamsForPaymentProcessor($fields);
However, there is a possible case where the syntax might diverge when dealing with multiple participants.
In general the contribution code is cleaner because rather than coming up with 100 & one conditions as to why we add or remove the billing fields it simply assumes that if we presented them on the form in the first place then we probably did so in order to save them