[tools] testbot/cgi: Don't show autoincrement fields of new items.
Francois Gouget
fgouget at codeweavers.com
Tue Mar 22 07:15:17 CDT 2022
They don't have a value yet and cannot be edited.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
testbot/lib/ObjectModel/CGI/ItemPage.pm | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/testbot/lib/ObjectModel/CGI/ItemPage.pm b/testbot/lib/ObjectModel/CGI/ItemPage.pm
index 940115475f..a178aa6e09 100644
--- a/testbot/lib/ObjectModel/CGI/ItemPage.pm
+++ b/testbot/lib/ObjectModel/CGI/ItemPage.pm
@@ -99,13 +99,16 @@ sub DisplayProperty($$)
my ($self, $PropertyDescriptor) = @_;
my $Display = $self->SUPER::DisplayProperty($PropertyDescriptor);
- if ($Display eq "rw" && ! $self->{Item}->GetIsNew() &&
- $PropertyDescriptor->GetIsKey())
- {
- $Display = "";
- }
-
- return $Display;
+ return # Don't show autoincrement fields of new items: they don't have a
+ # value yet and cannot be edited anyway so there is no point.
+ ($PropertyDescriptor->GetClass() eq "Basic" and
+ $PropertyDescriptor->GetType() eq "S" and
+ $self->{Item}->GetIsNew()) ? "" :
+ # Don't allow editing key attributes of existing items. Furthermore
+ # the item is identified in the page title so hide them altogether.
+ ($PropertyDescriptor->GetIsKey() and !$self->{Item}->GetIsNew() and
+ $Display eq "rw") ? "" :
+ $Display;
}
sub GetActions($)
--
2.30.2
More information about the wine-devel
mailing list