[Rt-commit] rt branch, 4.2/validator-owner, created. rt-4.2.1-54-g20b6e97

Alex Vandiver alexmv at bestpractical.com
Fri Jan 10 17:00:30 EST 2014


The branch, 4.2/validator-owner has been created
        at  20b6e9759938c6d16086fc6923f13e26215aea45 (commit)

- Log -----------------------------------------------------------------
commit 20b6e9759938c6d16086fc6923f13e26215aea45
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Dec 13 13:20:24 2013 -0500

    Prompt to fix Owner, like other user columns
    
    Fixes [issues #28403].

diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index 6eaac17..fb6c923 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -614,6 +614,19 @@ push @CHECKS, 'Tickets -> other' => sub {
     );
     $res *= check_integrity(
         'Tickets', 'Owner' => 'Users', 'id',
+         action => sub {
+             my ($id, %prop) = @_;
+             return unless my $replace_with = prompt_integer(
+                 'Replace',
+                 "Column Owner should point to a user, but there is record #$id in Tickets\n"
+                 ."where it's not true. It's ok to replace these wrong references with id of any user.\n"
+                 ."Note that id you enter is not checked. You can pick any user from your DB, but it's\n"
+                 ."may be better to create a special user for this, for example 'user_that_has_been_deleted'\n"
+                 ."or something like that.",
+                 "Tickets.Owner -> user #$prop{Owner}"
+             );
+             update_records( 'Tickets', { id => $id, Owner => $prop{Owner} }, { Owner => $replace_with } );
+         },
     );
     # XXX: check that owner is only member of owner role group
     return $res;

-----------------------------------------------------------------------


More information about the rt-commit mailing list