[otrs-cvs] ImportExport/Kernel/Modules AdminImportExport.pm, 1.26, 1.26.4.1

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/ImportExport/Kernel/Modules
In directory lancelot:/tmp/cvs-serv3998/Kernel/Modules

Modified Files:
      Tag: rel-3_1
	AdminImportExport.pm 
Log Message:
Enhanced interface to show a summary after importing.

Author: ub

Index: AdminImportExport.pm
===================================================================
RCS file: /home/cvs/ImportExport/Kernel/Modules/AdminImportExport.pm,v
retrieving revision 1.26
retrieving revision 1.26.4.1
diff -2 -u -d -r1.26 -r1.26.4.1
--- AdminImportExport.pm	20 Oct 2010 19:26:04 -0000	1.26
+++ AdminImportExport.pm	30 Nov 2012 13:27:44 -0000	1.26.4.1
@@ -1,5 +1,5 @@
 # --
 # Kernel/Modules/AdminImportExport.pm - admin frontend of import export module
-# Copyright (C) 2001-2010 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
 # --
 # $Id$
@@ -744,5 +744,5 @@
 
         return $Self->{LayoutObject}->Redirect(
-            OP => "Action=$Self->{Action}&Subaction=$Subaction&TemplateID=$TemplateID",
+            OP => "Action=$Self->{Action};Subaction=$Subaction;TemplateID=$TemplateID",
         );
     }
@@ -916,5 +916,5 @@
 
             return $Self->{LayoutObject}->Redirect(
-                OP => "Action=$Self->{Action}&Subaction=$Subaction&TemplateID=$TemplateID",
+                OP => "Action=$Self->{Action};Subaction=$Subaction;TemplateID=$TemplateID",
             );
         }
@@ -949,5 +949,5 @@
 
         return $Self->{LayoutObject}->Redirect(
-            OP => "Action=$Self->{Action}&Subaction=$Subaction&TemplateID=$TemplateID",
+            OP => "Action=$Self->{Action};Subaction=$Subaction;TemplateID=$TemplateID",
         );
     }
@@ -1102,8 +1102,69 @@
         }
 
-        return $Self->{LayoutObject}->Redirect(
-            OP =>
-                "Action=$Self->{Action}&Subaction=Overview&TemplateID=$TemplateData->{TemplateID}",
+        # output header and navbar
+        my $Output = $Self->{LayoutObject}->Header();
+        $Output .= $Self->{LayoutObject}->NavigationBar();
+
+        # output import results
+        $Self->{LayoutObject}->Block(
+            Name => 'ImportResult',
+            Data => {
+                %{$Result},
+            },
         );
+
+        # get all return codes and collect the duplicate names
+        my @DuplicateNames;
+        RETURNCODE:
+        for my $RetCode ( sort keys %{ $Result->{RetCode} } ) {
+
+            # just get the duplicate name
+            if ( $RetCode =~ m{ \A DuplicateName \s+ (.+) }xms ) {
+                push @DuplicateNames, $1;
+            }
+            else {
+                $Self->{LayoutObject}->Block(
+                    Name => 'ImportResultReturnCode',
+                    Data => {
+                        ReturnCodeName  => $RetCode,
+                        ReturnCodeCount => $Result->{RetCode}->{$RetCode},
+                    },
+                );
+            }
+        }
+
+        # output duplicate names if neccessary
+        if (@DuplicateNames) {
+
+            my $DuplicateNamesString = join ', ', @DuplicateNames;
+
+            $Self->{LayoutObject}->Block(
+                Name => 'ImportResultDuplicateNames',
+                Data => {
+                    DuplicateNames => $DuplicateNamesString,
+                },
+            );
+        }
+
+        # output last processed line mumber of import file
+        if ( $Result->{Failed} ) {
+            $Self->{LayoutObject}->Block(
+                Name => 'ImportResultLastLineNumber',
+                Data => {
+                    LastLineNumber => $Result->{Counter},
+                },
+            );
+        }
+
+        # start output
+        $Output .= $Self->{LayoutObject}->Output(
+            TemplateFile => 'AdminImportExport',
+            Data         => {
+                %Param,
+            },
+        );
+
+        $Output .= $Self->{LayoutObject}->Footer();
+        return $Output;
     }
 
@@ -1177,5 +1238,5 @@
             Data => {
                 %Param,
-                }
+            },
         );
 
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.