Color a (Customer) field red

Dont create your support topics here! No new topics with questions allowed!

Moderator: crythias

Forum rules
Dont create your support topics here! No new topics with questions allowed!
Post Reply
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Color a (Customer) field red

Post by crythias »

What this solves: Adding a field to Customer Company and coloring it red.

Why?

I needed an alert field for certain customers. The first part: alter table customer_company to add the field I needed. Up to you to do this. Backup, test, your data is your responsibility, but

Code: Select all

alter table customer_company add my_alert_message varchar(200) NULL ;
is not likely to cause a problem with future upgrades. I like to include my_ in my column changes to differentiate from stock tables. OTRS will (most likely/probably) never use my_ prefix in its table columns.

And then in the CustomerCompany Map in the order you want it displayed:

Code: Select all

        [ 'CustomerCompanyAlertMessage',           'Alert Message', 'my_alert_message', 1, 0, 'var', '"></a><span style="color:red">[% Data.CustomerCompanyAlertMessage %]</span><a style="display:none" href="', 0 ],
A breakdown of what the html stuff does:
"> closes the href markup for the URL
</a> closes the obligatory anchor markup because it's a URL
<span style="color:red"> does what you think.
[% Data.CustomerCompanyAlertMessage %] makes sure the message isn't collapsed (...)
</span> closes red
<a style="display:none" href=" pretends to be the opening anchor (a) markup again, which by default makes a hyperlink/duplicates the text. So display:none hides it.

What's great about this is it's relatively easy and painless (?) to integrate markup without changing code.
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
Post Reply