Skip to content

Commit

Permalink
Merge branch 'rel-11_0' into rel-11_1
Browse files Browse the repository at this point in the history
Conflicts were resolved in .github/workflows/docker_image_update_autobuild.yml.
But it is not evident whether the resolution was correct.
  • Loading branch information
bschmalhofer committed Nov 15, 2024
2 parents 9b73d7c + 83afe11 commit 19863f5
Show file tree
Hide file tree
Showing 19 changed files with 515 additions and 112 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/docker_image_update_autobuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,22 @@ jobs:
target: 'otobo-web'
docker_tag: 'latest-11_0-autobuild'
base_image: 'perl:5.38-bookworm'

# otobo-nginx-kerberos-webproxy uses different dockerfiles in 10.0 and 10.1
-
target: 'otobo-web'
docker_tag: 'latest-11_1-autobuild'
base_image: 'perl:5.40-slim-bookworm'
# common info for every target; for nginx this includes the base image
target: 'otobo-nginx-kerberos-webproxy'
docker_tag: 'latest-10_0-autobuild'
dockerfile: 'otobo.nginx-kerberos.dockerfile'
-
target: 'otobo-nginx-kerberos-webproxy'
docker_tag: 'latest-10_1-autobuild'
dockerfile: 'otobo.nginx-kerberos.dockerfile'
-
target: 'otobo-nginx-kerberos-webproxy'
docker_tag: 'latest-11_0-autobuild'
dockerfile: 'otobo.nginx.dockerfile'

# common info for every target; for nginx this includes the base imagie
-
target: 'otobo-web'
dockerfile: 'otobo.web.dockerfile'
Expand All @@ -57,7 +68,6 @@ jobs:
base_image: 'nginx:mainline'
-
target: 'otobo-nginx-kerberos-webproxy'
dockerfile: 'otobo.nginx.dockerfile'
context: 'scripts/nginx'
repository: 'rotheross/otobo-nginx-kerberos-webproxy'
base_image: 'nginx:mainline'
Expand Down
25 changes: 12 additions & 13 deletions .github/workflows/docker_image_update_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ on:

jobs:
CheckDockerImageUpdate:
runs-on: 'ubuntu-latest'
strategy:

# create different images
Expand All @@ -39,7 +38,7 @@ jobs:
dockerfile: 'otobo.elasticsearch.dockerfile'
context: 'scripts/elasticsearch'
repository: 'rotheross/otobo-elasticsearch'
base_image: 'docker.elastic.co/elasticsearch/elasticsearch:7.17.25'
base_image: 'elasticsearch:7.17.3'
-
target: 'otobo-nginx-webproxy'
dockerfile: 'otobo.nginx.dockerfile'
Expand All @@ -59,13 +58,13 @@ jobs:
repository: 'rotheross/otobo-selenium-chrome'
base_image: 'selenium/standalone-chrome-debug:3.141.59-20210422'


runs-on: ${{ matrix.target }}
steps:

