locking row of data need some help

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
utony
Veteran Member
Posts: 93
Joined: 2020-04-03 18:37

locking row of data need some help

Post by utony » 2020-12-31 03:50

I am looking for some code to help lock a row once a certain selection is selected from a drop down.

My drop down is if called REPORT_STATUS.

There are 4 selection options; REPORT IN PROGRESS, SUBMITTED OF REVIEW, EDITS NEEDED, APPROVED.

THERE ARE TWO WORKING GROUPS IN MY APP; OFFICER AND SUPERVISOR.

OFFICER will be doing 99.9% of entering data and will be selecting these three options only for report status; REPORT IN PROGRESS, SUBMITTED OF REVIEW, EDITS NEEDED. Once the supervisor reads the report and thinks it complete, they will mark the report status as "APPROVED". This is when I want the row to be locked out from "Officer" to only have (Read-Only) access. Basically removing Edit/Delete access to the record.

I could use code help and where to insert it.

Any help would be great!

Alisson
Veteran Member
Posts: 81
Joined: 2017-02-25 20:32

Re: locking row of data need some help

Post by Alisson » 2020-12-31 20:42

Have a look at this answer from jsetzer:

viewtopic.php?t=3090

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1161
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: locking row of data need some help

Post by onoehring » 2021-01-03 10:01

Hi,

you also may check if the APPROVED has been set in the /hooks/tablename.php -> before_update function. If it is set, you return FALSE from that function and any further updates will fail. Of course you can make this dependent on your usergroup as well (thus the supervisor may still edit the record).

Olaf

utony
Veteran Member
Posts: 93
Joined: 2020-04-03 18:37

Re: locking row of data need some help

Post by utony » 2021-01-05 22:14

Olaf, any example of said code for function would be much appreciated. Your help is much needed.


Post Reply