# --
# Kernel/Config.pm - Config file for OTRS kernel
# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
# --
# 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:
#
#  -->> Most OTRS configuration should be done via the OTRS web interface
#       and the SysConfig. Only for some configuration, such as database
#       credentials and customer data source changes, you should edit this
#       file. For changes do customer data sources you can copy the definitions
#       from Kernel/Config/Defaults.pm and paste them in this file.
#       Config.pm will not be overwritten when updating OTRS.
# --

package Kernel::Config;

use strict;
use warnings;
use utf8;

sub Load {
    my $Self = shift;
    $Self->{'NodeID'} =  '1';

    # ---------------------------------------------------- #
    # database settings                                    #
    # ---------------------------------------------------- #

    # The database host
    #$Self->{'DatabaseHost'} = 'mariadb.sapian.com.co';
    $Self->{'DatabaseHost'} = 'mariadb-01-med.cur.sapian.local';

    # The database name
    #$Self->{'Database'} = 'otrs_5';
    $Self->{'Database'} = 'otrs';

    # The database user
    $Self->{'DatabaseUser'} = 'otrs';

    # The password of database user. You also can use bin/otrs.CryptPassword.pl
    # for crypted passwords
    $Self->{'DatabasePw'} = 'Vei8ioshuZaiV1';

    # The database DSN for MySQL ==> more: "perldoc DBD::mysql"
    $Self->{DatabaseDSN} = "DBI:mysql:database=$Self->{Database};host=$Self->{DatabaseHost};";

    # The database DSN for PostgreSQL ==> more: "perldoc DBD::Pg"
    # if you want to use a local socket connection
#    $Self->{DatabaseDSN} = "DBI:Pg:dbname=$Self->{Database};";
    # if you want to use a TCP/IP 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;

    # The database DSN for Microsoft SQL Server - only supported if OTRS is
    # installed on Windows as well
#    $Self->{DatabaseDSN} = "DBI:ODBC:driver={SQL Server};Database=$Self->{Database};Server=$Self->{DatabaseHost},1433";

    # The database DSN for Oracle ==> more: "perldoc DBD::oracle"
#    $ENV{ORACLE_HOME} = '/u01/app/oracle/product/10.2.0/client_1';
#    $ENV{NLS_DATE_FORMAT} = 'YYYY-MM-DD HH24:MI:SS';
#    $ENV{NLS_LANG} = "american_america.utf8";

#    $Self->{DatabaseDSN} = "DBI:Oracle:sid=OTRS;host=$Self->{DatabaseHost};port=1522;";

    # ---------------------------------------------------- #
    # fs root directory
    # ---------------------------------------------------- #

    $Self->{DefaultCharset} = 'utf-8';
    $Self->{Home} = '/opt/otrs';

    #$Self->{'Frontend::NotifyModule'}->{'800-Scheduler-Check'} =  {
    #    'Module' => 'Kernel::Output::HTML::Notification::SchedulerCheck'
    #};

    # CustomerUser (customer database backend and settings)
    $Self->{CustomerUser} = {
        Name => 'Database Datasource',
        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'],
      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',      '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 ],
          [ '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 ],
        ],
    };



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

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

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

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

    # --- Inicio SAPIAN LDAP Agente Identificacion --- #
    # This is an example configuration for an LDAP auth. backend.
    # (Make sure Net::LDAP is installed!)
#    $Self->{'AuthModule'} = 'Kernel::System::Auth::LDAP';
#    $Self->{'AuthModule::LDAP::Host'} = 'ldaps://sbs.sapian.com.co';
#    $Self->{'AuthModule::LDAP::BaseDN'} = 'dc=sapian,dc=com,dc=co';
#    $Self->{'AuthModule::LDAP::UID'} = 'uid';

    # Check if the user is allowed to auth in a posixGroup
    # (e. g. user needs to be in a group xyz to use otrs)
    #$Self->{'AuthModule::LDAP::GroupDN'} = 'cn=otrsallow,ou=posixGroups,dc=example,dc=com';
    #$Self->{'AuthModule::LDAP::AccessAttr'} = 'memberUid';
    # for ldap posixGroups objectclass (just uid)
    #  $Self->{'AuthModule::LDAP::UserAttr'} = 'UID';
    # for non ldap posixGroups objectclass (with full user dn)
    #  $Self->{'AuthModule::LDAP::UserAttr'} = 'DN';

    # The following is valid but would only be necessary if the
    # anonymous user do NOT have permission to read from the LDAP tree
#    $Self->{'AuthModule::LDAP::SearchUserDN'} = 'cn=manager,ou=Internal,dc=sapian,dc=com,dc=co';
#    $Self->{'AuthModule::LDAP::SearchUserPw'} = 'NQtdN3qHcUq7zJy0';

    # 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'} = '@domain.com';

    # Net::LDAP new params (if needed - for more info see perldoc Net::LDAP)
#    $Self->{'AuthModule::LDAP::Params'} = {
#        port => 636,
#        timeout => 120,
#        async => 0,
#        version => 3,
#        cafile => 'etc/ssl/certs/ca.cer',
#        clientcert => '/etc/ssl/certs/server.cer',
#        clientkey => '/etc/ssl/certs/server.key',
#    };

}

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

use vars qw(@ISA);

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

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

1;
