I tried to create a new button in ticket zoom screen like pending & close button.
All the scenarios are working correct except "new state" field is not populating status.
1. CustomButton.xml in /Kernel/Config/Files/XML
Code: Select all
<Setting Name="Ticket::Frontend::MenuModule###510-Awaiting Customer Response" Required="0" Valid="1">
<Description Translatable="1">Shows a link in the menu to set ticket in Awaiting Customer Response in the ticket zoom view of the agent interface. Additional access control to show or not show this link can be done by using Key "Group" and Content like "rw:group1;move_into:group2". To cluster menu items use for Key "ClusterName" and for the Content any name you want to see in the UI. Use "ClusterPriority" to configure the order of a certain cluster within the toolbar.</Description>
<Navigation>Frontend::Agent::View::TicketZoom::MenuModule</Navigation>
<Value>
<Hash>
<Item Key="Module">Kernel::Output::HTML::TicketMenu::Generic</Item>
<Item Key="Name" Translatable="1">Close</Item>
<Item Key="Description" Translatable="1">Set this ticket to Awaiting Internal Response</Item>
<Item Key="Action">AgentTicketAwaiting</Item>
<Item Key="Link">Action=AgentTicketAwaiting;TicketID=[% Data.TicketID | html %]</Item>
<Item Key="Target"></Item>
<Item Key="PopupType">TicketAction</Item>
<Item Key="ClusterName" Translatable="1"></Item>
<Item Key="ClusterPriority"></Item>
</Hash>
</Value>
</Setting>
Code: Select all
# --
# Copyright (C) 2001-2019 xxx, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
use strict;
use warnings;
use utf8;
use vars (qw($Self));
my $Selenium = $Kernel::OM->Get('Kernel::System::UnitTest::Selenium');
$Selenium->RunTest(
sub {
my $Helper = $Kernel::OM->Get('Kernel::System::UnitTest::Helper');
my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');
# Do not check RichText.
$Helper->ConfigSettingChange(
Valid => 1,
Key => 'Frontend::RichText',
Value => 0
);
# Set the time input dropdown to another value.
$Helper->ConfigSettingChange(
Valid => 1,
Key => 'TimeInputMinutesStep',
Value => 30
);
# Create test user.
my $TestUserLogin = $Helper->TestUserCreate(
Groups => [ 'admin', 'users' ],
) || die "Did not get test user";
$Selenium->Login(
Type => 'Agent',
User => $TestUserLogin,
Password => $TestUserLogin,
);
# Get test user ID.
my $TestUserID = $Kernel::OM->Get('Kernel::System::User')->UserLookup(
UserLogin => $TestUserLogin,
);
# Create test ticket.
my $TicketID = $TicketObject->TicketCreate(
Title => 'Selenium Test Ticket',
Queue => 'Raw',
Lock => 'unlock',
Priority => '3 normal',
State => 'new',
CustomerID => 'SeleniumCustomer',
CustomerUser => 'SeleniumCustomer@localhost.com',
OwnerID => $TestUserID,
UserID => $TestUserID,
);
$Self->True(
$TicketID,
"Ticket is created - ID $TicketID",
);
# Login as test user.
$Selenium->Login(
Type => 'Agent',
User => $TestUserLogin,
Password => $TestUserLogin,
);
my $ScriptAlias = $Kernel::OM->Get('Kernel::Config')->Get('ScriptAlias');
# Navigate to zoom view of created test ticket.
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AgentTicketZoom;TicketID=$TicketID");
# Click on 'Awaiting' and switch window.
$Selenium->find_element("//a[contains(\@href, \'Action=AgentTicketAwaiting;TicketID=$TicketID' )]")->click();
$Selenium->WaitFor( WindowCount => 2 );
my $Handles = $Selenium->get_window_handles();
$Selenium->switch_to_window( $Handles->[1] );
# Wait until page has loaded, if necessary.
$Selenium->WaitFor(
JavaScript =>
'return typeof($) === "function" && $(".WidgetSimple").length;'
);
# Check page.
for my $ID (
qw(NewStateID Subject RichText FileUpload IsVisibleForCustomer submitRichText)
)
{
my $Element = $Selenium->find_element( "#$ID", 'css' );
$Element->is_enabled();
$Element->is_displayed();
}
# Check whether the time input dropdown only shows two values.
$Self->Is(
$Selenium->execute_script("return \$('#Minute option').length;"),
2,
"Time input dropdown has only two values",
);
$Self->Is(
$Selenium->execute_script("return \$('#Minute option').first().text();"),
'00',
"Time input dropdown first available value is 00",
);
$Self->Is(
$Selenium->execute_script("return \$('#Minute option').last().text();"),
'30',
"Time input dropdown last available value is 30",
);
# Change ticket to Awaiting Customer Response.
$Selenium->InputFieldValueSet(
Element => '#NewStateID',
Value => 11,
);
$Selenium->find_element( "#Subject", 'css' )->send_keys('Test');
$Selenium->find_element( "#RichText", 'css' )->send_keys('Test');
$Selenium->find_element( "#submitRichText", 'css' )->click();
$Selenium->WaitFor( WindowCount => 1 );
$Selenium->switch_to_window( $Handles->[0] );
# Navigate to AgentTicketHistory of created test ticket.
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AgentTicketHistory;TicketID=$TicketID");
# Confirm awaiting change action.
my $Awaiting = "Changed state from \"new\" to \"Awaiting Customer Response\".";
$Self->True(
index( $Selenium->get_page_source(), $Awaiting ) > -1,
'Ticket awaiting action completed'
);
# Delete created test tickets.
my $Success = $TicketObject->TicketDelete(
TicketID => $TicketID,
UserID => $TestUserID,
);
# Ticket deletion could fail if apache still writes to ticket history. Try again in this case.
if ( !$Success ) {
sleep 3;
$Success = $TicketObject->TicketDelete(
TicketID => $TicketID,
UserID => $TestUserID,
);
}
$Self->True(
$Success,
"Ticket is deleted - ID $TicketID"
);
# Make sure the cache is correct.
$Kernel::OM->Get('Kernel::System::Cache')->CleanUp(
Type => 'Ticket',
);
}
);
1;
Code: Select all
# --
# Copyright (C) 2001-2019 xxx, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
[% InsertTemplate("AgentTicketActionCommon.tt") %]
Code: Select all
# --
# Copyright (C) 2001-2019 xxx, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::Modules::AgentTicketAwaiting;
use strict;
use warnings;
use parent qw( Kernel::Modules::AgentTicketActionCommon );
1;
Kindly suggest but i am missing here.
Thanks in advance