Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion includes/admin/class-dt-import.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ private function main_column() {
'assigned_to' => $file_assigned_to,
'data' => $this->mapping_process( $temp_name ),
'selected_geocode_api' => $selected_geocode_api,
'check_for_duplicates' => isset( $_POST['check_for_duplicates'] )
'check_for_duplicates' => isset( $_POST['check_for_duplicates'] ),
'overwrite_existing_fields' => isset( $_POST['overwrite_existing_fields'] )
];

set_transient( 'disciple_tools_import_settings', $import_settings, 3600 * 24 );
Expand Down Expand Up @@ -590,6 +591,11 @@ public function import_form() {
<input type='checkbox' name='check_for_duplicates' id='check_for_duplicates'>
<?php echo esc_html( printf( 'Instead of creating new %1$s, update existing %2$s that have the same email or phone number if a match is found.', $this->post_label_plural, $this->post_label_plural ) ); ?>
</label>
<br><br>
<label>
<input type='checkbox' checked name='overwrite_existing_fields' id='overwrite_existing_fields'>
<?php echo esc_html( 'Overwrite all existing fields?' ); ?>
</label>
</td>
</tr>
<?php endif; ?>
Expand Down Expand Up @@ -1016,6 +1022,7 @@ public function insert_data() {
$rest_url = rest_url() . 'dt-posts/v2/' . $this->post_type . '?silent=true';
if ( $import_settings['check_for_duplicates'] ){
$rest_url .= '&check_for_duplicates=contact_phone,contact_email';
$rest_url .= '&overwrite_existing_fields=' . ( ( isset( $import_settings['overwrite_existing_fields'] ) && $import_settings['overwrite_existing_fields'] ) ? 'true' : 'false' );
}
?>
<!-- Box -->
Expand Down