#865 CSV import : mapping several columns to the same fields gives an error. Fix: the wizard does not allow the user to move forward.

SVN:trunk[3198]
This commit is contained in:
Romain Quetiez
2014-06-05 14:42:53 +00:00
parent d07ca49e53
commit 67ef671632
3 changed files with 31 additions and 4 deletions

View File

@@ -579,6 +579,7 @@ Dict::Add('EN US', 'English', 'English', array(
'UI:CSVImport:HeaderMappings' => 'Mappings',
'UI:CSVImport:HeaderSearch' => 'Search?',
'UI:CSVImport:AlertIncompleteMapping' => 'Please select a mapping for every field.',
'UI:CSVImport:AlertMultipleMapping' => 'Please make sure that a target field is mapped only once.',
'UI:CSVImport:AlertNoSearchCriteria' => 'Please select at least one search criteria',
'UI:CSVImport:Encoding' => 'Character encoding',
'UI:UniversalSearchTitle' => 'iTop - Universal Search',

View File

@@ -451,7 +451,8 @@ Dict::Add('FR FR', 'French', 'Français', array(
'UI:CSVImport:HeaderFields' => 'Champs',
'UI:CSVImport:HeaderMappings' => 'Correspondance',
'UI:CSVImport:HeaderSearch' => 'Recherche ?',
'UI:CSVImport:AlertIncompleteMapping' => 'Veuillez choisir le correspondance de chacun des champs.',
'UI:CSVImport:AlertIncompleteMapping' => 'Veuillez choisir la correspondance pour chacun des champs.',
'UI:CSVImport:AlertMultipleMapping' => 'Veuillez vous assurer que chaque champ cible est sélectionné une seule fois.',
'UI:CSVImport:AlertNoSearchCriteria' => 'Veuillez choisir au moins une clef de recherche.',
'UI:CSVImport:Encoding' => 'Encodage des caractères',

View File

@@ -862,8 +862,9 @@ EOF
$oPage->add('</form>');
$oPage->add('</div>');
$sAlertIncompleteMapping = Dict::S('UI:CSVImport:AlertIncompleteMapping');
$sAlertNoSearchCriteria = Dict::S('UI:CSVImport:AlertNoSearchCriteria');
$sAlertIncompleteMapping = addslashes(Dict::S('UI:CSVImport:AlertIncompleteMapping'));
$sAlertMultipleMapping = addslashes(Dict::S('UI:CSVImport:AlertMultipleMapping'));
$sAlertNoSearchCriteria = addslashes(Dict::S('UI:CSVImport:AlertNoSearchCriteria'));
$oPage->add_ready_script(
<<<EOF
@@ -963,10 +964,17 @@ EOF
function CheckValues()
{
// Reset the highlight in case the check has already been executed with failure
$('select[name^=field]').each( function() {
$(this).parent().css({'border': '0'});
});
bResult = true;
bMappingOk = true;
bMultipleMapping = false;
bSearchOk = false;
$('select[name^=field]').each( function() {
$(this).parent().css({'border': '0'});
if ($(this).val() == '')
{
$(this).parent().css({'border': '2px #D81515 solid'});
@@ -975,7 +983,20 @@ EOF
}
else
{
$(this).parent().css({'border': '0'});
iOccurences = 0;
sRefValue = $(this).val();
$('select[name^=field]').each( function() {
if ($(this).val() == sRefValue)
{
iOccurences++;
}
});
if (iOccurences > 1)
{
$(this).parent().css({'border': '2px #D81515 solid'});
bResult = false;
bMultipleMapping = true;
}
}
});
// At least one search field must be checked
@@ -986,6 +1007,10 @@ EOF
{
alert("$sAlertIncompleteMapping");
}
if (bMultipleMapping)
{
alert("$sAlertMultipleMapping");
}
if (!bSearchOk)
{
bResult = false;