-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
[NFC] Cleanup towards CRM-20759, define variables more legibly & consistently. #10554
Conversation
e884fae
to
b515bdf
Compare
@@ -782,19 +758,19 @@ public function submit($params, $mapperKeys) { | |||
if (($first == 'a' && $second == 'b') || | |||
($first == 'b' && $second == 'a') | |||
) { | |||
$relatedVal = $this->_mapperFields[$fldName]; | |||
$parserParameters['mapperRelated'][$i] = $this->_mapperFields[$fldName]; |
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 changed this to match the other function's name - not sure it makes any more sense though :-)
CRM/Contact/Import/Form/MapField.php
Outdated
|
||
//set main contact properties. | ||
$properties = array( | ||
'ims' => 'mapperImProvider', | ||
'mapper' => 'mapper', |
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.
Yes, this can go too. I just stopped short to try to keep the focus narrow
ae56dd3
to
4d6b0b7
Compare
test this please |
ccb3463
to
741ceef
Compare
I really want the 2 copy & paste variants of this code loop to be combinable but I think it takes a numebr of small changes to get there in a readable way
741ceef
to
1881b7b
Compare
@@ -717,39 +717,15 @@ public function formatCustomFieldName(&$fields) { | |||
* @return \CRM_Contact_Import_Parser_Contact | |||
*/ | |||
public function submit($params, $mapperKeys) { | |||
$mapper = $mapperKeysMain = array(); | |||
$mapper = $mapperKeysMain = $locations = array(); | |||
$parserParameters = CRM_Contact_Import_Parser_Contact::getParameterForParser($this->_columnCount); |
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.
currently this just gets a base populated array - later I would like to move the whole derivation of $parserParameters into there & share between the 2 functions -but I feel that is too much for one pr
); | ||
|
||
//set respective mapper params to array. | ||
foreach (array_keys($mapperParams) as $mapperParam) { |
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 in conjunction with the $$mapperParam = NULL; loop does the same as CRM_Contact_Import_Parser_Contact::getParameterForParser
} | ||
} | ||
|
||
//set the respective mapper param array values. | ||
foreach ($mapperParams as $mapperParamKey => $mapperParamVal) { |
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.
The point of this is to transfer the value e.g $relatedContactTypeVal into the $relatedContactType array - weird huh!
} | ||
|
||
$this->set('columnNames', $this->_columnNames); | ||
|
||
//set main contact properties. |
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.
replaced by straightforward set statements below
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.
Seems to make sense to me @eileenmcnaughton
Thanks @seamuslee001 - merging. I'm still working on code over the top of this so it's getting further testing in there |
I really want the 2 copy & paste variants of this code loop to be combinable but I think it takes a numebr
of small changes to get there in a readable way
@totten - this is how I was planning on following up on that extraction - turning those weirdly assigned vars into an array & standardising across functions