Einbindng einer zweiten MySQL-DB als Kundenbackend

Allgemein Fragen, deutsche News, Ankündigungen & Events zum OTRS
Post Reply
timo2k
Znuny newbie
Posts: 41
Joined: 16 Feb 2010, 21:00
Znuny Version: 4.0.16

Einbindng einer zweiten MySQL-DB als Kundenbackend

Post by timo2k »

Hallo Forum,

derzeit stehe ich irgendwie auf dem Schlauch.
(CentOS7, OTRS 4.0.4)
Ich habe in meiner Config.pm die ganz normalen Datenbank-Settings drin. Zusätzlich noch ein Backend aus dem Windows-AD für User und Agents.
Jetzt würde ich gerne ein zweites Kundenbackend anlegen mit Usern, die in einer externen MySQL-DB liegen.
Ich habe in meine Config.pm folgenden Code eingbaut:

Code: Select all

$Self->{CustomerUser5} = {
    Name => 'Mitarbeiter ohne AD-Konto',
    Module => 'Kernel::System::CustomerUser::DB',
    Params => {
        # if you want to use an external database, add the
        # required settings
        DSN => 'DBI:odbc:yourdsn',
        DSN => 'DBI:mysql:database=personal_noad;host=localhost',
      User => 'personal_noad',
        Password => '12345678',
        Table => 'personal_noad',
    },
    # 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 => 250,
    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
        [ 'UserTitle',      'Title',      'Status',        1, 0, 'var', '', 0 ],
        [ 'UserFirstname',  'Firstname',  'Vorname',   1, 1, 'var', '', 0 ],
        [ 'UserLastname',   'Lastname',   'Name',    1, 1, 'var', '', 0 ],
        [ 'UserLogin',      'Username',   'Anzeigename',        1, 1, 'var', '', 0 ],
        [ 'UserEmail',      'Email',      'E_Mail',        1, 1, 'var', '', 0 ],
        [ 'UserCustomerID', 'CustomerID', 'PNR',  0, 1, 'var', '', 0 ],
        [ 'UserMobile',     'Mobile',     'Handynummer',       1, 0, 'var', '', 0 ],
    ],
};
bekomme aber nur einen Error 500.
Kann es sein, dass es daran liegt, dass die Mitarbeiter alle die selbe E-Mail-Adresse (dummy@localhost) haben?
System: OTRS 4.0.16 | CentOS 7.2 | Apache 2.4.6 | MariaDB 5.5.44 | Perl 5.16.3 | PHP 5.4.16
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Einbindng einer zweiten MySQL-DB als Kundenbackend

Post by reneeb »

Was sagt denn das error-log des Apachen?
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
timo2k
Znuny newbie
Posts: 41
Joined: 16 Feb 2010, 21:00
Znuny Version: 4.0.16

Re: Einbindng einer zweiten MySQL-DB als Kundenbackend

Post by timo2k »

Folgende Meldung steht im Error-Log:

Code: Select all

[Fri Jan 16 11:44:49.130414 2015] [:error] [pid 23976] [Fri Jan 16 11:44:49 2015] -e: Need CustomerUser->CustomerKey in Kernel/Config.pm! at /opt/otrs//Kernel/System/CustomerUser/DB.pm line 51.\n
System: OTRS 4.0.16 | CentOS 7.2 | Apache 2.4.6 | MariaDB 5.5.44 | Perl 5.16.3 | PHP 5.4.16
timo2k
Znuny newbie
Posts: 41
Joined: 16 Feb 2010, 21:00
Znuny Version: 4.0.16

Re: Einbindng einer zweiten MySQL-DB als Kundenbackend

Post by timo2k »

Ich bin jetzt etwas weiter - ich bekomme laut otrs.loc folgenden Fehler:

Code: Select all

[Mon Jan 19 10:58:00 2015][Error][Kernel::System::CustomerUser::DB::CustomerName][112] Need UserLogin!
[Mon Jan 19 10:58:00 2015][Error][Kernel::System::CustomerUser::LDAP::CustomerName][214] Need UserLogin!
[Mon Jan 19 10:58:00 2015][Error][Kernel::System::CustomerUser::DB::CustomerName][112] Need UserLogin!
Kapiere ich nichts ganz, das Feld UserLogin wird doch gemappt?

Mein Backend sieht wie folgt aus:

