Page 1 of 1
Disable "Add New" if I reach 0 (zero)
Posted: 2021-06-15 10:33
by onyr
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
Re: Disable "Add New" if I reach 0 (zero)
Posted: 2021-06-16 18:50
by jsetzer
Change permissions in admin area.
Revoke insert permission on that table from the specify group or groups.
Re: Disable "Add New" if I reach 0 (zero)
Posted: 2021-06-17 04:52
by onyr
Hi,
Good idea.
And if my balance is zero (0), how to stop transaction like warning users that your balance is insufficient?
Thanks
O
Re: Disable "Add New" if I reach 0 (zero)
Posted: 2021-06-18 04:56
by jsetzer
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.
Re: Disable "Add New" if I reach 0 (zero)
Posted: 2021-06-22 12:12
by onyr
Hi,
Thanks for your help.
O