diff --git a/lib/GADS/Layout.pm b/lib/GADS/Layout.pm index 42b141e7b..6bfae2f80 100644 --- a/lib/GADS/Layout.pm +++ b/lib/GADS/Layout.pm @@ -129,6 +129,16 @@ sub record_name_with_article { A shift->record_name; } +# Whether to show the add record button on this table. It is not shown if this +# table is referred to by another table's curval which has an add button, +# unless the current user has manage fields permission on this table. +sub show_add_record +{ my $self = shift; + return 1 if $self->user_can('layout'); + return 0 if grep $self->column($_->id)->show_add, @{$self->referred_by}; + 1; +} + has site => ( is => 'ro', lazy => 1, diff --git a/views/data_table.tt b/views/data_table.tt index a0ed44055..e85ac4209 100755 --- a/views/data_table.tt +++ b/views/data_table.tt @@ -4,13 +4,15 @@