-
Notifications
You must be signed in to change notification settings - Fork 9
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
36784 Plugin can not set supervisor in address record #594
36784 Plugin can not set supervisor in address record #594
Conversation
Pull Request Test Coverage Report for Build 5886855372
💛 - Coveralls |
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.
@dai-eastgate
Looks good. I just found a missing part in documentation. Please take a look. :)
@@ -68,7 +68,7 @@ public function __construct( | |||
* @throws NotFoundException | |||
*/ | |||
public function createOrCompleteAddress( | |||
FormData $pFormData, bool $mergeExisting = false, string $contactType = ''): int | |||
FormData $pFormData, bool $mergeExisting = false, string $contactType = '', int $estateId = null): int |
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.
Could you please add PHPDoc for these arguments: $contactType and $estateId for complete documentation? :)
@@ -82,6 +82,13 @@ public function createOrCompleteAddress( | |||
if ( key_exists( 'newsletter', $requestParams ) ) { | |||
unset( $requestParams['newsletter'] ); | |||
} | |||
if (!empty($estateId)) { | |||
$userName = $this->getSupervisorUsernameByEstateId($estateId); | |||
if (!empty($userName)) { |
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.
In the past we got minor bugs with using empty() function because "0" and 0 is also empty true. It is unlikely but what happens if the ID or username is 0?
Do you think using isset could be better or could causes other errors?
Edit:
Oh I see getSupervisorUsernameByEstateId returns maybe an empty string. So I guess we need empty() here.
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.
I'll check and let you know asap
@andernath I fixed it, please review again for me. Thanks |
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.
Thanks, I will start testing.
Steps to install the approved version:
|
related to #553
changed log :
Add supervisor to address record when sending contact form in detail page