Services translation change valid/invalid flag

Moderator: crythias

Post Reply
roanselmi
Znuny newbie
Posts: 29
Joined: 23 Feb 2015, 19:02
Znuny Version: 3.3.6
Real Name: Roberto Anselmi
Company: Deloitte XBS

Services translation change valid/invalid flag

Post by roanselmi »

Hi, all.

My OTRS system is: OTRS 3.3.6 with IIS 7 and MySQL on Windows Server 2008 R2 std.

Briefly, I translate the services from english to brazilian portuguese (adding some rows to pt_BR.pm) and now when I switch my language from english to portuguese in Preferences, the services are translated in the right way, but all of them turn to 'valid', even the 'invalid' ones. As a result, when customer user (or an agent) create a ticket and choose this kind of translated services (the ones that were 'invalid' and now are 'valid'), OTRS set service to NULL in the ticket.

In more detail, I've used pt_BR.pm because I was not able to use the pt_BR_Custom.pm way, then I've enabled the translation for services in more (for example, in AgentTicketPhone.pm):

{
Name => 'ServiceID',
Data => $Services,
SelectedID => $GetParam{ServiceID},
PossibleNone => 1,
Translation => 1,
TreeView => $TreeView,
Max => 100,
},

Any idea about where I have to look in OTRS files?

Roberto Anselmi
OTRS 3.3.6 - Windows Server 2008 R2 standard - IIS 7.5
MySQL 5.1.51 - ActivePerl 5.16.2
Giulio Soleni
Znuny wizard
Posts: 392
Joined: 30 Dec 2010, 14:35
Znuny Version: 6.0.x and 5.0.x
Real Name: Giulio Soleni
Company: IKS srl

Re: Services translation change valid/invalid flag

Post by Giulio Soleni »

Ciao Roberto,
sorry I cannot solve your issue but I have got exactly the same issue with queue translation.

I have tested it on beta5 also...

Hope someone can shed some light on "invalidation" mechanism and why both translated queues and services are still displayed as valid and selectable when they are not.

Giulio
OTRS 6.0.x on CentOS 7.x with MariaDB 10.2.x database connected to an Active Directory for Agents and Customers.
ITSM and FAQ modules installed.
Giulio Soleni
Znuny wizard
Posts: 392
Joined: 30 Dec 2010, 14:35
Znuny Version: 6.0.x and 5.0.x
Real Name: Giulio Soleni
Company: IKS srl

Re: Services translation change valid/invalid flag

Post by Giulio Soleni »

I think that the problem for the queues could be somewhere within /opt/otrs/Kernel/Output/HTML/CustomerNewTicket/QueueSelectionGeneric.pm but I am not absolutely sure :?

If someone of the developers would help me to know where in the code it's specified that a sub-queue (or a sub-service) must be grayed-out due to the fact it's not selectable, like in the example here below
queues.jpg
Because I am almost sure that is there, at that point, that the control fails when the sub-queue (or sub service) is translated.
queues2.png
Again... any help would be really apreciated.

Thank you
Giulio
You do not have the required permissions to view the files attached to this post.
OTRS 6.0.x on CentOS 7.x with MariaDB 10.2.x database connected to an Active Directory for Agents and Customers.
ITSM and FAQ modules installed.
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Services translation change valid/invalid flag

Post by crythias »

Some assistance:
https://github.com/OTRS/otrs/blob/maste ... ne.pm#L629

Code: Select all

        my $Services = $Self->_GetServices(
            %GetParam,
            %ACLCompatGetParam,
            %SplitTicketParam,
            CustomerUserID => $CustomerData{UserLogin} || '',
            QueueID        => $Self->{QueueID}         || 1,
        );
https://github.com/OTRS/otrs/blob/maste ... e.pm#L2095
sub _GetServices
https://github.com/OTRS/otrs/blob/maste ... e.pm#L2115

Code: Select all

    # get service list
    if ( $Param{CustomerUserID} ) {
        %Service = $Kernel::OM->Get('Kernel::System::Ticket')->TicketServiceList(
            %Param,
            Action => $Self->{Action},
            UserID => $Self->{UserID},
        );
    }
https://github.com/OTRS/otrs/blob/maste ... t.pm#L2191
https://github.com/OTRS/otrs/blob/maste ... t.pm#L2242

Code: Select all

    # get service object
    my $ServiceObject = $Kernel::OM->Get('Kernel::System::Service');

    my %Services;
    if ( !$Param{CustomerUserID} ) {
        %Services = $ServiceObject->ServiceList(
            UserID => 1,
            KeepChildren =>
                $Kernel::OM->Get('Kernel::Config')->Get('Ticket::Service::KeepChildren'),
        );
    }
https://github.com/OTRS/otrs/blob/maste ... ice.pm#L72

Code: Select all

=item ServiceList()
return a hash list of services
It grabs some things from Cache, but then queries:

Code: Select all

       SQL => 'SELECT id, name, valid_id FROM service',

Code: Select all

    while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
        $ServiceList{ $Row[0] }      = $Row[1];
        $ServiceValidList{ $Row[0] } = $Row[2];
    }
This *says* it checks if the untranslated name (this is how I read it) has a corresponding entry in the "valid_id" column that matches within the "valid" table to make sure that the "valid_id" is one that matches "Valid".

Maybe that is confusing, but ... let's say there's a list of entries that are indicative of "valid" or "invalid" in a table called "Valid". https://github.com/OTRS/otrs/blob/maste ... m/Valid.pm
So, a service has a "valid_id" that might indicate something that references a stored value in the table named "valid":
https://github.com/OTRS/otrs/blob/maste ... lid.pm#L80

defined:
https://github.com/OTRS/otrs/blob/maste ... sql.sql#L7

Code: Select all

INSERT INTO valid (id, name, create_by, create_time, change_by, change_time)
    VALUES
    (1, 'valid', 1, current_timestamp, 1, current_timestamp);
# ----------------------------------------------------------
#  insert into table valid
# ----------------------------------------------------------
INSERT INTO valid (id, name, create_by, create_time, change_by, change_time)
    VALUES
    (2, 'invalid', 1, current_timestamp, 1, current_timestamp);
# ----------------------------------------------------------
#  insert into table valid
# ----------------------------------------------------------
INSERT INTO valid (id, name, create_by, create_time, change_by, change_time)
    VALUES
    (3, 'invalid-temporarily', 1, current_timestamp, 1, current_timestamp);
It's *possible* that there is something that's a conflict between "valid" and what's stored as valid in the service.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Post Reply