We have no companies (Customers), and want eahc Customer_user to be unique. By default a new Customer User logging in creates an account with the login, customerid and email all the same.
How could we force that throughout? Preferably either making the other fields read-only or hidden, but that's not too important.
I can't figure out how to do it with an ACL, neither referring to a customerUser where it is not true, nor to set the other 2 from the email.
I was thinking about forcing it somewhere in the add/edit screen, but just have not understood the relationship of the templates and otrs well enough to see a good approach there. In the ticket entry I can force it by making the (already defaulting) customerid field read-only, but the customer setup screen (with all the fields) is more complex, at least to me. Just javascript for on-change and force the named field back to what I want?
Generic agents only seem to act on tickets.
I actually thought about a trigger in the database, which is simple, but no idea of the side effect of doing it after-the-fact, since the customer-id might have been used.
Are there any relevant options to either turn this on, or tools to enforce it, that I am missing?
[SOLVED] Force Customer User Login and CustomerID to be same as Email
Moderator: crythias
-
- Znuny newbie
- Posts: 55
- Joined: 10 Feb 2015, 15:30
- Znuny Version: 4.0.6
- Real Name: Linwood Ferguson
- Company: LE Ferguson, LLC
[SOLVED] Force Customer User Login and CustomerID to be same as Email
Last edited by Linwood on 05 Mar 2015, 19:09, edited 1 time in total.
Linwood Ferguson
OTRS 4.0 patch 6, ubuntu 14.04 on HyperV, MySql
OTRS 4.0 patch 6, ubuntu 14.04 on HyperV, MySql
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Force Customer User Login and CustomerID to be same as Email
javascript. Basically, on blur of login, set the other fields.
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
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
-
- Znuny newbie
- Posts: 55
- Joined: 10 Feb 2015, 15:30
- Znuny Version: 4.0.6
- Real Name: Linwood Ferguson
- Company: LE Ferguson, LLC
Re: Force Customer User Login and CustomerID to be same as Email
Thanks. Now what I was hopping, but better than wondering what I was missing.crythias wrote:javascript. Basically, on blur of login, set the other fields.
Linwood Ferguson
OTRS 4.0 patch 6, ubuntu 14.04 on HyperV, MySql
OTRS 4.0 patch 6, ubuntu 14.04 on HyperV, MySql
-
- Znuny newbie
- Posts: 55
- Joined: 10 Feb 2015, 15:30
- Znuny Version: 4.0.6
- Real Name: Linwood Ferguson
- Company: LE Ferguson, LLC
Re: Force Customer User Login and CustomerID to be same as Email
It is probably obvious to those more familiar, but on the hope it might help someone else, here is what I did to resolve this.
1) Created a separate theme (here VRP)
2) Copied in AdminCustomerUser.tt to that theme.
3) Made these changes in that file:
Effectively what this does is, as the program iterates over the customer file contents, it looks for specific field names; for UserEmail it puts a javascript hook to copy its contents to two other fields; for those two other fields it makes the read-only and takes them out of the tab sequence (the latter may not work on older browsers but I think it will do no harm, but haven't tried -- the -1 is a HTML5 feature if I recall).
4) Copied the entire contents of the definition of CustomerUser for the database (it would be different for other back ends)
(not just the snippit shown_, into Config.pm, then moved UserLogin line under UserEmail. This isn't strictly necessary but it is less confusing as it means the user entry in UserEmail is first (above) the ones it sets.
This seems to work, though if it's wrong in some fashion I would sure appreciate advice.
Note that I tried to follow what appeared to be the standard in the templating use in otrs by including
but I clearly do not understand what that does; it includes it in a ready function that doesn't seem to permit it to be called. So I left it naked at the end which appears to have included it in a working fashion, if not properly. Again - if someone knows the "right" way to do this, let me know.
Now when an agent enters a customer-user, they enter email, it auto-populates login and customerid, and doesn't permit them to be changed. Obviously only useful if one is not using the concept of customers (companies), though one could leave it without the read-only and tabIndex and use it to default those fields explicitly if you occasionally used Customer(Company) coding.
1) Created a separate theme (here VRP)
2) Copied in AdminCustomerUser.tt to that theme.
3) Made these changes in that file:
Code: Select all
diff -s /opt/otrs/Kernel/Output/HTML/VRP/AdminCustomerUser.tt /opt/otrs/Kernel/Output/HTML/Standard/AdminCustomerUser.tt
165,166c165
< # customize: For duplicative fields make them read only and skipped, for email copy to these two
< <input type="text" [% IF (Data.Name == 'UserEmail') %] onblur="myBlurFunction();" [% ELSIF ( (Data.Name == 'UserCustomerID') || (Data.Name == 'UserLogin') ) %] readonly tabIndex="-1" [% ELSE %] [% END %] id="[% Data.Name | html %]" name="[% Data.Name | html %]" class="W50pc [% Data.RequiredClass | html %] [% Data.InvalidField | html %]" value="[% Data.Value | html %]" [% Data.ReadOnlyType | html %]/>
---
> <input type="text" id="[% Data.Name | html %]" name="[% Data.Name | html %]" class="W50pc [% Data.RequiredClass | html %] [% Data.InvalidField | html %]" value="[% Data.Value | html %]" [% Data.ReadOnlyType | html %]/>
192d190
<
201d198
<
268d264
<
288,295d283
<
< # Custom changes to enforce email to other fields
< <script type="text/javascript">
< function myBlurFunction() {
< document.getElementById("UserLogin").value = document.getElementById("UserEmail").value;
< document.getElementById("UserCustomerID").value = document.getElementById("UserEmail").value;
< }
< </script>
4) Copied the entire contents of the definition of CustomerUser for the database (it would be different for other back ends)
Code: Select all
$Self->{CustomerUser} = {
Name => 'Database Backend',
This seems to work, though if it's wrong in some fashion I would sure appreciate advice.
Note that I tried to follow what appeared to be the standard in the templating use in otrs by including
Code: Select all
[% WRAPPER JSOnDocumentComplete %]
[% END %}
Now when an agent enters a customer-user, they enter email, it auto-populates login and customerid, and doesn't permit them to be changed. Obviously only useful if one is not using the concept of customers (companies), though one could leave it without the read-only and tabIndex and use it to default those fields explicitly if you occasionally used Customer(Company) coding.
Linwood Ferguson
OTRS 4.0 patch 6, ubuntu 14.04 on HyperV, MySql
OTRS 4.0 patch 6, ubuntu 14.04 on HyperV, MySql