Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
66673bfe
Commit
66673bfe
authored
2 years ago
by
Eileen McNaughton
Browse files
Options
Downloads
Patches
Plain Diff
Fix import regression - contribution import borks on do_not_import
parent
b70b865a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Contribute/Import/Form/MapField.php
+7
-21
7 additions, 21 deletions
CRM/Contribute/Import/Form/MapField.php
CRM/Contribute/Import/Parser/Contribution.php
+5
-1
5 additions, 1 deletion
CRM/Contribute/Import/Parser/Contribution.php
with
12 additions
and
22 deletions
CRM/Contribute/Import/Form/MapField.php
+
7
−
21
View file @
66673bfe
...
...
@@ -143,6 +143,7 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField {
$dataPatterns
=
$this
->
getDataPatterns
();
$mapperKeysValues
=
$this
->
getSubmittedValue
(
'mapper'
);
$columnHeaders
=
$this
->
getColumnHeaders
();
$fieldMappings
=
$this
->
getFieldMappings
();
/* Initialize all field usages to false */
foreach
(
$mapperKeys
as
$key
)
{
...
...
@@ -174,12 +175,13 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField {
$sel
=
&
$this
->
addElement
(
'hierselect'
,
"mapper[
$i
]"
,
ts
(
'Mapper for Field %1'
,
[
1
=>
$i
]),
NULL
);
$jsSet
=
FALSE
;
if
(
$this
->
getSubmittedValue
(
'savedMapping'
))
{
// $mappingContactType is not really a contact type - the data has been mangled
// into that field - see https://lab.civicrm.org/dev/core/-/issues/654
[
$mappingName
,
$mappingContactType
]
=
CRM_Core_BAO_Mapping
::
getMappingFields
(
$savedMappingID
);
$mappingName
=
$mappingName
[
1
];
$fieldMapping
=
$fieldMappings
[
$i
]
??
NULL
;
$mappingContactType
=
$mappingContactType
[
1
];
if
(
isset
(
$
m
apping
Name
[
$i
]))
{
if
(
$
mappingName
[
$i
]
!=
ts
(
'do_not_import'
))
{
if
(
isset
(
$
fieldM
apping
s
[
$i
]))
{
if
(
$
fieldMapping
[
'name'
]
!=
=
ts
(
'do_not_import'
))
{
$softField
=
$mappingContactType
[
$i
]
??
''
;
if
(
!
$softField
)
{
...
...
@@ -189,7 +191,7 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField {
$js
.
=
"
{
$formName
}
['mapper[
$i
][2]'].style.display = 'none';
\n
"
;
$js
.
=
"
{
$formName
}
['mapper[
$i
][3]'].style.display = 'none';
\n
"
;
$defaults
[
"mapper[
$i
]"
]
=
[
$
mappingName
[
$i
],
$
fieldMapping
[
'name'
],
$softField
,
// Since the soft credit type id is not stored we can't load it here.
''
,
...
...
@@ -253,22 +255,6 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField {
}
$js
.
=
"</script>
\n
"
;
$this
->
assign
(
'initHideBoxes'
,
$js
);
//set warning if mismatch in more than
if
(
isset
(
$mappingName
))
{
if
((
$this
->
_columnCount
!=
count
(
$mappingName
)))
{
$warning
++
;
}
}
if
(
$warning
!=
0
&&
$this
->
getSubmittedValue
(
'savedMapping'
))
{
$session
=
CRM_Core_Session
::
singleton
();
$session
->
setStatus
(
ts
(
'The data columns in this import file appear to be different from the saved mapping. Please verify that you have selected the correct saved mapping before continuing.'
));
}
else
{
$session
=
CRM_Core_Session
::
singleton
();
$session
->
setStatus
(
NULL
);
}
$this
->
setDefaults
(
$defaults
);
$this
->
addFormButtons
();
...
...
This diff is collapsed.
Click to expand it.
CRM/Contribute/Import/Parser/Contribution.php
+
5
−
1
View file @
66673bfe
...
...
@@ -160,7 +160,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Import_Parser {
public
function
getMappedRow
(
array
$values
):
array
{
$params
=
[];
foreach
(
$this
->
getFieldMappings
()
as
$i
=>
$mappedField
)
{
if
(
$mappedField
[
'name'
]
===
'do_not_import'
||
$mappedField
[
'name'
]
===
NULL
)
{
if
(
$mappedField
[
'name'
]
===
'do_not_import'
||
!
$mappedField
[
'name'
])
{
continue
;
}
if
(
!
empty
(
$mappedField
[
'soft_credit_match_field'
]))
{
...
...
@@ -223,6 +223,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Import_Parser {
'softCredit'
=>
TRUE
,
'headerPattern'
=>
'/Soft Credit/i'
,
'options'
=>
FALSE
,
'type'
=>
CRM_Utils_Type
::
T_STRING
,
],
]
);
...
...
@@ -926,6 +927,9 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Import_Parser {
if
(
empty
(
$this
->
importableFieldsMetadata
))
{
$this
->
setFieldMetadata
();
}
if
(
$mappedField
[
'name'
]
===
''
)
{
return
''
;
}
$title
=
[];
$title
[]
=
$this
->
getFieldMetadata
(
$mappedField
[
'name'
])[
'title'
];
if
(
$mappedField
[
'soft_credit_match_field'
])
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment