[Rt-commit] rt branch, 4.4/existing-unique-ocfv, repushed
Shawn Moore
shawn at bestpractical.com
Mon Sep 12 11:21:26 EDT 2016
The branch 4.4/existing-unique-ocfv was deleted and repushed:
was 8099aa68be69453e1a052db284ca2a8749ed5939
now c7e880d9e31fef494629a687c5717d881b580b66
1: 8099aa6 ! 1: c7e880d Avoid uniqueness violation when submitting an unchanged OCFV
@@ -26,15 +26,15 @@
+ my $existing = RT::ObjectCustomFieldValues->new(RT->SystemUser);
+ $existing->LimitToCustomField($CF->Id);
+ $existing->LimitToEnabled;
++ $existing->Limit(FIELD => 'ObjectType', VALUE => ref($Object));
++ $existing->Limit(FIELD => 'ObjectId', VALUE => $Object->id, OPERATOR => '!=');
+ $existing->Limit(
+ FIELD => 'Content',
+ VALUE => $value,
);
- if ($existing->Id) {
++
+ while (my $ocfv = $existing->Next) {
-+ next if $ocfv->ObjectId == $Object->Id
-+ && $ocfv->ObjectType eq ref($Object);
-+
my $msg = loc("That is not a unique value");
$m->notes( ('InvalidField-' . $CF->Id) => $msg );
push @res, $CF->Name .': '. $msg;
More information about the rt-commit
mailing list