[otrs-cvs] GeneralCatalog/Kernel/Modules AdminGeneralCatalog.pm, 1.26, 1.27

"CVS commits notifications of OTRS.org" <[email protected]> Wed, 5 Jun 2013 10:58:34 +0000
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/GeneralCatalog/Kernel/Modules
In directory lancelot:/tmp/cvs-serv29833/Kernel/Modules

Modified Files:
	AdminGeneralCatalog.pm 
Log Message:
Fixed bug# 9055 - Remove "Add Catalog-Class" from Class-Zoom in General Catalog.

Author: ub

Index: AdminGeneralCatalog.pm
===================================================================
RCS file: /home/cvs/GeneralCatalog/Kernel/Modules/AdminGeneralCatalog.pm,v
retrieving revision 1.26
retrieving revision 1.27
diff -2 -u -d -r1.26 -r1.27
--- AdminGeneralCatalog.pm	19 Oct 2010 14:58:02 -0000	1.26
+++ AdminGeneralCatalog.pm	5 Jun 2013 10:58:29 -0000	1.27
@@ -1,5 +1,5 @@
 # --
 # Kernel/Modules/AdminGeneralCatalog.pm - admin frontend of general catalog management
-# Copyright (C) 2001-2010 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
 # --
 # $Id$
@@ -50,16 +50,7 @@
 
         # check needed class
-        return $Self->{LayoutObject}->Redirect( OP => "Action=$Self->{Action}" ) if !$Class;
-
-        # get catalog class list
-        my $ClassList       = $Self->{GeneralCatalogObject}->ClassList();
-        my $ClassOptionStrg = $Self->{LayoutObject}->BuildSelection(
-            Name         => 'Class',
-            Data         => $ClassList,
-            Class        => 'W100pc',
-            SelectedID   => $Class,
-            PossibleNone => 1,
-            Translation  => 0,
-        );
+        if ( !$Class ) {
+            return $Self->{LayoutObject}->Redirect( OP => "Action=$Self->{Action}" );
+        }
 
         # output overview
@@ -88,6 +79,7 @@
 
         # check item list
-        return $Self->{LayoutObject}->ErrorScreen()
-            if !$ItemIDList || !%{$ItemIDList};
+        if ( !$ItemIDList || !%{$ItemIDList} ) {
+            return $Self->{LayoutObject}->ErrorScreen();
+        }
 
         for my $ItemID ( sort { $ItemIDList->{$a} cmp $ItemIDList->{$b} } keys %{$ItemIDList} ) {
@@ -113,13 +105,8 @@
             Data => {
                 %Param,
-                ClassOptionStrg => $ClassOptionStrg,
+                Class => $Class,
             },
         );
 
-        # ActionAddClass
-        $Self->{LayoutObject}->Block(
-            Name => 'ActionAddClass',
-        );
-
         # ActionOverview
         $Self->{LayoutObject}->Block(
@@ -151,4 +138,6 @@
         # get params
         $ItemData{ItemID} = $Self->{ParamObject}->GetParam( Param => "ItemID" );
+
+        # add a new catalog item
         if ( $ItemData{ItemID} eq 'NEW' ) {
 
@@ -157,7 +146,10 @@
 
             # redirect to overview
-            return $Self->{LayoutObject}->Redirect( OP => "Action=$Self->{Action}" )
-                if !$ItemData{Class};
+            if ( !$ItemData{Class} ) {
+                return $Self->{LayoutObject}->Redirect( OP => "Action=$Self->{Action}" );
+            }
         }
+
+        # edit an existing catalog item
         else {
 
@@ -168,21 +160,11 @@
 
             # check item data
-            return $Self->{LayoutObject}->ErrorScreen()
-                if !$ItemDataRef;
+            if ( !$ItemDataRef ) {
+                return $Self->{LayoutObject}->ErrorScreen();
+            }
 
             %ItemData = %{$ItemDataRef};
         }
 
-        # generate ClassOptionStrg
-        my $ClassList       = $Self->{GeneralCatalogObject}->ClassList();
-        my $ClassOptionStrg = $Self->{LayoutObject}->BuildSelection(
-            Name         => 'Class',
-            Data         => $ClassList,
-            SelectedID   => $ItemData{Class},
-            Class        => 'W100pc',
-            PossibleNone => 1,
-            Translation  => 0,
-        );
-
         # output overview
         $Self->{LayoutObject}->Block(
@@ -190,5 +172,5 @@
             Data => {
                 %Param,
-                ClassOptionStrg => $ClassOptionStrg,
+                Class => $ItemData{Class},
             },
         );
@@ -222,6 +204,8 @@
 
             # skip items that don't belong to the class
-            next if $Preferences{$Item}->{Class}
-                    && $Preferences{$Item}->{Class} ne $ItemData{Class};
+            if ( $Preferences{$Item}->{Class} && $Preferences{$Item}->{Class} ne $ItemData{Class} )
+            {
+                next ITEM;
+            }
 
             # find output module
@@ -275,13 +259,4 @@
                 },
             );
-
-            # ActionOverview
-            $Self->{LayoutObject}->Block(
-                Name => 'ActionAddItem',
-                Data => {
-                    %Param,
-                    ClassOptionStrg => $ClassOptionStrg,
-                },
-            );
         }
         else {
@@ -294,9 +269,4 @@
                 },
             );
-
-            # ActionAddClass
-            $Self->{LayoutObject}->Block(
-                Name => 'ActionAddClass',
-            );
         }
 
@@ -334,6 +304,7 @@
 
         # check class
-        return $Self->{LayoutObject}->Redirect( OP => "Action=$Self->{Action}" )
-            if $ItemData{Class} eq 'NEW';
+        if ( $ItemData{Class} eq 'NEW' ) {
+            return $Self->{LayoutObject}->Redirect( OP => "Action=$Self->{Action}" );
+        }
 
         # save to database
@@ -396,9 +367,11 @@
         }
 
-        return $Self->{LayoutObject}->ErrorScreen() if !$Success;
+        if ( !$Success ) {
+            return $Self->{LayoutObject}->ErrorScreen();
+        }
 
         # redirect to overview class list
         return $Self->{LayoutObject}->Redirect(
-            OP => "Action=$Self->{Action}&Subaction=ItemList&Class=$ItemData{Class}"
+            OP => "Action=$Self->{Action};Subaction=ItemList;Class=$ItemData{Class}"
         );
     }
@@ -409,14 +382,4 @@
     else {
 
-        # get catalog class list
-        my $ClassList       = $Self->{GeneralCatalogObject}->ClassList();
-        my $ClassOptionStrg = $Self->{LayoutObject}->BuildSelection(
-            Name         => 'Class',
-            Data         => $ClassList,
-            Class        => 'W100pc',
-            PossibleNone => 1,
-            Translation  => 0,
-        );
-
         # output overview
         $Self->{LayoutObject}->Block(
@@ -433,4 +396,7 @@
         );
 
+        # get catalog class list
+        my $ClassList = $Self->{GeneralCatalogObject}->ClassList();
+
         for my $Class ( @{$ClassList} ) {
 
@@ -444,13 +410,4 @@
         }
 
-        # ActionOverview
-        $Self->{LayoutObject}->Block(
-            Name => 'ActionAddItem',
-            Data => {
-                %Param,
-                ClassOptionStrg => $ClassOptionStrg,
-            },
-        );
-
         # ActionAddClass
         $Self->{LayoutObject}->Block(
---------------------------------------------------------------------
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