Customer Company Drop Down

Moderator: crythias

Locked
srenon
Znuny newbie
Posts: 60
Joined: 20 Mar 2013, 14:26
Znuny Version: 3.3.8

Customer Company Drop Down

Post by srenon »

Hi everyone,

Custome rCompany dropdown selection is not display on customer user edit screen.

In my config.pm i have enable CustomerCompanySuport => 1

My config.pm is like below

could you help me?

Thank you so much.

Code: Select all

<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<title>MISSOUM Lina</title>
</head>
<body>
# --
# Kernel/Config.pm - Config file for OTRS kernel
# Copyright (C) 2001-2011 xxx, http://otrs.org/
# --
# $Id: Config.pm.dist,v 1.25 2011-09-16 10:58:28 mg Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
#  Note:
#
#  -->> OTRS does have a lot of config settings. For more settings
#       (Notifications, Ticket::ViewAccelerator, Ticket::NumberGenerator,
#       LDAP, PostMaster, Session, Preferences, ...) see
#       Kernel/Config/Defaults.pm and copy your wanted lines into "this"
#       config file. This file will not be changed on update!
#
# --

package Kernel::Config;

use utf8;

sub Load {
    my $Self = shift;
    # ---------------------------------------------------- #
    # ---------------------------------------------------- #
    #                                                      #
    #         Start of your own config options!!!          #
    #                                                      #
    # ---------------------------------------------------- #
    # ---------------------------------------------------- #

    # ---------------------------------------------------- #
    # database settings                                    #
    # ---------------------------------------------------- #
    # DatabaseHost
    # (The database host.)
    $Self->{'DatabaseHost'} = 'localhost';
    # Database
    # (The database name.)
    $Self->{'Database'} = 'otrs';
    # DatabaseUser
    # (The database user.)
    $Self->{'DatabaseUser'} = 'otrs';
    # DatabasePw
    # (The password of database user. You also can use bin/otrs.CryptPassword.pl
    # for crypted passwords.)
    $Self->{'DatabasePw'} = '';
    # DatabaseDSN
    # (The database DSN for MySQL ==> more: "man DBD::mysql")
    $Self->{DatabaseDSN} = "DBI:mysql:database=$Self->{Database};host=$Self->{DatabaseHost};";

    # (The database DSN for PostgreSQL ==> more: "man DBD::Pg")
    # if you want to use a local socket connection
#    $Self->{DatabaseDSN} = "DBI:Pg:dbname=$Self->{Database};";
    # if you want to use a tcpip connection
#    $Self->{DatabaseDSN} = "DBI:Pg:dbname=$Self->{Database};host=$Self->{DatabaseHost};";
    # if you have PostgresSQL 8.1 or earlier, activate the legacy driver with this line:
#    $Self->{DatabasePostgresqlBefore82} = 1;




    # ---------------------------------------------------- #
    # fs root directory
    # ---------------------------------------------------- #
    $Self->{Home} = '/opt/otrs';

    # ---------------------------------------------------- #
    # insert your own config settings "here"               #
    # config settings taken from Kernel/Config/Defaults.pm #
    # ---------------------------------------------------- #
    # $Self->{SessionUseCookie} = 0;
    # $Self->{CheckMXRecord} = 0;

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

    # # ---------------------------------------------------- #
    # # Customer authentication section                      #
    # # ---------------------------------------------------- #
	
	# This is the auth. module againt the otrs db
	$Self->{'Customer::AuthModule1'} = 'Kernel::System::CustomerAuth::DB';
	$Self->{'Customer::AuthModule::DB::Table1'} = 'customer_user';
	$Self->{'Customer::AuthModule::DB::CustomerKey1'} = 'login';
	$Self->{'Customer::AuthModule::DB::CustomerPassword1'} = 'pw';
	
	# Connection au LDAP CDG33
	$Self->{'Customer::AuthModule2'} = 'Kernel::System::CustomerAuth::LDAP';
	$Self->{'Customer::AuthModule::LDAP::Host2'} = 'thor.domcdg33.local';
	$Self->{'Customer::AuthModule::LDAP::BaseDN2'} = 'OU=Utilisateurs-CDG,OU=CDG33,DC=domcdg33,DC=local';
	$Self->{'Customer::AuthModule::LDAP::UID2'} = 'sAMAccountName';
	$Self->{'Customer::AuthModule::LDAP::SearchUserDN2'} = 'otrs';
	$Self->{'Customer::AuthModule::LDAP::SearchUserPw2'} = '';
	$Self->{'Customer::AuthModule::LDAP::AlwaysFilter2'} = '(mail=*)';
	$Self->{'Customer::AuthModule::LDAP::Params2'} = { async => 0, port => 389, timeout => 120, version =>3, };
	
	
	
	# (customer user database backend and settings)
    $Self->{CustomerUser1} = {
        Name   => 'Collectivites',
        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:mysql:database=customerdb;host=customerdbhost',
#            User => '',
#            Password => '',
            Table => 'customer_user',
            # 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 => 'login',
        # customer #
        CustomerID             => 'customer_id',
        CustomerValid          => 'valid_id',
        CustomerUserListFields => [ 'first_name', 'last_name', 'email' ],
#       CustomerUserListFields => ['login', 'first_name', 'last_name', 'customer_id', 'email'],
        CustomerUserSearchFields           => [ 'login', 'first_name', 'last_name', 'customer_id','email' ],
        CustomerUserSearchPrefix           => '*',
        CustomerUserSearchSuffix           => '*',
        CustomerUserSearchListLimit        => 250,
        CustomerUserPostMasterSearchFields => ['email'],
        CustomerUserNameFields             => [ 'title', 'first_name', 'last_name' ],
        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,
        # 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)
            [ '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',      'Email', 'email',           1, 1, 'var', '$Env{"CGIHandle"}?Action=AgentTicketCompose;ResponseID=1;TicketID=$Data{"TicketID"};ArticleID=$Data{"ArticleID"}', 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 ],
        ],
        # default selections
        Selections => {
#            UserTitle => {
#                'Mr.' => 'Mr.',
#                'Mrs.' => 'Mrs.',
#            },
        },
    };


	
    #CustomerUser
    #(customer user LDAP backend and settings)
    $Self->{CustomerUser2} = {
      Name => 'Centre de gestion',
        Module => 'Kernel::System::CustomerUser::LDAP',
        Params => {
			Host => 'thor.domcdg33.local',
			BaseDN => 'OU=Utilisateurs-CDG,OU=CDG33,DC=domcdg33,DC=local',
			SSCOPE => 'sub',
			UserDN => 'CN=otrs,OU=Comptes-CDG,OU=CDG33,dc=domcdg33,dc=local',
			UserPw => '',
			AlwaysFilter => '(objectCategory=user)',
			SourceCharset => 'utf-8',
			DestCharset => 'utf-8',
			Params => {
				inet4 => 1,
				port => 389,
				timeout => 120,
				async   => 0,
				version => 3,
			},
		},
        CustomerKey => 'sAMAccountName',
        CustomerID => 'department',
        CustomerUserListFields => ['givenname', 'sn', 'mail'],
        CustomerUserSearchFields => ['sAMAccountName', 'cn', 'company', 'mail'],
		CustomerUserSearchPrefix => '*',
		CustomerUserSearchSuffix => '*',
		CustomerUserSearchListLimit => 250,
        CustomerUserPostMasterSearchFields => ['mail'],
        CustomerUserNameFields => ['givenname', 'sn'],
        Map => [
            [ 'UserTitle',      'Title',      'title',           1, 0, 'var', '', 0 ],
            [ 'UserFirstname',  'Firstname',  'givenname',       1, 1, 'var', '', 0 ],
            [ 'UserLastname',   'Lastname',   'sn',              1, 1, 'var', '', 0 ],
            [ 'UserLogin',      'Username',   'sAMAccountName',  1, 1, 'var', '', 0 ],
            [ 'UserEmail',      'Email',      'mail',            1, 1, 'var', '', 0 ],
            [ 'UserCustomerID', 'CustomerID', 'department',  0, 1, 'var', '', 0 ],
            [ 'UserPhone',      'Phone',      'telephonenumber', 1, 0, 'var', '', 0 ],
            [ 'UserAddress',    'Address',    'postaladdress',   1, 0, 'var', '', 0 ],
            [ 'UserComment',    'Comment',    'description',     1, 0, 'var', '', 0 ],
            ],
    };

    $Self->{CustomerCompany} = {
        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:mysql:database=customerdb;host=customerdbhost',
#            User => '',
#            Password => '',
            Table => 'customer_company',
#            ForeignDB => 0,    # set this to 1 if your table does not have create_time, create_by, change_time and change_by fields
        },
    # company unique id
    CustomerCompanyKey             => 'customer_id',
    CustomerCompanyValid           => 'valid_id',
    CustomerCompanyListFields      => ['name'],
    CustomerCompanySearchFields    => ['customer_id', 'name'],
    CustomerCompanySearchPrefix    => '*',
    CustomerCompanySearchSuffix    => '*',
    CustomerCompanySearchListLimit => 250,
    CacheTTL                       => 60 * 60 * 24, # use 0 to turn off cache
    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 ],
            [ '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"}', 0 ],
            [ 'CustomerCompanyComment', 'Comment',    'comments',    1, 0, 'var', '', 0 ],
            [ 'ValidID',                'Valid',      'valid_id',    0, 1, 'int', '', 0 ],
        ],
    };



	
    # Authentification des agents par Active Directory.
	
	
    $Self->{'AuthModule'} = 'Kernel::System::Auth::LDAP';
    $Self->{'AuthModule::LDAP::Host'} = 'thor.domcdg33.local';
    $Self->{'AuthModule::LDAP::BaseDN'} = 'dc=domcdg33,dc=local';
    $Self->{'AuthModule::LDAP::UID'} = 'sAMAccountName';
 
    # Check if the user is allowed to auth in a posixGroup
    # (e. g. user needs to be in a group OTRS_Agents to use otrs)
    $Self->{'AuthModule::LDAP::GroupDN'} = 'CN=OTRS_DOC,OU=Applications,OU=CDG33,dc=domcdg33,dc=local';
    $Self->{'AuthModule::LDAP::AccessAttr'} = 'member';
    $Self->{'AuthModule::LDAP::UserAttr'} = 'DN';
 
    # Bind credentials to log into AD
    $Self->{'AuthModule::LDAP::SearchUserDN'} = 'CN=otrs,OU=Comptes-CDG,OU=CDG33,dc=domcdg33,dc=local';
    $Self->{'AuthModule::LDAP::SearchUserPw'} = '';
 
    # in case you want to add always one filter to each ldap query, use
    # this option. e. g. AlwaysFilter => '(mail=*)' or AlwaysFilter => '(objectclass=user)'
    $Self->{'AuthModule::LDAP::AlwaysFilter'} = '';
 
    # in case you want to add a suffix to each login name,  then
    # you can use this option. e. g. user just want to use user but
    # in your ldap directory exists user@domain.
    #$Self->{'AuthModule::LDAP::UserSuffix'} = '';
 
    # Net::LDAP new params (if needed - for more info see perldoc Net::LDAP)
    $Self->{'AuthModule::LDAP::Params'} = {
       port => 389,
       timeout => 120,
       async => 0,
       version => 3,
    };
	
	#Authentification des agents via SSO
	
	#$Self->{LoginURL} = 'http://otrsdev/otrs-web/notauthd.html';
	#$Self->{LogoutURL} = 'http://otrsdev/otrs-web/goodbye.html';

	#$Self->{'AuthModule'} = 'Kernel::System::Auth::HTTPBasicAuth';
	#$Self->{'AuthModule::HTTPBasicAuth::ReplaceRegExp'} = '@DOMCDG33.LOCAL';
 
    # Now sync data with OTRS DB
    $Self->{'AuthSyncModule'} = 'Kernel::System::Auth::Sync::LDAP';
    $Self->{'AuthSyncModule::LDAP::Host'} = 'otrs.domcdg33.local';
    $Self->{'AuthSyncModule::LDAP::BaseDN'} = 'dc=domcdg33, dc=local';
    $Self->{'AuthSyncModule::LDAP::UID'} = 'sAMAccountName';
    $Self->{'AuthSyncModule::LDAP::SearchUserDN'} = 'CN=otrs,OU=Comptes-CDG,OU=CDG33,dc=domcdg33,dc=local';
    $Self->{'AuthSyncModule::LDAP::SearchUserPw'} = '';
 
    $Self->{'AuthSyncModule::LDAP::UserSyncMap'} = {
		# DB -> LDAP
        UserFirstname => 'givenName',
        UserLastname  => 'sn',
        UserEmail     => 'mail',
    };
 
    # AuthSyncModule::LDAP::UserSyncInitialGroups
    # (sync following group with rw permission after initial create of first agent
    # login)
    
	$Self->{'AuthSyncModule::LDAP::UserSyncInitialGroups'} = [
        'Agents CDG33',
    ];

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



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

