Skip to content
Snippets Groups Projects
Unverified Commit fda805c0 authored by Eileen McNaughton's avatar Eileen McNaughton Committed by GitHub
Browse files

Merge pull request #23777 from darrick/fix_import_disableUSPS

fix disableUSPS since import running in separate context of Queue.
parents 9c1d3669 ba70f014
No related branches found
No related tags found
No related merge requests found
......@@ -164,6 +164,7 @@ class CRM_Contact_Import_Form_DataSource extends CRM_Import_Form_DataSource {
'onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP,
'contactType' => CRM_Import_Parser::CONTACT_INDIVIDUAL,
'fieldSeparator' => CRM_Core_Config::singleton()->fieldSeparator,
'disableUSPS' => TRUE,
];
if ($this->get('loadedMapping')) {
......
......@@ -191,7 +191,6 @@ class CRM_Contact_Import_Form_Preview extends CRM_Import_Form_Preview {
CRM_ACL_BAO_Cache::deleteContactCacheEntry($userID);
}
CRM_Utils_Address_USPS::disable($this->getSubmittedValue('disableUSPS'));
$this->runTheImport();
}
......
......@@ -119,6 +119,10 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser {
public function import($values) {
$rowNumber = (int) $values[array_key_last($values)];
// Put this here for now since we're gettting run by a job and need to
// reset it for each task run.
CRM_Utils_Address_USPS::disable($this->getSubmittedValue('disableUSPS'));
$this->_unparsedStreetAddressContacts = [];
if (!$this->getSubmittedValue('doGeocodeAddress')) {
// CRM-5854, reset the geocode method to null to prevent geocoding
......
......@@ -80,7 +80,9 @@
{if $form.disableUSPS}
<tr class="crm-import-datasource-form-block-disableUSPS">
<td class="label"></td>
<td>{$form.disableUSPS.html} <label for="disableUSPS">{$form.disableUSPS.label}</label></td>
<td>{$form.disableUSPS.html} <label for="disableUSPS">{$form.disableUSPS.label}</label><br />
&nbsp;&nbsp;&nbsp; <span class="description">{ts}Uncheck at your own risk as batch processing violates USPS API TOS.{/ts}</span>
</td>
</tr>
{/if}
</table>
......
......@@ -2004,6 +2004,7 @@ class CRM_Contact_Import_Parser_ContactTest extends CiviUnitTestCase {
'contactType' => CRM_Import_Parser::CONTACT_INDIVIDUAL,
'contactSubType' => '',
'doGeocodeAddress' => 0,
'disableUSPS' => 0,
'dataSource' => 'CRM_Import_DataSource_SQL',
'sqlQuery' => 'SELECT first_name FROM civicrm_contact',
'onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment