znuny / Znuny

Znuny/Znuny LTS is a fork of the ((OTRS)) Community Edition, one of the most flexible web-based ticketing systems used for Customer Service, Help Desk, IT Service Management.
https://www.znuny.org
GNU General Public License v3.0
333 stars 82 forks source link

Bug - Empty block (horizontal line) dynamic field group process management #513

Closed mo-azfar closed 6 months ago

mo-azfar commented 7 months ago

Environment

Expected behavior

There is multiple process defined and multiple group in dynamic field widget group. If some process didnt have the dynamic field value in defined widget group, the block should be hidden / remove.

Actual behavior

There is multiple process defined and multiple group in dynamic field widget group. If some process didnt have the dynamic field value in defined widget group, the block actually there and quite waste the space.

We can see it from the horizontal line there.

image

How to reproduce

Steps to reproduce the behavior:

  1. Create 2 process management.
  2. Define dynamic field widget group.
  3. See at ticket zoom view
mo-azfar commented 7 months ago

You can see the block is called in every group with no value checking. https://github.com/znuny/Znuny/blob/4ba26a0ec2e3f0c72bc96710c208b2318989e96e/Kernel/Modules/AgentTicketZoom.pm#L1658

Below is some code that i applied to tackle this. Perhaps you guys has a better way.

my @FieldsInAGroup;
for my $GroupName (
    sort keys %{ $Self->{DisplaySettings}->{ProcessWidgetDynamicFieldGroups} }
    )
{

# --
# Remove empty block group for dynamic field.
# --
# $LayoutObject->Block(
#     Name => 'ProcessWidgetDynamicFieldGroups',
# );
# --

my $GroupFieldsString = $Self->{DisplaySettings}->{ProcessWidgetDynamicFieldGroups}->{$GroupName};

$GroupFieldsString =~ s{\s}{}xmsg;
my @GroupFields = split( ',', $GroupFieldsString );

# --
# Remove empty block group for dynamic field.
# --
my $ShowBlock = 0;
for my $FieldChecker (@FieldsWidget) {
    if ( !$ShowBlock ){
        if ( grep { $_ eq $FieldChecker->{Name} } @GroupFields ) {
            $ShowBlock = 1;
        }
    }
}

if ( $ShowBlock ) {
    $LayoutObject->Block(
        Name => 'ProcessWidgetDynamicFieldGroups',
    );
}
# --

if ( $#GroupFields + 1 ) {

image

KaldungJr commented 7 months ago

We can't verify your issue with our existing example processes. Would you be able to send us your process used in the issue?

mo-azfar commented 7 months ago

We can't verify your issue with our existing example processes. Would you be able to send us your process used in the issue?

Hi, basically my ProcessWidgetDynamicGroups as below with contain multiple df group across all process:

image

Let say i create a process ticket 'Software Support' as below (which only utilize 'Software Support' df group), we can see all the df group block has been called and display as horizontal line.

image

Export_ProcessEntityID_Process-22cfb5eb43279532308232c678671c34.zip

rkaldung commented 7 months ago

@mo-azfar Can you also add the dynamics (and screens) export?

mo-azfar commented 7 months ago

@rkaldung Yes..please refer attached zip file..also attached Config for ProcessWidgetDynamicFieldGroups


$Self->{'Ticket::Frontend::AgentTicketZoom'}->{'ProcessWidgetDynamicFieldGroups'} =  {
  '1. Basic Info' => 'Playbook, Status, DeviceName, UserType, Hash, HashResponse, DoubleCheckPreviousData, FalsePositive, PreviousDataNote, NetworkDetectionTools',
  '2. Affected Credentials & Level of Access' => 'AffectedCredentialsNote, AccessLevelCustomer, AccessLevelInternal, AccessLevel, AccessLevelAccountType,  AccessLevelNote',
  '2. Threat Analysis & Forensic' => 'ThreatCategory, ThreatAnalysisNote, ThreatAnalysisStatus, SecurityRiskLevel',
  '2. Threat Classification' => 'InformationReviewed, InformationReviewedNote, ThreatLevel',
  '3. Live Threat Actor and Analysis Log' => 'LiveThreatActor, LiveThreatActorNote, LogAnalysisFailedLogin, LogAnalysisSuccessLogin, LogAnalysisLateralMovement, LogAnalysisLateralMovementPath, LogAnalysisNote ',
  '3. Remediate Action' => 'RemediateMethod, RemediateNote, RemediateStatus',
  '3. Threat Scope' => 'EnvironmentLogReviewed, EnvironmentLogReviewedNote',
  '4. Password Checking' => 'PasswordReused, PasswordStrength',
  '4. Scanned Device' => 'ScanDeviceNote, ScanDeviceStatus',
  '4. Threat Mitigation' => 'ThreatMitigated, ThreatMitigatedNote',
  '5. Root Cause Analysis' => 'RootCauseAnalysis, RootCauseAnalysisNote',
  'Software Support' => 'RelatedContract, ContractID, ContractStartDate, ContractEndDate, SupportTag, RelatedContractDetail'
};

Export Process and DF.zip

rkaldung commented 7 months ago

Internal issue 782

dennykorsukewitz commented 6 months ago

Hi @mo-azfar,

thanks for your report and the fix suggestion.

I have attached a patch here that is much simpler. Can you please check if the error is fixed with this patch.

0001-782-Bug-Empty-block-horizontal-line-dynamic-field-gr.patch

mo-azfar commented 6 months ago

Hi @mo-azfar,

thanks for your report and the fix suggestion.

I have attached a patch here that is much simpler. Can you please check if the error is fixed with this patch.

0001-782-Bug-Empty-block-horizontal-line-dynamic-field-gr.patch

Hi @dennykorsukewitz ..thanks for the patch..

Before patch

before-patch-00001

However the display result as below after patched. Notice the dynamic field display is 1 x 1 instead of 4 x 1.

after-patch-0001

dennykorsukewitz commented 6 months ago

Hi @mo-azfar

Ah, thanks for testing. I'll take another look at it then.

dennykorsukewitz commented 6 months ago

Hi @mo-azfar

I have adopted your idea and adapted it a little. Can you check the fix again?

Thank you.

0002-782-Bug-Empty-block-horizontal-line-dynamic-field-gr.patch

mo-azfar commented 6 months ago

Hi @dennykorsukewitz ,

Tested with group and no-group.. Perfect :)

image

dennykorsukewitz commented 6 months ago

7.0.15 https://github.com/znuny/Znuny/commit/a6a3c3f508239c71ce2de3f5ecfe9f0a50ba8d3f