Use search display to view errors when using Civi-import extension
authorEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 24 Nov 2022 00:15:00 +0000 (13:15 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 24 Nov 2022 00:15:00 +0000 (13:15 +1300)
This replaces the link to download the csv with a link to view the search
display if civiimport is enabled, allowing re-doing within the UI

ext/civiimport/civiimport.php
templates/CRM/Contact/Import/Form/Summary.tpl

index fe0aa5c517e7ad278acb71090951d7ef9ebf49dd..1cc66e1d186a747655a7a0922213c128d99cfe5d 100644 (file)
@@ -234,4 +234,8 @@ function civiimport_civicrm_buildForm(string $formName, $form) {
       }
     }
   }
+
+  if ($formName === 'CRM_Contact_Import_Form_Summary') {
+    $form->assign('downloadErrorRecordsUrl', '/civicrm/search#/display/Import_' . $form->getUserJobID() . '/Import_' . $form->getUserJobID() . '?_status=ERROR');
+  }
 }
index 9c57dfa77fcbf2849ff40c150fd2cc0d94ba9c2d..629bff6a05b8eb4b2e7548faf91dd99722f45291 100644 (file)
@@ -34,7 +34,7 @@
         {ts count=$invalidRowCount plural='CiviCRM has detected invalid data and/or formatting errors in %count records. These records have not been imported.'}CiviCRM has detected invalid data and/or formatting errors in one record. This record has not been imported.{/ts}
         </p>
         <p class="error">
-        {ts 1=$downloadErrorRecordsUrl|smarty:nodefaults}You can <a href='%1'>Download Errors</a>. You may then correct them, and import the new file with the corrected data.{/ts}
+        {ts 1=$downloadErrorRecordsUrl|smarty:nodefaults}You can <a href='%1'>See the errors</a>. You may then correct them, and re-import with the corrected data.{/ts}
         </p>
     {/if}
 
@@ -66,7 +66,7 @@
       <tr class="error"><td class="label crm-grid-cell">{ts}Invalid Rows (skipped){/ts}</td>
         <td class="data">{$invalidRowCount}</td>
         <td class="explanation">{ts}Rows with invalid data in one or more fields (for example, invalid email address formatting). These rows will be skipped (not imported).{/ts}
-          <div class="action-link"><a href="{$downloadErrorRecordsUrl|smarty:nodefaults}"><i class="crm-i fa-download" aria-hidden="true"></i> {ts}Download Errors{/ts}</a></div>
+          <div class="action-link"><a href="{$downloadErrorRecordsUrl|smarty:nodefaults}"><i class="crm-i fa-download" aria-hidden="true"></i> {ts}See Errors{/ts}</a></div>
         </td>
       </tr>
     {/if}