Hi list,

I'm playing with the ImportExport module, trying to add a new format backend.

I think I've found a bug:

In the Run() function in "Modules/AdminImportExport.pm", under subAction "TemplateEdit4", when creating the form input fields for the format attribute's value, the following code is used:

            for my $Item ( @{$MappingFormatAttributes} ) {

                # create form input
my $InputString = $Self->{LayoutObject}->ImportExportFormInputCreate(
                    Item   => $Item,
                    Prefix => 'Format::' . $AtributteRowCounter . '::',
                    Value  => $MappingFormatData->{ $Item->{Key} },
                );

                # output attribute row
                $Self->{LayoutObject}->Block(
                    Name => 'TemplateEdit4MapNumberColumn',
                    Data => {
                        Name      => $Item->{Name},
                        InputStrg => $InputString,
                        Counter   => $AtributteRowCounter,
                    },
                );
            }

Where no "Name" parameter is passed to the $Self->{LayoutObject}->ImportExportFormInputCreate() function.

This causes the FormInputCreate() function in "Output/HTML/ImportExportLayoutText.pm" to create a field with a name containing the prefix twice:

    # prepare data
    my $ID = ( $Param{Prefix} || '' ) . ( $Param{Item}->{Key} );
    my $Name = ( $Param{Prefix} || '' ) . ( $Param{Name} || $ID );
    my $Class = ( $SizeClass || '' ) . ( $Param{Class} || '' );

    my $String
= "<input id=\"$ID\" type=\"text\" name=\"$Name\" class=\"$Class\" ";

While the FormDataGet() function tries to get text fields' value by a name containing the prefix only once:

    $Param{Prefix} ||= '';

    # get form data
    my $FormData = $Self->{ParamObject}->GetParam(
        Param => $Param{Prefix} . $Param{Item}->{Key},
    );

So, this effectively prevents the user of text fields in the mapping definition.

I fixed it here as follow:

                # create form input
my $InputString = $Self->{LayoutObject}->ImportExportFormInputCreate(
                    Item   => $Item,
++                Name => $Item->{Name},
                    Prefix => 'Format::' . $AtributteRowCounter . '::',
                    Value  => $MappingFormatData->{ $Item->{Key} },
                );

Does it make sense for you?

Br,

Cyrille

---------------------------------------------------------------------
OTRS mailing list: itsm - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/itsm
To unsubscribe: http://lists.otrs.org/mailman/listinfo/itsm

Reply via email to