Skip to content

Commit

Permalink
Merge pull request #23456 from eileenmcnaughton/import_more
Browse files Browse the repository at this point in the history
[Import] Consolidate DataSource.tpl - template for first file on activity import
  • Loading branch information
yashodha authored May 26, 2022
2 parents 3150b83 + 0ac455f commit 7c63299
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 67 deletions.
8 changes: 0 additions & 8 deletions CRM/Activity/Import/Form/DataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,13 @@ class CRM_Activity_Import_Form_DataSource extends CRM_Import_Form_DataSource {
*/
public function buildQuickForm() {
parent::buildQuickForm();

// FIXME: This 'onDuplicate' form element is never used -- copy/paste error?
$this->addRadio('onDuplicate', ts('On duplicate entries'), [
CRM_Import_Parser::DUPLICATE_SKIP => ts('Skip'),
CRM_Import_Parser::DUPLICATE_UPDATE => ts('Update'),
CRM_Import_Parser::DUPLICATE_FILL => ts('Fill'),
]);
}

/**
* Process the uploaded file.
*/
public function postProcess() {
$this->storeFormValues([
'onDuplicate',
'dateFormats',
'savedMapping',
]);
Expand Down
45 changes: 1 addition & 44 deletions templates/CRM/Activity/Import/Form/DataSource.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,4 @@
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{* Import Wizard - Step 1 (choose data source) *}
<div class="crm-block crm-form-block crm-import-datasource-form-block">

{* WizardHeader.tpl provides visual display of steps thru the wizard as well as title for current step *}
{include file="CRM/common/WizardHeader.tpl"}
<div class="help">
{ts 1=$importEntity 2= $importEntities}The %1 Import Wizard allows you to easily upload %2 from other applications into CiviCRM.{/ts}
{ts}Files to be imported must be in the 'comma-separated-values' format (CSV) and must contain data needed to match an existing contact in your CiviCRM database.{/ts} {help id='upload'}
</div>

<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
<div id="upload-file">
<h3>{ts}Upload Data File{/ts}</h3>
<table class="form-layout-compressed">
<tr class="crm-import-uploadfile-from-block-uploadFile">
<td class="label">{$form.uploadFile.label}</td>
<td>{$form.uploadFile.html}<br />
<span class="description">{ts}File format must be comma-separated-values (CSV).{/ts}</span><br /><span>{ts 1=$uploadSize}Maximum Upload File Size: %1 MB{/ts}</span>
</td>
</tr>
<tr class="crm-import-uploadfile-form-block-skipColumnHeader">
<td class="label"></td>
<td>{$form.skipColumnHeader.html}{$form.skipColumnHeader.label}<br />
<span class="description">{ts}Check this box if the first row of your file consists of field names (Example: 'Contact ID', 'Activity Type', 'Activity Date').{/ts}</span>
</td>
</tr>
<tr class="crm-import-datasource-form-block-fieldSeparator">
<td class="label">{$form.fieldSeparator.label} {help id='id-fieldSeparator' file='CRM/Contact/Import/Form/DataSource'}</td>
<td>{$form.fieldSeparator.html}</td>
</tr>
<tr>{include file="CRM/Core/Date.tpl"}</tr>
{if $savedMapping}
<tr class="crm-import-uploadfile-form-block-savedMapping">
<td>{$form.savedMapping.label}</td>
<td>{$form.savedMapping.html}<br />
<span class="description">{ts}Select Saved Mapping or Leave blank to create a new One.{/ts}</span>
{/if}
</td>
</tr>
</table>
<div class="spacer"></div>
</div>
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>
{include file="CRM/Import/Form/DataSource.tpl"}
34 changes: 19 additions & 15 deletions templates/CRM/Import/Form/DataSource.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,30 @@
</span>
</td>
</tr>
<tr class="crm-import-uploadfile-from-block-contactType">
<td class="label">{$form.contactType.label}</td>
<td>{$form.contactType.html}<br />
<span class="description">
{ts 1=$importEntities}Select 'Individual' if you are importing %1 made by individual persons.{/ts}
{ts 1=$importEntities}Select 'Organization' or 'Household' if you are importing %1 made by contacts of that type. (NOTE: Some built-in contact types may not be enabled for your site.){/ts}
</span>
</td>
</tr>
<tr class="crm-import-uploadfile-from-block-onDuplicate">
<td class="label">{$form.onDuplicate.label}</td>
<td>{$form.onDuplicate.html} {help id="id-onDuplicate"}</td>
</tr>
{if array_key_exists('contactType', $form)}
<tr class="crm-import-uploadfile-from-block-contactType">
<td class="label">{$form.contactType.label}</td>
<td>{$form.contactType.html}<br />
<span class="description">
{ts 1=$importEntities}Select 'Individual' if you are importing %1 made by individual persons.{/ts}
{ts 1=$importEntities}Select 'Organization' or 'Household' if you are importing %1 made by contacts of that type. (NOTE: Some built-in contact types may not be enabled for your site.){/ts}
</span>
</td>
</tr>
{/if}
{if array_key_exists('onDuplicate', $form)}
<tr class="crm-import-uploadfile-from-block-onDuplicate">
<td class="label">{$form.onDuplicate.label}</td>
<td>{$form.onDuplicate.html} {help id="id-onDuplicate"}</td>
</tr>
{/if}
<tr class="crm-import-datasource-form-block-fieldSeparator">
<td class="label">{$form.fieldSeparator.label} {help id='id-fieldSeparator' file='CRM/Contact/Import/Form/DataSource'}</td>
<td>{$form.fieldSeparator.html}</td>
</tr>
<tr class="crm-import-uploadfile-from-block-date">{include file="CRM/Core/Date.tpl"}</tr>
<tr class="crm-import-uploadfile-form-block-date">{include file="CRM/Core/Date.tpl"}</tr>
{if $savedMapping}
<tr class="crm-import-uploadfile-from-block-savedMapping">
<tr class="crm-import-uploadfile-form-block-savedMapping">
<td>{$form.savedMapping.label}</td>
<td>{$form.savedMapping.html}<br />
<span class="description">{ts}If you want to use a previously saved import field mapping - select it here.{/ts}</span>
Expand Down

0 comments on commit 7c63299

Please sign in to comment.