External Backend broken in 4.01 ?

Moderator: crythias

Locked
setecastronomy
Znuny newbie
Posts: 28
Joined: 23 Jun 2014, 11:02
Znuny Version: 3.3.7

External Backend broken in 4.01 ?

Post by setecastronomy »

I had lots of problems
configuring an External backend in Otrs 3.3.7, then I discovered it was due to a bug, resolved in 3.3.8.
Last week I installed Otrs 4.0.1 from scratch and I tried to configure again an External backend for the customer table.
When I request the customer list it is not empty but the rows have empty strings.
Looking in the log I found:

Code: Select all

Unknown column 'create_time' in 'field list', SQL: 'SELECT Nome, Cognome, CodiceFiscale, ID_persona, email, CodiceItav, Telefono, Cellulare, Via_Piazza, Cap, Localita, Note, create_time, create_by, change_time, change_by, CodiceFiscale FROM persone WHERE LOWER(CodiceFiscale) = LOWER(?) LIMIT 1'
Again OTRS want those damn fields which I don't have and that are not mandatory.

Can you confirm it is a new bug ?
Don't think further investigation is needed but please let me know.

thanks
Filippo
OTRS 4.0.1 on Ubuntu Linux and Mysql DB
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: External Backend broken in 4.01 ?

Post by reneeb »

Please show us your configuration.
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
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: External Backend broken in 4.01 ?

Post by jojo »

did you confiugre the backend as external database?
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
setecastronomy
Znuny newbie
Posts: 28
Joined: 23 Jun 2014, 11:02
Znuny Version: 3.3.7

Re: External Backend broken in 4.01 ?

Post by setecastronomy »

Here is what I added to my config.pm file.
Anyway according to me it is useless to check my configuration, it is correct.
My Customer User table, which in reality is the Mysql view 'Persone', doesn't have create_time, create_by, change_time, change_by.
They are 'optional' so OTRS should work well, instead it wants them as it is clear from the error message on first post.
In the mean time I added those fields to the view with fixed values and now the customer list is filled correctly.
However I remark this is not the expected behavior. Have I to open a bug report somewhere ?

Feel free to update the title of the thread, it may be misleading, but I couldn't think anything better.

Code: Select all

# CustomerUser
    # (customer user database backend and settings)
    $Self->{CustomerUser} = {
        Name   => 'Database Backend',
        Module => 'Kernel::System::CustomerUser::DB',
        Params => {

            Table => 'persone',
            # if your frontend is unicode and the charset of your
            # customer database server is iso-8859-1, use these options.
#           SourceCharset => 'iso-8859-1',
#           DestCharset => 'utf-8',
            # 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 => 'CodiceFiscale',

        # customer #
        CustomerID             => 'ID_persona',
        #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 => [ 'Nome', 'Cognome', 'email' ],

#        CustomerUserListFields => ['login', 'first_name', 'last_name', 'customer_id', 'email'],
        CustomerUserSearchFields           => [ 'CodiceFiscale', 'Nome', 'Cognome', 'ID_persona' ],
        CustomerUserSearchPrefix           => '*',
        CustomerUserSearchSuffix           => '*',
        CustomerUserSearchListLimit        => 250,
        CustomerUserPostMasterSearchFields => ['email'],
        CustomerUserNameFields             => [ 'Nome', 'Cognome' ],
        CustomerUserEmailUniqCheck         => 1,

#        # show now own tickets in customer panel, CompanyTickets
#        CustomerUserExcludePrimaryCustomerID => 0,
#        # generate auto logins
#        AutoLoginCreation => 0,
#        # generate auto login prefix
#        AutoLoginCreationPrefix => 'auto',
#        # admin can change customer preferences
#        AdminSetPreferences => 1,
#        # use customer company support (reference to company, See CustomerCompany settings)
#        CustomerCompanySupport => 1,
#		AuthModule => 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',  'Nome', 1, 1, 'var', '', 0 ],
            [ 'UserLastname',   'Lastname',   'Cognome',  1, 1, 'var', '', 0 ],
            [ 'UserLogin',      'Username',   'CodiceFiscale',      1, 1, 'var', '', 0 ],
            [ 'UserPassword',   'Password',   'ID_persona',         0, 0, 'var', '', 0 ],
            [ 'UserEmail',      'Email',      'email',      1, 1, 'var', '', 0 ],
#            [ 'UserEmail',      'Email', 'email',           1, 1, 'var', '$Env{"CGIHandle"}?Action=AgentTicketCompose;ResponseID=1;TicketID=$Data{"TicketID"};ArticleID=$Data{"ArticleID"}', 0, '', 'AsPopup OTRSPopup_TicketAction' ],
            [ 'UserCustomerID', 'CustomerID', 'CodiceItav', 0, 1, 'var', '', 0 ],
#            [ 'UserCustomerIDs', 'CustomerIDs', 'customer_ids', 1, 0, 'var', '', 0 ],
            [ 'UserPhone',        'Phone',       'Telefono',        1, 0, 'var', '', 0 ],
#            [ 'UserFax',          'Fax',         'fax',          1, 0, 'var', '', 0 ],
            [ 'UserMobile',       'Mobile',      'Cellulare',       1, 0, 'var', '', 0 ],
            [ 'UserStreet',       'Street',      'Via_Piazza',       1, 0, 'var', '', 0 ],
            [ 'UserZip',          'Zip',         'Cap',          1, 0, 'var', '', 0 ],
            [ 'UserCity',         'City',        'Localita',         1, 0, 'var', '', 0 ],
#            [ 'UserCountry',      'Country',     'country',      1, 0, 'var', '', 0 ],
            [ 'UserComment',      'Comment',     'Note',     1, 0, 'var', '', 0 ],
#            [ 'ValidID',          'Valid',       'valid_id',     0, 1, 'int', '', 0 ],
        ],

        # default selections
        Selections => {

#            UserTitle => {
#                'Mr.' => 'Mr.',
#                'Mrs.' => 'Mrs.',
#            },
        },
    };
OTRS 4.0.1 on Ubuntu Linux and Mysql DB
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: External Backend broken in 4.01 ?

Post by reneeb »

You need to set "ForeignDB" in the Param section:

Code: Select all

        Params => {

            Table => 'persone',
            # if your frontend is unicode and the charset of your
            # customer database server is iso-8859-1, use these options.
#           SourceCharset => 'iso-8859-1',
#           DestCharset => 'utf-8',
            # 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,
            ForeignDB => 1, # <-- THIS IS IMPORTANT WHEN YOU USE EXTERNAL DB WITHOUT create_time, ... COLUMN
        },
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
setecastronomy
Znuny newbie
Posts: 28
Joined: 23 Jun 2014, 11:02
Znuny Version: 3.3.7

Re: External Backend broken in 4.01 ?

Post by setecastronomy »

reneeb wrote:You need to set "ForeignDB" in the Param section
I apologize, reading my previous discussion I thought that parameter was useless.
My issue is resolved, anyway I think the documentation can be improved, so other people don't fall in my same mistake.
In fact inside OTRS 4 - Admin Manual ForeignDB is only reported in the chapter dealing the upgrade from 3.3, while I started from scratch.

Thanks
Filippo
OTRS 4.0.1 on Ubuntu Linux and Mysql DB
Locked