# ---------------------------------------------------- #
# needed system stuff (don't edit this)                #
# ---------------------------------------------------- #
use strict;
use warnings;

use vars qw(@ISA $VERSION);
$VERSION = qw($Revision: 1.25 $)[1];

use Kernel::Config::Defaults;
push (@ISA, 'Kernel::Config::Defaults');

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


#----------- KIX tsunami framework -----------
use File::Basename;
use FindBin qw($Bin);
# CustomPackageLibs ~#
use lib "/opt/otrs/KIXCore";
use lib "/opt/otrs/KIX4OTRS";
# EO CustomPackageLibs ~#
#----------- EO KIX tsunami framework -----------

1;

Last edited by crythias on 14 Oct 2014, 13:45, edited 1 time in total.
Reason: [code] tags
HervE
Znuny wizard
Posts: 391
Joined: 03 Jan 2011, 17:15
Znuny Version: 3.3.8
Location: France

Re: Customer Company Drop Down

Post by HervE »

Hello,

You have two CustomerUser objects (CustomerUser1 and CustomerUser2).
Your problem must have something to do with that, because, as for me, I have only one CustomerUser object and CustomerCompanySupport option works perfectly.

Check around this.
(I don't know if it helps?)

Regards,
HervE
OTRS 3.3.8 - Windows 7 - IIS7 - SQL Server - Firefox 30
srenon
Znuny newbie
Posts: 60
Joined: 20 Mar 2013, 14:26
Znuny Version: 3.3.8

Re: Customer Company Drop Down

Post by srenon »

I tried specified CustomerCompany1 and CustomerCompany2 bloc without success.

Other ideas?

Seb
Locked