every employee can only see his paycheck

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
facos79
Veteran Member
Posts: 115
Joined: 2014-10-29 12:31

every employee can only see his paycheck

Post by facos79 » 2018-05-17 21:11

Good morning, I need advice on how to solve a problem:
I'm making a program with appgini that allows you to upload documents (salary paycheck).
I created a user for each employee.
How can I make sure that every employee can only see his paycheck?
There are more than 60 employees and the payer in the table is the holder.

Thank you for the advice
Greetings

--------------------------------

Buongiorno, avrei bisgono di un consiglio su come risolvere un problema:
Sto realizzando un programma con appgini che permetta di caricare dei documenti ( busta paga dello stipendio ) .
Ho creato un utente per ogni lavoratore dipendente.
Come faccio a fare in modo che ogni lavoratore dipendente possa vedere solo la propria busta paga ?
Sono più di 60 dipendenti e chi carica la nusta paga nella tabella è il titolare.

Vi ringrazio per i consigli.
Saluti

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: every employee can only see his paycheck

Post by pbottcher » 2018-05-18 05:57

Hi,

you can change the owner of each record (=salary paycheck) to the employee. In the permission setting you allow each employee to only see his records.
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.

facos79
Veteran Member
Posts: 115
Joined: 2014-10-29 12:31

Re: every employee can only see his paycheck

Post by facos79 » 2018-05-18 20:38

Hello,
thank you.
The problem is that this procedure is very inconvenient if I have to load over 100 paychecks. For each paycheck must give permission to the record to make it visible to the employee only.

Is not there a way to assign it directly, perhaps by selecting the user during data entry?

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: every employee can only see his paycheck

Post by pbottcher » 2018-05-18 22:00

Hi,

if you have a field in your table which will identify the owner of the paycheck (i assume it is called owner) and you would set this during your data entry you could use the
<tablename>.php file and use the <tablename>_after_insert function to change the ownership of the record after the insert.
To do so you could use

Code: Select all

$pkValue = sqlValue("select pkValue from membership_userrecords where tableName='<tablename>' and pkValue='".$data['selectedID']."'");
set_record_owner('<tablename>', $pkValue, $data['owner']);
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.

Post Reply