Import CostumerUser aus MSSQL Quelle

Hilfe zu OTRS Problemen aller Art
Post Reply
MJoest
Znuny newbie
Posts: 4
Joined: 09 Oct 2018, 07:40
Znuny Version: 6.0.10

Import CostumerUser aus MSSQL Quelle

Post by MJoest »

Hallo Zusammen,

ich beschäftige mich erst seit kurzem mit OTRS und natürlich tauchen da Fragen und auch Probleme auf. Meine Recherchen im Netz waren bisher noch nicht erfolgreich :(

Zum Einsatz kommt eine OTRS 6.0.10 Community Edition auf einem CentOS7 Server.

Ich konnte bisher erfolgreich Agents über das AD einbinden und auch Kunden aus einer externen MSSQL DB einbinden. Nun stehe ich aber vor dem Problem, dass ich auch Kundenbenutzer aus einer MSSQL DB einbinden muss, um diese dann den Kunden zuordnen zu können.

Die Verbindung zur DB steht, jedoch bekomme ich nun folgende Fehlermeldung

Code: Select all

[Error][Kernel::System::CustomerUser::DB::CustomerUserDataGet][Line:1217]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Ung▒ltiger Spaltenname 'create_time'. (SQL-42S22)#012[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Ung▒ltiger Spaltenname 'create_by'. (SQL-42S22)#012[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Ung▒ltiger Spaltenname 'change_time'. (SQL-42S22)#012[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Ung▒ltiger Spaltenname 'change_by'. (SQL-42S22) [state was 42S22 now 42000]#012[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Anweisung(en) konnte(n) nicht vorbereitet werden. (SQL-42000), SQL: 'SELECT TOP 1  first_name,  last_name,  last_name,  email,  customer_id,  phone,  mobile, create_time, create_by, change_time, change_by, login FROM otrs_company_user WHERE LOWER(login) = LOWER(?)'
Bei den Einstellungen für CustomerCompany habe ich ja die Möglichkeit mit ForeignDB => 1 diese Spalten zu umgehen. Mache ich dies nun auch in der CustomerUser, geht der Apache auf Fehler 500.

Hat jemand einen Tipp, bzw. Lösung für mich, wie ich dies lösen kann?

Hier noch meine gekürzte Config.pm

Code: Select all

##############################################################
#                 Start Customer Company Backend             #
##############################################################
# Connection to Mention Database
    $Self->{CustomerCompany} = {
        Name   => 'Mention Company',
        Module => 'Kernel::System::CustomerCompany::DB',
        Params => {
            # if you want to use an external database, add the
            # required settings
            Type => 'mssql', # only for ODBC connections
            DSN => 'DBI:ODBC:mention',
            User => 'xxx',
            Password => 'xxx',
            Table => 'otrs_company',
            ForeignDB => 1,    # set this to 1 if your table does not have create_time, create_by, change_time and change_by fields

            # CaseSensitive defines if the data storage of your DBMS is case sensitive and will be
            # preconfigured within the database driver by default.
            # If the collation of your data storage differs from the default settings,
            # you can set the current behavior ( either 1 = CaseSensitive or 0 = CaseINSensitive )
            # to fit your environment.
            #
#            CaseSensitive => 0,

            # SearchCaseSensitive will control if the searches within the data storage are performed
            # case sensitively (if possible) or not. Change this option to 1, if you want to search case sensitive.
            # This can improve the performance dramatically on large databases.
            SearchCaseSensitive => 0,
        },
# company unique id
        CustomerCompanyKey             => 'customer_id',
        #CustomerCompanyValid           => 'valid_id',
        CustomerCompanyListFields      => [ 'customer_id', 'name' ],
        CustomerCompanySearchFields    => [ 'customer_id', 'name' ],
        CustomerCompanySearchPrefix    => '*',
        CustomerCompanySearchSuffix    => '*',
        CustomerCompanySearchListLimit => 1500,
        CacheTTL                       =>  60 * 60 * 24, # use 0 to turn off cache

Map => [
            # Info about dynamic fields:
            #
            # Dynamic Fields of type CustomerCompany can be used within the mapping (see example below).
            # The given storage (third column) then can also be used within the following configurations (see above):
            # CustomerCompanySearchFields, CustomerCompanyListFields
            #
            # Note that the columns 'frontend' and 'readonly' will be ignored for dynamic fields.

            # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly
            [ 'CustomerID',             'CustomerID', 'customer_id', 0, 1, 'var', '', 0 ],
            [ 'CustomerCompanyName',    'Customer',   'name',        1, 1, 'var', '', 0 ],
            [ 'CustomerCompanyStreet',  'Street',     'street',      1, 0, 'var', '', 0 ],
            [ 'CustomerCompanyZIP',     'Zip',        'zip',         1, 0, 'var', '', 0 ],
            [ 'CustomerCompanyCity',    'City',       'city',        1, 0, 'var', '', 0 ],
            [ 'CustomerCompanyCountry', 'Country',    'country',     1, 0, 'var', '', 0 ],
            [ 'CustomerCompanyURL',     'URL',        'url',         1, 0, 'var', '[% Data.CustomerCompanyURL | html %]', 0 ],
            #[ 'CustomerCompanyComment', 'Comment',    'comments',    1, 0, 'var', '', 0 ],
            #[ 'ValidID',                'Valid',      'valid_id',    0, 1, 'int', '', 0 ],

            # Dynamic field example
#            [ 'DynamicField_Name_Y', undef, 'Name_Y', 0, 0, 'dynamic_field', undef, 0 ],
        ],
    };
##############################################################
#                 END Customer Company Backend               #
##############################################################
#
##############################################################
#                 Start Customer User Backend               #
##############################################################


# CustomerUser (customer database backend and settings)
$Self->{CustomerUser1} = {
    Name => 'Mention Company Customer',
    Module => 'Kernel::System::CustomerUser::DB',
    Params => {
        # if you want to use an external database, add the required settings
#            DSN => 'DBI:odbc:yourdsn',
            Type => 'mssql', # only for ODBC connections
            DSN => 'DBI:ODBC:mention',
            User => 'xxx',
            Password => 'xxx',
            Table => 'otrs_company_user',
            #ForeignDB => 1
            # CaseSensitive will control if the SQL statements need LOWER()
            #   function calls to work case insensitively. Setting this to
            #   1 will improve performance dramatically on large databases.
            CaseSensitive => 0,
        },
# customer unique id
CustomerKey => 'login',

# customer #
CustomerID => 'customer_id',
#CustomerValid => 'valid_id',
    CustomerUserListFields => ['first_name', 'last_name', 'email'],
    CustomerUserSearchFields => ['login', 'last_name', 'customer_id'],
    CustomerUserSearchPrefix => '',
    CustomerUserSearchSuffix => '*',
    CustomerUserSearchListLimit => 1500,
    CustomerUserPostMasterSearchFields => ['email'],
    CustomerUserNameFields => ['title','first_name','last_name'],
    CustomerUserEmailUniqCheck => 1,
#    # show not own tickets in customer panel, CompanyTickets
#    CustomerUserExcludePrimaryCustomerID => 0,
#    # generate auto logins
#    AutoLoginCreation => 0,
#    AutoLoginCreationPrefix => 'auto',
#    # admin can change customer preferences
#    AdminSetPreferences => 1,
#    # cache time to live in sec. - cache any database queries
#    CacheTTL => 0,
#    # just a read only source
    ReadOnly => 0,
    Map => [
        # note: Login, Email and CustomerID needed!
        # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly, http-link-target, link class(es)
#        [ 'UserTitle',      'Title',      'title',      1, 0, 'var', '', 0 ],
        [ 'UserFirstname',  'Firstname',  'first_name', 1, 1, 'var', '', 0 ],
        [ 'UserLastname',   'Lastname',   'last_name',  1, 1, 'var', '', 0 ],
        [ 'UserLogin',      'Username',   'login',      1, 1, 'var', '', 0 ],
#        [ 'UserPassword',   'Password',   'pw',         0, 0, 'var', '', 0 ],
        [ 'UserEmail',      'Email',      'email',      1, 1, 'var', '', 0 ],
#        [ 'UserEmail',      Translatable('Email'), 'email',           1, 1, 'var', '[% Env("CGIHandle") %]?Action=AgentTicketCompose;ResponseID=1;TicketID=[% Data.TicketID | uri %];ArticleID=[% Data.ArticleID | uri %]', 0, '', 'AsPopup OTRSPopup_TicketAction' ],
        [ 'UserCustomerID', 'CustomerID', 'customer_id', 0, 1, 'var', '', 0 ],
#        [ 'UserCustomerIDs', 'CustomerIDs', 'customer_ids', 1, 0, 'var', '', 0 ],
        [ 'UserPhone',        'Phone',       'phone',        1, 0, 'var', '', 0 ],
#        [ 'UserFax',          'Fax',         'fax',          1, 0, 'var', '', 0 ],
        [ 'UserMobile',       'Mobile',      'mobile',       1, 0, 'var', '', 0 ],
#        [ 'UserStreet',       'Street',      'street',       1, 0, 'var', '', 0 ],
#        [ 'UserZip',          'Zip',         'zip',          1, 0, 'var', '', 0 ],
#        [ 'UserCity',         'City',        'city',         1, 0, 'var', '', 0 ],
#        [ 'UserCountry',      'Country',     'country',      1, 0, 'var', '', 0 ],
#        [ 'UserComment',      'Comment',     'comments',     1, 0, 'var', '', 0 ],
#        [ 'ValidID',          'Valid',       'valid_id',     0, 1, 'int', '', 0 ],

        # Dynamic field example
#        [ 'DynamicField_Name_X', undef, 'Name_X', 0, 0, 'dynamic_field', undef, 0, undef, undef, ],
    ],
    # default selections
    Selections => {
        UserTitle => {
            'Mr.' => 'Mr.',
            'Mrs.' => 'Mrs.',
        },
    },
};
##############################################################
#                 END Customer User Backend               #
##############################################################
wurzel
Znuny guru
Posts: 3217
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: Import CostumerUser aus MSSQL Quelle

Post by wurzel »

Hi,

Das ForeignDB sollte auch in CustomerUser gehen.


dreh' mal das Log Level in der Systemkonfiguration auf Debug, da siehste dann im log mehr.

Den 500er Fehler kannst Du im apache Error log lesen.

viele Grüße
Flo
OTRS 8 SILVER (Prod)
OTRS 8 auf Debian 11 (Test)
Znuny 7.x latest version testing auf Debian 11

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
MJoest
Znuny newbie
Posts: 4
Joined: 09 Oct 2018, 07:40
Znuny Version: 6.0.10

Re: Import CostumerUser aus MSSQL Quelle

Post by MJoest »

Hallo wurzel,

danke ersteinmal vorweg.
wurzel wrote: 10 Oct 2018, 08:15 Das ForeignDB sollte auch in CustomerUser gehen.
Ok, dann muss ich mich auf Fehlersuche begeben.
wurzel wrote: 10 Oct 2018, 08:15 dreh' mal das Log Level in der Systemkonfiguration auf Debug, da siehste dann im log mehr.
Wo finde ich das genau? Hatte schon das Handbuch zu rate gezogen von OTRS, aber keine genaue Erklärung gefunden wie ich es hochdrehe.
wurzel wrote: 10 Oct 2018, 08:15 Den 500er Fehler kannst Du im apache Error log lesen.
Das werde ich mir als nächstes ansehen, bzw. den Fehler reproduzieren.
wurzel
Znuny guru
Posts: 3217
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: Import CostumerUser aus MSSQL Quelle

Post by wurzel »

Hi,

Systemkonfiguration > loglevel

viel Erfolg. Oft ist der 500er "nur" ein Syntaxfehler (fehlende Kommas oder so) Das sollte im apache Log dann zu finden sein.

viele Grüße
Flo
OTRS 8 SILVER (Prod)
OTRS 8 auf Debian 11 (Test)
Znuny 7.x latest version testing auf Debian 11

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
MJoest
Znuny newbie
Posts: 4
Joined: 09 Oct 2018, 07:40
Znuny Version: 6.0.10

Re: Import CostumerUser aus MSSQL Quelle

Post by MJoest »

Hallo Zusammen,

ersteinmal Danke an wurzel und Entschuldigung, dass es so lange gedauert hat, bis ich einen Rückmeldung gegeben habe.
Aber ich bin erst diese Woche wieder dazu gekommen, an unserem OTRS zu arbeiten.

Stand der Dinge:

Ich habe, nachdem ich auf dieses Problem (viewtopic.php?f=35&t=40122) gestossen bin, erneut versucht die Kundenbenutzer über eine externe DB einzufügen und habe an der Config.pm etwas herumgespielt.

Der Fehler 500 kam wohl von: CaseSensitive => 0, dieses musste ich auskommentieren, dann war Fehler 500 weg.

Nun ist es so, das mir zwar Kundenbenutzer angezeigt werden, aber ich den Namen der DB nicht sehe (siehe roter Kreis in Bild1) und mir im Syslog folgender Fehler ausgegeben wird:

Code: Select all

Dec 12 12:17:27 support OTRS-CGI-99[7055]: [Error][Kernel::System::CustomerUser::DB::CustomerUserDataGet][Line:1174]: Need User!
Meine Config.pm sieht für den CustomerUser Teil so aus:

Code: Select all

##############################################################
#                 Start Customer User Backend               #
##############################################################


# CustomerUser (customer database backend and settings)
$Self->{CustomerUser} = {
    Name => 'Mention_Customer',
    Module => 'Kernel::System::CustomerUser::DB',
    Params => {
        # if you want to use an external database, add the required settings
#            DSN => 'DBI:odbc:yourdsn',
            Type => 'mssql', # only for ODBC connections
            DSN => 'DBI:ODBC:mention',
            User => 'OTRS',
            Password => 'SECRETPASSWORD',
            Table => 'otrs_company_user',
            ForeignDB => 1
            # CaseSensitive will control if the SQL statements need LOWER()
            #   function calls to work case insensitively. Setting this to
            #   1 will improve performance dramatically on large databases.
            #CaseSensitive => 0, # ERROR 500 LOG: syntax error at /opt/otrs//Kernel/Config.pm line 283, near "CaseSensitive"\nGlobal symbol "$Self" requires explicit package name at /opt/otrs//Kernel/Config.pm line 350.\nsyntax error at /opt/otrs//Kernel/Config.pm line 366, near "}"\nCompilation failed in require at /opt/otrs//Kernel/System/ObjectManager.pm line 24.\nBEGIN failed--compilation aborted at /opt/otrs//Kernel/System/ObjectManager.pm line 24.\nCompilation failed in require at /opt/otrs/bin/cgi-bin/index.pl line 35.\nBEGIN failed--compilation aborted at /opt/otrs/bin/cgi-bin/index.pl line 35.\n
        },
# customer unique id
CustomerKey => 'login',

# customer #
CustomerID => 'customer_id',
#CustomerValid => 'valid_id',
    CustomerUserListFields => ['first_name', 'last_name', 'email'],
    CustomerUserSearchFields => ['login', 'last_name', 'customer_id'],
    CustomerUserSearchPrefix => '',
    CustomerUserSearchSuffix => '*',
    CustomerUserSearchListLimit => 1500,
    CustomerUserPostMasterSearchFields => ['email'],
    CustomerUserNameFields => ['title','first_name','last_name'],
    CustomerUserEmailUniqCheck => 1,
#    # show not own tickets in customer panel, CompanyTickets
#    CustomerUserExcludePrimaryCustomerID => 0,
#    # generate auto logins
#    AutoLoginCreation => 0,
#    AutoLoginCreationPrefix => 'auto',
#    # admin can change customer preferences
#    AdminSetPreferences => 1,
#    # cache time to live in sec. - cache any database queries
#    CacheTTL => 0,
#    # just a read only source
    ReadOnly => 1,
    Map => [
        # note: Login, Email and CustomerID needed!
        # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly, http-link-target, link class(es)
#        [ 'UserTitle',      'Title',      'title',      1, 0, 'var', '', 0 ],
        [ 'UserFirstname',  'Firstname',  'first_name', 1, 1, 'var', '', 0 ],
        [ 'UserLastname',   'Lastname',   'last_name',  1, 1, 'var', '', 0 ],
        [ 'UserLogin',      'Username',   'login',      1, 1, 'var', '', 0 ],
#        [ 'UserPassword',   'Password',   'pw',         0, 0, 'var', '', 0 ],
        [ 'UserEmail',      'Email',      'email',      1, 1, 'var', '', 0 ],
#        [ 'UserEmail',      Translatable('Email'), 'email',           1, 1, 'var', '[% Env("CGIHandle") %]?Action=AgentTicketCompose;ResponseID=1;TicketID=[% Data.TicketID | uri %];ArticleID=[% Data.ArticleID | uri %]', 0, '', 'AsPopup OTRSPopup_TicketAction' ],
        [ 'UserCustomerID', 'CustomerID', 'customer_id', 0, 1, 'var', '', 0 ],
#        [ 'UserCustomerIDs', 'CustomerIDs', 'customer_ids', 1, 0, 'var', '', 0 ],
        [ 'UserPhone',        'Phone',       'phone',        1, 0, 'var', '', 0 ],
#        [ 'UserFax',          'Fax',         'fax',          1, 0, 'var', '', 0 ],
        [ 'UserMobile',       'Mobile',      'mobile',       1, 0, 'var', '', 0 ],
#        [ 'UserStreet',       'Street',      'street',       1, 0, 'var', '', 0 ],
#        [ 'UserZip',          'Zip',         'zip',          1, 0, 'var', '', 0 ],
#        [ 'UserCity',         'City',        'city',         1, 0, 'var', '', 0 ],
#        [ 'UserCountry',      'Country',     'country',      1, 0, 'var', '', 0 ],
#        [ 'UserComment',      'Comment',     'comments',     1, 0, 'var', '', 0 ],
#        [ 'ValidID',          'Valid',       'valid_id',     0, 1, 'int', '', 0 ],

        # Dynamic field example
#        [ 'DynamicField_Name_X', undef, 'Name_X', 0, 0, 'dynamic_field', undef, 0, undef, undef, ],
    ],
    # default selections
    Selections => {
        UserTitle => {
            'Mr.' => 'Mr.',
            'Mrs.' => 'Mrs.',
        },
    },
};
##############################################################
#                 END Customer User Backend               #
##############################################################

#Top #Error 500 LOG: Can't locate object method "Top" via package "Kernel::Config" at /opt/otrs//Kernel/Config.pm line 347.\n

$Self->{CustomerUser}->{CustomerCompanySupport} = 0;

    # ---------------------------------------------------- #

    # ---------------------------------------------------- #
    # data inserted by installer                           #
    # ---------------------------------------------------- #
    # $DIBI$

    # ---------------------------------------------------- #
    # ---------------------------------------------------- #
    #                                                      #
    # end of your own config options!!!                    #
    #                                                      #
    # ---------------------------------------------------- #
    # ---------------------------------------------------- #
}

# ---------------------------------------------------- #
# needed system stuff (don't edit this)                #
# ---------------------------------------------------- #

use base qw(Kernel::Config::Defaults);

# -----------------------------------------------------#

1;
Habe ich nen Konfigurationsfehler?

Vielen Dank im Voraus

Mario
You do not have the required permissions to view the files attached to this post.
Post Reply