[otrs-cvs] ImportExport/Kernel/System/ImportExport/FormatBackend CSV.pm, 1.1, 1.2

cvs-log at otrs.org cvs-log at otrs.org
Mon Feb 4 12:19:59 GMT 2008


Comments:
Update of /home/cvs/ImportExport/Kernel/System/ImportExport/FormatBackend
In directory lancelot:/tmp/cvs-serv6382/Kernel/System/ImportExport/FormatBackend

Modified Files:
	CSV.pm 
Log Message:
Improved modularisation of import and export functions.

Author: mh

Index: CSV.pm
===================================================================
RCS file: /home/cvs/ImportExport/Kernel/System/ImportExport/FormatBackend/CSV.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** CSV.pm	31 Jan 2008 19:28:48 -0000	1.1
--- CSV.pm	4 Feb 2008 12:19:54 -0000	1.2
***************
*** 30,33 ****
--- 30,64 ----
  =cut
  
+ =item new()
+ 
+ create a object
+ 
+     use Kernel::Config;
+     use Kernel::System::DB;
+     use Kernel::System::Log;
+     use Kernel::System::Main;
+     use Kernel::System::ImportExport::FormatBackend::CSV;
+ 
+     my $ConfigObject = Kernel::Config->new();
+     my $LogObject = Kernel::System::Log->new(
+         ConfigObject => $ConfigObject,
+     );
+     my $MainObject = Kernel::System::Main->new(
+         ConfigObject => $ConfigObject,
+         LogObject    => $LogObject,
+     );
+     my $DBObject = Kernel::System::DB->new(
+         ConfigObject => $ConfigObject,
+         LogObject    => $LogObject,
+         MainObject   => $MainObject,
+     );
+     my $BackendObject = Kernel::System::ImportExport::FormatBackend::CSV->new(
+         ConfigObject => $ConfigObject,
+         LogObject    => $LogObject,
+         DBObject     => $DBObject,
+     );
+ 
+ =cut
+ 
  sub new {
      my ( $Type, %Param ) = @_;
***************
*** 50,53 ****
--- 81,85 ----
  
      my $Attributes = $FormatBackend->AttributesGet(
+         Type   => 'Import',
          UserID => 1,
      );
***************
*** 58,79 ****
      my ( $Self, %Param ) = @_;
  
!     # check needed object
!     if ( !$Param{UserID} ) {
!         $Self->{LogObject}->Log( Priority => 'error', Message => 'Need UserID!' );
!         return;
      }
  
!     my $Attributes = [
!         {
!             Key   => 'Test123',
!             Name  => 'Test123',
!             Type  => 'Selection',
!             Input => {
!                 Data         => { 0 => 'Nix', 1 => 'Test', },
!                 PossibleNone => 1,
!                 Translation  => 0,
              },
!         },
!     ];
  
      return $Attributes;
--- 90,128 ----
      my ( $Self, %Param ) = @_;
  
!     # check needed stuff
!     for my $Argument (qw(Type UserID)) {
!         if ( !$Param{$Argument} ) {
!             $Self->{LogObject}->Log(
!                 Priority => 'error',
!                 Message  => "Need $Argument!",
!             );
!             return;
!         }
      }
  
!     my $Attributes = [];
! 
!     if ( $Param{Type} eq 'Import' ) {
!         $Attributes = [
!             {
!                 Key         => 'ImportDirectory',
!                 Name        => 'Import Directory',
!                 Description => 'Only needed for automated importing per script',
!                 Type        => 'Text',
!                 Required    => 0,
              },
!         ];
!     }
!     else {
!         $Attributes = [
!             {
!                 Key         => 'ExportDirectory',
!                 Name        => 'Export Directory',
!                 Description => 'Only needed for automated importing per script',
!                 Type        => 'Text',
!                 Required    => 0,
!             },
!         ];
!     }
  
      return $Attributes;
***************
*** 98,100 ****
  $Revision$ $Date$
  
! =cut
\ No newline at end of file
--- 147,149 ----
  $Revision$ $Date$
  
! =cut


More information about the cvs-log mailing list