-
bescott53
Post
by bescott53 » 2019-04-28 12:23
Hello board, Ian trying to stop an update from happening if the user is. It in a certain group. It doesn’t seem to work, can someone help?
Code: Select all
function commission_approvals_before_update($data, $memberInfo, &$args){
if($memberinfo['groupID']!='3'){
$id=makesafe($selectedID);
$complete=sqlValue("select `ClaimCompleted` from `commission_approvals` where `refnum`='$id'");
if($complete=='Claim Complete') return FALSE;
}
return TRUE;
}
-
jsetzer
- AppGini Super Hero
- Posts: 1814
- Joined: 2018-07-06 06:03
- Location: Kiel, Germany
-
Contact:
Post
by jsetzer » 2019-04-28 13:43
Try var_dump($complete); exit(); to check return value of sqlValue call
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readability
AppGini 24.10 Revision 1579 + all AppGini Helper tools
-
pbottcher
- AppGini Super Hero
- Posts: 1638
- Joined: 2018-04-01 10:12
Post
by pbottcher » 2019-04-28 13:51
Hi,
try
Code: Select all
"select `ClaimCompleted` from `commission_approvals` where `refnum`='".$id."'"
instead of
Code: Select all
"select `ClaimCompleted` from `commission_approvals` where `refnum`='$id'"
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
-
bescott53
Post
by bescott53 » 2019-04-30 09:28
pbottcher, jsetzer thanks, here is the final code that worked
Code: Select all
function commission_approvals_before_update($data, $memberInfo, &$args){
if($memberInfo['groupID']!='3'){
$id=makesafe($data['selectedID']);
$complete=sqlValue("select ClaimCompleted from commission_approvals where refnum='" . $id. "'");
if($complete=='Claim Complete')
return FALSE;
}
return TRUE;
}