- name: Setting up the environment file
run: |
patch="${{ matrix.patch }}"
docker_tag="rel-${patch}_test"
patch=${{ matrix.patch }}
docker_tag="rel-${patch}"
mixed_case_repository="${{ github.repository }}"
lowercased_repository="${mixed_case_repository,,}"
build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
Expand Down Expand Up @@ -120,24 +119,24 @@ jobs:
uses: docker/build-push-action@v6
with:
load: true
context: .
file: otobo.web.dockerfile
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
pull: true
build-args: |
BUILD_DATE=${{ env.otobo_build_date }}
DOCKER_TAG=${{ env.otobo_docker_tag }}
GIT_REPO=${{ github.repositoryUrl }}
GIT_BRANCH=${{ env.otobo_branch }}
GIT_COMMIT=${{ env.otobo_commit }}
target: otobo-web
target: ${{ matrix.target }}
tags: ${{ env.otobo_image }}
cache-from: type=gha
cache-to: type=gha,mode=max`

-
# otobo_first_time hasn't run yet, so /opt/otobo is still empty
name: Info
if: steps.check.outputs.needs-updating == 'true'
if: ${{ steps.check.outputs.needs-updating == 'true' && matrix.target == 'otobo-web' }}
run: |
docker run --rm -w /opt/otobo_install/otobo_next --entrypoint /bin/bash $otobo_image -c "more git-repo.txt git-branch.txt git-commit.txt RELEASE | cat"
Expand All @@ -158,16 +157,16 @@ jobs:
uses: docker/build-push-action@v6
with:
push: true
context: .
file: otobo.web.dockerfile
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
pull: true
build-args: |
BUILD_DATE=${{ env.otobo_build_date }}
DOCKER_TAG=${{ env.otobo_docker_tag }}
GIT_REPO=${{ github.repositoryUrl }}
GIT_BRANCH=${{ env.otobo_branch }}
GIT_COMMIT=${{ env.otobo_commit }}
target: otobo-web
target: ${{ matrix.target }}
tags: ${{ env.otobo_image }}
cache-from: type=gha
cache-to: type=gha,mode=max`
cache-to: type=gha,mode=max
4 changes: 2 additions & 2 deletions Kernel/Modules/AgentTicketHistory.pm
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ sub Run {
# values stored previously in older format might not be compatible with new human readable form.
# Please see bug#11520 for more information.
#
# HistoryType: TicketDynamicFieldUpdate
# HistoryType: ArticleDynamicFieldUpdate & TicketDynamicFieldUpdate
# - Old: %%FieldName%%$FieldName%%Value%%$HistoryValue%%OldValue%%$HistoryOldValue
# - New: %%$FieldName%%$HistoryOldValue%%$HistoryValue
if ( $Data->{HistoryType} eq 'TicketDynamicFieldUpdate' ) {
if ( $Data->{HistoryType} eq 'ArticleDynamicFieldUpdate' || $Data->{HistoryType} eq 'TicketDynamicFieldUpdate' ) {
@Values = ( $Values[1], $Values[5] // '', $Values[3] // '' );
}

Expand Down
10 changes: 6 additions & 4 deletions Kernel/Output/HTML/Layout.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4019,7 +4019,7 @@ sub BuildDateSelection {
if ( $Prefix !~ /^DynamicField_/ || $Suffix ne '_Template' ) {
my $DatepickerJS = '
Core.UI.Datepicker.Init({
Day: $("#" + Core.App.EscapeSelector("' . $Prefix . '") + "Day"' . ( $Suffix ? ' + Core.App.EscapeSelector("' . $Suffix . '")' : '' ) . '),
Day: $("#" + Core.App.EscapeSelector("' . $Prefix . '") + "Day"' . ( $Suffix ? ' + Core.App.EscapeSelector("' . $Suffix . '")' : '' ) . '),
Month: $("#" + Core.App.EscapeSelector("' . $Prefix . '") + "Month"' . ( $Suffix ? ' + Core.App.EscapeSelector("' . $Suffix . '")' : '' ) . '),
Year: $("#" + Core.App.EscapeSelector("' . $Prefix . '") + "Year"' . ( $Suffix ? ' + Core.App.EscapeSelector("' . $Suffix . '")' : '' ) . '),
Hour: $("#" + Core.App.EscapeSelector("' . $Prefix . '") + "Hour"' . ( $Suffix ? ' + Core.App.EscapeSelector("' . $Suffix . '")' : '' ) . '),
Expand All @@ -4028,6 +4028,8 @@ sub BuildDateSelection {
DateInFuture: ' . ( $ValidateDateInFuture ? 'true' : 'false' ) . ',
DateNotInFuture: ' . ( $ValidateDateNotInFuture ? 'true' : 'false' ) . ',
WeekDayStart: ' . $WeekDayStart . '
}, {
Disabled: ' . ( $Param{Disabled} ? 'true' : 'false' ) . '
});';

$Self->AddJSOnDocumentComplete( Code => $DatepickerJS );
Expand Down Expand Up @@ -5348,9 +5350,9 @@ sub RichTextDocumentComplete {
);

# verify HTML document
my $CustomerInterface = ($Self->{SessionSource} && ($Self->{SessionSource} eq 'CustomerInterface')) ? 1 : 0;
my $HTMLString = $Kernel::OM->Get('Kernel::System::HTMLUtils')->DocumentComplete(
String => $StringRef->$*,
my $CustomerInterface = ( $Self->{SessionSource} && ( $Self->{SessionSource} eq 'CustomerInterface' ) ) ? 1 : 0;
my $HTMLString = $Kernel::OM->Get('Kernel::System::HTMLUtils')->DocumentComplete(
String => $StringRef->$*,
CustomerInterface => $CustomerInterface
);

Expand Down
118 changes: 118 additions & 0 deletions Kernel/System/Console/Command/Maint/GenericInterface/TriggerInvoker.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# --
# OTOBO is a web-based ticketing system for service organisations.
# --
# Copyright (C) 2001-2020 OTRS AG, https://otrs.com/
# Copyright (C) 2019-2024 Rother OSS GmbH, https://otobo.io/
# --
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# --

package Kernel::System::Console::Command::Maint::GenericInterface::TriggerInvoker;

use strict;
use warnings;

use parent qw(Kernel::System::Console::BaseCommand);

use Kernel::System::VariableCheck qw(:all);

our @ObjectDependencies = (
'Kernel::GenericInterface::Requester',
'Kernel::System::Daemon::SchedulerDB',
'Kernel::System::GenericInterface::Webservice',
);

sub Configure {
my ( $Self, %Param ) = @_;

$Self->Description('Triggers a given Invoker webservice.');
$Self->AddArgument(
Name => 'webservice',
Description => "Select name of web service to be triggered.",
Required => 1,
HasValue => 1,
ValueRegex => qr/./smx,
);
$Self->AddArgument(
Name => 'invoker',
Description => "Select Invoker to be triggered.",
Required => 1,
HasValue => 1,
ValueRegex => qr/./,
);

return;
}

sub PreRun {
my ( $Self, %Param ) = @_;

my $Invoker = $Self->GetArgument('invoker');
my $WebserviceName = $Self->GetArgument('webservice');

# Check if all requirements are met (web service exists and has needed method).
my $Webservice = $Kernel::OM->Get('Kernel::System::GenericInterface::Webservice')->WebserviceGet(
Name => $WebserviceName,
);

if ( !IsHashRefWithData($Webservice) ) {
$Self->Print(
"<red>Required web service '$WebserviceName' does not exist!</red>\n"
);
return $Self->ExitCodeError();
}
if ( $Webservice->{ValidID} ne '1' ) {
$Self->Print(
"<red>Required web service '$WebserviceName' is invalid!</red>\n"
);
return $Self->ExitCodeError();
}

my $InvokerControllerMapping = $Webservice->{Config}{Requester}{Transport}{Config}{InvokerControllerMapping};

if ( !IsHashRefWithData($InvokerControllerMapping) ) {
$Self->Print(
"<red>Web service '$WebserviceName' does not contain required REST controller mapping!</red>\n"
);
return $Self->ExitCodeError();
}
if ( !IsHashRefWithData( $InvokerControllerMapping->{$Invoker} ) ) {
$Self->Print(
"<red>Web service '$WebserviceName' does not contain the Invoker '$Invoker'!</red>\n"
);
return $Self->ExitCodeError();
}

# Remember data for task.
$Self->{InvokerTaskData} = {
WebserviceID => $Webservice->{ID},
Invoker => $Invoker,
Data => { Dummy => 1 },
};

return;
}

sub Run {
my ( $Self, %Param ) = @_;

my $Invoker = $Self->GetArgument('invoker');

$Self->Print(
"<yellow>Triggering $Invoker for immediate (asynchronous) execution.</yellow>\n"
);

my $Result = $Kernel::OM->Get('Kernel::GenericInterface::Requester')->Run( $Self->{InvokerTaskData}->%* );

$Self->Print("<green>Done.</green>\n");
return $Self->ExitCodeOk();
}

1;
5 changes: 5 additions & 0 deletions Kernel/System/DynamicField/Driver/BaseDateTime.pm
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ sub EditFieldRender {
$FieldClass .= ' Validate_Required';
}

# set readonly css class
if ( $Param{Readonly} ) {
$FieldClass .= ' Readonly';
}

# set error css class
if ( $Param{ServerError} ) {
$FieldClass .= ' ServerError';
Expand Down
5 changes: 5 additions & 0 deletions Kernel/System/DynamicField/Driver/Checkbox.pm
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,11 @@ sub EditFieldRender {
$FieldClass .= ' Validate_Required';
}

# set readonly css class
if ( $Param{Readonly} ) {
$FieldClass .= ' Readonly';
}

# set error css class
if ( $Param{ServerError} ) {
$FieldClass .= ' ServerError';
Expand Down
9 changes: 7 additions & 2 deletions Kernel/System/DynamicField/Driver/Date.pm
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ sub ValueSet {

$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "The value for the field Date is invalid!\n"
. "The date must be valid and the time must be 00:00:00",
Message => "The value $ValueItem for the field Date is invalid!\n"
. "The date must be in format 0000-00-00 and the time must be 00:00:00",
);

return;
Expand Down Expand Up @@ -370,6 +370,11 @@ sub EditFieldRender {
$FieldClass .= ' Validate_Required';
}

# set readonly css class
if ( $Param{Readonly} ) {
$FieldClass .= ' Readonly';
}

# set error css class
if ( $Param{ServerError} ) {
$FieldClass .= ' ServerError';
Expand Down
5 changes: 5 additions & 0 deletions Kernel/System/DynamicField/Driver/RichText.pm
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ sub EditFieldRender {
$FieldClass .= ' Validate_Required';
}

# set readonly css class
if ( $Param{Readonly} ) {
$FieldClass .= ' Readonly';
}

# set error css class
if ( $Param{ServerError} ) {
$FieldClass .= ' ServerError';
Expand Down
29 changes: 28 additions & 1 deletion Kernel/System/JSON.pm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ create a JSON object. Do not use it directly, instead use:
sub new {
my ($Type) = @_;

# allocate new hash for object
# allocate a new hash for object, even though that hash is never used
return bless {}, $Type;
}

Expand Down Expand Up @@ -185,6 +185,15 @@ sub Decode {
# grudgingly accept data that is neither a hash- nor an array reference
$JSONObject->allow_nonref(1);

# In OTOBO 10.0.x and OTOBO 10.1.x there is a tree walker that
# replaces the boolean values, that is instances of JSON::PP::Boolean,
# with the plain integer values 0 and 1.
# This behavior is reproduced with explicitly declaring
# what should be emitted for JSON booleans 'true' and 'false'.
# Note that when using Cpanel::JSON::XS, the attribute unblessed_bool can be used
# for the same purpose.
$JSONObject->boolean_values( 0, 1 );

# Deserialize JSON and get a Perl data structure.
# Use Try::Tiny as JSON::XS->decode() dies when providing a malformed JSON string.
# In that case we want to return an empty list.
Expand Down Expand Up @@ -264,4 +273,22 @@ sub ToBoolean {
return $Scalar ? $Self->True : $Self->False;
}

=head2 IsBool()
Indicates whether the passed in variable is a boolean value. Specifically whether it is an
instance of C<Types::Serialiser::Boolean>. Note that C<Types::Serialiser::Boolean> is an alias for C<JSON::PP::Boolean>.
my $IsBool1 = $JSONObject->IsBool(1); # assigns undef
my $IsBool2 = $JSONObject->IsBool( $JSONObject->False); # assigns 1
In this case the returned JSON will be C<q{false}>. For true expressions we get C<q{true}>.
=cut

sub IsBool {
my ( $Self, $Scalar ) = @_;

return Types::Serialiser::is_bool($Scalar);
}

1;
Loading

0 comments on commit 19863f5

Please sign in to comment.