[otrs-cvs] otrs/Kernel/Modules AdminProcessManagement.pm, 1.47, 1.48

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

Modified Files:
	AdminProcessManagement.pm 
Log Message:
- Print path info.
- Replaced dumped transition info by human readable style.
- Added more information per element type.

Author: mab

Index: AdminProcessManagement.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/Modules/AdminProcessManagement.pm,v
retrieving revision 1.47
retrieving revision 1.48
diff -2 -u -d -r1.47 -r1.48
--- AdminProcessManagement.pm	29 Jan 2013 15:59:02 -0000	1.47
+++ AdminProcessManagement.pm	7 Feb 2013 08:52:54 -0000	1.48
@@ -488,4 +488,8 @@
     elsif ( $Self->{Subaction} eq 'ProcessPrint' ) {
 
+        # we need to use Data::Dumper with custom Indent
+        my $Indent = $Data::Dumper::Indent;
+        $Data::Dumper::Indent = 1;
+
         # check for ProcessID
         my $ProcessID = $Self->{ParamObject}->GetParam( Param => 'ID' ) || '';
@@ -496,4 +500,10 @@
         }
 
+        my $BooleanMapping = {
+            0 => 'No',
+            1 => 'Yes',
+            2 => 'Yes (mandatory)',
+        };
+
         my $ProcessData = $Self->_GetProcessData(
             ID => $ProcessID
@@ -572,4 +582,28 @@
                 );
 
+                for my $ElementAttribute (
+                    qw(DescriptionShort DescriptionLong SubmitButtonText SubmitAdviceText Permission RequiredLock)
+                    )
+                {
+
+                    my $Value = $ProcessData->{ActivityDialogs}->{$ActivityDialogEntityID}->{Config}
+                        ->{$ElementAttribute};
+
+                    if ( $Value ne undef ) {
+
+                        if ( $ElementAttribute eq 'RequiredLock' ) {
+                            $Value = $BooleanMapping->{$Value};
+                        }
+
+                        $Self->{LayoutObject}->Block(
+                            Name => 'ElementAttribute',
+                            Data => {
+                                Key   => $ElementAttribute,
+                                Value => $Value,
+                            },
+                        );
+                    }
+                }
+
                 # list all assigned fields
                 my $AssignedFields
@@ -590,4 +624,31 @@
                             },
                         );
+
+                        my %Values = %{
+                            $ProcessData->{ActivityDialogs}->{$ActivityDialogEntityID}
+                                ->{Config}->{Fields}->{$AssignedField}
+                        };
+                        if ( $Values{Config} ) {
+                            $Values{Config} = Dumper( $Values{Config} );
+                            $Values{Config} =~ s{ \s* \$VAR1 \s* =}{}xms;
+                            $Values{Config} =~ s{\s+\{}{\{}xms;
+                        }
+
+                        for my $Key ( keys %Values ) {
+
+                            if ( $Key eq 'Display' ) {
+                                $Values{$Key} = $BooleanMapping->{ $Values{$Key} };
+                            }
+
+                            if ( $Values{$Key} ) {
+                                $Self->{LayoutObject}->Block(
+                                    Name => 'AssignedFieldsRowValue',
+                                    Data => {
+                                        Key   => $Key,
+                                        Value => $Values{$Key},
+                                    },
+                                );
+                            }
+                        }
                     }
                 }
