[Rt-commit] rt branch, 4.2/serialize-ticket, updated. rt-4.2.13-123-g912eb93
Shawn Moore
shawn at bestpractical.com
Wed Feb 22 17:04:05 EST 2017
The branch, 4.2/serialize-ticket has been updated
via 912eb9318c393bbe2c7f7e5b858b9b55650df2ce (commit)
from ce381610a24c7ea1b90f95c64e74b2b0c95b85e6 (commit)
Summary of changes:
lib/RT/Attribute.pm | 4 ++++
lib/RT/Migrate/Importer.pm | 4 ++--
lib/RT/Record.pm | 4 ++++
lib/RT/Transaction.pm | 4 ++++
4 files changed, 14 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit 912eb9318c393bbe2c7f7e5b858b9b55650df2ce
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Wed Feb 22 21:46:34 2017 +0000
Add AllowsImportReuse method rather than hardcoding the logic
diff --git a/lib/RT/Attribute.pm b/lib/RT/Attribute.pm
index aa965e0..a0ed08a 100644
--- a/lib/RT/Attribute.pm
+++ b/lib/RT/Attribute.pm
@@ -913,6 +913,10 @@ sub Serialize {
return %store;
}
+sub AllowsImportReuse {
+ return 0;
+}
+
RT::Base->_ImportOverlays();
1;
diff --git a/lib/RT/Migrate/Importer.pm b/lib/RT/Migrate/Importer.pm
index 4fad760..41bf57d 100644
--- a/lib/RT/Migrate/Importer.pm
+++ b/lib/RT/Migrate/Importer.pm
@@ -354,7 +354,7 @@ sub LoadForReuse {
my $self = shift;
my ($class, $uid) = @_;
- return if grep { $class eq $_ } 'RT::Transaction', 'RT::Attribute';
+ return unless $class->AllowsImportReuse;
my $attribute = RT::Attribute->new( RT->SystemUser );
$attribute->LoadByCols(
@@ -374,7 +374,7 @@ sub RegisterForReuse {
my $self = shift;
my ($obj, $uid) = @_;
- return if grep { ref($obj) eq $_ } 'RT::Transaction', 'RT::Attribute';
+ return unless $obj->AllowsImportReuse;
return if $self->LoadForReuse(ref($obj), $uid);
my $attr = RT::Attribute->new(RT->SystemUser);
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index f80061f..dbc019a 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -2542,6 +2542,10 @@ sub PreInflate {
sub PostInflate {
}
+sub AllowsImportReuse {
+ return 1;
+}
+
=head2 _AsInsertQuery
Returns INSERT query string that duplicates current record and
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index 8dae6a3..47759f0 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -2169,6 +2169,10 @@ sub PreInflate {
return $class->SUPER::PreInflate( $importer, $uid, $data );
}
+sub AllowsImportReuse {
+ return 0;
+}
+
RT::Base->_ImportOverlays();
1;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list