Disable "Add New" if I reach 0 (zero)

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
onyr
Posts: 6
Joined: 2021-06-13 12:49

Disable "Add New" if I reach 0 (zero)

Post by onyr » 2021-06-15 10:33

Hi all,
How can I disable "Add New" button if I my quantity on "Reste à livrer" is 0 (zero). It's on "Enlevement" subform php file or on "commande" form?
Thank you
Attachments
Capture d’écran 2021-06-15 à 11.15.16.png
Capture d’écran 2021-06-15 à 11.15.16.png (37.26 KiB) Viewed 1133 times

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Disable "Add New" if I reach 0 (zero)

Post by jsetzer » 2021-06-16 18:50

Change permissions in admin area.
Revoke insert permission on that table from the specify group or groups.
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

onyr
Posts: 6
Joined: 2021-06-13 12:49

Re: Disable "Add New" if I reach 0 (zero)

Post by onyr » 2021-06-17 04:52

Hi,

Good idea.

And if my balance is zero (0), how to stop transaction like warning users that your balance is insufficient?

Thanks

O

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Disable "Add New" if I reach 0 (zero)

Post by jsetzer » 2021-06-18 04:56

First thing which comes into my mind:

As this is a detail view, you can check value of balance in TABLENAME_dv hook: If balance is zero, revoke insert permission on database level (using SQL command) from group or even from specific user (we don't know your use-case). Then append an alert to $html variable.
Additionally you should check in before-insert hook and deny insert if balance is zero.
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

onyr
Posts: 6
Joined: 2021-06-13 12:49

Re: Disable "Add New" if I reach 0 (zero)

Post by onyr » 2021-06-22 12:12

Hi,
Thanks for your help.
O

Post Reply