Skip to content
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

Add links to search kits to import preview screen, when Civ-Import is enabled #25816

Merged
merged 1 commit into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions CRM/Import/Form/Preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ protected function assignPreviewVariables(): void {
$this->assign('mapper', $this->getMappedFieldLabels());
$this->assign('dataValues', $this->getDataRows([], 2));
$this->assign('columnNames', $this->getColumnHeaders());
// This can be overridden by Civi-Import so that the Download url
// links that go to SearchKit open in a new tab.
$this->assign('isOpenResultsInNewTab');
$this->assign('allRowsURL');
//get the mapping name displayed if the mappingId is set
$mappingId = $this->get('loadMappingId');
if ($mappingId) {
Expand Down
7 changes: 6 additions & 1 deletion ext/civiimport/civiimport.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,12 @@ function civiimport_civicrm_buildForm(string $formName, $form) {
}
}

if ($formName === 'CRM_Contact_Import_Form_Summary') {
//@todo - do for all Preview forms - just need to fix each Preview.tpl to
// not open in new tab as they are not yet consolidated into one file.
// (Or consolidate them now).
if ($formName === 'CRM_Contact_Import_Form_Summary' || $formName === 'CRM_Contribute_Import_Form_Preview') {
$form->assign('isOpenResultsInNewTab', TRUE);
$form->assign('downloadErrorRecordsUrl', CRM_Utils_System::url('civicrm/search', '', TRUE, '/display/Import_' . $form->getUserJobID() . '/Import_' . $form->getUserJobID() . '?_status=ERROR', FALSE));
$form->assign('allRowsUrl', CRM_Utils_System::url('civicrm/search', '', TRUE, '/display/Import_' . $form->getUserJobID() . '/Import_' . $form->getUserJobID(), FALSE));
}
}
8 changes: 5 additions & 3 deletions templates/CRM/Contribute/Import/Form/Preview.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

{if $invalidRowCount}
<p class="error">
{ts 1=$invalidRowCount 2=$downloadErrorRecordsUrl}CiviCRM has detected invalid data or formatting errors in %1 records. If you continue, these records will be skipped. You can download a file with just these problem records: <a href='%2'>Download Errors</a>. If you wish, you can then correct them in the original import file, cancel this import, and begin again at step 1.{/ts}
{ts 1=$invalidRowCount 2=$downloadErrorRecordsUrl}CiviCRM has detected invalid data or formatting errors in %1 records. If you continue, these records will be skipped. You can review these problem records: <a href='%2' {if $isOpenResultsInNewTab} target="_blank" rel="noopener noreferrer"{/if}>See Errors</a>. If you wish, you can then correct them in the original import file, cancel this import, and begin again at step 1.{/ts}
</p>
{/if}

Expand All @@ -32,15 +32,17 @@
<table id="preview-counts" class="report">
<tr><td class="label crm-grid-cell">{ts}Total Rows{/ts}</td>
<td class="data">{$totalRowCount}</td>
<td class="explanation">{ts}Total rows (contribution records) in uploaded file.{/ts}</td>
<td class="explanation">{ts}Total rows (contribution records) in uploaded file.{/ts}
{if $allRowsUrl} <a href="{$allRowsUrl}" target="_blank" rel="noopener noreferrer">{ts}See rows{/ts}</a>{/if}
</td>
</tr>

{if $invalidRowCount}
<tr class="error"><td class="label crm-grid-cell">{ts}Rows with Errors{/ts}</td>
<td class="data">{$invalidRowCount}</td>
<td class="explanation">{ts}Rows with invalid data in one or more fields. These rows will be skipped (not imported).{/ts}
{if $invalidRowCount}
<p><a href="{$downloadErrorRecordsUrl}">{ts}Download Errors{/ts}</a></p>
<p><a href="{$downloadErrorRecordsUrl|smarty:nodefaults}" {if $isOpenResultsInNewTab} target="_blank" rel="noopener noreferrer"{/if}>{ts}See Errors{/ts}</a></p>
{/if}
</td>
</tr>
Expand Down