%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
<h2><&|/l&>Selected Custom Fields</&></h2>
<& /Elements/CollectionList,
%ARGS,
- Collection => $applied_cfs,
+ Collection => $added_cfs,
Rows => 0,
Page => 1,
Format => $format,
- DisplayFormat =>
- $id
- ? ("'__RemoveCheckBox.{$id}__',". $format .", '__MoveCF.{$id}__'")
- : ("'__CheckBox.{RemoveCustomField}__',". $format .", '__MoveCF.{$id}__'"),
+ DisplayFormat => $display_format,
AllowSorting => 0,
ShowEmpty => 0,
PassArguments => [
OrderBy => 'Name',
Order => 'ASC',
%ARGS,
- Collection => $not_applied_cfs,
- Rows => 50,
+ Collection => $not_added_cfs,
+ Rows => $rows,
Format => $format,
DisplayFormat => "'__CheckBox.{AddCustomField}__',". $format,
AllowSorting => 1,
if ( $UpdateCFs ) {
foreach my $cf_id ( @AddCustomField ) {
my $CF = RT::CustomField->new( $session{'CurrentUser'} );
+ $CF->SetContextObject( $Object );
$CF->Load( $cf_id );
unless ( $CF->id ) {
push @results, loc("Couldn't load CustomField #[_1]", $cf_id);
}
foreach my $cf_id ( @RemoveCustomField ) {
my $CF = RT::CustomField->new( $session{'CurrentUser'} );
+ $CF->SetContextObject( $Object );
$CF->Load( $cf_id );
unless ( $CF->id ) {
push @results, loc("Couldn't load CustomField #[_1]", $cf_id);
}
}
-my $applied_cfs = RT::CustomFields->new( $session{'CurrentUser'} );
-$applied_cfs->LimitToLookupType($lookup);
-$applied_cfs->LimitToGlobalOrObjectId($id);
-$applied_cfs->ApplySortOrder;
+$m->callback(CallbackName => 'UpdateExtraFields', Results => \@results, Object => $Object, %ARGS);
+
+my $added_cfs = RT::CustomFields->new( $session{'CurrentUser'} );
+$added_cfs->LimitToLookupType($lookup);
+$added_cfs->LimitToGlobalOrObjectId($id);
+$added_cfs->SetContextObject( $Object );
+$added_cfs->ApplySortOrder;
-my $not_applied_cfs = RT::CustomFields->new( $session{'CurrentUser'} );
-$not_applied_cfs->LimitToLookupType($lookup);
-$not_applied_cfs->LimitToNotApplied( $id ? ($id, 0) : (0) );
+my $not_added_cfs = RT::CustomFields->new( $session{'CurrentUser'} );
+$not_added_cfs->LimitToLookupType($lookup);
+$not_added_cfs->LimitToNotAdded( $id ? ($id, 0) : (0) );
my $format = RT->Config->Get('AdminSearchResultFormat')->{'CustomFields'};
+my $rows = RT->Config->Get('AdminSearchResultRows')->{'CustomFields'} || 50;
+
+my $display_format = $id
+ ? ("'__RemoveCheckBox.{$id}__',". $format .", '__MoveCF.{$id}__'")
+ : ("'__CheckBox.{RemoveCustomField}__',". $format .", '__MoveCF.{$id}__'");
+$m->callback(CallbackName => 'EditDisplayFormat', DisplayFormat => \$display_format, id => $id);
</%INIT>
<%ARGS>