[Rt-commit] rtir branch 4.0/queue-level-cf-groupings created. 4.0.2-4-g477cf99b

BPS Git Server git at git.bestpractical.com
Thu May 5 21:43:47 UTC 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rtir".

The branch, 4.0/queue-level-cf-groupings has been created
        at  477cf99b9ae10f12f8a8547515441cc4854726bd (commit)

- Log -----------------------------------------------------------------
commit 477cf99b9ae10f12f8a8547515441cc4854726bd
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri May 6 05:05:15 2022 +0800

    Support queue-level custom field groupings
    
    RT supports it in 46cc17adf2, this commit is the corresponding changes
    for RTIR.

diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index 19785a14..e5d4e6de 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -160,7 +160,8 @@
     %CFDefaults,
     Object => $ticket,
     CustomFieldGenerator => sub { $QueueObj->TicketCustomFields },
-    Groupings => [ RT::CustomField->CustomGroupings('RTIR::Ticket'), '' ],
+    Groupings => [ RT::CustomField->CustomGroupings( 'RTIR::Ticket', $QueueObj->Name ), '' ],
+    CategoryObj => $QueueObj,
 &>
 <&| /Widgets/TitleBox, title => loc("Dates"), class=>'ticket-info-dates' &>
 <table width="100%" border="0">
diff --git a/html/RTIR/Edit.html b/html/RTIR/Edit.html
index e6371f28..d04bd46c 100644
--- a/html/RTIR/Edit.html
+++ b/html/RTIR/Edit.html
@@ -139,7 +139,7 @@
     %ARGS,
     Object => $Ticket,
     CustomFieldGenerator => sub { $Ticket->QueueObj->TicketCustomFields },
-    Groupings => [ RT::CustomField->CustomGroupings('RTIR::Ticket'), '' ],
+    Groupings => [ RT::CustomField->CustomGroupings( 'RTIR::Ticket', $Ticket->QueueObj->Name ), '' ],
 &>
 
 
diff --git a/html/RTIR/Elements/EditCustomFields b/html/RTIR/Elements/EditCustomFields
index f892eeda..28cec509 100644
--- a/html/RTIR/Elements/EditCustomFields
+++ b/html/RTIR/Elements/EditCustomFields
@@ -48,6 +48,7 @@
 <& /Elements/EditCustomFields,
   Object => $TicketObj,
   QueueObj => $QueueObj,
+  CategoryObj => $QueueObj,
   ($TicketObj->Id ? () : (CustomFields => $QueueObj->TicketCustomFields)), # on ticket creation, use Queue CFs
   %ARGS,
   %$CFDefaults,
diff --git a/html/RTIR/Incident/Create.html b/html/RTIR/Incident/Create.html
index 549935d4..72569574 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -170,7 +170,8 @@ if ( $ChildObj && $ChildObj->id && !$ChildObj->CurrentUserHasRight('ModifyTicket
     %CFDefaults,
     Object => $ticket,
     CustomFieldGenerator => sub { $QueueObj->TicketCustomFields },
-    Groupings => [ RT::CustomField->CustomGroupings('RTIR::Ticket'), '' ],
+    Groupings => [ RT::CustomField->CustomGroupings( 'RTIR::Ticket', $QueueObj->Name ), '' ],
+    CategoryObj => $QueueObj,
 &>
 
 </div>
diff --git a/html/RTIR/Investigation/Elements/Create b/html/RTIR/Investigation/Elements/Create
index 69d5680b..e25624be 100644
--- a/html/RTIR/Investigation/Elements/Create
+++ b/html/RTIR/Investigation/Elements/Create
@@ -126,7 +126,7 @@
     %CFDefaults,
     Object => $ticket,
     CustomFieldGenerator => sub { $QueueObj->TicketCustomFields },
-    Groupings => [ RT::CustomField->CustomGroupings('RTIR::Ticket'), '' ],
+    Groupings => [ RT::CustomField->CustomGroupings( 'RTIR::Ticket', $QueueObj->Name ), '' ],
 &>
 % }
 
diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 21a98cd2..6bcad6ab 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -826,11 +826,11 @@ require RT::CustomField;
         my $self        = shift;
         my $record      = shift;
 
-        my $record_class = $orig_GroupingClass->($self,$record);
+        my ( $record_class, $category ) = $orig_GroupingClass->( $self, $record, @_ );
 
         # we're only doing shenanigans on Tickets, which might be RTIR::Ticket
         unless ($record_class eq 'RT::Ticket') {
-            return $record_class;
+            return wantarray ? ( $record_class, $category ) : $record_class;
         }
 
         my $queue = undef;
@@ -848,10 +848,9 @@ require RT::CustomField;
         }
 
         if (RT::IR->OurQueue($queue)) {
-            return 'RTIR::Ticket';
-        } else {
-            return $record_class;
+            $record_class = 'RTIR::Ticket';
         }
+        return wantarray ? ( $record_class, $category ) : $record_class;
     };
 }
 

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


hooks/post-receive
-- 
rtir


More information about the rt-commit mailing list