[SOLVED] Add fields to Customer Company

Moderator: crythias

Locked
miguelmz
Znuny wizard
Posts: 370
Joined: 17 Nov 2011, 17:46
Znuny Version: 6.0.10
Real Name: Miguel
Company: SIA
Location: Madrid, Spain.

[SOLVED] Add fields to Customer Company

Post by miguelmz »

Hi,

I'm trying to add new fields to customer company. Recently I added new fields to customers using the config.pm and I looked for how to do the same with companies without success.

I have seen / otrs / Kernel / System / CustomerCompany.pm this but I can't enter the correct format in Config.pm

Code: Select all

# config options
    $Self->{CustomerCompanyTable} = $Self->{ConfigObject}->Get('CustomerCompany')->{Params}->{Table}
        || die "Need CustomerCompany->Params->Table in Kernel/Config.pm!";
    $Self->{CustomerCompanyKey}
        = $Self->{ConfigObject}->Get('CustomerCompany')->{CustomerCompanyKey}
        || $Self->{ConfigObject}->Get('CustomerCompany')->{Key}
        || die "Need CustomerCompany->CustomerCompanyKey in Kernel/Config.pm!";
    $Self->{CustomerCompanyMap} = $Self->{ConfigObject}->Get('CustomerCompany')->{Map}
        || die "Need CustomerCompany->Map in Kernel/Config.pm!";
    $Self->{CustomerCompanyValid}
        = $Self->{ConfigObject}->Get('CustomerCompany')->{'CustomerCompanyValid'};
    $Self->{SearchListLimit}
        = $Self->{ConfigObject}->Get('CustomerCompany')->{'CustomerCompanySearchListLimit'};
    $Self->{SearchPrefix}
        = $Self->{ConfigObject}->Get('CustomerCompany')->{'CustomerCompanySearchPrefix'};

    if ( !defined( $Self->{SearchPrefix} ) ) {
        $Self->{SearchPrefix} = '';
    }
    $Self->{SearchSuffix}
        = $Self->{ConfigObject}->Get('CustomerCompany')->{'CustomerCompanySearchSuffix'};
    if ( !defined( $Self->{SearchSuffix} ) ) {
        $Self->{SearchSuffix} = '*';
    }
anyone have any idea?

Regards,
Miguel.
Last edited by miguelmz on 22 Jun 2012, 15:07, edited 1 time in total.
We want OTRS certifications in Spain!!

Check out my free addons! :mrgreen:
miguelmz
Znuny wizard
Posts: 370
Joined: 17 Nov 2011, 17:46
Znuny Version: 6.0.10
Real Name: Miguel
Company: SIA
Location: Madrid, Spain.

Re: Add fields to Customer Company

Post by miguelmz »

Ups.

sorry, sometimes I need to get help on something to realize after :lol:

I found this blog post OTRS http://blog.otrs.org/author/mb/ where you can see this

Code: Select all

# ---------------------------------------------------- #
    # CustomerCompany configuration
    # ---------------------------------------------------- #
    $Self->{CustomerCompany} = {
        Params => {
            # if you want to use an external database, add the
            # required settings
            DSN      => 'DBI:ODBC:mssqldynamics',
            User     => 'otrs',
            Password => 'secretpass',
            Table    => 'view_for_otrs',
        },

        # customer uniq id
        CustomerCompanyKey             => 'customer_id',
        CustomerCompanyValid           => 'valid_id',
        CustomerCompanyListFields      => [ 'name' ],
        CustomerCompanySearchFields    => [ 'name', 'customer_id' ],
        CustomerCompanySearchPrefix    => '',
        CustomerCompanySearchSuffix    => '*',
        CustomerCompanySearchListLimit => 250,

        Map => [
            # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly
            [ 'CustomerID',                  'CustomerID',    'customer_id',  0, 1, 'var', '', 0 ],
            [ 'CustomerCompanyName',         'Company',       'name',         1, 1, 'var', '', 0 ],
            [ 'CustomerCompanyURL',          'URL',           'url',          1, 0, 'var', '$Data{"CustomerCompanyURL"}', 0 ],
        ],
    };
Is exactly the same as for any customer, I just add the field in the same format.

Code: Select all

           # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly
           [ 'Fax',                         'Fax',           'fax',          1, 1, 'var', '', 0 ],
thanks anyway.
will put the post solved.

Regards.
We want OTRS certifications in Spain!!

Check out my free addons! :mrgreen:
Locked