[tools] testbot/web: Remove a dependency on FormPage::SaveProperties() in VMDetails.

Francois Gouget fgouget at codeweavers.com
Tue Mar 22 07:21:43 CDT 2022


Save() is already calling SaveProperties() to store the form fields in
the $VM object. Just make sure to check the old value of $VM->Errors
before it is ovewritten.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/web/admin/VMDetails.pl | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/testbot/web/admin/VMDetails.pl b/testbot/web/admin/VMDetails.pl
index 19983c643c..f39b0d6740 100644
--- a/testbot/web/admin/VMDetails.pl
+++ b/testbot/web/admin/VMDetails.pl
@@ -48,23 +48,21 @@ sub Save($)
 {
   my ($self) = @_;
 
-  my $OldStatus = $self->{Item}->Status || "";
-  return !1 if (!$self->SaveProperties());
-
-  if ($OldStatus ne $self->{Item}->Status)
+  my $ResetErrors;
+  if (($self->GetParam("Status") || "") ne $self->{Item}->Status)
   {
     # The administrator action resets the consecutive error count
     $self->{Item}->Errors(undef);
-    my ($ErrProperty, $ErrMessage) = $self->{Item}->Validate();
-    if (!defined $ErrMessage)
-    {
-      $self->{Item}->RecordStatus(undef, $self->{Item}->Status ." administrator");
-    }
+    $ResetErrors = 1;
   }
 
-  my $ErrKey;
-  ($ErrKey, $self->{ErrField}, $self->{ErrMessage}) = $self->{Collection}->Save();
-  return ! defined($self->{ErrMessage});
+  return undef if (!$self->SUPER::Save());
+
+  if ($ResetErrors)
+  {
+    $self->{Item}->RecordStatus(undef, $self->{Item}->Status ." administrator");
+  }
+  return 1;
 }
 
 sub GenerateFooter($)
-- 
2.30.2



More information about the wine-devel mailing list