We continue our series of interesting support questions to help you customize your EvolutivoFW application.
Can I integrate Google Calendar?
We introduced this integration very early in the project, I'd adventure to say around 2015! We hadn't needed to configure a Google Calendar into the application in some time and although I knew that customers that had it configured were working correctly I had my doubts it would still work because everything changes so fast nowadays... To my surprise the existing Google Calendar configuration documentation still works.
Eventually, we will have to upgrade the libraries we use to support higher levels of PHP, but you can still use this feature.
Can we do some actions when a User is created or edited?
This is a valid question that has much more relevance now that we can give access permission to any user of the application. The answer is "only with custom programming".
Users is a special module for various reasons, as a nonstandard module it does not support the powerful automation workflow engine that we have and it also does not support any of the many events and hooks that standard modules enjoy. So the only way to add some custom logic when a Users record is created or edited is by creating some code. Since we are big fans of not having to modify the base code to add your custom logic, even in this nonstandard module we give you a way of doing that.
In the configod.php
file you will find the $cbodUserLog
variable:
// User Create/Update Log
$cbodUserLog = false;
If you set this variable to true, you will get a set of messages in the internal queue system.
'date' => date(Field_Metadata::DATETIME_ISO_FORMAT),
'currentuser' => $current_user->id,
'action' => 'create',
'userstatus' => 'Active',
'oduser' => $this->id,
'date' => date(Field_Metadata::DATETIME_ISO_FORMAT),
'currentuser' => $current_user->id,
'action' => 'edit',
'userstatus' => $nowStatus,
'oduser' => $this->id,
'date' => date(Field_Metadata::DATETIME_ISO_FORMAT),
'currentuser' => $current_user->id,
'action' => 'trash',
'userstatus' => 'Inactive',
'username' => $adb->query_result($uinf, 0, 'user_name'),
'lastname' => $adb->query_result($uinf, 0, 'last_name'),
'oduser' => $id,
'date' => date(Field_Metadata::DATETIME_ISO_FORMAT),
'currentuser' => $current_user->id,
'action' => 'transfer',
'userstatus' => 'Inactive',
'username' => $adb->query_result($uinf, 0, 'user_name'),
'lastname' => $adb->query_result($uinf, 0, 'last_name'),
'oduser' => $userId,
So, if you create a script that runs every few minutes with the typical structure of a queue consumer you will be able to add any custom logic you need for those events. That would look something like this.
<?php
$Vtiger_Utils_Log = false;
include_once 'vtlib/Vtiger/Module.php';
$cbmq = coreBOS_MQTM::getInstance();
while ($msg = $cbmq->getMessage('coreBOSOnDemandChannel', 'Users', 'CentralSync')) {
$msginfo = unserialize($msg['information']);
// process the message here and do whatever you need
}
Obviously, if you don't want to use the queue system, you can always modify the Users save()
method.
Plethora of integrations!