1# --
2# Copyright (C) 2001-2020 OTRS AG, https://otrs.com/
3# --
4# This software comes with ABSOLUTELY NO WARRANTY. For details, see
5# the enclosed file COPYING for license information (GPL). If you
6# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
7# --
8
9package Kernel::Output::HTML::Layout::Datepicker;
10
11use strict;
12use warnings;
13
14our $ObjectManagerDisabled = 1;
15
16=head1 NAME
17
18Kernel::Output::HTML::Layout::Datepicker - Datepicker data
19
20=head1 DESCRIPTION
21
22All valid functions.
23
24=head1 PUBLIC INTERFACE
25
26=head2 DatepickerGetVacationDays()
27
28Returns a hash of all vacation days defined in the system.
29
30    $LayoutObject->DatepickerGetVacationDays();
31
32=cut
33
34sub DatepickerGetVacationDays {
35    my ( $Self, %Param ) = @_;
36
37    # get config object
38    my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
39
40    # get the defined vacation days
41    my $TimeVacationDays        = $ConfigObject->Get('TimeVacationDays');
42    my $TimeVacationDaysOneTime = $ConfigObject->Get('TimeVacationDaysOneTime');
43    if ( $Param{Calendar} ) {
44        if ( $ConfigObject->Get( "TimeZone::Calendar" . $Param{Calendar} . "Name" ) ) {
45            $TimeVacationDays        = $ConfigObject->Get( "TimeVacationDays::Calendar" . $Param{Calendar} );
46            $TimeVacationDaysOneTime = $ConfigObject->Get(
47                "TimeVacationDaysOneTime::Calendar" . $Param{Calendar}
48            );
49        }
50    }
51
52    # translate the vacation description if possible
53    for my $Month ( sort keys %{$TimeVacationDays} ) {
54        for my $Day ( sort keys %{ $TimeVacationDays->{$Month} } ) {
55            $TimeVacationDays->{$Month}->{$Day}
56                = $Self->{LanguageObject}->Translate( $TimeVacationDays->{$Month}->{$Day} );
57        }
58    }
59
60    for my $Year ( sort keys %{$TimeVacationDaysOneTime} ) {
61        for my $Month ( sort keys %{ $TimeVacationDaysOneTime->{$Year} } ) {
62            for my $Day ( sort keys %{ $TimeVacationDaysOneTime->{$Year}->{$Month} } ) {
63                $TimeVacationDaysOneTime->{$Year}->{$Month}->{$Day} = $Self->{LanguageObject}->Translate(
64                    $TimeVacationDaysOneTime->{$Year}->{$Month}->{$Day}
65                );
66            }
67        }
68    }
69    return {
70        'TimeVacationDays'        => $TimeVacationDays,
71        'TimeVacationDaysOneTime' => $TimeVacationDaysOneTime,
72    };
73}
74
751;
76
77=head1 TERMS AND CONDITIONS
78
79This software is part of the OTRS project (L<https://otrs.org/>).
80
81This software comes with ABSOLUTELY NO WARRANTY. For details, see
82the enclosed file COPYING for license information (GPL). If you
83did not receive this file, see L<https://www.gnu.org/licenses/gpl-3.0.txt>.
84
85=cut
86