@@ -605,11 +666,6 @@
             for my $TransitionEntityID ( sort keys %{ $ProcessData->{Transitions} } ) {
 
-                my $Indent = $Data::Dumper::Indent;
-                $Data::Dumper::Indent = 1;
-                my $Config = Dumper( $ProcessData->{Transitions}->{$TransitionEntityID}->{Config} );
-                $Data::Dumper::Indent = $Indent;
-
-                $Config =~ s{ \s* \$VAR1 \s* =}{}xms;
-                $Config =~ s{\s+\{}{\{}xms;
+                # list config
+                my $Config = $ProcessData->{Transitions}->{$TransitionEntityID}->{Config};
 
                 $Self->{LayoutObject}->Block(
@@ -617,7 +673,88 @@
                     Data => {
                         %{ $ProcessData->{Transitions}->{$TransitionEntityID} },
-                        Config => $Config,
+                        ConditionLinking => $Config->{ConditionLinking},
                     },
                 );
+
+                if ( $Config && %{$Config} ) {
+
+                    $Self->{LayoutObject}->Block(
+                        Name => 'Condition',
+                    );
+
+                    for my $Condition ( keys %{ $Config->{Condition} } ) {
+
+                        $Self->{LayoutObject}->Block(
+                            Name => 'ConditionRow',
+                            Data => {
+                                Name => $Condition,
+                            },
+                        );
+
+                        my %Values = %{ $Config->{Condition}->{$Condition} };
+
+                        for my $Key ( keys %Values ) {
+
+                            if ( $Values{$Key} ) {
+
+                                if ( ref $Values{$Key} eq 'HASH' ) {
+
+                                    $Self->{LayoutObject}->Block(
+                                        Name => 'ConditionRowSub',
+                                        Data => {
+                                            NameSub => $Key,
+                                        },
+                                    );
+
+                                    for my $SubKey ( keys %{ $Values{$Key} } ) {
+
+                                        if ( ref $Values{$Key}->{$SubKey} eq 'HASH' ) {
+
+                                            $Self->{LayoutObject}->Block(
+                                                Name => 'ConditionRowSubSub',
+                                                Data => {
+                                                    NameSubSub => $SubKey,
+                                                },
+                                            );
+
+                                            for my $SubSubKey ( keys %{ $Values{$Key}->{$SubKey} } )
+                                            {
+
+                                                $Self->{LayoutObject}->Block(
+                                                    Name => 'ConditionRowSubSubValue',
+                                                    Data => {
+                                                        Key => $SubSubKey,
+                                                        Value =>
+                                                            $Values{$Key}->{$SubKey}->{$SubSubKey},
+                                                    },
+                                                );
+                                            }
+                                        }
+                                        else {
+
+                                            $Self->{LayoutObject}->Block(
+                                                Name => 'ConditionRowSubValue',
+                                                Data => {
+                                                    Key   => $SubKey,
+                                                    Value => $Values{$Key}->{$SubKey},
+                                                },
+                                            );
+                                        }
+                                    }
+                                }
+                                else {
+
+                                    $Self->{LayoutObject}->Block(
+                                        Name => 'ConditionRowValue',
+                                        Data => {
+                                            Key   => $Key,
+                                            Value => $Values{$Key},
+                                        },
+                                    );
+                                }
+                            }
+                        }
+                    }
+                }
             }
         }
@@ -684,4 +821,54 @@
         }
 
+        # collect path information
+        my @Path;
+        push @Path, $ProcessData->{Process}->{Config}->{StartActivity};
+
+        ACTIVITY:
+        for my $Activity ( @{ $ProcessData->{Process}->{Activities} } ) {
+            next ACTIVITY if $Activity eq $ProcessData->{Process}->{Config}->{StartActivity};
+            push @Path, $Activity;
+        }
+
+        for my $Activity (@Path) {
+
+            for my $Transition ( keys %{ $ProcessData->{Process}->{Config}->{Path}->{$Activity} } )
+            {
+                my $TransitionActionString;
+                if (
+                    $ProcessData->{Process}->{Config}->{Path}->{$Activity}->{$Transition}
+                    ->{TransitionAction}
+                    && @{
+                        $ProcessData->{Process}->{Config}->{Path}->{$Activity}->{$Transition}
+                            ->{TransitionAction}
+                    }
+                    )
+                {
+                    $TransitionActionString = join(
+                        ', ',
+                        @{
+                            $ProcessData->{Process}->{Config}->{Path}->{$Activity}->{$Transition}
+                                ->{TransitionAction}
+                            }
+                    );
+                    if ($TransitionActionString) {
+                        $TransitionActionString = '(' . $TransitionActionString . ')';
+                    }
+                }
+
+                $Self->{LayoutObject}->Block(
+                    Name => 'PathItem',
+                    Data => {
+                        ActivityStart     => $Activity,
+                        Transition        => $Transition,
+                        TransitionActions => $TransitionActionString,
+                        ActivityEnd =>
+                            $ProcessData->{Process}->{Config}->{Path}->{$Activity}->{$Transition}
+                            ->{ActivityEntityID},
+                    },
+                );
+            }
+        }
+
         $Output .= $Self->{LayoutObject}->Output(
             TemplateFile => "AdminProcessManagementProcessPrint",
@@ -691,4 +878,7 @@
                 State => $ProcessData->{Process}->{State} . ' ('
                     . $ProcessData->{Process}->{StateEntityID} . ')',
+                Description   => $ProcessData->{Process}->{Config}->{Description},
+                StartActivity => $ProcessData->{Process}->{Config}->{StartActivity},
+
                 %Param,
             },
@@ -697,4 +887,7 @@
         $Output .= $Self->{LayoutObject}->Footer();
 
+        # reset Indent
+        $Data::Dumper::Indent = $Indent;
+
         return $Output;
     }
---------------------------------------------------------------------
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.