[Rt-commit] rt branch, 4.4/cf-sort-order-inputs, repushed
? sunnavy
sunnavy at bestpractical.com
Wed Feb 7 09:56:53 EST 2018
The branch 4.4/cf-sort-order-inputs was deleted and repushed:
was cd6ef438e09899f22002f3203508c4aa446c1b07
now 379b92aa64a031bb9e259ce2c30baf5bc8b3f2a2
1: cd6ef438e ! 1: 9d4186f25 support cf reordering by directly editing SortOrder on ocf admin pages
@@ -18,7 +18,7 @@
+ my $sort_order = $sort{$cf_id};
+ $sort_order =~ s/^\s+//;
+ $sort_order =~ s/\s+$//;
-+ next unless $sort_order =~ /^\d+$/;
++ next unless $sort_order =~ /^-?\d+$/;
+
+ my $record = RT::ObjectCustomField->new( $session{'CurrentUser'} );
+ $record->LoadByCols( ObjectId => $id, CustomField => $cf_id );
@@ -29,8 +29,13 @@
+ }
+
+ if ( $record->SortOrder != $sort_order ) {
++ if ( $id && !$record->ObjectId ) {
++ # just in case, global inputs are disabled on non-global pages
++ push @results, loc("Only global pages can update SortOrder of global objects");
++ next;
++ }
+ my ( $status, $msg ) = $record->SetSortOrder( $sort_order );
-+ push @results, $msg;
++ push @results, '#' . $record->CustomField . ': ' . $msg;
+ }
+ }
+
@@ -69,8 +74,8 @@
+ $record->LoadByCols( CustomField => $id, ObjectId => $applied_id );
+ if ( $record->id ) {
+ my $name = "CustomField-$id-SortOrder";
-+ my $value = $DECODED_ARGS->{ $name } // $record->SortOrder;
-+ return \qq{<input name="}, $name, \qq{" size="3" value="$value" $disabled />};
++ my $value = $record->SortOrder;
++ return \qq{<input name="}, $name, \qq{" size="5" value="$value" $disabled />};
+ }
+ else {
+ RT->Logger->warning("Custom field #$id is not applied to object #$applied_id");
@@ -81,3 +86,4 @@
};
$COLUMN_MAP->{'AppliedTo'} = $COLUMN_MAP->{'AddedTo'};
+
-: ------- > 2: b1c2b7669 try to automatically resolve duplicated SortOrder for custom fields
-: ------- > 3: 379b92aa6 config option to enable/disable SortOrder's auto-resolve approach
More information about the rt-commit
mailing list