From 719a6fec40e54f409d4a4e2bb32e6dc0e2423d3a Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 27 May 2013 18:57:37 -0700 Subject: [PATCH] Rename CRM_Import -> CRM_Contact_Import CRM-11254 ---------------------------------------- * CRM-11254: Create parent class for import http://issues.civicrm.org/jira/browse/CRM-11254 ---------------------------------------- * CRM-11254: http://issues.civicrm.org/jira/browse/CRM-11254 * CRM-11254:: http://issues.civicrm.org/jira/browse/CRM-11254: --- CRM/Activity/Import/Form/Summary.php | 8 +- CRM/Activity/Import/Parser.php | 6 +- CRM/Activity/Import/Parser/Activity.php | 10 +- CRM/{ => Contact}/Import/Controller.php | 4 +- CRM/{ => Contact}/Import/Field.php | 2 +- CRM/{ => Contact}/Import/Form/DataSource.php | 30 ++--- CRM/{ => Contact}/Import/Form/MapField.php | 34 +++--- CRM/{ => Contact}/Import/Form/Preview.php | 32 +++--- CRM/{ => Contact}/Import/Form/Summary.php | 14 +-- CRM/{ => Contact}/Import/Form/UploadFile.php | 0 CRM/{ => Contact}/Import/ImportJob.php | 10 +- CRM/{ => Contact}/Import/Importer.php | 6 +- CRM/{ => Contact}/Import/Page/AJAX.php | 2 +- CRM/{ => Contact}/Import/Parser.php | 42 +++---- CRM/{ => Contact}/Import/Parser/Contact.php | 104 +++++++++--------- CRM/{ => Contact}/Import/StateMachine.php | 14 +-- CRM/Contribute/Import/Form/Summary.php | 2 +- CRM/Contribute/Import/Parser.php | 22 ++-- CRM/Contribute/Import/Parser/Contribution.php | 12 +- CRM/Contribute/StateMachine/Contribution.php | 4 +- CRM/Core/xml/Menu/Import.xml | 6 +- CRM/Event/Import/Field.php | 2 +- CRM/Event/Import/Form/Summary.php | 8 +- CRM/Event/Import/Parser.php | 6 +- CRM/Event/Import/Parser/Participant.php | 28 ++--- CRM/Import/DataSource.php | 2 - CRM/Import/DataSource/CSV.php | 2 +- CRM/Import/DataSource/SQL.php | 3 +- CRM/Mailing/Event/BAO/Forward.php | 2 +- CRM/Mailing/Event/BAO/Subscribe.php | 2 +- CRM/Member/Import/Form/Summary.php | 8 +- CRM/Member/Import/Parser.php | 6 +- CRM/Member/Import/Parser/Membership.php | 38 +++---- CRM/PCP/StateMachine/PCP.php | 4 +- .../CRM/{ => Contact}/Import/Form/CSV.tpl | 0 .../{ => Contact}/Import/Form/DataSource.hlp | 0 .../{ => Contact}/Import/Form/DataSource.tpl | 0 .../{ => Contact}/Import/Form/MapField.tpl | 4 +- .../{ => Contact}/Import/Form/MapTable.tpl | 0 .../CRM/{ => Contact}/Import/Form/Mapper.tpl | 0 .../CRM/{ => Contact}/Import/Form/Preview.tpl | 2 +- .../CRM/{ => Contact}/Import/Form/SQL.tpl | 0 .../CRM/{ => Contact}/Import/Form/Summary.tpl | 0 tools/CRM/Auction/StateMachine/Item.php | 2 +- 44 files changed, 240 insertions(+), 243 deletions(-) rename CRM/{ => Contact}/Import/Controller.php (93%) rename CRM/{ => Contact}/Import/Field.php (99%) rename CRM/{ => Contact}/Import/Form/DataSource.php (92%) rename CRM/{ => Contact}/Import/Form/MapField.php (97%) rename CRM/{ => Contact}/Import/Form/Preview.php (93%) rename CRM/{ => Contact}/Import/Form/Summary.php (89%) rename CRM/{ => Contact}/Import/Form/UploadFile.php (100%) rename CRM/{ => Contact}/Import/ImportJob.php (98%) rename CRM/{ => Contact}/Import/Importer.php (92%) rename CRM/{ => Contact}/Import/Page/AJAX.php (98%) rename CRM/{ => Contact}/Import/Parser.php (95%) rename CRM/{ => Contact}/Import/Parser/Contact.php (96%) rename CRM/{ => Contact}/Import/StateMachine.php (85%) rename templates/CRM/{ => Contact}/Import/Form/CSV.tpl (100%) rename templates/CRM/{ => Contact}/Import/Form/DataSource.hlp (100%) rename templates/CRM/{ => Contact}/Import/Form/DataSource.tpl (100%) rename templates/CRM/{ => Contact}/Import/Form/MapField.tpl (98%) rename templates/CRM/{ => Contact}/Import/Form/MapTable.tpl (100%) rename templates/CRM/{ => Contact}/Import/Form/Mapper.tpl (100%) rename templates/CRM/{ => Contact}/Import/Form/Preview.tpl (99%) rename templates/CRM/{ => Contact}/Import/Form/SQL.tpl (100%) rename templates/CRM/{ => Contact}/Import/Form/Summary.tpl (100%) diff --git a/CRM/Activity/Import/Form/Summary.php b/CRM/Activity/Import/Form/Summary.php index c8f8d3847f..987581d2ed 100644 --- a/CRM/Activity/Import/Form/Summary.php +++ b/CRM/Activity/Import/Form/Summary.php @@ -54,11 +54,11 @@ class CRM_Activity_Import_Form_Summary extends CRM_Core_Form { $totalRowCount += $relatedCount; $this->set('totalRowCount', $totalRowCount); - $invalidRowCount = $this->get('invalidRowCount'); - $conflictRowCount = $this->get('conflictRowCount'); + $invalidRowCount = $this->get('invalidRowCount'); + $conflictRowCount = $this->get('conflictRowCount'); $duplicateRowCount = $this->get('duplicateRowCount'); - $onDuplicate = $this->get('onDuplicate'); - $mismatchCount = $this->get('unMatchCount'); + $onDuplicate = $this->get('onDuplicate'); + $mismatchCount = $this->get('unMatchCount'); if ($duplicateRowCount > 0) { $urlParams = 'type=' . CRM_Activity_Import_Parser::DUPLICATE . '&parser=CRM_Activity_Import_Parser'; $this->set('downloadDuplicateRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); diff --git a/CRM/Activity/Import/Parser.php b/CRM/Activity/Import/Parser.php index 4b9e93a7e1..1ade0e306c 100644 --- a/CRM/Activity/Import/Parser.php +++ b/CRM/Activity/Import/Parser.php @@ -528,7 +528,7 @@ abstract class CRM_Activity_Import_Parser { $this->_fields[$name] = new CRM_Activity_Import_Field($name, $title, $type, $headerPattern, $dataPattern); } else { - $this->_fields[$name] = new CRM_Import_Field($name, $title, $type, $headerPattern, $dataPattern, CRM_Utils_Array::value('hasLocationType', $tempField[$name])); + $this->_fields[$name] = new CRM_Contact_Import_Field($name, $title, $type, $headerPattern, $dataPattern, CRM_Utils_Array::value('hasLocationType', $tempField[$name])); } } } @@ -639,12 +639,12 @@ abstract class CRM_Activity_Import_Parser { } function errorFileName($type) { - $fileName = CRM_Import_Parser::errorFileName($type); + $fileName = CRM_Contact_Import_Parser::errorFileName($type); return $fileName; } function saveFileName($type) { - $fileName = CRM_Import_Parser::saveFileName($type); + $fileName = CRM_Contact_Import_Parser::saveFileName($type); return $fileName; } } diff --git a/CRM/Activity/Import/Parser/Activity.php b/CRM/Activity/Import/Parser/Activity.php index a88957c699..6383db367e 100644 --- a/CRM/Activity/Import/Parser/Activity.php +++ b/CRM/Activity/Import/Parser/Activity.php @@ -197,14 +197,14 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { $params[$key] = $dateValue; } else { - CRM_Import_Parser_Contact::addToErrorMsg('Activity date', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Activity date', $errorMessage); } } } elseif ($key == 'activity_engagement_level' && $val && !CRM_Utils_Rule::positiveInteger($val) ) { - CRM_Import_Parser_Contact::addToErrorMsg('Activity Engagement Index', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Activity Engagement Index', $errorMessage); } } //date-Format part ends @@ -212,13 +212,13 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { //checking error in custom data $params['contact_type'] = isset($this->_contactType) ? $this->_contactType : 'Activity'; - CRM_Import_Parser_Contact::isErrorInCustomData($params, $errorMessage); + CRM_Contact_Import_Parser_Contact::isErrorInCustomData($params, $errorMessage); if ($errorMessage) { $tempMsg = "Invalid value for field(s) : $errorMessage"; array_unshift($values, $tempMsg); $errorMessage = NULL; - return CRM_Import_Parser::ERROR; + return CRM_Contact_Import_Parser::ERROR; } return CRM_Activity_Import_Parser::VALID; @@ -260,7 +260,7 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { $params[$key] = CRM_Utils_Date::formatDate($val, $dateType); } elseif ($customFields[$customFieldID]['data_type'] == 'Date') { - CRM_Import_Parser_Contact::formatCustomDate($params, $params, $dateType, $key); + CRM_Contact_Import_Parser_Contact::formatCustomDate($params, $params, $dateType, $key); } elseif ($customFields[$customFieldID]['data_type'] == 'Boolean') { $params[$key] = CRM_Utils_String::strtoboolstr($val); diff --git a/CRM/Import/Controller.php b/CRM/Contact/Import/Controller.php similarity index 93% rename from CRM/Import/Controller.php rename to CRM/Contact/Import/Controller.php index be011d5dad..c1cf2c7a87 100644 --- a/CRM/Import/Controller.php +++ b/CRM/Contact/Import/Controller.php @@ -32,7 +32,7 @@ * $Id$ * */ -class CRM_Import_Controller extends CRM_Core_Controller { +class CRM_Contact_Import_Controller extends CRM_Core_Controller { /** * class constructor @@ -45,7 +45,7 @@ class CRM_Import_Controller extends CRM_Core_Controller { set_time_limit(0); } - $this->_stateMachine = new CRM_Import_StateMachine($this, $action); + $this->_stateMachine = new CRM_Contact_Import_StateMachine($this, $action); // create and instantiate the pages $this->addPages($this->_stateMachine, $action); diff --git a/CRM/Import/Field.php b/CRM/Contact/Import/Field.php similarity index 99% rename from CRM/Import/Field.php rename to CRM/Contact/Import/Field.php index c434cb8d8c..ffe7c301a9 100644 --- a/CRM/Import/Field.php +++ b/CRM/Contact/Import/Field.php @@ -24,7 +24,7 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ */ -class CRM_Import_Field { +class CRM_Contact_Import_Field { /**#@+ * @access protected diff --git a/CRM/Import/Form/DataSource.php b/CRM/Contact/Import/Form/DataSource.php similarity index 92% rename from CRM/Import/Form/DataSource.php rename to CRM/Contact/Import/Form/DataSource.php index 9a70a26d6c..720408eace 100644 --- a/CRM/Import/Form/DataSource.php +++ b/CRM/Contact/Import/Form/DataSource.php @@ -37,7 +37,7 @@ * This class delegates to the chosen DataSource to grab the data to be * imported. */ -class CRM_Import_Form_DataSource extends CRM_Core_Form { +class CRM_Contact_Import_Form_DataSource extends CRM_Core_Form { private $_dataSource; @@ -113,7 +113,7 @@ class CRM_Import_Form_DataSource extends CRM_Core_Form { $this->_dataSourceIsValid = TRUE; $this->assign('showDataSourceFormPane', TRUE); $dataSourcePath = explode('_', $this->_dataSource); - $templateFile = "CRM/Import/Form/" . $dataSourcePath[3] . ".tpl"; + $templateFile = "CRM/Contact/Import/Form/" . $dataSourcePath[3] . ".tpl"; $this->assign('dataSourceFormTemplateFile', $templateFile); } } @@ -149,16 +149,16 @@ class CRM_Import_Form_DataSource extends CRM_Core_Form { // duplicate handling options $duplicateOptions = array(); $duplicateOptions[] = $this->createElement('radio', - NULL, NULL, ts('Skip'), CRM_Import_Parser::DUPLICATE_SKIP + NULL, NULL, ts('Skip'), CRM_Contact_Import_Parser::DUPLICATE_SKIP ); $duplicateOptions[] = $this->createElement('radio', - NULL, NULL, ts('Update'), CRM_Import_Parser::DUPLICATE_UPDATE + NULL, NULL, ts('Update'), CRM_Contact_Import_Parser::DUPLICATE_UPDATE ); $duplicateOptions[] = $this->createElement('radio', - NULL, NULL, ts('Fill'), CRM_Import_Parser::DUPLICATE_FILL + NULL, NULL, ts('Fill'), CRM_Contact_Import_Parser::DUPLICATE_FILL ); $duplicateOptions[] = $this->createElement('radio', - NULL, NULL, ts('No Duplicate Checking'), CRM_Import_Parser::DUPLICATE_NOCHECK + NULL, NULL, ts('No Duplicate Checking'), CRM_Contact_Import_Parser::DUPLICATE_NOCHECK ); $this->addGroup($duplicateOptions, 'onDuplicate', @@ -179,17 +179,17 @@ class CRM_Import_Form_DataSource extends CRM_Core_Form { $contactOptions = array(); if (CRM_Contact_BAO_ContactType::isActive('Individual')) { $contactOptions[] = $this->createElement('radio', - NULL, NULL, ts('Individual'), CRM_Import_Parser::CONTACT_INDIVIDUAL, $js + NULL, NULL, ts('Individual'), CRM_Contact_Import_Parser::CONTACT_INDIVIDUAL, $js ); } if (CRM_Contact_BAO_ContactType::isActive('Household')) { $contactOptions[] = $this->createElement('radio', - NULL, NULL, ts('Household'), CRM_Import_Parser::CONTACT_HOUSEHOLD, $js + NULL, NULL, ts('Household'), CRM_Contact_Import_Parser::CONTACT_HOUSEHOLD, $js ); } if (CRM_Contact_BAO_ContactType::isActive('Organization')) { $contactOptions[] = $this->createElement('radio', - NULL, NULL, ts('Organization'), CRM_Import_Parser::CONTACT_ORGANIZATION, $js + NULL, NULL, ts('Organization'), CRM_Contact_Import_Parser::CONTACT_ORGANIZATION, $js ); } @@ -231,8 +231,8 @@ class CRM_Import_Form_DataSource extends CRM_Core_Form { $config = CRM_Core_Config::singleton(); $defaults = array( 'dataSource' => 'CRM_Import_DataSource_CSV', - 'onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP, - 'contactType' => CRM_Import_Parser::CONTACT_INDIVIDUAL, + 'onDuplicate' => CRM_Contact_Import_Parser::DUPLICATE_SKIP, + 'contactType' => CRM_Contact_Import_Parser::CONTACT_INDIVIDUAL, 'fieldSeparator' => $config->fieldSeparator, ); @@ -324,17 +324,17 @@ class CRM_Import_Form_DataSource extends CRM_Core_Form { $fieldNames = $this->_prepareImportTable($db, $importTableName); $mapper = array(); - $parser = new CRM_Import_Parser_Contact($mapper); + $parser = new CRM_Contact_Import_Parser_Contact($mapper); $parser->setMaxLinesToProcess(100); $parser->run($importTableName, $mapper, - CRM_Import_Parser::MODE_MAPFIELD, + CRM_Contact_Import_Parser::MODE_MAPFIELD, $contactType, $fieldNames['pk'], $fieldNames['status'], - CRM_Import_Parser::DUPLICATE_SKIP, + CRM_Contact_Import_Parser::DUPLICATE_SKIP, NULL, NULL, FALSE, - CRM_Import_Parser::DEFAULT_TIMEOUT, + CRM_Contact_Import_Parser::DEFAULT_TIMEOUT, $contactSubType, $dedupe ); diff --git a/CRM/Import/Form/MapField.php b/CRM/Contact/Import/Form/MapField.php similarity index 97% rename from CRM/Import/Form/MapField.php rename to CRM/Contact/Import/Form/MapField.php index 0ae89564fc..113bc6e9ae 100644 --- a/CRM/Import/Form/MapField.php +++ b/CRM/Contact/Import/Form/MapField.php @@ -36,7 +36,7 @@ /** * This class gets the name of the file to upload */ -class CRM_Import_Form_MapField extends CRM_Core_Form { +class CRM_Contact_Import_Form_MapField extends CRM_Core_Form { /** * cache of preview data values @@ -195,31 +195,31 @@ class CRM_Import_Form_MapField extends CRM_Core_Form { $highlightedFields[] = 'external_identifier'; //format custom field names, CRM-2676 switch ($this->get('contactType')) { - case CRM_Import_Parser::CONTACT_INDIVIDUAL: + case CRM_Contact_Import_Parser::CONTACT_INDIVIDUAL: $contactType = 'Individual'; $highlightedFields[] = 'first_name'; $highlightedFields[] = 'last_name'; break; - case CRM_Import_Parser::CONTACT_HOUSEHOLD: + case CRM_Contact_Import_Parser::CONTACT_HOUSEHOLD: $contactType = 'Household'; $highlightedFields[] = 'household_name'; break; - case CRM_Import_Parser::CONTACT_ORGANIZATION: + case CRM_Contact_Import_Parser::CONTACT_ORGANIZATION: $contactType = 'Organization'; $highlightedFields[] = 'organization_name'; break; } $this->_contactType = $contactType; - if ($this->_onDuplicate == CRM_Import_Parser::DUPLICATE_SKIP) { + if ($this->_onDuplicate == CRM_Contact_Import_Parser::DUPLICATE_SKIP) { unset($this->_mapperFields['id']); } else { $highlightedFields[] = 'id'; } - if ($this->_onDuplicate != CRM_Import_Parser::DUPLICATE_NOCHECK) { + if ($this->_onDuplicate != CRM_Contact_Import_Parser::DUPLICATE_NOCHECK) { //Mark Dedupe Rule Fields as required, since it's used in matching contact foreach (array( 'Individual', 'Household', 'Organization') as $cType) { @@ -324,7 +324,7 @@ class CRM_Import_Form_MapField extends CRM_Core_Form { $this->addElement('checkbox', 'saveMapping', $saveDetailsName, NULL, array('onclick' => "showSaveDetails(this)")); - $this->addFormRule(array('CRM_Import_Form_MapField', 'formRule')); + $this->addFormRule(array('CRM_Contact_Import_Form_MapField', 'formRule')); //-------- end of saved mapping stuff --------- @@ -431,7 +431,7 @@ class CRM_Import_Form_MapField extends CRM_Core_Form { //Modified the Relationship fields if the fields are //present in dedupe rule - if ($this->_onDuplicate != CRM_Import_Parser::DUPLICATE_NOCHECK && + if ($this->_onDuplicate != CRM_Contact_Import_Parser::DUPLICATE_NOCHECK && is_array($this->_dedupeFields[$cType]) ) { static $cTypeArray = array(); @@ -498,15 +498,15 @@ class CRM_Import_Form_MapField extends CRM_Core_Form { if (isset($mappingRelation[$i])) { // relationship mapping switch ($this->get('contactType')) { - case CRM_Import_Parser::CONTACT_INDIVIDUAL: + case CRM_Contact_Import_Parser::CONTACT_INDIVIDUAL: $contactType = 'Individual'; break; - case CRM_Import_Parser::CONTACT_HOUSEHOLD: + case CRM_Contact_Import_Parser::CONTACT_HOUSEHOLD: $contactType = 'Household'; break; - case CRM_Import_Parser::CONTACT_ORGANIZATION: + case CRM_Contact_Import_Parser::CONTACT_ORGANIZATION: $contactType = 'Organization'; } //CRM-5125 @@ -964,15 +964,15 @@ class CRM_Import_Form_MapField extends CRM_Core_Form { $locationTypes = CRM_Core_PseudoConstant::locationType(); $contactType = $this->get('contactType'); switch ($contactType) { - case CRM_Import_Parser::CONTACT_INDIVIDUAL: + case CRM_Contact_Import_Parser::CONTACT_INDIVIDUAL: $cType = 'Individual'; break; - case CRM_Import_Parser::CONTACT_HOUSEHOLD: + case CRM_Contact_Import_Parser::CONTACT_HOUSEHOLD: $cType = 'Household'; break; - case CRM_Import_Parser::CONTACT_ORGANIZATION: + case CRM_Contact_Import_Parser::CONTACT_ORGANIZATION: $cType = 'Organization'; } @@ -1029,7 +1029,7 @@ class CRM_Import_Form_MapField extends CRM_Core_Form { $this->set('savedMapping', $saveMappingFields->mapping_id); } - $parser = new CRM_Import_Parser_Contact($mapperKeysMain, $mapperLocType, $mapperPhoneType, + $parser = new CRM_Contact_Import_Parser_Contact($mapperKeysMain, $mapperLocType, $mapperPhoneType, $mapperImProvider, $related, $relatedContactType, $relatedContactDetails, $relatedContactLocType, $relatedContactPhoneType, $relatedContactImProvider, @@ -1040,13 +1040,13 @@ class CRM_Import_Form_MapField extends CRM_Core_Form { $statusFieldName = $this->get('statusFieldName'); $parser->run($this->_importTableName, $mapper, - CRM_Import_Parser::MODE_PREVIEW, + CRM_Contact_Import_Parser::MODE_PREVIEW, $this->get('contactType'), $primaryKeyName, $statusFieldName, $this->_onDuplicate, NULL, NULL, FALSE, - CRM_Import_Parser::DEFAULT_TIMEOUT, + CRM_Contact_Import_Parser::DEFAULT_TIMEOUT, $this->get('contactSubType'), $this->get('dedupe') ); diff --git a/CRM/Import/Form/Preview.php b/CRM/Contact/Import/Form/Preview.php similarity index 93% rename from CRM/Import/Form/Preview.php rename to CRM/Contact/Import/Form/Preview.php index 42d66e547b..16d67500e4 100644 --- a/CRM/Import/Form/Preview.php +++ b/CRM/Contact/Import/Form/Preview.php @@ -37,7 +37,7 @@ * This class previews the uploaded file and returns summary * statistics */ -class CRM_Import_Form_Preview extends CRM_Core_Form { +class CRM_Contact_Import_Form_Preview extends CRM_Core_Form { /** * Function to set variables up before form is built @@ -78,17 +78,17 @@ class CRM_Import_Form_Preview extends CRM_Core_Form { } if ($invalidRowCount) { - $urlParams = 'type=' . CRM_Import_Parser::ERROR . '&parser=CRM_Import_Parser'; + $urlParams = 'type=' . CRM_Contact_Import_Parser::ERROR . '&parser=CRM_Contact_Import_Parser'; $this->set('downloadErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); } if ($conflictRowCount) { - $urlParams = 'type=' . CRM_Import_Parser::CONFLICT . '&parser=CRM_Import_Parser'; + $urlParams = 'type=' . CRM_Contact_Import_Parser::CONFLICT . '&parser=CRM_Contact_Import_Parser'; $this->set('downloadConflictRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); } if ($mismatchCount) { - $urlParams = 'type=' . CRM_Import_Parser::NO_MATCH . '&parser=CRM_Import_Parser'; + $urlParams = 'type=' . CRM_Contact_Import_Parser::NO_MATCH . '&parser=CRM_Contact_Import_Parser'; $this->set('downloadMismatchRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); } @@ -184,7 +184,7 @@ class CRM_Import_Form_Preview extends CRM_Core_Form { $this->addButtons($buttons); - $this->addFormRule(array('CRM_Import_Form_Preview', 'formRule'), $this); + $this->addFormRule(array('CRM_Contact_Import_Form_Preview', 'formRule'), $this); } /** @@ -274,7 +274,7 @@ class CRM_Import_Form_Preview extends CRM_Core_Form { ); $tableName = $this->get('importTableName'); - $importJob = new CRM_Import_ImportJob($tableName); + $importJob = new CRM_Contact_Import_ImportJob($tableName); $importJob->setJobParams($importJobParams); // If ACL applies to the current user, update cache before running the import. @@ -319,13 +319,13 @@ class CRM_Import_Form_Preview extends CRM_Core_Form { $this->set('errorFile', $errorFile); - $urlParams = 'type=' . CRM_Import_Parser::ERROR . '&parser=CRM_Import_Parser'; + $urlParams = 'type=' . CRM_Contact_Import_Parser::ERROR . '&parser=CRM_Contact_Import_Parser'; $this->set('downloadErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); - $urlParams = 'type=' . CRM_Import_Parser::CONFLICT . '&parser=CRM_Import_Parser'; + $urlParams = 'type=' . CRM_Contact_Import_Parser::CONFLICT . '&parser=CRM_Contact_Import_Parser'; $this->set('downloadConflictRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); - $urlParams = 'type=' . CRM_Import_Parser::NO_MATCH . '&parser=CRM_Import_Parser'; + $urlParams = 'type=' . CRM_Contact_Import_Parser::NO_MATCH . '&parser=CRM_Contact_Import_Parser'; $this->set('downloadMismatchRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); } @@ -403,7 +403,7 @@ class CRM_Import_Form_Preview extends CRM_Core_Form { } } - $parser = new CRM_Import_Parser_Contact($mapperKeys, $mapperLocTypes, + $parser = new CRM_Contact_Import_Parser_Contact($mapperKeys, $mapperLocTypes, $mapperPhoneTypes, $mapperRelated, $mapperRelatedContactType, $mapperRelatedContactDetails, $mapperRelatedContactLocType, $mapperRelatedContactPhoneType @@ -449,7 +449,7 @@ class CRM_Import_Form_Preview extends CRM_Core_Form { $tableName = $this->get('importTableName'); //print "Running parser on table: $tableName
"; $parser->run($tableName, $mapperFields, - CRM_Import_Parser::MODE_IMPORT, + CRM_Contact_Import_Parser::MODE_IMPORT, $this->get('contactType'), $this->get('primaryKeyName'), $this->get('statusFieldName'), @@ -457,7 +457,7 @@ class CRM_Import_Form_Preview extends CRM_Core_Form { $this->get('statusID'), $this->get('totalRowCount'), $doGeocodeAddress, - CRM_Import_Parser::DEFAULT_TIMEOUT, + CRM_Contact_Import_Parser::DEFAULT_TIMEOUT, $this->get('contactSubType'), $this->get('dedupe') ); @@ -561,7 +561,7 @@ class CRM_Import_Form_Preview extends CRM_Core_Form { } // add all the necessary variables to the form - $parser->set($this, CRM_Import_Parser::MODE_IMPORT); + $parser->set($this, CRM_Contact_Import_Parser::MODE_IMPORT); // check if there is any error occured @@ -585,13 +585,13 @@ class CRM_Import_Form_Preview extends CRM_Core_Form { $this->set('errorFile', $errorFile); - $urlParams = 'type=' . CRM_Import_Parser::ERROR . '&parser=CRM_Import_Parser'; + $urlParams = 'type=' . CRM_Contact_Import_Parser::ERROR . '&parser=CRM_Contact_Import_Parser'; $this->set('downloadErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlparams)); - $urlParams = 'type=' . CRM_Import_Parser::CONFLICT . '&parser=CRM_Import_Parser'; + $urlParams = 'type=' . CRM_Contact_Import_Parser::CONFLICT . '&parser=CRM_Contact_Import_Parser'; $this->set('downloadConflictRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); - $urlParams = 'type=' . CRM_Import_Parser::NO_MATCH . '&parser=CRM_Import_Parser'; + $urlParams = 'type=' . CRM_Contact_Import_Parser::NO_MATCH . '&parser=CRM_Contact_Import_Parser'; $this->set('downloadMismatchRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); } } diff --git a/CRM/Import/Form/Summary.php b/CRM/Contact/Import/Form/Summary.php similarity index 89% rename from CRM/Import/Form/Summary.php rename to CRM/Contact/Import/Form/Summary.php index 1f78599c9e..634aab53a7 100644 --- a/CRM/Import/Form/Summary.php +++ b/CRM/Contact/Import/Form/Summary.php @@ -36,7 +36,7 @@ /** * This class summarizes the import results */ -class CRM_Import_Form_Summary extends CRM_Core_Form { +class CRM_Contact_Import_Form_Summary extends CRM_Core_Form { /** * Function to set variables up before form is built @@ -59,11 +59,11 @@ class CRM_Import_Form_Summary extends CRM_Core_Form { $mismatchCount = $this->get('unMatchCount'); $unparsedAddressCount = $this->get('unparsedAddressCount'); if ($duplicateRowCount > 0) { - $urlParams = 'type=' . CRM_Import_Parser::DUPLICATE . '&parser=CRM_Import_Parser'; + $urlParams = 'type=' . CRM_Contact_Import_Parser::DUPLICATE . '&parser=CRM_Contact_Import_Parser'; $this->set('downloadDuplicateRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); } elseif ($mismatchCount) { - $urlParams = 'type=' . CRM_Import_Parser::NO_MATCH . '&parser=CRM_Import_Parser'; + $urlParams = 'type=' . CRM_Contact_Import_Parser::NO_MATCH . '&parser=CRM_Contact_Import_Parser'; $this->set('downloadMismatchRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); } else { @@ -71,20 +71,20 @@ class CRM_Import_Form_Summary extends CRM_Core_Form { $this->set('duplicateRowCount', $duplicateRowCount); } if ($unparsedAddressCount) { - $urlParams = 'type=' . CRM_Import_Parser::UNPARSED_ADDRESS_WARNING . '&parser=CRM_Import_Parser'; + $urlParams = 'type=' . CRM_Contact_Import_Parser::UNPARSED_ADDRESS_WARNING . '&parser=CRM_Contact_Import_Parser'; $this->assign('downloadAddressRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); $unparsedStreetAddressString = ts('Records imported successfully but unable to parse some of the street addresses'); $this->assign('unparsedStreetAddressString', $unparsedStreetAddressString); } $this->assign('dupeError', FALSE); - if ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) { + if ($onDuplicate == CRM_Contact_Import_Parser::DUPLICATE_UPDATE) { $dupeActionString = ts('These records have been updated with the imported data.'); } - elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_REPLACE) { + elseif ($onDuplicate == CRM_Contact_Import_Parser::DUPLICATE_REPLACE) { $dupeActionString = ts('These records have been replaced with the imported data.'); } - elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_FILL) { + elseif ($onDuplicate == CRM_Contact_Import_Parser::DUPLICATE_FILL) { $dupeActionString = ts('These records have been filled in with the imported data.'); } else { diff --git a/CRM/Import/Form/UploadFile.php b/CRM/Contact/Import/Form/UploadFile.php similarity index 100% rename from CRM/Import/Form/UploadFile.php rename to CRM/Contact/Import/Form/UploadFile.php diff --git a/CRM/Import/ImportJob.php b/CRM/Contact/Import/ImportJob.php similarity index 98% rename from CRM/Import/ImportJob.php rename to CRM/Contact/Import/ImportJob.php index f53b84380a..fdf8283157 100644 --- a/CRM/Import/ImportJob.php +++ b/CRM/Contact/Import/ImportJob.php @@ -36,7 +36,7 @@ /** * This class acts like a psuedo-BAO for transient import job tables */ -class CRM_Import_ImportJob { +class CRM_Contact_Import_ImportJob { protected $_tableName; protected $_primaryKeyName; @@ -245,7 +245,7 @@ class CRM_Import_ImportJob { } } - $this->_parser = new CRM_Import_Parser_Contact( + $this->_parser = new CRM_Contact_Import_Parser_Contact( $this->_mapperKeys, $this->_mapperLocTypes, $this->_mapperPhoneTypes, @@ -261,7 +261,7 @@ class CRM_Import_ImportJob { ); $this->_parser->run($this->_tableName, $mapperFields, - CRM_Import_Parser::MODE_IMPORT, + CRM_Contact_Import_Parser::MODE_IMPORT, $this->_contactType, $this->_primaryKeyName, $this->_statusFieldName, @@ -269,7 +269,7 @@ class CRM_Import_ImportJob { $this->_statusID, $this->_totalRowCount, $this->_doGeocodeAddress, - CRM_Import_Parser::DEFAULT_TIMEOUT, + CRM_Contact_Import_Parser::DEFAULT_TIMEOUT, $this->_contactSubType, $this->_dedupe ); @@ -307,7 +307,7 @@ class CRM_Import_ImportJob { } public function setFormVariables($form) { - $this->_parser->set($form, CRM_Import_Parser::MODE_IMPORT); + $this->_parser->set($form, CRM_Contact_Import_Parser::MODE_IMPORT); } private function _addImportedContactsToNewGroup($contactIds, diff --git a/CRM/Import/Importer.php b/CRM/Contact/Import/Importer.php similarity index 92% rename from CRM/Import/Importer.php rename to CRM/Contact/Import/Importer.php index 6f785b4d55..489a5c766b 100644 --- a/CRM/Import/Importer.php +++ b/CRM/Contact/Import/Importer.php @@ -37,16 +37,16 @@ * This class mainly exists to allow imports to be triggered synchronously (i.e. * via a form post) and asynchronously (i.e. by the workflow system) */ -class CRM_Import_Importer { +class CRM_Contact_Import_Importer { public function __construct() { // may not need this } public function runIncompleteImportJobs($timeout = 55) { $startTime = time(); - $incompleteImportTables = CRM_Import_ImportJob::getIncompleteImportTables(); + $incompleteImportTables = CRM_Contact_Import_ImportJob::getIncompleteImportTables(); foreach ($incompleteImportTables as $importTable) { - $importJob = new CRM_Import_ImportJob($importTable); + $importJob = new CRM_Contact_Import_ImportJob($importTable); $importJob->runImport(NULL, $timeout); $currentTime = time(); if (($currentTime - $startTime) >= $timeout) { diff --git a/CRM/Import/Page/AJAX.php b/CRM/Contact/Import/Page/AJAX.php similarity index 98% rename from CRM/Import/Page/AJAX.php rename to CRM/Contact/Import/Page/AJAX.php index 38d16c1f14..fa9a4241d8 100644 --- a/CRM/Import/Page/AJAX.php +++ b/CRM/Contact/Import/Page/AJAX.php @@ -36,7 +36,7 @@ /** * This class contains all the function that are called using AJAX */ -class CRM_Import_Page_AJAX { +class CRM_Contact_Import_Page_AJAX { /** * Function to show import status diff --git a/CRM/Import/Parser.php b/CRM/Contact/Import/Parser.php similarity index 95% rename from CRM/Import/Parser.php rename to CRM/Contact/Import/Parser.php index fccd05e661..9d071c9fb3 100644 --- a/CRM/Import/Parser.php +++ b/CRM/Contact/Import/Parser.php @@ -35,7 +35,7 @@ -abstract class CRM_Import_Parser { +abstract class CRM_Contact_Import_Parser { CONST MAX_ERRORS = 250, MAX_WARNINGS = 25, VALID = 1, WARNING = 2, ERROR = 4, CONFLICT = 8, STOP = 16, DUPLICATE = 32, MULTIPLE_DUPE = 64, NO_MATCH = 128, UNPARSED_ADDRESS_WARNING = 256; /** @@ -247,7 +247,7 @@ abstract class CRM_Import_Parser { $statusID = NULL, $totalRowCount = NULL, $doGeocodeAddress = FALSE, - $timeout = CRM_Import_Parser::DEFAULT_TIMEOUT, + $timeout = CRM_Contact_Import_Parser::DEFAULT_TIMEOUT, $contactSubType = NULL, $dedupeRuleGroupID = NULL ) { @@ -257,15 +257,15 @@ abstract class CRM_Import_Parser { $this->_dedupeRuleGroupID = $dedupeRuleGroupID; switch ($contactType) { - case CRM_Import_Parser::CONTACT_INDIVIDUAL: + case CRM_Contact_Import_Parser::CONTACT_INDIVIDUAL: $this->_contactType = 'Individual'; break; - case CRM_Import_Parser::CONTACT_HOUSEHOLD: + case CRM_Contact_Import_Parser::CONTACT_HOUSEHOLD: $this->_contactType = 'Household'; break; - case CRM_Import_Parser::CONTACT_ORGANIZATION: + case CRM_Contact_Import_Parser::CONTACT_ORGANIZATION: $this->_contactType = 'Organization'; } @@ -552,7 +552,7 @@ abstract class CRM_Import_Parser { $this->_activeFieldCount = count($fieldKeys); foreach ($fieldKeys as $key) { if (empty($this->_fields[$key])) { - $this->_activeFields[] = new CRM_Import_Field('', ts('- do not import -')); + $this->_activeFields[] = new CRM_Contact_Import_Field('', ts('- do not import -')); } else { $this->_activeFields[] = clone($this->_fields[$key]); @@ -801,9 +801,9 @@ abstract class CRM_Import_Parser { $headerPattern = '//', $dataPattern = '//', $hasLocationType = FALSE ) { - $this->_fields[$name] = new CRM_Import_Field($name, $title, $type, $headerPattern, $dataPattern, $hasLocationType); + $this->_fields[$name] = new CRM_Contact_Import_Field($name, $title, $type, $headerPattern, $dataPattern, $hasLocationType); if (empty($name)) { - $this->_fields['doNotImport'] = new CRM_Import_Field($name, $title, $type, $headerPattern, $dataPattern, $hasLocationType); + $this->_fields['doNotImport'] = new CRM_Contact_Import_Field($name, $title, $type, $headerPattern, $dataPattern, $hasLocationType); } } @@ -844,15 +844,15 @@ abstract class CRM_Import_Parser { switch ($this->_contactType) { case 'Individual': - $store->set('contactType', CRM_Import_Parser::CONTACT_INDIVIDUAL); + $store->set('contactType', CRM_Contact_Import_Parser::CONTACT_INDIVIDUAL); break; case 'Household': - $store->set('contactType', CRM_Import_Parser::CONTACT_HOUSEHOLD); + $store->set('contactType', CRM_Contact_Import_Parser::CONTACT_HOUSEHOLD); break; case 'Organization': - $store->set('contactType', CRM_Import_Parser::CONTACT_ORGANIZATION); + $store->set('contactType', CRM_Contact_Import_Parser::CONTACT_ORGANIZATION); } if ($this->_invalidRowCount) { @@ -973,23 +973,23 @@ abstract class CRM_Import_Parser { $config = CRM_Core_Config::singleton(); $fileName = $config->uploadDir . "sqlImport"; switch ($type) { - case CRM_Import_Parser::ERROR: + case CRM_Contact_Import_Parser::ERROR: $fileName .= '.errors'; break; - case CRM_Import_Parser::CONFLICT: + case CRM_Contact_Import_Parser::CONFLICT: $fileName .= '.conflicts'; break; - case CRM_Import_Parser::DUPLICATE: + case CRM_Contact_Import_Parser::DUPLICATE: $fileName .= '.duplicates'; break; - case CRM_Import_Parser::NO_MATCH: + case CRM_Contact_Import_Parser::NO_MATCH: $fileName .= '.mismatch'; break; - case CRM_Import_Parser::UNPARSED_ADDRESS_WARNING: + case CRM_Contact_Import_Parser::UNPARSED_ADDRESS_WARNING: $fileName .= '.unparsedAddress'; break; } @@ -1003,23 +1003,23 @@ abstract class CRM_Import_Parser { return $fileName; } switch ($type) { - case CRM_Import_Parser::ERROR: + case CRM_Contact_Import_Parser::ERROR: $fileName = 'Import_Errors.csv'; break; - case CRM_Import_Parser::CONFLICT: + case CRM_Contact_Import_Parser::CONFLICT: $fileName = 'Import_Conflicts.csv'; break; - case CRM_Import_Parser::DUPLICATE: + case CRM_Contact_Import_Parser::DUPLICATE: $fileName = 'Import_Duplicates.csv'; break; - case CRM_Import_Parser::NO_MATCH: + case CRM_Contact_Import_Parser::NO_MATCH: $fileName = 'Import_Mismatch.csv'; break; - case CRM_Import_Parser::UNPARSED_ADDRESS_WARNING: + case CRM_Contact_Import_Parser::UNPARSED_ADDRESS_WARNING: $fileName = 'Import_Unparsed_Address.csv'; break; } diff --git a/CRM/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php similarity index 96% rename from CRM/Import/Parser/Contact.php rename to CRM/Contact/Import/Parser/Contact.php index 3077195539..1516e919f9 100644 --- a/CRM/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -40,7 +40,7 @@ require_once 'api/v3/Contact.php'; /** * class to parse contact csv files */ -class CRM_Import_Parser_Contact extends CRM_Import_Parser { +class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { protected $_mapperKeys; protected $_mapperLocType; protected $_mapperPhoneType; @@ -234,8 +234,8 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { $this->_updateWithId = FALSE; if (in_array('id', $this->_mapperKeys) || ($this->_externalIdentifierIndex >= 0 && in_array($this->_onDuplicate, array( - CRM_Import_Parser::DUPLICATE_UPDATE, - CRM_Import_Parser::DUPLICATE_FILL, + CRM_Contact_Import_Parser::DUPLICATE_UPDATE, + CRM_Contact_Import_Parser::DUPLICATE_FILL, )))) { $this->_updateWithId = TRUE; } @@ -252,7 +252,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { * @access public */ function mapField(&$values) { - return CRM_Import_Parser::VALID; + return CRM_Contact_Import_Parser::VALID; } /** @@ -332,7 +332,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { ); $this->updateImportRecord($values[count($values) - 1], $importRecordParams); - return CRM_Import_Parser::ERROR; + return CRM_Contact_Import_Parser::ERROR; } } @@ -349,7 +349,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { ); $this->updateImportRecord($values[count($values) - 1], $importRecordParams); - return CRM_Import_Parser::ERROR; + return CRM_Contact_Import_Parser::ERROR; } /* otherwise, count it and move on */ @@ -370,7 +370,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { ); $this->updateImportRecord($values[count($values) - 1], $importRecordParams); - return CRM_Import_Parser::ERROR; + return CRM_Contact_Import_Parser::ERROR; } //check for duplicate external Identifier @@ -386,7 +386,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { "${statusFieldName}Msg" => $errorMessage, ); $this->updateImportRecord($values[count($values) - 1], $importRecordParams); - return CRM_Import_Parser::ERROR; + return CRM_Contact_Import_Parser::ERROR; } //otherwise, count it and move on $this->_allExternalIdentifiers[$externalID] = $this->_lineCount; @@ -421,7 +421,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { $this->updateImportRecord($values[count($values) - 1], $importRecordParams); array_unshift($values, $tempMsg); $errorMessage = NULL; - return CRM_Import_Parser::ERROR; + return CRM_Contact_Import_Parser::ERROR; } //if user correcting errors by walking back @@ -432,7 +432,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { ); $this->updateImportRecord($values[count($values) - 1], $importRecordParams); - return CRM_Import_Parser::VALID; + return CRM_Contact_Import_Parser::VALID; } /** @@ -457,7 +457,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { $response = $this->summary($values); $statusFieldName = $this->_statusFieldName; - if ($response != CRM_Import_Parser::VALID) { + if ($response != CRM_Contact_Import_Parser::VALID) { $importRecordParams = array( $statusFieldName => 'INVALID', "${statusFieldName}Msg" => "Invalid (Error Code: $response)", @@ -478,8 +478,8 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { //check if external identifier exists in database if (CRM_Utils_Array::value('external_identifier', $params) && (CRM_Utils_Array::value('id', $params) || in_array($onDuplicate, array( - CRM_Import_Parser::DUPLICATE_SKIP, - CRM_Import_Parser::DUPLICATE_NOCHECK, + CRM_Contact_Import_Parser::DUPLICATE_SKIP, + CRM_Contact_Import_Parser::DUPLICATE_NOCHECK, )))) { if ($internalCid = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params['external_identifier'], 'id', 'external_identifier')) { @@ -491,7 +491,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { "${statusFieldName}Msg" => $errorMessage, ); $this->updateImportRecord($values[count($values) - 1], $importRecordParams); - return CRM_Import_Parser::DUPLICATE; + return CRM_Contact_Import_Parser::DUPLICATE; } } } @@ -508,7 +508,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { elseif (!CRM_Contact_BAO_ContactType::isExtendsContactType($subType, $this->_contactType)) { $message = "Mismatched or Invalid Contact SubType."; array_unshift($values, $message); - return CRM_Import_Parser::NO_MATCH; + return CRM_Contact_Import_Parser::NO_MATCH; } } @@ -549,7 +549,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { else { $message = "More than one matching contact found for given criteria."; array_unshift($values, $message); - $this->_retCode = CRM_Import_Parser::NO_MATCH; + $this->_retCode = CRM_Contact_Import_Parser::NO_MATCH; } } else { @@ -580,26 +580,26 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { $message = "Mismatched contact SubTypes :"; array_unshift($values, $message); $updateflag = FALSE; - $this->_retCode = CRM_Import_Parser::NO_MATCH; + $this->_retCode = CRM_Contact_Import_Parser::NO_MATCH; } else { $newContact = $this->createContact($formatted, $contactFields, $onDuplicate, $contactId, FALSE, $this->_dedupeRuleGroupID); $updateflag = FALSE; - $this->_retCode = CRM_Import_Parser::VALID; + $this->_retCode = CRM_Contact_Import_Parser::VALID; } } else { $message = "Mismatched contact Types :"; array_unshift($values, $message); $updateflag = FALSE; - $this->_retCode = CRM_Import_Parser::NO_MATCH; + $this->_retCode = CRM_Contact_Import_Parser::NO_MATCH; } } } if ($updateflag) { $message = "Mismatched contact IDs OR Mismatched contact Types :"; array_unshift($values, $message); - $this->_retCode = CRM_Import_Parser::NO_MATCH; + $this->_retCode = CRM_Contact_Import_Parser::NO_MATCH; } } } @@ -620,26 +620,26 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { $message = "Mismatched contact SubTypes :"; array_unshift($values, $message); - $this->_retCode = CRM_Import_Parser::NO_MATCH; + $this->_retCode = CRM_Contact_Import_Parser::NO_MATCH; } else { $newContact = $this->createContact($formatted, $contactFields, $onDuplicate, $params['id'], FALSE, $this->_dedupeRuleGroupID); - $this->_retCode = CRM_Import_Parser::VALID; + $this->_retCode = CRM_Contact_Import_Parser::VALID; } } else { $message = "Mismatched contact Types :"; array_unshift($values, $message); - $this->_retCode = CRM_Import_Parser::NO_MATCH; + $this->_retCode = CRM_Contact_Import_Parser::NO_MATCH; } } else { // we should avoid multiple errors for single record // since we have already retCode and we trying to force again. - if ($this->_retCode != CRM_Import_Parser::NO_MATCH) { + if ($this->_retCode != CRM_Contact_Import_Parser::NO_MATCH) { $message = "No contact found for this contact ID:" . $params['id']; array_unshift($values, $message); - $this->_retCode = CRM_Import_Parser::NO_MATCH; + $this->_retCode = CRM_Contact_Import_Parser::NO_MATCH; } } } @@ -694,12 +694,12 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { //get return code if we create new contact in update mode, CRM-4148 if ($this->_updateWithId) { - $this->_retCode = CRM_Import_Parser::VALID; + $this->_retCode = CRM_Contact_Import_Parser::VALID; } } elseif (isset($newContact) && CRM_Core_Error::isAPIError($newContact, CRM_Core_ERROR::DUPLICATE_CONTACT)) { // if duplicate, no need of further processing - if ($onDuplicate == CRM_Import_Parser::DUPLICATE_SKIP) { + if ($onDuplicate == CRM_Contact_Import_Parser::DUPLICATE_SKIP) { $errorMessage = "Skipping duplicate record"; array_unshift($values, $errorMessage); $importRecordParams = array( @@ -707,7 +707,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { "${statusFieldName}Msg" => $errorMessage, ); $this->updateImportRecord($values[count($values) - 1], $importRecordParams); - return CRM_Import_Parser::DUPLICATE; + return CRM_Contact_Import_Parser::DUPLICATE; } $relationship = TRUE; @@ -775,7 +775,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { if ($relCsType = CRM_Utils_Array::value('contact_sub_type', $params[$key]) && $relCsType != $relationType->$direction) { $errorMessage = ts("Mismatched or Invalid contact subtype found for this related contact"); array_unshift($values, $errorMessage); - return CRM_Import_Parser::NO_MATCH; + return CRM_Contact_Import_Parser::NO_MATCH; } else { $formatting['contact_sub_type'] = $relationType->$direction; @@ -792,14 +792,14 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { } // check for valid related contact id in update/fill mode, CRM-4424 if (in_array($onDuplicate, array( - CRM_Import_Parser::DUPLICATE_UPDATE, - CRM_Import_Parser::DUPLICATE_FILL, + CRM_Contact_Import_Parser::DUPLICATE_UPDATE, + CRM_Contact_Import_Parser::DUPLICATE_FILL, )) && CRM_Utils_Array::value('id', $params[$key])) { $relatedContactType = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params[$key]['id'], 'contact_type'); if (!$relatedContactType) { $errorMessage = ts("No contact found for this related contact ID: %1", array(1 => $params[$key]['id'])); array_unshift($values, $errorMessage); - return CRM_Import_Parser::NO_MATCH; + return CRM_Contact_Import_Parser::NO_MATCH; } else { //validation of related contact subtype for update mode @@ -813,7 +813,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { $relatedCsType != CRM_Utils_Array::value('contact_sub_type', $formatting))) { $errorMessage = ts("Mismatched or Invalid contact subtype found for this related contact ID: %1", array(1 => $params[$key]['id'])); array_unshift($values, $errorMessage); - return CRM_Import_Parser::NO_MATCH; + return CRM_Contact_Import_Parser::NO_MATCH; } else { // get related contact id to format data in update/fill mode, @@ -832,7 +832,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { if (!$allowToCreate) { $errorMessage = ts('Related contact required fields are missing.'); array_unshift($values, $errorMessage); - return CRM_Import_Parser::NO_MATCH; + return CRM_Contact_Import_Parser::NO_MATCH; } //fixed for CRM-4148 @@ -866,7 +866,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { "${statusFieldName}Msg" => $errorMessage, ); $this->updateImportRecord($values[count($values) - 1], $importRecordParams); - return CRM_Import_Parser::ERROR; + return CRM_Contact_Import_Parser::ERROR; } } else { @@ -874,8 +874,8 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { } // update/fill related contact after getting matching Contact Ids, CRM-4424 if (in_array($onDuplicate, array( - CRM_Import_Parser::DUPLICATE_UPDATE, - CRM_Import_Parser::DUPLICATE_FILL, + CRM_Contact_Import_Parser::DUPLICATE_UPDATE, + CRM_Contact_Import_Parser::DUPLICATE_FILL, ))) { //validation of related contact subtype for update mode //CRM-5125 @@ -887,7 +887,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { if (!empty($relatedCsType) && (!CRM_Contact_BAO_ContactType::isAllowEdit($matchedIDs[0], $relatedCsType) && $relatedCsType != CRM_Utils_Array::value('contact_sub_type', $formatting))) { $errorMessage = ts("Mismatched or Invalid contact subtype found for this related contact."); array_unshift($values, $errorMessage); - return CRM_Import_Parser::NO_MATCH; + return CRM_Contact_Import_Parser::NO_MATCH; } else { $updatedContact = $this->createContact($formatting, $contactFields, $onDuplicate, $matchedIDs[0]); @@ -1013,7 +1013,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { $errorMessage .= "\n" . $url_string; array_unshift($values, $errorMessage); $this->updateImportRecord($values[count($values) - 1], $importRecordParams); - return CRM_Import_Parser::ERROR; + return CRM_Contact_Import_Parser::ERROR; } // Params only had one id, so shift it out @@ -1022,14 +1022,14 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { $vals = array('contact_id' => $contactId); - if ($onDuplicate == CRM_Import_Parser::DUPLICATE_REPLACE) { + if ($onDuplicate == CRM_Contact_Import_Parser::DUPLICATE_REPLACE) { civicrm_api('contact', 'delete', $vals); $cid = CRM_Contact_BAO_Contact::createProfileContact($formatted, $contactFields, $contactId, NULL, NULL, $formatted['contact_type']); } - elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) { + elseif ($onDuplicate == CRM_Contact_Import_Parser::DUPLICATE_UPDATE) { $newContact = $this->createContact($formatted, $contactFields, $onDuplicate, $contactId); } - elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_FILL) { + elseif ($onDuplicate == CRM_Contact_Import_Parser::DUPLICATE_FILL) { $newContact = $this->createContact($formatted, $contactFields, $onDuplicate, $contactId); } // else skip does nothing and just returns an error code. @@ -1050,14 +1050,14 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { } } //CRM-262 No Duplicate Checking - if ($onDuplicate == CRM_Import_Parser::DUPLICATE_SKIP) { + if ($onDuplicate == CRM_Contact_Import_Parser::DUPLICATE_SKIP) { array_unshift($values, $url_string); $importRecordParams = array( $statusFieldName => 'DUPLICATE', "${statusFieldName}Msg" => "Skipping duplicate record", ); $this->updateImportRecord($values[count($values) - 1], $importRecordParams); - return CRM_Import_Parser::DUPLICATE; + return CRM_Contact_Import_Parser::DUPLICATE; } $importRecordParams = array( @@ -1065,7 +1065,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { ); $this->updateImportRecord($values[count($values) - 1], $importRecordParams); //return warning if street address is not parsed, CRM-5886 - return $this->processMessage($values, $statusFieldName, CRM_Import_Parser::VALID); + return $this->processMessage($values, $statusFieldName, CRM_Contact_Import_Parser::VALID); } else { // Not a dupe, so we had an error @@ -1076,11 +1076,11 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { "${statusFieldName}Msg" => $errorMessage, ); $this->updateImportRecord($values[count($values) - 1], $importRecordParams); - return CRM_Import_Parser::ERROR; + return CRM_Contact_Import_Parser::ERROR; } } // sleep(3); - return $this->processMessage($values, $statusFieldName, CRM_Import_Parser::VALID); + return $this->processMessage($values, $statusFieldName, CRM_Contact_Import_Parser::VALID); } /** @@ -1633,7 +1633,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { $newContact = NULL; - if (is_null($contactId) && ($onDuplicate != CRM_Import_Parser::DUPLICATE_NOCHECK)) { + if (is_null($contactId) && ($onDuplicate != CRM_Contact_Import_Parser::DUPLICATE_NOCHECK)) { $dupeCheck = (bool)($onDuplicate); } @@ -1694,7 +1694,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { * @param $cid int contact id */ function formatParams(&$params, $onDuplicate, $cid) { - if ($onDuplicate == CRM_Import_Parser::DUPLICATE_SKIP) { + if ($onDuplicate == CRM_Contact_Import_Parser::DUPLICATE_SKIP) { return; } @@ -1707,11 +1707,11 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { $modeUpdate = $modeFill = FALSE; - if ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) { + if ($onDuplicate == CRM_Contact_Import_Parser::DUPLICATE_UPDATE) { $modeUpdate = TRUE; } - if ($onDuplicate == CRM_Import_Parser::DUPLICATE_FILL) { + if ($onDuplicate == CRM_Contact_Import_Parser::DUPLICATE_FILL) { $modeFill = TRUE; } @@ -2037,7 +2037,7 @@ class CRM_Import_Parser_Contact extends CRM_Import_Parser { $statusFieldName => 'ERROR', "${statusFieldName}Msg" => $errorMessage, ); - $returnCode = CRM_Import_Parser::UNPARSED_ADDRESS_WARNING; + $returnCode = CRM_Contact_Import_Parser::UNPARSED_ADDRESS_WARNING; } $this->updateImportRecord($values[count($values) - 1], $importRecordParams); return $returnCode; diff --git a/CRM/Import/StateMachine.php b/CRM/Contact/Import/StateMachine.php similarity index 85% rename from CRM/Import/StateMachine.php rename to CRM/Contact/Import/StateMachine.php index 65edef1280..095762bf98 100644 --- a/CRM/Import/StateMachine.php +++ b/CRM/Contact/Import/StateMachine.php @@ -37,24 +37,24 @@ * State machine for managing different states of the Import process. * */ -class CRM_Import_StateMachine extends CRM_Core_StateMachine { +class CRM_Contact_Import_StateMachine extends CRM_Core_StateMachine { /** * class constructor * - * @param object CRM_Import_Controller + * @param object CRM_Contact_Import_Controller * @param int $action * - * @return object CRM_Import_StateMachine + * @return object CRM_Contact_Import_StateMachine */ function __construct(&$controller, $action = CRM_Core_Action::NONE) { parent::__construct($controller, $action); $this->_pages = array( - 'CRM_Import_Form_DataSource' => NULL, - 'CRM_Import_Form_MapField' => NULL, - 'CRM_Import_Form_Preview' => NULL, - 'CRM_Import_Form_Summary' => NULL, + 'CRM_Contact_Import_Form_DataSource' => NULL, + 'CRM_Contact_Import_Form_MapField' => NULL, + 'CRM_Contact_Import_Form_Preview' => NULL, + 'CRM_Contact_Import_Form_Summary' => NULL, ); $this->addSequentialPages($this->_pages, $action); diff --git a/CRM/Contribute/Import/Form/Summary.php b/CRM/Contribute/Import/Form/Summary.php index 2d9829281a..d78904f860 100644 --- a/CRM/Contribute/Import/Form/Summary.php +++ b/CRM/Contribute/Import/Form/Summary.php @@ -98,7 +98,7 @@ class CRM_Contribute_Import_Form_Summary extends CRM_Core_Form { $this->assign('dupeError', TRUE); - /* only subtract dupes from successfyul import if we're skipping */ + /* only subtract dupes from successful import if we're skipping */ $this->set('validRowCount', $totalRowCount - $invalidRowCount - $conflictRowCount - $duplicateRowCount - $mismatchCount - $invalidSoftCreditRowCount - $invalidPledgePaymentRowCount diff --git a/CRM/Contribute/Import/Parser.php b/CRM/Contribute/Import/Parser.php index 60082afef7..2d7b5cc8a9 100644 --- a/CRM/Contribute/Import/Parser.php +++ b/CRM/Contribute/Import/Parser.php @@ -666,7 +666,7 @@ pppp * @return void $this->_fields[$name] = new CRM_Contribute_Import_Field($name, $title, $type, $headerPattern, $dataPattern); } else { - $this->_fields[$name] = new CRM_Import_Field($name, $title, $type, $headerPattern, $dataPattern, + $this->_fields[$name] = new CRM_Contact_Import_Field($name, $title, $type, $headerPattern, $dataPattern, CRM_Utils_Array::value('hasLocationType', $tempField[$name]) ); } @@ -829,18 +829,18 @@ pppp * @return void case CRM_Contribute_Import_Parser::DUPLICATE: //here constants get collides. if ($type == CRM_Contribute_Import_Parser::ERROR) { - $type = CRM_Import_Parser::ERROR; + $type = CRM_Contact_Import_Parser::ERROR; } elseif ($type == CRM_Contribute_Import_Parser::NO_MATCH) { - $type = CRM_Import_Parser::NO_MATCH; + $type = CRM_Contact_Import_Parser::NO_MATCH; } elseif ($type == CRM_Contribute_Import_Parser::CONFLICT) { - $type = CRM_Import_Parser::CONFLICT; + $type = CRM_Contact_Import_Parser::CONFLICT; } else { - $type = CRM_Import_Parser::DUPLICATE; + $type = CRM_Contact_Import_Parser::DUPLICATE; } - $fileName = CRM_Import_Parser::errorFileName($type); + $fileName = CRM_Contact_Import_Parser::errorFileName($type); break; case CRM_Contribute_Import_Parser::SOFT_CREDIT_ERROR: @@ -868,18 +868,18 @@ pppp * @return void case CRM_Contribute_Import_Parser::DUPLICATE: //here constants get collides. if ($type == CRM_Contribute_Import_Parser::ERROR) { - $type = CRM_Import_Parser::ERROR; + $type = CRM_Contact_Import_Parser::ERROR; } elseif ($type == CRM_Contribute_Import_Parser::NO_MATCH) { - $type = CRM_Import_Parser::NO_MATCH; + $type = CRM_Contact_Import_Parser::NO_MATCH; } elseif ($type == CRM_Contribute_Import_Parser::CONFLICT) { - $type = CRM_Import_Parser::CONFLICT; + $type = CRM_Contact_Import_Parser::CONFLICT; } else { - $type = CRM_Import_Parser::DUPLICATE; + $type = CRM_Contact_Import_Parser::DUPLICATE; } - $fileName = CRM_Import_Parser::saveFileName($type); + $fileName = CRM_Contact_Import_Parser::saveFileName($type); break; case CRM_Contribute_Import_Parser::SOFT_CREDIT_ERROR: diff --git a/CRM/Contribute/Import/Parser/Contribution.php b/CRM/Contribute/Import/Parser/Contribution.php index 7e695d2858..acbb3cf968 100644 --- a/CRM/Contribute/Import/Parser/Contribution.php +++ b/CRM/Contribute/Import/Parser/Contribution.php @@ -177,7 +177,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa $params[$key] = $dateValue; } else { - CRM_Import_Parser_Contact::addToErrorMsg('Receive Date', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Receive Date', $errorMessage); } break; @@ -186,7 +186,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa $params[$key] = $dateValue; } else { - CRM_Import_Parser_Contact::addToErrorMsg('Cancel Date', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Cancel Date', $errorMessage); } break; @@ -195,7 +195,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa $params[$key] = $dateValue; } else { - CRM_Import_Parser_Contact::addToErrorMsg('Receipt date', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Receipt date', $errorMessage); } break; @@ -204,7 +204,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa $params[$key] = $dateValue; } else { - CRM_Import_Parser_Contact::addToErrorMsg('Thankyou Date', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Thankyou Date', $errorMessage); } break; } @@ -215,7 +215,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa $params['contact_type'] = 'Contribution'; //checking error in custom data - CRM_Import_Parser_Contact::isErrorInCustomData($params, $errorMessage); + CRM_Contact_Import_Parser_Contact::isErrorInCustomData($params, $errorMessage); if ($errorMessage) { $tempMsg = "Invalid value for field(s) : $errorMessage"; @@ -270,7 +270,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa } if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) { if ($customFields[$customFieldID]['data_type'] == 'Date') { - CRM_Import_Parser_Contact::formatCustomDate($params, $formatted, $dateType, $key); + CRM_Contact_Import_Parser_Contact::formatCustomDate($params, $formatted, $dateType, $key); unset($params[$key]); } elseif ($customFields[$customFieldID]['data_type'] == 'Boolean') { diff --git a/CRM/Contribute/StateMachine/Contribution.php b/CRM/Contribute/StateMachine/Contribution.php index 3161ad90e0..d37ef0b5f4 100644 --- a/CRM/Contribute/StateMachine/Contribution.php +++ b/CRM/Contribute/StateMachine/Contribution.php @@ -42,10 +42,10 @@ class CRM_Contribute_StateMachine_Contribution extends CRM_Core_StateMachine { /** * class constructor * - * @param object CRM_Import_Controller + * @param object CRM_Contact_Import_Controller * @param int $action * - * @return object CRM_Import_StateMachine + * @return object CRM_Contact_Import_StateMachine */ function __construct($controller, $action = CRM_Core_Action::NONE) { parent::__construct($controller, $action); diff --git a/CRM/Core/xml/Menu/Import.xml b/CRM/Core/xml/Menu/Import.xml index 351d80c04a..13e478d7f1 100644 --- a/CRM/Core/xml/Menu/Import.xml +++ b/CRM/Core/xml/Menu/Import.xml @@ -6,7 +6,7 @@ Import import contacts,access CiviCRM 1 - CRM_Import_Controller + CRM_Contact_Import_Controller 400 @@ -14,7 +14,7 @@ Import Contacts import contacts,access CiviCRM 1 - CRM_Import_Controller + CRM_Contact_Import_Controller 410 @@ -27,7 +27,7 @@ civicrm/ajax/status - CRM_Import_Page_AJAX::status + CRM_Contact_Import_Page_AJAX::status import contacts,access CiviCRM diff --git a/CRM/Event/Import/Field.php b/CRM/Event/Import/Field.php index ad38c9bdc4..a575ed7bef 100644 --- a/CRM/Event/Import/Field.php +++ b/CRM/Event/Import/Field.php @@ -122,7 +122,7 @@ class CRM_Event_Import_Field { if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($this->_name)) { static $customFields = NULL; if (!$customFields) { - $customFields = CRM_Core_BAO_CustomField::getFields('Membership'); + $customFields = CRM_Core_BAO_CustomField::getFields('Participant'); } if (!array_key_exists($customFieldID, $customFields)) { return FALSE; diff --git a/CRM/Event/Import/Form/Summary.php b/CRM/Event/Import/Form/Summary.php index 66754e6cf3..ca28a62b1e 100644 --- a/CRM/Event/Import/Form/Summary.php +++ b/CRM/Event/Import/Form/Summary.php @@ -53,11 +53,11 @@ class CRM_Event_Import_Form_Summary extends CRM_Core_Form { $totalRowCount += $relatedCount; $this->set('totalRowCount', $totalRowCount); - $invalidRowCount = $this->get('invalidRowCount'); - $conflictRowCount = $this->get('conflictRowCount'); + $invalidRowCount = $this->get('invalidRowCount'); + $conflictRowCount = $this->get('conflictRowCount'); $duplicateRowCount = $this->get('duplicateRowCount'); - $onDuplicate = $this->get('onDuplicate'); - $mismatchCount = $this->get('unMatchCount'); + $onDuplicate = $this->get('onDuplicate'); + $mismatchCount = $this->get('unMatchCount'); if ($duplicateRowCount > 0) { $urlParams = 'type=' . CRM_Event_Import_Parser::DUPLICATE . '&parser=CRM_Event_Import_Parser'; $this->set('downloadDuplicateRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); diff --git a/CRM/Event/Import/Parser.php b/CRM/Event/Import/Parser.php index 6e5e9c157a..13ba8570cb 100644 --- a/CRM/Event/Import/Parser.php +++ b/CRM/Event/Import/Parser.php @@ -550,7 +550,7 @@ abstract class CRM_Event_Import_Parser { $this->_fields[$name] = new CRM_Event_Import_Field($name, $title, $type, $headerPattern, $dataPattern); } else { - $this->_fields[$name] = new CRM_Import_Field($name, $title, $type, $headerPattern, $dataPattern, + $this->_fields[$name] = new CRM_Contact_Import_Field($name, $title, $type, $headerPattern, $dataPattern, CRM_Utils_Array::value('hasLocationType', $tempField[$name]) ); } @@ -685,12 +685,12 @@ abstract class CRM_Event_Import_Parser { } function errorFileName($type) { - $fileName = CRM_Import_Parser::errorFileName($type); + $fileName = CRM_Contact_Import_Parser::errorFileName($type); return $fileName; } function saveFileName($type) { - $fileName = CRM_Import_Parser::saveFileName($type); + $fileName = CRM_Contact_Import_Parser::saveFileName($type); return $fileName; } } diff --git a/CRM/Event/Import/Parser/Participant.php b/CRM/Event/Import/Parser/Participant.php index 477f7ca9c9..22f0794b5b 100644 --- a/CRM/Event/Import/Parser/Participant.php +++ b/CRM/Event/Import/Parser/Participant.php @@ -177,20 +177,20 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser { if (!(($index < 0) || ($this->_participantStatusIndex < 0))) { $errorRequired = !CRM_Utils_Array::value($this->_participantStatusIndex, $values); if (!CRM_Utils_Array::value('event_id', $params) && !CRM_Utils_Array::value('event_title', $params)) { - CRM_Import_Parser_Contact::addToErrorMsg('Event', $missingField); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Event', $missingField); } if (!CRM_Utils_Array::value('participant_status_id', $params)) { - CRM_Import_Parser_Contact::addToErrorMsg('Participant Status', $missingField); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Participant Status', $missingField); } } else { $errorRequired = TRUE; $missingField = NULL; if ($index < 0) { - CRM_Import_Parser_Contact::addToErrorMsg('Event', $missingField); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Event', $missingField); } if ($this->_participantStatusIndex < 0) { - CRM_Import_Parser_Contact::addToErrorMsg('Participant Status', $missingField); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Participant Status', $missingField); } } @@ -211,7 +211,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser { $params[$key] = $dateValue; } else { - CRM_Import_Parser_Contact::addToErrorMsg('Register Date', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Register Date', $errorMessage); } } elseif ($val && ($key == 'participant_role_id' || $key == 'participant_role')) { @@ -220,15 +220,15 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser { if ($key == 'participant_role_id') { foreach ($val as $role) { if (!in_array(trim($role), array_keys($roleIDs))) { - CRM_Import_Parser_Contact::addToErrorMsg('Participant Role Id', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Participant Role Id', $errorMessage); break; } } } else { foreach ($val as $role) { - if (!CRM_Import_Parser_Contact::in_value(trim($role), $roleIDs)) { - CRM_Import_Parser_Contact::addToErrorMsg('Participant Role', $errorMessage); + if (!CRM_Contact_Import_Parser_Contact::in_value(trim($role), $roleIDs)) { + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Participant Role', $errorMessage); break; } } @@ -238,12 +238,12 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser { $statusIDs = CRM_Event_PseudoConstant::participantStatus(); if ($key == 'participant_status_id') { if (!in_array(trim($val), array_keys($statusIDs))) { - CRM_Import_Parser_Contact::addToErrorMsg('Participant Status Id', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Participant Status Id', $errorMessage); break; } } - elseif (!CRM_Import_Parser_Contact::in_value($val, $statusIDs)) { - CRM_Import_Parser_Contact::addToErrorMsg('Participant Status', $errorMessage); + elseif (!CRM_Contact_Import_Parser_Contact::in_value($val, $statusIDs)) { + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Participant Status', $errorMessage); break; } } @@ -252,13 +252,13 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser { $params['contact_type'] = 'Participant'; //checking error in custom data - CRM_Import_Parser_Contact::isErrorInCustomData($params, $errorMessage); + CRM_Contact_Import_Parser_Contact::isErrorInCustomData($params, $errorMessage); if ($errorMessage) { $tempMsg = "Invalid value for field(s) : $errorMessage"; array_unshift($values, $tempMsg); $errorMessage = NULL; - return CRM_Import_Parser::ERROR; + return CRM_Contact_Import_Parser::ERROR; } return CRM_Event_Import_Parser::VALID; } @@ -292,7 +292,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser { if ($val) { if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) { if ($customFields[$customFieldID]['data_type'] == 'Date') { - CRM_Import_Parser_Contact::formatCustomDate($params, $formatted, $dateType, $key); + CRM_Contact_Import_Parser_Contact::formatCustomDate($params, $formatted, $dateType, $key); unset($params[$key]); } elseif ($customFields[$customFieldID]['data_type'] == 'Boolean') { diff --git a/CRM/Import/DataSource.php b/CRM/Import/DataSource.php index f5dd81a9c7..0a2b22e5a3 100644 --- a/CRM/Import/DataSource.php +++ b/CRM/Import/DataSource.php @@ -33,8 +33,6 @@ * */ -#require_once 'CRM/Import/Parser/Contact.php'; - /** * This class defines the DataSource interface but must be subclassed to be * useful. diff --git a/CRM/Import/DataSource/CSV.php b/CRM/Import/DataSource/CSV.php index a5ed742843..0f9c5b4c70 100644 --- a/CRM/Import/DataSource/CSV.php +++ b/CRM/Import/DataSource/CSV.php @@ -74,7 +74,7 @@ class CRM_Import_DataSource_CSV extends CRM_Import_DataSource { $form->set('originalColHeader', CRM_Utils_Array::value('original_col_header', $result)); $table = $result['import_table_name']; - $importJob = new CRM_Import_ImportJob($table); + $importJob = new CRM_Contact_Import_ImportJob($table); $form->set('importTableName', $importJob->getTableName()); } diff --git a/CRM/Import/DataSource/SQL.php b/CRM/Import/DataSource/SQL.php index 98c1faf865..5a9b3b9d2e 100644 --- a/CRM/Import/DataSource/SQL.php +++ b/CRM/Import/DataSource/SQL.php @@ -61,8 +61,7 @@ class CRM_Import_DataSource_SQL extends CRM_Import_DataSource { } public function postProcess(&$params, &$db, &$form) { - require_once 'CRM/Import/ImportJob.php'; - $importJob = new CRM_Import_ImportJob( + $importJob = new CRM_Contact_Import_ImportJob( CRM_Utils_Array::value( 'import_table_name', $params ), $params['sqlQuery'], true ); diff --git a/CRM/Mailing/Event/BAO/Forward.php b/CRM/Mailing/Event/BAO/Forward.php index 9f479685f5..2ecbf1a291 100644 --- a/CRM/Mailing/Event/BAO/Forward.php +++ b/CRM/Mailing/Event/BAO/Forward.php @@ -119,7 +119,7 @@ class CRM_Mailing_Event_BAO_Forward extends CRM_Mailing_Event_DAO_Forward { ); require_once 'CRM/Utils/DeprecatedUtils.php'; _civicrm_api3_deprecated_add_formatted_param($value, $formatted); - $formatted['onDuplicate'] = CRM_Import_Parser::DUPLICATE_SKIP; + $formatted['onDuplicate'] = CRM_Contact_Import_Parser::DUPLICATE_SKIP; $formatted['fixAddress'] = TRUE; $contact = civicrm_api('contact', 'create', $formatted); if (civicrm_error($contact)) { diff --git a/CRM/Mailing/Event/BAO/Subscribe.php b/CRM/Mailing/Event/BAO/Subscribe.php index ad7d1e5fcc..144271a4dd 100644 --- a/CRM/Mailing/Event/BAO/Subscribe.php +++ b/CRM/Mailing/Event/BAO/Subscribe.php @@ -114,7 +114,7 @@ LEFT JOIN civicrm_email ON contact_a.id = civicrm_email.contact_id ); _civicrm_api3_deprecated_add_formatted_param($value, $formatted); - $formatted['onDuplicate'] = CRM_Import_Parser::DUPLICATE_SKIP; + $formatted['onDuplicate'] = CRM_Contact_Import_Parser::DUPLICATE_SKIP; $formatted['fixAddress'] = TRUE; require_once 'api/api.php'; $contact = civicrm_api('contact', 'create', $formatted); diff --git a/CRM/Member/Import/Form/Summary.php b/CRM/Member/Import/Form/Summary.php index 095d4ea3f4..8b702ac1bb 100644 --- a/CRM/Member/Import/Form/Summary.php +++ b/CRM/Member/Import/Form/Summary.php @@ -54,11 +54,11 @@ class CRM_Member_Import_Form_Summary extends CRM_Core_Form { $totalRowCount += $relatedCount; $this->set('totalRowCount', $totalRowCount); - $invalidRowCount = $this->get('invalidRowCount'); - $conflictRowCount = $this->get('conflictRowCount'); + $invalidRowCount = $this->get('invalidRowCount'); + $conflictRowCount = $this->get('conflictRowCount'); $duplicateRowCount = $this->get('duplicateRowCount'); - $onDuplicate = $this->get('onDuplicate'); - $mismatchCount = $this->get('unMatchCount'); + $onDuplicate = $this->get('onDuplicate'); + $mismatchCount = $this->get('unMatchCount'); if ($duplicateRowCount > 0) { $urlParams = 'type=' . CRM_Member_Import_Parser::DUPLICATE . '&parser=CRM_Member_Import_Parser'; $this->set('downloadDuplicateRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); diff --git a/CRM/Member/Import/Parser.php b/CRM/Member/Import/Parser.php index 7afe34c30c..4c7ecac661 100644 --- a/CRM/Member/Import/Parser.php +++ b/CRM/Member/Import/Parser.php @@ -545,7 +545,7 @@ abstract class CRM_Member_Import_Parser { $this->_fields[$name] = new CRM_Member_Import_Field($name, $title, $type, $headerPattern, $dataPattern); } else { - $this->_fields[$name] = new CRM_Import_Field($name, $title, $type, $headerPattern, $dataPattern, + $this->_fields[$name] = new CRM_Contact_Import_Field($name, $title, $type, $headerPattern, $dataPattern, CRM_Utils_Array::value('hasLocationType', $tempField[$name]) ); } @@ -680,12 +680,12 @@ abstract class CRM_Member_Import_Parser { } function errorFileName($type) { - $fileName = CRM_Import_Parser::errorFileName($type); + $fileName = CRM_Contact_Import_Parser::errorFileName($type); return $fileName; } function saveFileName($type) { - $fileName = CRM_Import_Parser::saveFileName($type); + $fileName = CRM_Contact_Import_Parser::saveFileName($type); return $fileName; } } diff --git a/CRM/Member/Import/Parser/Membership.php b/CRM/Member/Import/Parser/Membership.php index 46310eed01..13c5e106aa 100644 --- a/CRM/Member/Import/Parser/Membership.php +++ b/CRM/Member/Import/Parser/Membership.php @@ -163,7 +163,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { //To check whether start date or join date is provided if (!CRM_Utils_Array::value('membership_start_date', $params) && !CRM_Utils_Array::value('join_date', $params)) { $errorMessage = 'Membership Start Date is required to create a memberships.'; - CRM_Import_Parser_Contact::addToErrorMsg('Start Date', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Start Date', $errorMessage); } //end @@ -177,33 +177,33 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { case 'join_date': if (CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key)) { if (!CRM_Utils_Rule::date($params[$key])) { - CRM_Import_Parser_Contact::addToErrorMsg('Member Since', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Member Since', $errorMessage); } } else { - CRM_Import_Parser_Contact::addToErrorMsg('Member Since', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Member Since', $errorMessage); } break; case 'membership_start_date': if (CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key)) { if (!CRM_Utils_Rule::date($params[$key])) { - CRM_Import_Parser_Contact::addToErrorMsg('Start Date', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Start Date', $errorMessage); } } else { - CRM_Import_Parser_Contact::addToErrorMsg('Start Date', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Start Date', $errorMessage); } break; case 'membership_end_date': if (CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key)) { if (!CRM_Utils_Rule::date($params[$key])) { - CRM_Import_Parser_Contact::addToErrorMsg('End date', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('End date', $errorMessage); } } else { - CRM_Import_Parser_Contact::addToErrorMsg('End date', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('End date', $errorMessage); } break; @@ -212,19 +212,19 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { if (!CRM_Utils_Array::crmInArray($val, $membershipTypes) && !array_key_exists($val, $membershipTypes) ) { - CRM_Import_Parser_Contact::addToErrorMsg('Membership Type', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Membership Type', $errorMessage); } break; case 'status_id': if (!CRM_Utils_Array::crmInArray($val, CRM_Member_PseudoConstant::membershipStatus())) { - CRM_Import_Parser_Contact::addToErrorMsg('Membership Status', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Membership Status', $errorMessage); } break; case 'email': if (!CRM_Utils_Rule::email($val)) { - CRM_Import_Parser_Contact::addToErrorMsg('Email Address', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Email Address', $errorMessage); } } } @@ -234,13 +234,13 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { $params['contact_type'] = 'Membership'; //checking error in custom data - CRM_Import_Parser_Contact::isErrorInCustomData($params, $errorMessage); + CRM_Contact_Import_Parser_Contact::isErrorInCustomData($params, $errorMessage); if ($errorMessage) { $tempMsg = "Invalid value for field(s) : $errorMessage"; array_unshift($values, $tempMsg); $errorMessage = NULL; - return CRM_Import_Parser::ERROR; + return CRM_Contact_Import_Parser::ERROR; } return CRM_Member_Import_Parser::VALID; @@ -286,33 +286,33 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { case 'join_date': if (CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key)) { if (!CRM_Utils_Rule::date($params[$key])) { - CRM_Import_Parser_Contact::addToErrorMsg('Member Since', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Member Since', $errorMessage); } } else { - CRM_Import_Parser_Contact::addToErrorMsg('Member Since', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Member Since', $errorMessage); } break; case 'membership_start_date': if (CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key)) { if (!CRM_Utils_Rule::date($params[$key])) { - CRM_Import_Parser_Contact::addToErrorMsg('Start Date', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Start Date', $errorMessage); } } else { - CRM_Import_Parser_Contact::addToErrorMsg('Start Date', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('Start Date', $errorMessage); } break; case 'membership_end_date': if (CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key)) { if (!CRM_Utils_Rule::date($params[$key])) { - CRM_Import_Parser_Contact::addToErrorMsg('End Date', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('End Date', $errorMessage); } } else { - CRM_Import_Parser_Contact::addToErrorMsg('End Date', $errorMessage); + CRM_Contact_Import_Parser_Contact::addToErrorMsg('End Date', $errorMessage); } break; @@ -336,7 +336,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { } if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) { if ( $customFields[$customFieldID]['data_type'] == 'Date' ) { - CRM_Import_Parser_Contact::formatCustomDate($params, $formatted, $dateType, $key); + CRM_Contact_Import_Parser_Contact::formatCustomDate($params, $formatted, $dateType, $key); unset($params[$key]); } else if ( $customFields[$customFieldID]['data_type'] == 'Boolean' ) { $params[$key] = CRM_Utils_String::strtoboolstr($val); diff --git a/CRM/PCP/StateMachine/PCP.php b/CRM/PCP/StateMachine/PCP.php index a1601442a5..3404e57408 100644 --- a/CRM/PCP/StateMachine/PCP.php +++ b/CRM/PCP/StateMachine/PCP.php @@ -42,10 +42,10 @@ class CRM_PCP_StateMachine_PCP extends CRM_Core_StateMachine { /** * class constructor * - * @param object CRM_Import_Controller + * @param object CRM_Contact_Import_Controller * @param int $action * - * @return object CRM_Import_StateMachine + * @return object CRM_Contact_Import_StateMachine */ function __construct($controller, $action = CRM_Core_Action::NONE) { parent::__construct($controller, $action); diff --git a/templates/CRM/Import/Form/CSV.tpl b/templates/CRM/Contact/Import/Form/CSV.tpl similarity index 100% rename from templates/CRM/Import/Form/CSV.tpl rename to templates/CRM/Contact/Import/Form/CSV.tpl diff --git a/templates/CRM/Import/Form/DataSource.hlp b/templates/CRM/Contact/Import/Form/DataSource.hlp similarity index 100% rename from templates/CRM/Import/Form/DataSource.hlp rename to templates/CRM/Contact/Import/Form/DataSource.hlp diff --git a/templates/CRM/Import/Form/DataSource.tpl b/templates/CRM/Contact/Import/Form/DataSource.tpl similarity index 100% rename from templates/CRM/Import/Form/DataSource.tpl rename to templates/CRM/Contact/Import/Form/DataSource.tpl diff --git a/templates/CRM/Import/Form/MapField.tpl b/templates/CRM/Contact/Import/Form/MapField.tpl similarity index 98% rename from templates/CRM/Import/Form/MapField.tpl rename to templates/CRM/Contact/Import/Form/MapField.tpl index 4a64921cbe..06af617fde 100644 --- a/templates/CRM/Import/Form/MapField.tpl +++ b/templates/CRM/Contact/Import/Form/MapField.tpl @@ -38,7 +38,7 @@
{include file="CRM/common/formButtons.tpl" location="top"}
{* Table for mapping data to CRM fields *} - {include file="CRM/Import/Form/MapTable.tpl} + {include file="CRM/Contact/Import/Form/MapTable.tpl}