[Bps-public-commit] r16200 - sd/trunk/lib/App/SD/CLI/Command/Ticket

ruz at bestpractical.com ruz at bestpractical.com
Thu Oct 2 12:35:18 EDT 2008


Author: ruz
Date: Thu Oct  2 12:35:18 2008
New Revision: 16200

Modified:
   sd/trunk/lib/App/SD/CLI/Command/Ticket/Update.pm

Log:
* skip empty changes, may happen when user wrote a comment only
  or after invalid changes returned back to original

Modified: sd/trunk/lib/App/SD/CLI/Command/Ticket/Update.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Ticket/Update.pm	(original)
+++ sd/trunk/lib/App/SD/CLI/Command/Ticket/Update.pm	Thu Oct  2 12:35:18 2008
@@ -47,22 +47,26 @@
     }
 
     # set the new props
-    my $error;
-    {
-        local $@;
-        eval { $record->set_props( props => $props_ref ) }
-            or $error = $@ || "Something went wrong!";
+    if ( keys %$props_ref ) {
+        my $error;
+        {
+            local $@;
+            eval { $record->set_props( props => $props_ref ) }
+                or $error = $@ || "Something went wrong!";
+        }
+        if ( $error ) {
+            print STDERR "Couldn't update the record, error:\n\n", $error, "\n";
+            die "Aborted.\n" unless $self->prompt_Yn( "Want to return back to editing?" );
+
+            ($ticket_string_to_edit, $error) = ($updated, '');
+            goto TRY_AGAIN;
+        }
+        print 'Updated ticket ' . $record->luid . ' (' . $record->uuid . ")\n";
     }
-    if ( $error ) {
-        print STDERR "Couldn't update the record, error:\n\n", $error, "\n";
-        die "Aborted.\n" unless $self->prompt_Yn( "Want to return back to editing?" );
-
-        ($ticket_string_to_edit, $error) = ($updated, '');
-        goto TRY_AGAIN;
+    else {
+        print "No changes in properties.\n";
     }
 
-    print 'Updated ticket ' . $record->luid . ' (' . $record->uuid . ")\n";
-
     $self->add_comment( content => $comment, uuid => $record->uuid )
         if $comment;
 };



More information about the Bps-public-commit mailing list