We continue our series of interesting support questions to help you customize your EvolutivoFW application.
How to block the creation of a ticket based on the Rating of an Account
Can I block the creation of a ticket based on the Rating of an Account? If the rating of the account is Shutdown do not permit the creation of the ticket.
There are various ways of doing this but I am going to show only one.
The easiest way to accomplish this is to not show the records at all. By defining a Popup filter business map we can filter out the records we don't want to be selected. This also has the advantage of retrieving and showing fewer records in the popup so it is faster.
The Popup filter business map to not show the accounts with a Rating of Shutdown
when selecting from the Support Tickets (HelpDesk) module is like this:
Name: HelpDesk_PopupFilter
Map Type: PopupFilter
Target Module: Support Ticket (HelpDesk)
The map:
<map>
<modulename>HelpDesk</modulename>
<field>
<fieldname>parent_id</fieldname>
<dependency>
<modulename>Accounts</modulename>
<advft_criteria>[{"groupid":1,"columnname":"Rating","comparator":"n","value":"Shutdown","columncondition":""}]</advft_criteria>
<advft_criteria_groups>[]</advft_criteria_groups>
</dependency>
</field>
</map>
That easy!
NOTE: In the last support question post I showed a way to block the save operation of a Potential record when certain sales stages were selected. That solution is also applicable here to block saving the Support ticket if a shutdown account is selected.
How to support emojis and special characters
If we try to save Unicode characters in any field of the application we will be greeted with an error message which originates almost directly from the database.
The problem has two parts. One is the database codification that is configured and the other is a configuration option in the application itself.
For a database to support Unicode characters, it must be defined as utf8mb4
. In general, it is a good idea to use this codification everywhere nowadays.
In the image above, the modcomments database table does not support utf8mb4, only utf8 as you can see in the next screenshot:
So our first task is to change that codification to utf8mb4
. You can do that in phpmyadmin or using these SQL commands.
ALTER TABLE `vtiger_modcomments` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
ALTER TABLE `vtiger_modcomments` CHANGE `commentcontent` `commentcontent` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL;
Then we have to configure the application to support this codification by editing the config.inc.php file and changing or adding if it isn't there, this definition:
$dbconfig['db_charset'] = 'utf8mb4';
I usually add that in the database configuration section, after persistence.
And now we can save emojis!!
Endless possibilities!