Disabeling unique email constraint [solved]

Moderator: crythias

Locked
felix
Znuny newbie
Posts: 30
Joined: 30 Nov 2010, 15:27
Znuny Version: 2.4.9

Disabeling unique email constraint [solved]

Post by felix »

Hello,

we work in a B2B environment with many (really) small companies. These companies may have several contacts and the contacts don't posses all a unique email. (We have a lot of companies with one email e.g. info@company.com)
Of course if not every customer has a unique email and email is required, this might bring some usability issues.
So I want to disable this uniquess constraint. I've seen that in the backend, there is no such constraint, so it must be on the level of the application.
My question are (and i've seen the topics related to this cosntraint, but they were all bypassed in the real world so no concrete solution on the application):
1) how can i disable this (if this needs to be done on a deeper code/config level, code-snippets would be wonderful as i am totally perl ignorant :-))
2) will it have impact on other modules if this constraint is disabeled?
thx
regards
Last edited by felix on 06 Dec 2010, 14:20, edited 1 time in total.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Disabeling unique email constraint

Post by crythias »

use customercellphone@mailinator.com or mainofficenumberext###@mailinator.com for email.
Or you can dig into the code, but this is easier, in my opinion.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
felix
Znuny newbie
Posts: 30
Joined: 30 Nov 2010, 15:27
Znuny Version: 2.4.9

Re: Disabeling unique email constraint

Post by felix »

thx for the real quick reply!

your bypass wouldn't be accepted as a solution. We specifically want to have a valid email adress for every customer, whether it is unique or not

any ideas?

grtz
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Disabeling unique email constraint

Post by crythias »

I don't know of any other way to provide required unique email addresses if the client doesn't provide them... unless you want to be in the yahoo.com mail assignment business.

Ok, another option is if you create your own unique emails that forward to info@company.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
jph---
Znuny newbie
Posts: 1
Joined: 06 Dec 2010, 06:48
Znuny Version: 3.0.0

Re: Disabeling unique email constraint

Post by jph--- »

Why answer things that are not the question of the original poster?

He does not want to force his customers to use any email addresses that they do not already use. Maybe five people at an office use "info@tinycorp.com" and they like sharing that way.

The original poster wants to allow them to do that, but still deal with them as 5 users inside OTRS.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Disabeling unique email constraint

Post by crythias »

You're right. I'm only giving answers based upon what I know of OTRS and that it requires (as far as I'm able to tell) unique email addresses per username.

It appears possible (as I've quickly browsed the forums) that perhaps additional spaces at the end of the email address might work to be "different".

@jph---, I do hope that your presence will also be used to assist original posters with their questions. I look forward to it.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Disabeling unique email constraint

Post by jojo »

Hi,

you can create your own declaration of customer data in Config.pm not having the e-mail Address unique as this is configured via the line " CustomerUserEmailUniqCheck => 1,"

BUT if you set this to 0 incoming mails will allways be assigned to the first match of this address
"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
felix
Znuny newbie
Posts: 30
Joined: 30 Nov 2010, 15:27
Znuny Version: 2.4.9

Re: Disabeling unique email constraint

Post by felix »

Hello all,

thanks for the replies, i finally got to tackle the problem. (thanks to both tips)

I first tried to edit the config. pm
I added the line:
$Self->{CustomerUserEmailUniqCheck}= 0;

didn't seem to work. Was I doing something wrong?

I went a bit deeper in the source files and got
OTRS\Kernel\System\CustomerUser\DB.pm

there I outcommented the following code:

Code: Select all

    # check email address if already exists
#    if ( $Param{UserEmail} && $Self->{CustomerUserMap} #>{CustomerUserEmailUniqCheck} ) {
 #       my %Result = $Self->CustomerSearch(
  #          Valid            => 1,
   #         PostMasterSearch => $Param{UserEmail},
    #    );
     #   if (%Result) {
      #      $Self->{LogObject}->Log(
       #         Priority => 'error',
        #        Message  => 'Email already exists!',
         #   );
          #  return;
        #}
    #}

Saved the file, rebooted the service and worked just fine!
so i consider this treath as solved

note: i noticed that for an update of the customer, the check isn't performed! I was able to update emails which already existed!
When looking at the code of function
sub CustomerUserUpdate
i don't see any similar checks to CustomerUserAdd!
Locked