Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By andeokles
#826008
Hello, we are having trouble setting the reminder when a task is overdue for our cases in Processmaker, we are trying to follow the steps mentioned in the following web page: https://www.pmusers.com/index.php/Send_ ... is_overdue
We have our installation of BPM in a Centos release 7.5 server. As the web mentions and also I investigated in forum.processmaker.com, we must case a specific process that loops endlessly to execute a script forever. We created a process called 'Reminder Test'.
Inside the script task, it contains the following code:
Code: Select all
//find the task ID by running a case in the other process and look at the TASK system variable:
$taskId = '8087765225d35dd85351ca7023653810';   <-- Our task ID
//set to the same email address used in Admin > Settings > Email Servers:
$emailFrom = '[email protected]';

$g = new G();
$now = date('Y-m-d H:i:s');
$query= "SELECT * FROM APP_CACHE_VIEW WHERE TAS_UID='$taskId' AND
   (APP_STATUS='TO_DO' OR APP_STATUS='DRAFT') AND DEL_THREAD_STATUS='OPEN' AND
   '$now' > DEL_TASK_DUE_DATE";
$aCases = executeQuery($query);
if (!is_array($aCases)) {
   die("Error: Bad Query: $query\n");
}

foreach ($aCases as $aCase) {
   $c = new Cases();
   $aCaseInfo = $c->loadCase($aCase['APP_UID'], $aCase['DEL_INDEX']);
   $aData = array(
      'caseNo' => $aCase['APP_NUMBER'],
      'caseTitle' => $aCase['APP_TITLE'],
      'caseStatus' => $aCase['APP_STATUS'],
      'taskName' => $aCase['APP_TASK_TITLE'],
      'taskAssignedDate' => $aCase['DEL_DELEGATE_DATE'],
      'taskDueDate' => $aCase['DEL_TASK_DUE_DATE'],
      'caseCreatedBy' => $aCaseInfo['CREATOR'],
      'caseStartDate' => $aCaseInfo['CREATE_DATE'],
      'caseUpdatedDate'=> $aCaseInfo['UPDATE_DATE'],
      'caseLink' => ($g->is_https() ? "https://" : "http://") . $_SERVER['SERVER_NAME'] .
          //':' . $_SERVER['SERVER_PORT'] . //comment out if no port number
          '/sys'[email protected]@SYS_SYS.'/'[email protected]@SYS_LANG.'/'[email protected]@SYS_SKIN.'/cases/open?APP_UID=' .
          $aCase['APP_UID'] . '&DEL_INDEX=' . $aCase['DEL_INDEX'] . '&action=draft'
   );
   $aUser = userInfo($aCase['USR_UID']);

   @@mailSent = PMFSendMessage(@@APPLICATION, $emailFrom, $aUser['mail'], '', '', 
       'Overdue case ' . $aCase['APP_TITLE'], 'overdueCase.html', $aData);
       
    print "\nSending email to {$aUser['mail']} for case {$aCase['APP_TITLE']}\n";
}

Now as the process is finished, we log into the server and we tried to execute twice the timereventcon.php located in our workflow directory then engine->bin->timereventcon.php.
Just to emphasize we have executed the following command php -f timereventcron.php many times and only once we have received 3 mails of 14. Right now I executed the query and returns me 5 records.
am not receiving mails anymore although I have executed the timereventcron.php again twice.
The only thing left, that I think it is not necessary is to configure the crontabs to execute the command periodically until we have this resolved.
The terminal logs are the following taking into account that our workflow folder in the server is called "workflow".
Any information that might be helpful it will be helpful.
Attachments
DeepinScreenshot_select-area_20190815103240.png
DeepinScreenshot_select-area_20190815103240.png (115.29 KiB) Viewed 345 times
DeepinScreenshot_select-area_20190815103221.png
DeepinScreenshot_select-area_20190815103221.png (112.63 KiB) Viewed 345 times
DeepinScreenshot_select-area_20190815103145.png
DeepinScreenshot_select-area_20190815103145.png (103.03 KiB) Viewed 345 times
DeepinScreenshot_select-area_20190815103207.png
DeepinScreenshot_select-area_20190815103207.png (112.69 KiB) Viewed 345 times
DeepinScreenshot_select-area_20190815103027.png
DeepinScreenshot_select-area_20190815103027.png (12.68 KiB) Viewed 345 times
DeepinScreenshot_select-area_20190815102924.png
DeepinScreenshot_select-area_20190815102924.png (45.71 KiB) Viewed 345 times
User avatar
By amosbatto
#826010
What version of PM are you using?
From your error messages, I'm guessing that you executed the cron scripts as root, which created files that the "apache" user can't access when normally running ProcessMaker.

You should delete the file processmaker/shared/log/cron.log. Then follow these instructions to execute the cron scripts as the "apache" user:
https://wiki.processmaker.com/3.2/Execu ... p#In_Linux

You have another error message saying that ProcessMaker can't access the wf_test database. Do you always get this message? Did you create the "test" workspace on this same installation, or have you migrated the installation from another server or upgraded it?

You should check whether you can login to the wf_test database using the username and password listed in your processmaker/shared/sites/test/db.php file

For example, if you have the following in your db.php file:
Code: Select all
  define ('DB_ADAPTER',     'mysql' );
  define ('DB_HOST',        'localhost' );
  define ('DB_NAME',        'wf_test' );
  define ('DB_USER',        'wf_5d2f8e59d4207' );
  define ('DB_PASS',        'gG5-cZ1_4V3bRnp' );
Then, you should be able to login int MySQL with the following command the terminal:
mysql -u wf_5d2f8e59d4207 -pgG5-cZ1_4V3bRnp -D wf_test
Task doesnt have any users.

Amosbatto: One more thing if you can help me with.[…]

Just guide me to implement this?

Hi, I have a text control (rfq_segment) and I wan[…]

Genial!!! gracias. :D i need to translate an[…]