Approval of records

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
miteshpc
Posts: 6
Joined: 2016-04-04 20:19

Approval of records

Post by miteshpc » 2016-04-05 19:17

I have made a standard crud application for club membership, no hooks.

I need that club members update their records on their own, but after the club administrator freezes the records, then the club members cannot update or delete those records. I can't figure out how to get that done. Any ideas will be appreciated.

AhmedBR
AppGini Super Hero
AppGini Super Hero
Posts: 327
Joined: 2013-09-19 10:23

Re: Approval of records

Post by AhmedBR » 2016-04-05 21:54

Check if user is admin and change record owner in HOOK after_update

Something like:

Code: Select all

$username=$memberInfo['username'];
if ($username = 'admin'){

sql("UPDATE membership_userrecords SET memberID='new_member' WHERE tableName='tablename' AND pkValue='{$data['selectedID']}'")

}
This way the user can edit the record as many times as he wants, but once ADMIN saves the record, owner will be changed and the user no longer can edit the record.

Also read this topic:
http://forums.appgini.com/phpbb/viewtopic.php?t=62#p115
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper

AhmedBR
AppGini Super Hero
AppGini Super Hero
Posts: 327
Joined: 2013-09-19 10:23

Re: Approval of records

Post by AhmedBR » 2016-04-05 23:32

Bu the way in AppGini 5.5 Admin can simply change owner manually from the record itself.
This will do the trick without any programing.
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper

miteshpc
Posts: 6
Joined: 2016-04-04 20:19

Re: Approval of records

Post by miteshpc » 2016-04-06 18:36

This is very useful. Thank you very much. Is there a way we can filter records by owner id? If that's possible then we have a workflow almost ready in action.

AhmedBR
AppGini Super Hero
AppGini Super Hero
Posts: 327
Joined: 2013-09-19 10:23

Re: Approval of records

Post by AhmedBR » 2016-04-06 19:03

Sure, but will require some programing (a query on membership_userrecords would return current Owner)

These links will help you understand filters:
http://bigprof.com/appgini/tips-and-tut ... ult-filter
http://bigprof.com/appgini/tips-and-tut ... ers/part-1
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper

Post Reply