init III
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::AgentCloudServicesDisabled;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Config',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::System::Group',
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
my $Output = '';
|
||||
|
||||
# check if cloud services are disabled
|
||||
my $CloudServicesDisabled = $Kernel::OM->Get('Kernel::Config')->Get('CloudServices::Disabled') || 0;
|
||||
|
||||
return '' if !$CloudServicesDisabled;
|
||||
return '' if $Param{Type} ne 'Admin';
|
||||
|
||||
my $Group = $Param{Config}->{Group} || 'admin';
|
||||
|
||||
# get layout object
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
my $HasPermission = $Kernel::OM->Get('Kernel::System::Group')->PermissionCheck(
|
||||
UserID => $Self->{UserID},
|
||||
GroupName => $Group,
|
||||
Type => 'rw',
|
||||
);
|
||||
|
||||
# notification should only be visible for administrators
|
||||
if ( !$HasPermission ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
my $Text = '<a href="'
|
||||
. $LayoutObject->{Baselink}
|
||||
. 'Action=AdminSystemConfiguration;Subaction=View;Setting=CloudServices::Disabled'
|
||||
. '">';
|
||||
$Text .= $LayoutObject->{LanguageObject}->Translate('Enable cloud services to unleash all OTRS features!');
|
||||
$Text .= '</a>';
|
||||
|
||||
return $LayoutObject->Notify(
|
||||
Data => $Text,
|
||||
Priority => 'Info',
|
||||
);
|
||||
}
|
||||
1;
|
||||
179
Perl OTRS/Kernel/Output/HTML/Notification/AgentOTRSBusiness.pm
Normal file
179
Perl OTRS/Kernel/Output/HTML/Notification/AgentOTRSBusiness.pm
Normal file
@@ -0,0 +1,179 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::AgentOTRSBusiness;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
|
||||
use Kernel::Language qw(Translatable);
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Config',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::System::Group',
|
||||
'Kernel::System::OTRSBusiness',
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
my $Output = '';
|
||||
|
||||
# get OTRS business object
|
||||
my $OTRSBusinessObject = $Kernel::OM->Get('Kernel::System::OTRSBusiness');
|
||||
|
||||
# get config options
|
||||
my $Group = $Param{Config}->{Group} || 'admin';
|
||||
my $IsInstalled = $OTRSBusinessObject->OTRSBusinessIsInstalled();
|
||||
my $OTRSBusinessLabel;
|
||||
if ( $OTRSBusinessObject->OTRSSTORMIsInstalled() ) {
|
||||
$OTRSBusinessLabel = '<b>STORM powered by OTRS</b>™';
|
||||
}
|
||||
elsif ( $OTRSBusinessObject->OTRSCONTROLIsInstalled() ) {
|
||||
$OTRSBusinessLabel = '<b>CONTROL powered by OTRS</b>™';
|
||||
}
|
||||
else {
|
||||
$OTRSBusinessLabel = '<b>OTRS Business Solution</b>™';
|
||||
}
|
||||
|
||||
# get layout object
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
#
|
||||
# check if OTRS Business Solution™ is not installed
|
||||
#
|
||||
if ( $Param{Type} eq 'Admin' && !$IsInstalled ) {
|
||||
my $Text = $LayoutObject->{LanguageObject}->Translate(
|
||||
'%s Upgrade to %s now! %s',
|
||||
'<a href="'
|
||||
. $LayoutObject->{Baselink}
|
||||
. 'Action=AdminOTRSBusiness'
|
||||
. '">',
|
||||
$OTRSBusinessLabel,
|
||||
'</a>',
|
||||
);
|
||||
|
||||
return $LayoutObject->Notify(
|
||||
Data => $Text,
|
||||
Priority => 'Info',
|
||||
);
|
||||
}
|
||||
|
||||
# all following checks require OTRS Business Solution™ to be installed
|
||||
return '' if !$IsInstalled;
|
||||
|
||||
#
|
||||
# check entitlement status
|
||||
#
|
||||
my $EntitlementStatus = $OTRSBusinessObject->OTRSBusinessEntitlementStatus(
|
||||
CallCloudService => 0,
|
||||
);
|
||||
|
||||
if ( $EntitlementStatus eq 'warning-error' || $EntitlementStatus eq 'forbidden' ) {
|
||||
|
||||
my $Text = $LayoutObject->{LanguageObject}->Translate(
|
||||
'This system uses the %s without a proper license! Please make contact with %s to renew or activate your contract!',
|
||||
$OTRSBusinessLabel,
|
||||
'sales@otrs.com',
|
||||
);
|
||||
|
||||
# Redirect to error screen because of unauthorized usage.
|
||||
if ( $EntitlementStatus eq 'forbidden' ) {
|
||||
$Text .= '
|
||||
<script>
|
||||
if (!window.location.search.match(/^[?]Action=(AgentOTRSBusiness|Admin.*)/)) {
|
||||
window.location.search = "Action=AgentOTRSBusiness;Subaction=BlockScreen";
|
||||
}
|
||||
</script>'
|
||||
}
|
||||
|
||||
return $LayoutObject->Notify(
|
||||
Data => $Text,
|
||||
Priority => 'Error',
|
||||
);
|
||||
}
|
||||
elsif ( $EntitlementStatus eq 'warning' ) {
|
||||
|
||||
$Output .= $LayoutObject->Notify(
|
||||
Info => $OTRSBusinessObject->OTRSSTORMIsInstalled()
|
||||
?
|
||||
Translatable('Please verify your license data!')
|
||||
:
|
||||
Translatable(
|
||||
'Connection to cloud.otrs.com via HTTPS couldn\'t be established. Please make sure that your OTRS can connect to cloud.otrs.com via port 443.'
|
||||
),
|
||||
Priority => 'Error',
|
||||
);
|
||||
}
|
||||
|
||||
my $HasPermission = $Kernel::OM->Get('Kernel::System::Group')->PermissionCheck(
|
||||
UserID => $Self->{UserID},
|
||||
GroupName => $Group,
|
||||
Type => 'rw',
|
||||
);
|
||||
|
||||
# all following notifications should only be visible for administrators
|
||||
if ( !$HasPermission ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
#
|
||||
# check contract expiry
|
||||
#
|
||||
my $ExpiryDate = $OTRSBusinessObject->OTRSBusinessContractExpiryDateCheck();
|
||||
|
||||
if ($ExpiryDate) {
|
||||
|
||||
my $Text = $LayoutObject->{LanguageObject}->Translate(
|
||||
'The license for your %s is about to expire. Please make contact with %s to renew your contract!',
|
||||
$OTRSBusinessLabel,
|
||||
'sales@otrs.com',
|
||||
);
|
||||
$Output .= $LayoutObject->Notify(
|
||||
Data => $Text,
|
||||
Priority => 'Warning',
|
||||
);
|
||||
}
|
||||
|
||||
#
|
||||
# check for available updates
|
||||
#
|
||||
my %UpdatesAvailable = $OTRSBusinessObject->OTRSBusinessVersionCheckOffline();
|
||||
|
||||
if ( $UpdatesAvailable{OTRSBusinessUpdateAvailable} ) {
|
||||
|
||||
my $Text = $LayoutObject->{LanguageObject}->Translate(
|
||||
'An update for your %s is available! Please update at your earliest!',
|
||||
$OTRSBusinessLabel
|
||||
);
|
||||
$Output .= $LayoutObject->Notify(
|
||||
Data => $Text,
|
||||
Priority => 'Warning',
|
||||
);
|
||||
}
|
||||
|
||||
if ( $UpdatesAvailable{FrameworkUpdateAvailable} ) {
|
||||
|
||||
my $Text = $LayoutObject->{LanguageObject}->Translate(
|
||||
'An update for your %s is available, but there is a conflict with your framework version! Please update your framework first!',
|
||||
$OTRSBusinessLabel
|
||||
);
|
||||
$Output .= $LayoutObject->Notify(
|
||||
Data => $Text,
|
||||
Priority => 'Warning',
|
||||
);
|
||||
}
|
||||
|
||||
return $Output;
|
||||
}
|
||||
|
||||
1;
|
||||
76
Perl OTRS/Kernel/Output/HTML/Notification/AgentOnline.pm
Normal file
76
Perl OTRS/Kernel/Output/HTML/Notification/AgentOnline.pm
Normal file
@@ -0,0 +1,76 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::AgentOnline;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Config',
|
||||
'Kernel::System::AuthSession',
|
||||
'Kernel::System::DateTime',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
my $SessionObject = $Kernel::OM->Get('Kernel::System::AuthSession');
|
||||
|
||||
my $SessionMaxIdleTime = $Kernel::OM->Get('Kernel::Config')->Get('SessionMaxIdleTime');
|
||||
|
||||
my %Online = ();
|
||||
my @Sessions = $SessionObject->GetAllSessionIDs();
|
||||
|
||||
for (@Sessions) {
|
||||
my %Data = $SessionObject->GetSessionIDData(
|
||||
SessionID => $_,
|
||||
);
|
||||
if (
|
||||
$Self->{UserID} ne $Data{UserID}
|
||||
&& $Data{UserType} eq 'User'
|
||||
&& $Data{UserLastRequest}
|
||||
&& $Data{UserLastRequest} + $SessionMaxIdleTime
|
||||
> $Kernel::OM->Create('Kernel::System::DateTime')->ToEpoch()
|
||||
&& $Data{UserFirstname}
|
||||
&& $Data{UserLastname}
|
||||
)
|
||||
{
|
||||
$Online{ $Data{UserID} } = "$Data{UserFullname}";
|
||||
if ( $Param{Config}->{ShowEmail} ) {
|
||||
$Online{ $Data{UserID} } .= " ($Data{UserEmail})";
|
||||
}
|
||||
}
|
||||
}
|
||||
for ( sort { $Online{$a} cmp $Online{$b} } keys %Online ) {
|
||||
if ( $Param{Message} ) {
|
||||
$Param{Message} .= ', ';
|
||||
}
|
||||
$Param{Message} .= "$Online{$_}";
|
||||
}
|
||||
if ( $Param{Message} ) {
|
||||
|
||||
# get layout object
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
return $LayoutObject->Notify(
|
||||
Info => $LayoutObject->{LanguageObject}->Translate(
|
||||
'Online Agent: %s',
|
||||
$Param{Message},
|
||||
),
|
||||
);
|
||||
}
|
||||
else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,42 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::AgentSessionLimit;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::System::AuthSession',
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
# Check if the agent session limit for the prior warning is reached
|
||||
# and save the message for the translation and the output.
|
||||
my $AgentSessionLimitPriorWarningMessage
|
||||
= $Kernel::OM->Get('Kernel::System::AuthSession')->CheckAgentSessionLimitPriorWarning();
|
||||
|
||||
return '' if !$AgentSessionLimitPriorWarningMessage;
|
||||
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
my $Output = $LayoutObject->Notify(
|
||||
Data => $LayoutObject->{LanguageObject}->Translate($AgentSessionLimitPriorWarningMessage),
|
||||
Priority => 'Warning',
|
||||
);
|
||||
|
||||
return $Output;
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,209 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::AgentTicketEscalation;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Kernel::Language qw(Translatable);
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::System::Cache',
|
||||
'Kernel::System::Ticket',
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
# get layout object
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
# only show the escalations on ticket overviews
|
||||
return ''
|
||||
if $LayoutObject->{Action}
|
||||
!~ /^AgentTicket(Queue|Service|(Status|Locked|Watch|Responsible)View)/;
|
||||
|
||||
# get cache object
|
||||
my $CacheObject = $Kernel::OM->Get('Kernel::System::Cache');
|
||||
|
||||
# check result cache
|
||||
my $CacheTime = $Param{Config}->{CacheTime} || 40;
|
||||
if ($CacheTime) {
|
||||
my $Output = $CacheObject->Get(
|
||||
Type => 'TicketEscalation',
|
||||
Key => 'EscalationResult::' . $Self->{UserID} . '::' . $LayoutObject->{UserLanguage},
|
||||
);
|
||||
return $Output if defined $Output;
|
||||
}
|
||||
|
||||
# get ticket object
|
||||
my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');
|
||||
|
||||
# get all overtime tickets
|
||||
my $ShownMax = $Param{Config}->{ShownMax} || 25;
|
||||
my $EscalationInMinutes = $Param{Config}->{EscalationInMinutes} || 120;
|
||||
my @TicketIDs = $TicketObject->TicketSearch(
|
||||
Result => 'ARRAY',
|
||||
Limit => $ShownMax,
|
||||
TicketEscalationTimeOlderMinutes => -$EscalationInMinutes,
|
||||
Permission => 'rw',
|
||||
UserID => $Self->{UserID},
|
||||
);
|
||||
|
||||
# get escalations
|
||||
my $ResponseTime = '';
|
||||
my $UpdateTime = '';
|
||||
my $SolutionTime = '';
|
||||
my $Comment = '';
|
||||
my $Count = 0;
|
||||
for my $TicketID (@TicketIDs) {
|
||||
my %Ticket = $TicketObject->TicketGet(
|
||||
TicketID => $TicketID,
|
||||
DynamicFields => 0,
|
||||
);
|
||||
|
||||
# check response time
|
||||
if ( defined $Ticket{FirstResponseTime} ) {
|
||||
$Ticket{FirstResponseTimeHuman} = $LayoutObject->CustomerAgeInHours(
|
||||
Age => $Ticket{FirstResponseTime},
|
||||
Space => ' ',
|
||||
);
|
||||
if ( $Ticket{FirstResponseTimeEscalation} ) {
|
||||
$LayoutObject->Block(
|
||||
Name => 'TicketEscalationFirstResponseTimeOver',
|
||||
Data => \%Ticket,
|
||||
);
|
||||
my $Data = $LayoutObject->Output(
|
||||
TemplateFile => 'AgentTicketEscalation',
|
||||
Data => \%Param,
|
||||
);
|
||||
$ResponseTime .= $LayoutObject->Notify(
|
||||
Priority => 'Error',
|
||||
Data => $Data,
|
||||
);
|
||||
$Count++;
|
||||
}
|
||||
elsif ( $Ticket{FirstResponseTimeNotification} ) {
|
||||
$LayoutObject->Block(
|
||||
Name => 'TicketEscalationFirstResponseTimeWillBeOver',
|
||||
Data => \%Ticket,
|
||||
);
|
||||
my $Data = $LayoutObject->Output(
|
||||
TemplateFile => 'AgentTicketEscalation',
|
||||
Data => \%Param,
|
||||
);
|
||||
$ResponseTime .= $LayoutObject->Notify(
|
||||
Priority => 'Notice',
|
||||
Data => $Data,
|
||||
);
|
||||
$Count++;
|
||||
}
|
||||
}
|
||||
|
||||
# check update time
|
||||
if ( defined $Ticket{UpdateTime} ) {
|
||||
$Ticket{UpdateTimeHuman} = $LayoutObject->CustomerAgeInHours(
|
||||
Age => $Ticket{UpdateTime},
|
||||
Space => ' ',
|
||||
);
|
||||
if ( $Ticket{UpdateTimeEscalation} ) {
|
||||
$LayoutObject->Block(
|
||||
Name => 'TicketEscalationUpdateTimeOver',
|
||||
Data => \%Ticket,
|
||||
);
|
||||
my $Data = $LayoutObject->Output(
|
||||
TemplateFile => 'AgentTicketEscalation',
|
||||
Data => \%Param,
|
||||
);
|
||||
$UpdateTime .= $LayoutObject->Notify(
|
||||
Priority => 'Error',
|
||||
Data => $Data,
|
||||
);
|
||||
$Count++;
|
||||
}
|
||||
elsif ( $Ticket{UpdateTimeNotification} ) {
|
||||
$LayoutObject->Block(
|
||||
Name => 'TicketEscalationUpdateTimeWillBeOver',
|
||||
Data => \%Ticket,
|
||||
);
|
||||
my $Data = $LayoutObject->Output(
|
||||
TemplateFile => 'AgentTicketEscalation',
|
||||
Data => \%Param,
|
||||
);
|
||||
$UpdateTime .= $LayoutObject->Notify(
|
||||
Priority => 'Notice',
|
||||
Data => $Data,
|
||||
);
|
||||
$Count++;
|
||||
}
|
||||
}
|
||||
|
||||
# check solution
|
||||
if ( defined $Ticket{SolutionTime} ) {
|
||||
$Ticket{SolutionTimeHuman} = $LayoutObject->CustomerAgeInHours(
|
||||
Age => $Ticket{SolutionTime},
|
||||
Space => ' ',
|
||||
);
|
||||
if ( $Ticket{SolutionTimeEscalation} ) {
|
||||
$LayoutObject->Block(
|
||||
Name => 'TicketEscalationSolutionTimeOver',
|
||||
Data => \%Ticket,
|
||||
);
|
||||
my $Data = $LayoutObject->Output(
|
||||
TemplateFile => 'AgentTicketEscalation',
|
||||
Data => \%Param,
|
||||
);
|
||||
$SolutionTime .= $LayoutObject->Notify(
|
||||
Priority => 'Error',
|
||||
Data => $Data,
|
||||
);
|
||||
$Count++;
|
||||
}
|
||||
elsif ( $Ticket{SolutionTimeNotification} ) {
|
||||
$LayoutObject->Block(
|
||||
Name => 'TicketEscalationSolutionTimeWillBeOver',
|
||||
Data => \%Ticket,
|
||||
);
|
||||
my $Data = $LayoutObject->Output(
|
||||
TemplateFile => 'AgentTicketEscalation',
|
||||
Data => \%Param,
|
||||
);
|
||||
$SolutionTime .= $LayoutObject->Notify(
|
||||
Priority => 'Notice',
|
||||
Data => $Data,
|
||||
);
|
||||
$Count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( $Count == $ShownMax ) {
|
||||
$Comment .= $LayoutObject->Notify(
|
||||
Priority => 'Error',
|
||||
Info => Translatable('There are more escalated tickets!'),
|
||||
);
|
||||
}
|
||||
my $Output = $ResponseTime . $UpdateTime . $SolutionTime . $Comment;
|
||||
|
||||
# cache result
|
||||
if ($CacheTime) {
|
||||
$CacheObject->Set(
|
||||
Type => 'TicketEscalation',
|
||||
Key => 'EscalationResult::' . $Self->{UserID} . '::' . $LayoutObject->{UserLanguage},
|
||||
Value => $Output,
|
||||
TTL => $CacheTime,
|
||||
);
|
||||
}
|
||||
|
||||
return $Output;
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,66 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::AgentTimeZoneCheck;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Kernel::Language qw(Translatable);
|
||||
use Kernel::System::DateTime;
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Config',
|
||||
'Kernel::System::User',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
my $ShowUserTimeZoneSelectionNotification
|
||||
= $Kernel::OM->Get('Kernel::Config')->Get('ShowUserTimeZoneSelectionNotification');
|
||||
return '' if !$ShowUserTimeZoneSelectionNotification;
|
||||
|
||||
my %UserPreferences = $Kernel::OM->Get('Kernel::System::User')->GetPreferences(
|
||||
UserID => $Self->{UserID},
|
||||
);
|
||||
return '' if !%UserPreferences;
|
||||
|
||||
# Ignore stored time zone if it's actually an old-style offset which is not valid anymore.
|
||||
# Please see bug#13374 for more information.
|
||||
if (
|
||||
$UserPreferences{UserTimeZone}
|
||||
&& !Kernel::System::DateTime->IsTimeZoneValid( TimeZone => $UserPreferences{UserTimeZone} )
|
||||
)
|
||||
{
|
||||
delete $UserPreferences{UserTimeZone};
|
||||
}
|
||||
|
||||
# Do not show notification if user has already valid time zone in the preferences.
|
||||
return '' if $UserPreferences{UserTimeZone};
|
||||
|
||||
# If OTRSTimeZone and UserDefaultTimeZone match and are not set to UTC, don't show a notification,
|
||||
# because in this case it almost certainly means that only this time zone is relevant.
|
||||
my $OTRSTimeZone = Kernel::System::DateTime->OTRSTimeZoneGet();
|
||||
my $UserDefaultTimeZone = Kernel::System::DateTime->UserDefaultTimeZoneGet();
|
||||
return '' if $OTRSTimeZone eq $UserDefaultTimeZone && $OTRSTimeZone ne 'UTC';
|
||||
|
||||
# show notification to set time zone
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
return $LayoutObject->Notify(
|
||||
Priority => 'Notice',
|
||||
Link => $LayoutObject->{Baselink} . 'Action=AgentPreferences;Subaction=Group;Group=UserProfile',
|
||||
Info =>
|
||||
Translatable('Please select a time zone in your preferences and confirm it by clicking the save button.'),
|
||||
);
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,69 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::CustomerOTRSBusiness;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::System::OTRSBusiness',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
my $Output = '';
|
||||
|
||||
# get OTRS business object
|
||||
my $OTRSBusinessObject = $Kernel::OM->Get('Kernel::System::OTRSBusiness');
|
||||
|
||||
return '' if !$OTRSBusinessObject->OTRSBusinessIsInstalled();
|
||||
|
||||
#
|
||||
# check entitlement status
|
||||
#
|
||||
my $EntitlementStatus = $OTRSBusinessObject->OTRSBusinessEntitlementStatus(
|
||||
CallCloudService => 0,
|
||||
);
|
||||
|
||||
if ( $EntitlementStatus eq 'warning-error' || $EntitlementStatus eq 'forbidden' ) {
|
||||
|
||||
my $OTRSBusinessLabel;
|
||||
if ( $OTRSBusinessObject->OTRSSTORMIsInstalled() ) {
|
||||
$OTRSBusinessLabel = '<b>STORM powered by OTRS</b>™';
|
||||
}
|
||||
elsif ( $OTRSBusinessObject->OTRSCONTROLIsInstalled() ) {
|
||||
$OTRSBusinessLabel = '<b>CONTROL powered by OTRS</b>™';
|
||||
}
|
||||
else {
|
||||
$OTRSBusinessLabel = '<b>OTRS Business Solution</b>™';
|
||||
}
|
||||
|
||||
# get layout object
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
my $Text = $LayoutObject->{LanguageObject}->Translate(
|
||||
'This system uses the %s without a proper license! Please make contact with %s to renew or activate your contract!',
|
||||
$OTRSBusinessLabel,
|
||||
'sales@otrs.com', # no mailto link as these are currently not displayed in the CI
|
||||
);
|
||||
$Output .= $LayoutObject->Notify(
|
||||
Data => $Text,
|
||||
Priority => 'Error',
|
||||
);
|
||||
}
|
||||
|
||||
return $Output;
|
||||
}
|
||||
|
||||
1;
|
||||
75
Perl OTRS/Kernel/Output/HTML/Notification/CustomerOnline.pm
Normal file
75
Perl OTRS/Kernel/Output/HTML/Notification/CustomerOnline.pm
Normal file
@@ -0,0 +1,75 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::CustomerOnline;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Config',
|
||||
'Kernel::System::AuthSession',
|
||||
'Kernel::System::DateTime',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
my $SessionObject = $Kernel::OM->Get('Kernel::System::AuthSession');
|
||||
|
||||
my $SessionMaxIdleTime = $Kernel::OM->Get('Kernel::Config')->Get('SessionMaxIdleTime');
|
||||
|
||||
my %Online = ();
|
||||
my @Sessions = $SessionObject->GetAllSessionIDs();
|
||||
|
||||
for (@Sessions) {
|
||||
my %Data = $SessionObject->GetSessionIDData(
|
||||
SessionID => $_,
|
||||
);
|
||||
if (
|
||||
$Data{UserType} eq 'Customer'
|
||||
&& $Data{UserLastRequest}
|
||||
&& $Data{UserLastRequest} + $SessionMaxIdleTime
|
||||
> $Kernel::OM->Create('Kernel::System::DateTime')->ToEpoch()
|
||||
&& $Data{UserFirstname}
|
||||
&& $Data{UserLastname}
|
||||
)
|
||||
{
|
||||
$Online{ $Data{UserID} } = "$Data{UserFullname}";
|
||||
if ( $Param{Config}->{ShowEmail} ) {
|
||||
$Online{ $Data{UserID} } .= " ($Data{UserEmail})";
|
||||
}
|
||||
}
|
||||
}
|
||||
for ( sort { $Online{$a} cmp $Online{$b} } keys %Online ) {
|
||||
if ( $Param{Message} ) {
|
||||
$Param{Message} .= ', ';
|
||||
}
|
||||
$Param{Message} .= "$Online{$_}";
|
||||
}
|
||||
if ( $Param{Message} ) {
|
||||
|
||||
# get layout object
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
return $LayoutObject->Notify(
|
||||
Info => $LayoutObject->{LanguageObject}->Translate(
|
||||
'Online Customer: %s',
|
||||
$Param{Message},
|
||||
),
|
||||
);
|
||||
}
|
||||
else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,96 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::CustomerSystemMaintenanceCheck;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::System::DateTime',
|
||||
'Kernel::System::SystemMaintenance',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::Config',
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
# get needed objects
|
||||
my $SystemMaintenanceObject = $Kernel::OM->Get('Kernel::System::SystemMaintenance');
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
my $ActiveMaintenance = $SystemMaintenanceObject->SystemMaintenanceIsActive();
|
||||
|
||||
# check if system maintenance is active
|
||||
if ($ActiveMaintenance) {
|
||||
|
||||
my $SystemMaintenanceData = $SystemMaintenanceObject->SystemMaintenanceGet(
|
||||
ID => $ActiveMaintenance,
|
||||
UserID => $Self->{UserID},
|
||||
);
|
||||
|
||||
my $NotifyMessage =
|
||||
$SystemMaintenanceData->{NotifyMessage}
|
||||
|| $Kernel::OM->Get('Kernel::Config')->Get('SystemMaintenance::IsActiveDefaultNotification')
|
||||
|| $LayoutObject->{LanguageObject}->Translate('System maintenance is active!');
|
||||
|
||||
return $LayoutObject->Notify(
|
||||
Priority => 'Notice',
|
||||
Data =>
|
||||
$LayoutObject->{LanguageObject}->Translate(
|
||||
$NotifyMessage,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
my %SystemMaintenanceIsComing = $SystemMaintenanceObject->SystemMaintenanceIsComing();
|
||||
|
||||
if (%SystemMaintenanceIsComing) {
|
||||
|
||||
my $MaintenanceStartDateTimeObject = $Kernel::OM->Create(
|
||||
'Kernel::System::DateTime',
|
||||
ObjectParams => {
|
||||
Epoch => $SystemMaintenanceIsComing{StartDate},
|
||||
},
|
||||
);
|
||||
my $MaintenanceStartDateTime = $LayoutObject->{LanguageObject}->FormatTimeString(
|
||||
$MaintenanceStartDateTimeObject->ToString(),
|
||||
'DateFormat',
|
||||
1,
|
||||
);
|
||||
|
||||
my $MaintenanceStopDateTimeObject = $Kernel::OM->Create(
|
||||
'Kernel::System::DateTime',
|
||||
ObjectParams => {
|
||||
Epoch => $SystemMaintenanceIsComing{StopDate},
|
||||
},
|
||||
);
|
||||
my $MaintenanceStopDateTime = $LayoutObject->{LanguageObject}->FormatTimeString(
|
||||
$MaintenanceStopDateTimeObject->ToString(),
|
||||
'DateFormat',
|
||||
1,
|
||||
);
|
||||
|
||||
return $LayoutObject->Notify(
|
||||
Priority => 'Notice',
|
||||
Data =>
|
||||
$LayoutObject->{LanguageObject}->Translate(
|
||||
"A system maintenance period will start at: %s and is expected to stop at: %s",
|
||||
$MaintenanceStartDateTime, $MaintenanceStopDateTime
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,67 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::CustomerUserTimeZoneCheck;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Kernel::Language qw(Translatable);
|
||||
use Kernel::System::DateTime;
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Config',
|
||||
'Kernel::System::CustomerUser',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
my $ShowUserTimeZoneSelectionNotification
|
||||
= $Kernel::OM->Get('Kernel::Config')->Get('ShowUserTimeZoneSelectionNotification');
|
||||
return '' if !$ShowUserTimeZoneSelectionNotification;
|
||||
|
||||
my %CustomerUserPreferences = $Kernel::OM->Get('Kernel::System::CustomerUser')->GetPreferences(
|
||||
UserID => $Self->{UserID},
|
||||
);
|
||||
return '' if !%CustomerUserPreferences;
|
||||
|
||||
# Ignore stored time zone if it's actually an old-style offset which is not valid anymore.
|
||||
# Please see bug#13374 for more information.
|
||||
if (
|
||||
$CustomerUserPreferences{UserTimeZone}
|
||||
&& !Kernel::System::DateTime->IsTimeZoneValid( TimeZone => $CustomerUserPreferences{UserTimeZone} )
|
||||
)
|
||||
{
|
||||
delete $CustomerUserPreferences{UserTimeZone};
|
||||
}
|
||||
|
||||
# Do not show notification if user has already valid time zone in the preferences.
|
||||
return '' if $CustomerUserPreferences{UserTimeZone};
|
||||
|
||||
# If OTRSTimeZone and UserDefaultTimeZone match and are not set to UTC, don't show a notification,
|
||||
# because in this case it almost certainly means that only this time zone is relevant.
|
||||
my $OTRSTimeZone = Kernel::System::DateTime->OTRSTimeZoneGet();
|
||||
my $UserDefaultTimeZone = Kernel::System::DateTime->UserDefaultTimeZoneGet();
|
||||
return '' if $OTRSTimeZone eq $UserDefaultTimeZone && $OTRSTimeZone ne 'UTC';
|
||||
|
||||
# show notification to set time zone
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
return $LayoutObject->Notify(
|
||||
Priority => 'Notice',
|
||||
|
||||
# Link => $LayoutObject->{Baselink} . 'Action=CustomerPreferences',
|
||||
Info =>
|
||||
Translatable('Please select a time zone in your preferences and confirm it by clicking the save button.'),
|
||||
);
|
||||
}
|
||||
|
||||
1;
|
||||
79
Perl OTRS/Kernel/Output/HTML/Notification/DaemonCheck.pm
Normal file
79
Perl OTRS/Kernel/Output/HTML/Notification/DaemonCheck.pm
Normal file
@@ -0,0 +1,79 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::DaemonCheck;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Kernel::System::VariableCheck qw(:all);
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Config',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::System::Cache',
|
||||
'Kernel::System::Group',
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
# get config object
|
||||
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
|
||||
|
||||
# get the NodeID from the SysConfig settings, this is used on High Availability systems.
|
||||
my $NodeID = $ConfigObject->Get('NodeID') || 1;
|
||||
|
||||
# get running daemon cache
|
||||
my $Running = $Kernel::OM->Get('Kernel::System::Cache')->Get(
|
||||
Type => 'DaemonRunning',
|
||||
Key => $NodeID,
|
||||
);
|
||||
|
||||
return '' if $Running;
|
||||
|
||||
# get layout object
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
my %NotificationDetails = (
|
||||
Priority => 'Error',
|
||||
Data => $LayoutObject->{LanguageObject}->Translate("OTRS Daemon is not running."),
|
||||
);
|
||||
|
||||
# check if user needs to be notified
|
||||
# get current user groups
|
||||
my %Groups = $Kernel::OM->Get('Kernel::System::Group')->PermissionUserGet(
|
||||
UserID => $Self->{UserID},
|
||||
Type => 'move_into',
|
||||
);
|
||||
|
||||
# reverse groups hash for easy look up
|
||||
%Groups = reverse %Groups;
|
||||
|
||||
# check if the user is in the Admin group
|
||||
# if that is the case, extend the error with a link
|
||||
if ( $Groups{admin} ) {
|
||||
$NotificationDetails{Link} = $LayoutObject->{Baselink} . '#';
|
||||
$NotificationDetails{LinkClass} = 'DaemonInfo';
|
||||
}
|
||||
|
||||
# if user is not admin, add 'Please contact the administrator.' to error message
|
||||
else {
|
||||
$NotificationDetails{Data}
|
||||
.= ' ' . $LayoutObject->{LanguageObject}->Translate("Please contact the administrator.");
|
||||
}
|
||||
|
||||
# show error notification
|
||||
return $LayoutObject->Notify(
|
||||
%NotificationDetails,
|
||||
);
|
||||
}
|
||||
|
||||
1;
|
||||
77
Perl OTRS/Kernel/Output/HTML/Notification/Generic.pm
Normal file
77
Perl OTRS/Kernel/Output/HTML/Notification/Generic.pm
Normal file
@@ -0,0 +1,77 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::Generic;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::System::Main',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::Config',
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
# define default value
|
||||
my %Arguments = (
|
||||
Priority => 'Warning',
|
||||
);
|
||||
|
||||
# Check which class to add
|
||||
if ( $Param{Config}->{Priority} && $Param{Config}->{Priority} eq 'Error' ) {
|
||||
$Arguments{Priority} = 'Error';
|
||||
}
|
||||
elsif ( $Param{Config}->{Priority} && $Param{Config}->{Priority} eq 'Success' ) {
|
||||
$Arguments{Priority} = 'Success';
|
||||
}
|
||||
elsif ( $Param{Config}->{Priority} && $Param{Config}->{Priority} eq 'Info' ) {
|
||||
$Arguments{Priority} = 'Info';
|
||||
}
|
||||
|
||||
if ( $Param{Config}->{Text} ) {
|
||||
$Arguments{Info} = $Param{Config}->{Text};
|
||||
}
|
||||
elsif ( $Param{Config}->{File} ) {
|
||||
|
||||
$Param{Config}->{File} =~ s{<OTRS_CONFIG_(.+?)>}{$Kernel::OM->Get('Kernel::Config')->Get($1)}egx;
|
||||
|
||||
return '' if !-e $Param{Config}->{File};
|
||||
|
||||
# try to read the file
|
||||
my $FileContent = $Kernel::OM->Get('Kernel::System::Main')->FileRead(
|
||||
Location => $Param{Config}->{File},
|
||||
Mode => 'utf8',
|
||||
Type => 'Local',
|
||||
Result => 'SCALAR',
|
||||
);
|
||||
|
||||
return '' if !$FileContent;
|
||||
return '' if ref $FileContent ne 'SCALAR';
|
||||
|
||||
$Arguments{Info} = ${$FileContent};
|
||||
}
|
||||
else {
|
||||
return '';
|
||||
}
|
||||
|
||||
# add link if available
|
||||
if ( $Param{Config}->{Link} ) {
|
||||
$Arguments{Link} = $Param{Config}->{Link};
|
||||
}
|
||||
|
||||
return '' if !$Arguments{Info};
|
||||
|
||||
return $Kernel::OM->Get('Kernel::Output::HTML::Layout')->Notify(%Arguments);
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,76 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::OutofOfficeCheck;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::System::User',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
my %UserData = $Kernel::OM->Get('Kernel::System::User')->GetUserData( UserID => $Self->{UserID} );
|
||||
return '' if ( !$UserData{OutOfOffice} );
|
||||
|
||||
my $CurSystemDTObject = $Kernel::OM->Create('Kernel::System::DateTime');
|
||||
my $OOOStartDTObject = $Self->_GetOutOfOfficeDateTimeObject(
|
||||
UserData => \%UserData,
|
||||
Type => 'Start'
|
||||
);
|
||||
my $OOOEndDTObject = $Self->_GetOutOfOfficeDateTimeObject(
|
||||
UserData => \%UserData,
|
||||
Type => 'End'
|
||||
);
|
||||
|
||||
if ( $OOOStartDTObject < $CurSystemDTObject && $OOOEndDTObject > $CurSystemDTObject ) {
|
||||
|
||||
# get layout object
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
return $LayoutObject->Notify(
|
||||
Priority => 'Notice',
|
||||
Link => $LayoutObject->{Baselink} . 'Action=AgentPreferences',
|
||||
Data =>
|
||||
$LayoutObject->{LanguageObject}
|
||||
->Translate("You have Out of Office enabled, would you like to disable it?"),
|
||||
);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
sub _GetOutOfOfficeDateTimeObject {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
my $Type = $Param{Type};
|
||||
my $UserData = $Param{UserData};
|
||||
|
||||
my $DTString = sprintf(
|
||||
'%s-%s-%s %s',
|
||||
$UserData->{"OutOfOffice${Type}Year"},
|
||||
$UserData->{"OutOfOffice${Type}Month"},
|
||||
$UserData->{"OutOfOffice${Type}Day"},
|
||||
( $Type eq 'End' ? '23:59:59' : '00:00:00' ),
|
||||
);
|
||||
|
||||
return $Kernel::OM->Create(
|
||||
'Kernel::System::DateTime',
|
||||
ObjectParams => {
|
||||
String => $DTString,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,53 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::PackageManagerCheckNotVerifiedPackages;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Config',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::System::Group',
|
||||
'Kernel::System::SysConfig',
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
# Check if setting is activated.
|
||||
my $PackageAllowNotVerifiedPackages = $Kernel::OM->Get('Kernel::Config')->Get('Package::AllowNotVerifiedPackages');
|
||||
return '' if !$PackageAllowNotVerifiedPackages;
|
||||
|
||||
# Check permissions.
|
||||
my $Group = $Param{Config}->{Group} || 'admin';
|
||||
my $HasPermission = $Kernel::OM->Get('Kernel::System::Group')->PermissionCheck(
|
||||
UserID => $Self->{UserID},
|
||||
GroupName => $Group,
|
||||
Type => 'rw',
|
||||
);
|
||||
|
||||
return '' if !$HasPermission;
|
||||
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
return $LayoutObject->Notify(
|
||||
Priority => 'Error',
|
||||
Data => $LayoutObject->{LanguageObject}->Translate(
|
||||
'The installation of packages which are not verified by the OTRS Group is activated. These packages could threaten your whole system! It is recommended not to use unverified packages.'
|
||||
),
|
||||
Link =>
|
||||
$LayoutObject->{Baselink}
|
||||
. 'Action=AdminSystemConfiguration;Subaction=View;Setting=Package%3A%3AAllowNotVerifiedPackages;',
|
||||
);
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,56 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::SystemConfigurationInvalidCheck;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::System::Group',
|
||||
'Kernel::System::SysConfig',
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
my $Group = $Param{Config}->{Group} || 'admin';
|
||||
|
||||
my $HasPermission = $Kernel::OM->Get('Kernel::System::Group')->PermissionCheck(
|
||||
UserID => $Self->{UserID},
|
||||
GroupName => $Group,
|
||||
Type => 'rw',
|
||||
);
|
||||
|
||||
return '' if !$HasPermission;
|
||||
|
||||
my @InvalidSettings = $Kernel::OM->Get('Kernel::System::SysConfig')->ConfigurationInvalidList(
|
||||
CachedOnly => 1,
|
||||
);
|
||||
|
||||
if ( scalar @InvalidSettings ) {
|
||||
|
||||
return $LayoutObject->Notify(
|
||||
Priority => 'Error',
|
||||
Link => $LayoutObject->{Baselink} . 'Action=AdminSystemConfiguration;Subaction=Invalid',
|
||||
Data => $LayoutObject->{LanguageObject}->Translate(
|
||||
"You have %s invalid setting(s) deployed. Click here to show invalid settings.",
|
||||
scalar @InvalidSettings,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,57 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::SystemConfigurationIsDirtyCheck;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::System::Group',
|
||||
'Kernel::System::SysConfig',
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
if ( $Param{Type} eq 'Admin' ) {
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
my $Group = $Param{Config}->{Group} || 'admin';
|
||||
|
||||
my $HasPermission = $Kernel::OM->Get('Kernel::System::Group')->PermissionCheck(
|
||||
UserID => $Self->{UserID},
|
||||
GroupName => $Group,
|
||||
Type => 'rw',
|
||||
);
|
||||
|
||||
return '' if !$HasPermission;
|
||||
|
||||
my $Result = $Kernel::OM->Get('Kernel::System::SysConfig')->ConfigurationIsDirtyCheck(
|
||||
UserID => $Self->{UserID},
|
||||
);
|
||||
|
||||
if ($Result) {
|
||||
|
||||
return $LayoutObject->Notify(
|
||||
Priority => 'Notice',
|
||||
Link => $LayoutObject->{Baselink} . 'Action=AdminSystemConfigurationDeployment;Subaction=Deployment',
|
||||
Data => $LayoutObject->{LanguageObject}->Translate(
|
||||
"You have undeployed settings, would you like to deploy them?"
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,77 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::SystemConfigurationOutOfSyncCheck;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Config',
|
||||
'Kernel::System::Group',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::System::SysConfig'
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
my $Group = $Param{Config}->{Group} || 'admin';
|
||||
|
||||
my $HasPermission = $Kernel::OM->Get('Kernel::System::Group')->PermissionCheck(
|
||||
UserID => $Self->{UserID},
|
||||
GroupName => $Group,
|
||||
Type => 'rw',
|
||||
);
|
||||
|
||||
return '' if !$HasPermission;
|
||||
|
||||
my $CurrentDeploymentID = $Kernel::OM->Get('Kernel::Config')->Get('CurrentDeploymentID') || 0;
|
||||
|
||||
my %LastDeployment = $Kernel::OM->Get('Kernel::System::SysConfig')->ConfigurationDeployGetLast();
|
||||
|
||||
# Quit silently if the DeploymentID from configuration match the latest from DB.
|
||||
return '' if !%LastDeployment;
|
||||
return '' if $CurrentDeploymentID == $LastDeployment{DeploymentID};
|
||||
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
my $CurrentDateTimeObject = $Kernel::OM->Create(
|
||||
'Kernel::System::DateTime'
|
||||
);
|
||||
|
||||
my $DeploymentDateTimeObject = $Kernel::OM->Create(
|
||||
'Kernel::System::DateTime',
|
||||
ObjectParams => {
|
||||
String => $LastDeployment{CreateTime},
|
||||
},
|
||||
);
|
||||
|
||||
my $AllowedDelayMinutes = $Param{Config}->{AllowedDelayMinutes} || 5;
|
||||
my $Success = $DeploymentDateTimeObject->Add(
|
||||
Minutes => $AllowedDelayMinutes,
|
||||
);
|
||||
|
||||
# Check if deployment delay is within the limits (return a warning).
|
||||
if ( $DeploymentDateTimeObject >= $CurrentDateTimeObject ) {
|
||||
return $LayoutObject->Notify(
|
||||
Priority => 'Warning',
|
||||
Data =>
|
||||
$LayoutObject->{LanguageObject}->Translate("The configuration is being updated, please be patient..."),
|
||||
);
|
||||
}
|
||||
|
||||
return $LayoutObject->Notify(
|
||||
Priority => 'Error',
|
||||
Data => $LayoutObject->{LanguageObject}->Translate("There is an error updating the system configuration!"),
|
||||
);
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,98 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::SystemMaintenanceCheck;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::System::DateTime',
|
||||
'Kernel::System::SystemMaintenance',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::Config',
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
# get system maintenance object
|
||||
my $SystemMaintenanceObject = $Kernel::OM->Get('Kernel::System::SystemMaintenance');
|
||||
|
||||
my $ActiveMaintenance = $SystemMaintenanceObject->SystemMaintenanceIsActive();
|
||||
|
||||
# get layout object
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
# check if system maintenance is active
|
||||
if ($ActiveMaintenance) {
|
||||
|
||||
my $SystemMaintenanceData = $SystemMaintenanceObject->SystemMaintenanceGet(
|
||||
ID => $ActiveMaintenance,
|
||||
UserID => $Self->{UserID},
|
||||
);
|
||||
|
||||
my $NotifyMessage =
|
||||
$SystemMaintenanceData->{NotifyMessage}
|
||||
|| $Kernel::OM->Get('Kernel::Config')->Get('SystemMaintenance::IsActiveDefaultNotification')
|
||||
|| $LayoutObject->{LanguageObject}->Translate("System maintenance is active!");
|
||||
|
||||
return $LayoutObject->Notify(
|
||||
Priority => 'Notice',
|
||||
Data =>
|
||||
$LayoutObject->{LanguageObject}->Translate(
|
||||
$NotifyMessage,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
my %SystemMaintenanceIsComing = $SystemMaintenanceObject->SystemMaintenanceIsComing();
|
||||
|
||||
if (%SystemMaintenanceIsComing) {
|
||||
|
||||
my $MaintenanceStartDateTimeObject = $Kernel::OM->Create(
|
||||
'Kernel::System::DateTime',
|
||||
ObjectParams => {
|
||||
Epoch => $SystemMaintenanceIsComing{StartDate},
|
||||
},
|
||||
);
|
||||
my $MaintenanceStartDateTime = $LayoutObject->{LanguageObject}->FormatTimeString(
|
||||
$MaintenanceStartDateTimeObject->ToString(),
|
||||
'DateFormat',
|
||||
1,
|
||||
);
|
||||
|
||||
my $MaintenanceStopDateTimeObject = $Kernel::OM->Create(
|
||||
'Kernel::System::DateTime',
|
||||
ObjectParams => {
|
||||
Epoch => $SystemMaintenanceIsComing{StopDate},
|
||||
},
|
||||
);
|
||||
my $MaintenanceStopDateTime = $LayoutObject->{LanguageObject}->FormatTimeString(
|
||||
$MaintenanceStopDateTimeObject->ToString(),
|
||||
'DateFormat',
|
||||
1,
|
||||
);
|
||||
|
||||
return $LayoutObject->Notify(
|
||||
Priority => 'Notice',
|
||||
Data =>
|
||||
$LayoutObject->{LanguageObject}->Translate(
|
||||
"A system maintenance period will start at: %s and is expected to stop at: %s",
|
||||
$MaintenanceStartDateTime, $MaintenanceStopDateTime
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
1;
|
||||
69
Perl OTRS/Kernel/Output/HTML/Notification/TimeAccounting.pm
Normal file
69
Perl OTRS/Kernel/Output/HTML/Notification/TimeAccounting.pm
Normal file
@@ -0,0 +1,69 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::TimeAccounting;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Kernel::Language qw(Translatable);
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::System::DateTime',
|
||||
'Kernel::System::TimeAccounting',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
);
|
||||
|
||||
sub new {
|
||||
my ( $Type, %Param ) = @_;
|
||||
|
||||
# allocate new hash for object
|
||||
my $Self = {};
|
||||
bless( $Self, $Type );
|
||||
|
||||
# get UserID param
|
||||
$Self->{UserID} = $Param{UserID} || die "Got no UserID!";
|
||||
|
||||
return $Self;
|
||||
}
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
my $DateTimeObject = $Kernel::OM->Create('Kernel::System::DateTime');
|
||||
my $DateTimeSettings = $DateTimeObject->Get();
|
||||
|
||||
# get time accounting object
|
||||
my $TimeAccountingObject = $Kernel::OM->Get('Kernel::System::TimeAccounting');
|
||||
|
||||
my %User = $TimeAccountingObject->UserCurrentPeriodGet(
|
||||
Year => $DateTimeSettings->{Year},
|
||||
Month => $DateTimeSettings->{Month},
|
||||
Day => $DateTimeSettings->{Day},
|
||||
);
|
||||
if ( $User{ $Self->{UserID} } ) {
|
||||
my %IncompleteWorkingDays = $TimeAccountingObject->WorkingUnitsCompletnessCheck(
|
||||
UserID => $Self->{UserID},
|
||||
);
|
||||
|
||||
# redirect if incomplete working day are out of range
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
my $Priority = ( $IncompleteWorkingDays{EnforceInsert} ) ? 'Error' : 'Warning';
|
||||
if ( $IncompleteWorkingDays{Warning} || $IncompleteWorkingDays{EnforceInsert} ) {
|
||||
return $Kernel::OM->Get('Kernel::Output::HTML::Layout')->Notify(
|
||||
Priority => $Priority,
|
||||
Link => $LayoutObject->{Baselink} . 'Action=AgentTimeAccountingEdit',
|
||||
Info => Translatable('Please insert your working hours!'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
1;
|
||||
44
Perl OTRS/Kernel/Output/HTML/Notification/UIDCheck.pm
Normal file
44
Perl OTRS/Kernel/Output/HTML/Notification/UIDCheck.pm
Normal file
@@ -0,0 +1,44 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, 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::Output::HTML::Notification::UIDCheck;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Config',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
);
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
# return if it's not root@localhost
|
||||
return '' if $Self->{UserID} != 1;
|
||||
|
||||
# get the product name
|
||||
my $ProductName = $Kernel::OM->Get('Kernel::Config')->Get('ProductName') || 'OTRS';
|
||||
|
||||
# get layout object
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
# show error notfy, don't work with user id 1
|
||||
return $LayoutObject->Notify(
|
||||
Priority => 'Error',
|
||||
Link => $LayoutObject->{Baselink} . 'Action=AdminUser',
|
||||
Info => $LayoutObject->{LanguageObject}->Translate(
|
||||
'Don\'t use the Superuser account to work with %s! Create new Agents and work with these accounts instead.',
|
||||
$ProductName
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
1;
|
||||
Reference in New Issue
Block a user