Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
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 Processnico
#814523
I create another process reminder.
The reminder process has a task code that should notify the person if he has not filled out the form.
it's ok?
Code: Select all
//find the task ID by running a case in the other process and look at the TASK system variable:
$taskId = '//number by taskid//';
//set to the same email address used in Admin > Settings > Email Servers:
$emailFrom = 'test@mail.com';

$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'.@@SYS_SYS.'/'.@@SYS_LANG.'/'.@@SYS_SKIN.'/cases/open?APP_UID=' .
          $aCase['APP_UID'] . '&DEL_INDEX=' . $aCase['DEL_INDEX'] . '&action=draft'
   );
   $aUser = userInfo($aCase['USR_UID']);

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

And when i execute timereverection they warning me something.
Last edited by Processnico on Tue May 29, 2018 3:47 am, edited 1 time in total.
User avatar
By amosbatto
#814525
The problem is that you probably executed one of the cron scripts in the past as the "root" user, so now the cron.log file is owned by root, not by daemon.

Change the ownership of all the files to daemon:
Code: Select all
chown -R daemon:daemon /opt/bitnami/apps/processmaker/htdocs/shared
Now, you should be able to execute the timereventcron.php file without seeing errors.
By Processnico
#814543
I'll think timereventcron execute everyday but they didn't email the user.
For you the code is correct?
Code: Select all
//find the task ID by running a case in the other process and look at the TASK system variable:
$taskId = 'idnumber'; //i put the idtask//
//set to the same email address used in Admin > Settings > Email Servers:
$emailFrom = 'test@mail.it'; 

$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'.@@SYS_SYS.'/'.@@SYS_LANG.'/'.@@SYS_SKIN.'/cases/open?APP_UID=' .
          $aCase['APP_UID'] . '&DEL_INDEX=' . $aCase['DEL_INDEX'] . '&action=draft'
   );
   $aUser = userInfo($aCase['USR_UID']);

   PMFSendMessage($emailFrom, $aUser['mail'], '', '', 'Overdue case ' . $aCase['APP_TITLE'],
       'overdueCase.html', $aData);
       
    print "\nSending email to {$aUser['mail']} for case {$aCase['APP_TITLE']}\n";
}
Attachments
Prcs.PNG
Prcs.PNG (112.88 KiB) Viewed 4100 times
User avatar
By amosbatto
#814558
Check your shared/log/cron.log file (and shared/log/cronError.log file if it exists).

I don't see anything wrong with the trigger, but it is best to check it by manually executing it to check if any errors appear.

Remember that the first time that eventtimercron.php executes, it sets the time, so you have to execute it a second time after the specified time has passed to see it execute. If it executes twice per day, then you will need to execute once to set the timer and then 12 hours later to see the event timer execute. If you have time zone weirdness, then you may need to wait 24 hours to see it execute.
By Processnico
#814566
They aren't cronError.log
Attachments
pff23.PNG
pff23.PNG (89.67 KiB) Viewed 3935 times
prcs2.PNG
prcs2.PNG (3.58 KiB) Viewed 3937 times
User avatar
By amosbatto
#814578
Edit your env.ini file and add the line:
Code: Select all
debug = 1
Then, add the trigger code to a process and turn on Debug Mode. Then, execute a case in that process inside the ProcessMaker interface. Do you see any error messages or is there the __ERROR__ system variable in the debugger?
By Processnico
#814633
I put a email to verify the timereverentcron, and process maker email me everytime i execute it.
But the codes i put on the task didn't work it.
Attachments
prcss.PNG
prcss.PNG (16.99 KiB) Viewed 3605 times
User avatar
By amosbatto
#815023
You forgot to include the case ID as the first parameter in PMFSendMessage(). You need to do this:
Code: Select all
   @@return = PMFSendMessage(@@APPLICATION, $emailFrom, $aUser['mail'], '', '', 'Overdue case ' . $aCase['APP_TITLE'],
       'overdueCase.html', $aData);
PS: Whenever you have a problem, you should be checking the return value of functions to figure out if they executed.

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]