Code: Select all

    $Self->{CustomerUser2} = {
        Name   => 'Mitarbeiter (gewerblich)',
        Module => 'Kernel::System::CustomerUser::DB',
        Params => {
            # if you want to use an external database, add the
            # required settings
            DSN => 'DBI:mysql:database=personal_noad;host=127.0.0.1',
            User => 'personal_noad',
            Password => '********',
            Table => 'personal_noad',
            ForeignDB => 1,    # set this to 1 if your table does not have create_time, create_by, change_time and change_by fields

            # 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 => 'PNR',

        # customer #
        CustomerID             => 'PNR',
        UserLogin              => 'Anzeigename',
        CustomerValid          => 'valid_id',

        # The last field must always be the email address so that a valid
        #   email address like "John Doe" <john.doe@domain.com> can be constructed from the fields.
        CustomerUserListFields => [ 'Vorname', 'Name', 'E_Mail' ],

        CustomerUserSearchFields           => [ 'Anzeigename', 'Vorname', 'Name', 'PNR' ],
        CustomerUserSearchPrefix           => '*',
        CustomerUserSearchSuffix           => '*',
        CustomerUserSearchListLimit        => 250,
        CustomerUserPostMasterSearchFields => ['E_Mail'],
        CustomerUserNameFields             => [ 'Vorname', 'Name' ],
        CustomerUserEmailUniqCheck         => 0,

        # cache time to live in sec. - cache any database queries
        CacheTTL => 60 * 60 * 24,
#        # 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)
            [ 'UserLogin',      'Username',   'Anzeigename',      1, 1, 'var', '', 0 ],
            [ 'UserFirstname',  'Firstname',  'Vorname', 1, 1, 'var', '', 0 ],
            [ 'UserLastname',   'Lastname',   'Name',  1, 1, 'var', '', 0 ],
            [ 'UserPassword',   'Password',   'PNR',         0, 0, 'var', '', 0 ],
            [ 'UserEmail',      'Email',      'E_Mail',      1, 1, 'var', '', 0 ],
            [ 'UserCustomerID', 'CustomerID', 'PNR', 0, 1, 'var', '', 0 ],
            [ 'UserMobile',       'Mobile',      'Handynummer',       1, 0, 'var', '', 0 ],
            [ 'UserTitle', 'Position', 'Status', 1, 0, 'var', '' ],
            [ 'UserComment',      'Comment',     'Kostenstelle',     1, 0, 'var', '', 0 ],
            [ 'ValidID',          'Valid',       'valid_id',     0, 1, 'int', '', 0 ],
        ],
    };
System: OTRS 4.0.16 | CentOS 7.2 | Apache 2.4.6 | MariaDB 5.5.44 | Perl 5.16.3 | PHP 5.4.16
timo2k
Znuny newbie
Posts: 41
Joined: 16 Feb 2010, 21:00
Znuny Version: 4.0.16

Re: Einbindng einer zweiten MySQL-DB als Kundenbackend

Post by timo2k »

Ich habe jetzt die Datenbank nochmal neu eingebunden. Jetzt funktioniert es mit einer Ausnahme - das Feld "Name" im Kundenbenutzerbackend wird nicht angezeigt. In der Quell-Datenbank wird das komplette Feld bestehend aus Name und Vorname "Anzeigename" genannt.

Code: Select all

    $Self->{CustomerUser5} = {
        Name   => 'Mitarbeiter (gewerblich)',
        Module => 'Kernel::System::CustomerUser::DB',
        Params => {
            # if you want to use an external database, add the
            # required settings
            DSN => 'DBI:mysql:database=personal;host=127.0.0.1',
            User => 'personaluser',
            Password => '*******',
            Table => 'personal',
            ForeignDB => 1,    # set this to 1 if your table does not have create_time, create_by, change_time and change_by fields
            CaseSensitive => 0,
        },

        # customer unique id
        CustomerKey => 'PNR',

        # customer #
        CustomerID             => 'PNR',
        UserLogin              => 'Anzeigename',
        CustomerValid          => 'Aktiv',
        UserFirstname => 'Vorname',
        UserLastname => 'Name',
  CustomerUserListFields => ['Anzeigename', 'E_Mail'],
  CustomerUserSearchFields => ['Anzeigename', 'E_Mail'],
	CustomerUserPostMasterSearchFields => ['E_Mail'],
  CustomerUserNameFields => ['Anzeigename'],
	CustomerUserSearchListLimit => 1000,

        # cache time to live in sec. - cache any database queries
        CacheTTL => 60 * 60 * 24,
#        # 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)
            [ 'UserFirstname',  'Firstname',  'Vorname', 1, 1, 'var', '', 0 ],
            [ 'UserLastname',   'Lastname',   'Name',  1, 1, 'var', '', 0 ],
            [ 'UserLogin',      'Login',   'Anzeigename',      1, 1, 'var', '', 0 ],
            [ 'UserPassword',   'Password',   'PNR',         0, 0, 'var', '', 0 ],
            [ 'UserEmail',      'Email',      'E_Mail',      1, 1, 'var', '', 0 ],
            [ 'UserCustomerID', 'CustomerID', 'E_Mail', 0, 1, 'var', '', 0 ],
            [ 'UserMobile',       'Mobile',      'Handynummer',       1, 0, 'var', '', 0 ],
  				  [ 'UserTitle', 'Position', 'Status', 1, 0, 'var', '' ],
            [ 'UserComment',      'Comment',     'Kostenstelle',     1, 0, 'var', '', 0 ],
            [ 'ValidID',          'Valid',       'Aktiv',     0, 1, 'int', '', 0 ],
        ],
    };
Hat jemand eine Idee?
System: OTRS 4.0.16 | CentOS 7.2 | Apache 2.4.6 | MariaDB 5.5.44 | Perl 5.16.3 | PHP 5.4.16
Post Reply