Questions and discussion about using ProcessMaker: user interface, running cases & functionality
#815916
I am creating an array via a trigger, returning all users assigned to a group and then getting their approval limits in the database. I record the approverId and approvalLimits and can tell that I am the approverId value and my approvalLimits are set to 10k. If the approver doesn't have sufficient approval limits, the WF then loops back and gets a new list of approvers for the user to select from (hence the array). The issue I am having is although I can see I have 10k in the variable and my approverId, when the trigger runs, I still see my approverId to select. Per the trigger, approvers with limts less than the current approver (10k in this example) and with the same Id as the current approver should not display. However, all approvers continue to show in the drop down. Ideas on what I'm doing wrong? Thanks!
Code: Select all
$db = '6892913715aeb1d2c93e9c9031737410';  //appsv database
@=approverList = array();  //empty array to hold the UIDs of the users in the approver group
$approverId = @=approverId;  //grab current approval ID
$approvalLimit = @%approvalLimit;
$origAction = @=requesterSaveSubmit;

if (is_null($approvalLimit) or $origAction = 'Save') {
	$approvalLimit = 0;
	$approverId = 0;
}

// get users in group
$query = "SELECT USERS.USR_UID, UPPER(USERS.USR_USERNAME) USERNAME, CONCAT(USR_LASTNAME, ', ', USR_FIRSTNAME) AS USERFULLNAME FROM USERS 
INNER JOIN GROUP_USER ON USERS.USR_UID = GROUP_USER.USR_UID 
WHERE GROUP_USER.GRP_UID
IN (SELECT CON_ID FROM CONTENT WHERE CON_CATEGORY='GRP_TITLE' AND CON_VALUE = 'ACH Wire Approval')
AND USERS.USR_UID <> '$approverId'
ORDER BY USERS.USR_LASTNAME";

$approvers = executeQuery($query);

if (is_array($approvers)) {

foreach ($approvers as $approver) {
  $userName = $approver['USERNAME'];
  $appLimitsQuery = "SELECT APPR_AMOUNT || '.00' AS APPLIMIT, APPR_AMOUNT AS APPLIMIT2 FROM APPS.APPROVER_LIMITS_VIEW WHERE APPROVER = '$userName'";
  $appLimits = executeQuery($appLimitsQuery, $db);
  $appLimit = $appLimits[1]['APPLIMIT'];
  $appLimit2 = $appLimits[1]['APPLIMIT2'];

  if ((count($appLimit) > 0) AND (intval($appLimit2) > intval($approvalLimit))) {  
	 // if (intval($appLimit2) > intval($approvalLimit)) { //only display new approver if approval limit is > current approval limit
         @=approverList[] = array(
         $approver['USR_UID'] .'-'. $appLimit,
         $approver['USERFULLNAME']
      );
	} 
	else {
		@@errorMessages["EU USER"] = "ERROR: " . $userName . " does not have sufficient approval authority.";
	}//}   
} }
else {
	@@errorMessages["EU USER"] = "ERROR: There are no active users in ACH Wire Approval User Group.";
}
Attachments
ApproverLimit.jpg
ApproverLimit.jpg (28.2 KiB) Viewed 3016 times
Want to create your own meme coin?

In the world of cryptocurrencies, a unique and exc[…]

The market for cryptocurrencies is demonstrating a[…]

What's SAP FICO?

Embarking on a dissertation can be one of the most[…]

Hello. For rental housing, there are software solu[…]