From 0ac455f0985252b26503d2ffc136f20bc39eb329 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sat, 14 May 2022 08:29:54 +1200 Subject: [PATCH] Consolidate DataSource.tpl I took a look at the activity DataSource.tpl and aside from minor markup the only difference between it and the shared markup is the absense of 'contactType' on the Activity form - so I added an 'if' --- CRM/Activity/Import/Form/DataSource.php | 8 ---- .../CRM/Activity/Import/Form/DataSource.tpl | 45 +------------------ templates/CRM/Import/Form/DataSource.tpl | 34 +++++++------- 3 files changed, 20 insertions(+), 67 deletions(-) diff --git a/CRM/Activity/Import/Form/DataSource.php b/CRM/Activity/Import/Form/DataSource.php index a244cb7e0a..ca4e8eeb4c 100644 --- a/CRM/Activity/Import/Form/DataSource.php +++ b/CRM/Activity/Import/Form/DataSource.php @@ -34,13 +34,6 @@ 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'), - ]); } /** @@ -48,7 +41,6 @@ class CRM_Activity_Import_Form_DataSource extends CRM_Import_Form_DataSource { */ public function postProcess() { $this->storeFormValues([ - 'onDuplicate', 'dateFormats', 'savedMapping', ]); diff --git a/templates/CRM/Activity/Import/Form/DataSource.tpl b/templates/CRM/Activity/Import/Form/DataSource.tpl index 1287c6d6a5..5395b37fcf 100644 --- a/templates/CRM/Activity/Import/Form/DataSource.tpl +++ b/templates/CRM/Activity/Import/Form/DataSource.tpl @@ -7,47 +7,4 @@ | and copyright information, see https://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{* Import Wizard - Step 1 (choose data source) *} -
- - {* WizardHeader.tpl provides visual display of steps thru the wizard as well as title for current step *} - {include file="CRM/common/WizardHeader.tpl"} -
- {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'} -
- -
{include file="CRM/common/formButtons.tpl" location="top"}
-
-

{ts}Upload Data File{/ts}

- - - - - - - - - - - - - - {include file="CRM/Core/Date.tpl"} - {if $savedMapping} - - - - -
{$form.uploadFile.label}{$form.uploadFile.html}
- {ts}File format must be comma-separated-values (CSV).{/ts}
{ts 1=$uploadSize}Maximum Upload File Size: %1 MB{/ts} -
{$form.skipColumnHeader.html}{$form.skipColumnHeader.label}
- {ts}Check this box if the first row of your file consists of field names (Example: 'Contact ID', 'Activity Type', 'Activity Date').{/ts} -
{$form.fieldSeparator.label} {help id='id-fieldSeparator' file='CRM/Contact/Import/Form/DataSource'}{$form.fieldSeparator.html}
{$form.savedMapping.label}{$form.savedMapping.html}
- {ts}Select Saved Mapping or Leave blank to create a new One.{/ts} -{/if} -
-
-
-
{include file="CRM/common/formButtons.tpl" location="bottom"}
-
+{include file="CRM/Import/Form/DataSource.tpl"} diff --git a/templates/CRM/Import/Form/DataSource.tpl b/templates/CRM/Import/Form/DataSource.tpl index 19f582d30b..b1b0308c7c 100644 --- a/templates/CRM/Import/Form/DataSource.tpl +++ b/templates/CRM/Import/Form/DataSource.tpl @@ -34,26 +34,30 @@ - - {$form.contactType.label} - {$form.contactType.html}
- - {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} - - - - - {$form.onDuplicate.label} - {$form.onDuplicate.html} {help id="id-onDuplicate"} - + {if array_key_exists('contactType', $form)} + + {$form.contactType.label} + {$form.contactType.html}
+ + {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} + + + + {/if} + {if array_key_exists('onDuplicate', $form)} + + {$form.onDuplicate.label} + {$form.onDuplicate.html} {help id="id-onDuplicate"} + + {/if} {$form.fieldSeparator.label} {help id='id-fieldSeparator' file='CRM/Contact/Import/Form/DataSource'} {$form.fieldSeparator.html} - {include file="CRM/Core/Date.tpl"} + {include file="CRM/Core/Date.tpl"} {if $savedMapping} - + {$form.savedMapping.label} {$form.savedMapping.html}
{ts}If you want to use a previously saved import field mapping - select it here.{/ts} -- 2.25.1