Share ideas, ask questions, and get feedback about developing for ProcessMaker

Moderator: ArturoRobles

Forum rules: Please post new questions under "Developing processes & programming" for ProcessMaker 2 or 3.
#828828
hi everyone,

i use PMFCancellCase to cancell a case in the trigger.
but it did not work for unassigned case.
any idea how to make it happend?

here is my trigger
Code: Select all
$fetched_queued = "SELECT * FROM PMT_CANCELL_WELCOME_CALL WHERE STATUS = 'QUEUE'";
$fetched_queued = executeQuery($fetched_queued);
foreach($fetched_queued as $queued_key=>$queued_value){
	$Caseno=$queued_value['CASENO'];
	$expiry_date_seconds = strtotime($queued_value['DUEDATE']);
	$query= "SELECT * FROM APP_CACHE_VIEW WHERE APP_NUMBER='$Caseno' AND (APP_STATUS='TO_DO' OR APP_STATUS='DRAFT') AND DEL_THREAD_STATUS='OPEN'";
	//echo "<pre>";
	$aCases = executeQuery($query);
	if (count($aCases)==0) {
		//echo "tidak ";
		$update="UPDATE PMT_CANCELL_WELCOME_CALL SET STATUS = 'COMP' WHERE CASENO = '$Caseno'";
		executeQuery($update);
	    //die("Error: Bad Query: $query\n");
	}else{
		echo "$Caseno";
	}
	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' 
	   );
			//set the date here*******************************
			
			if(($expiry_date_seconds==strtotime(date('Y-m-d'))) or ($expiry_date_seconds<strtotime(date('Y-m-d')))){
				//enable this code to test cancel case
				@@return=PMFCancelCase($aCase['APP_UID'], $aCase['DEL_INDEX'], $aCaseInfo['CURRENT_USER_UID']);
				if (@@return=="1"){
					$update="UPDATE PMT_CANCELL_WELCOME_CALL SET STATUS = 'CANCEL' WHERE CASENO = '$Caseno'";
					executeQuery($update);
					echo "CANCELLED";
				}else{
					echo "UNCANCELLED";
				}
				
			}else{
			  echo "not yet achieve 90 days";
			}

			$aUser = userInfo($aCase['USR_UID']);
	}
}

exit;
#828846
Hi everyone,

I decided to claim unassigned case with setCatchCase before cancell it,
but I had problem error.
can anyone please help me?
Code: Select all
$fetched_queued = "SELECT * FROM PMT_CANCELL_WELCOME_CALL WHERE STATUS = 'QUEUE'";
$fetched_queued = executeQuery($fetched_queued);
foreach($fetched_queued as $queued_key=>$queued_value){
	$Caseno=$queued_value['CASENO'];
	$expiry_date_seconds = strtotime($queued_value['DUEDATE']);
	$query= "SELECT * FROM APP_CACHE_VIEW WHERE APP_NUMBER='$Caseno' AND (APP_STATUS='TO_DO' OR APP_STATUS='DRAFT') AND DEL_THREAD_STATUS='OPEN'";
	//echo "<pre>";
	$aCases = executeQuery($query);
	if (count($aCases)==0) {
		//echo "tidak ";
		$update="UPDATE PMT_CANCELL_WELCOME_CALL SET STATUS = 'COMP' WHERE CASENO = '$Caseno'";
		executeQuery($update);
	    //die("Error: Bad Query: $query\n");
	}else{
		echo "$Caseno";
	}
	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' 
	   );
			//set the date here*******************************
			
			if(($expiry_date_seconds==strtotime(date('Y-m-d'))) or ($expiry_date_seconds<strtotime(date('Y-m-d')))){
				//enable this code to test cancel case
				@@indNew=$aCase['DEL_INDEX'];
				$appuid=$aCase['APP_UID'];
				$indexbaru=@%indNew + 1;
				//echo @@indNew;
				//$app= @@APPLICATION;
				//echo "$app";
				echo "<pre>";
				//echo "$aCase['APP_UID']";
				//$d=new cases();
				echo "oke";
				$d->setCatchUser($appuid, $indexbaru,'7648899695d9ec252724b35018079376');
				echo "oke";
				
				@@return=PMFCancelCase($aCase['APP_UID'], $aCase['DEL_INDEX'], $aCaseInfo['CURRENT_USER_UID']);
				if (@@return=="1"){
					$update="UPDATE PMT_CANCELL_WELCOME_CALL SET STATUS = 'CANCEL' WHERE CASENO = '$Caseno'";
					executeQuery($update);
					echo "CANCELLED";
				}else{
					echo "UNCANCELLED";
				}
				
			}else{
			  echo "not yet achieve 90 days";
			}

			$aUser = userInfo($aCase['USR_UID']);
	}
}

exit;

Hello, I have the same problem. :( :(

You there, this is really good post here. Thanks f[…]

Is it possible to view HTML codes of a DynaForm an[…]

Hide / Show based on selection

Hi, I have write a function for show and hide […]