[Rt-commit] rt branch, 4.4/validator-delete-txns-of-missing-cfs, created. rt-4.4.2-99-ga5fa328df

? sunnavy sunnavy at bestpractical.com
Thu Mar 22 16:30:45 EDT 2018


The branch, 4.4/validator-delete-txns-of-missing-cfs has been created
        at  a5fa328dff5a93b9a6292362319ced70906dbd5f (commit)

- Log -----------------------------------------------------------------
commit a5fa328dff5a93b9a6292362319ced70906dbd5f
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Mar 23 04:26:36 2018 +0800

    Delete dangling transactions with nonexistent custom fields

diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index 1b0716afe..59c63a567 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -745,6 +745,14 @@ push @CHECKS, 'Transactions -> other' => sub {
         'Transactions', 'Field' => 'CustomFields', 'id',
         condition   => 's.Type = ?',
         bind_values => [ 'CustomField' ],
+        action => sub {
+            my $id = shift;
+            return unless prompt(
+                'Delete', "Found a transaction without object."
+            );
+
+            delete_record( 'Transactions', $id );
+        },
     );
     # type = Take, Untake, Force, Steal or Give
     $res *= check_integrity(

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


More information about the rt-commit mailing list