[Bps-public-commit] RT-Extension-FeaturedTickets branch, master, updated. 5cb70033b71549f8a2b5087fa2b506f2d674d8e8

Craig Kaiser craig at bestpractical.com
Tue Mar 20 13:16:10 EDT 2018


The branch, master has been updated
       via  5cb70033b71549f8a2b5087fa2b506f2d674d8e8 (commit)
      from  ad06d2c9cfce8af01096fc1e658c7b0664be505f (commit)

Summary of changes:
 .../FeaturedTickets/Elements/Tabs/Privileged       | 35 ++++++++++++++++++++++
 html/NoAuth/Featured/index.html                    |  4 +--
 lib/RT/Extension/FeaturedTickets.pm                |  8 +++++
 3 files changed, 45 insertions(+), 2 deletions(-)
 create mode 100644 html/Callbacks/FeaturedTickets/Elements/Tabs/Privileged

- Log -----------------------------------------------------------------
commit 5cb70033b71549f8a2b5087fa2b506f2d674d8e8
Author: craig Kaiser <craig at bestpractical.com>
Date:   Tue Mar 20 12:09:43 2018 -0400

    Allow tickets to be cloned into featured queue
    
    Make it easy to take an existing ticket and pull the relevant
    information off of it and put into a new ticket in the featured queue.

diff --git a/html/Callbacks/FeaturedTickets/Elements/Tabs/Privileged b/html/Callbacks/FeaturedTickets/Elements/Tabs/Privileged
new file mode 100644
index 0000000..604f0c5
--- /dev/null
+++ b/html/Callbacks/FeaturedTickets/Elements/Tabs/Privileged
@@ -0,0 +1,35 @@
+
+<%init>
+return unless RT::Extension::FeaturedTickets::IsStaff($session{'CurrentUser'});
+
+my $args = $DECODED_ARGS;
+my $id = $args->{id};
+
+my $queue = RT::Queue->new($session{'CurrentUser'});
+my ($ret, $msg) = $queue->Load(RT->Config->Get('FeaturedTicketsQueue'));
+return ($ret, $msg) unless $ret;
+
+my $ticket = RT::Ticket->new($session{'CurrentUser'});
+($ret, $msg) = $ticket->Load( $id );
+return ($ret, $msg) unless $ret;
+
+my %params = (
+    Queue          => $queue->Name,
+    Subject        => $ticket->Subject,
+    'CustomField-' . $ticket->LoadCustomFieldByIdentifier('Description')->Id  => $ticket->FirstCustomFieldValue('Description'),
+    TimeEstimated  => $ticket->TimeEstimated,
+);
+
+my $url = RT->Config->Get('WebURL') . "/Ticket/Create.html?"
+        . $m->comp("/Elements/QueryString", %params);
+
+if ( $ticket->QueueObj->Name ne $queue->Name ) {
+    if (my $actions = PageMenu->child('actions')) {
+        $actions->child('Feature Ticket' =>
+            title => loc('Feature Ticket'),
+            path  => $url,
+        );
+    }
+}
+
+</%init>
diff --git a/html/NoAuth/Featured/index.html b/html/NoAuth/Featured/index.html
index 2d70093..65a1639 100644
--- a/html/NoAuth/Featured/index.html
+++ b/html/NoAuth/Featured/index.html
@@ -140,7 +140,7 @@
         <div class="pricing-table pricing-table-free">
             <div class="pricing-table-header">
                 <h2><% $ticket->Subject ? $ticket->Subject : 'Ticket: ' . $ticket->Id %></h2>
-                    <p class="feature-details"><% $ticket->FirstCustomFieldValue('Details') %></p>
+                    <p class="feature-details"><% $ticket->FirstCustomFieldValue('Description') %></p>
                 </div>
 
                 <ul class="pricing-table-list">
@@ -150,7 +150,7 @@
         <li>Funded!</li>
 %   }
                 </ul>
-%   my $args = {'ticket_id' => $ticket->Id, 'Subject' => $ticket->Subject, 'Goal' => $ticket->FirstCustomFieldValue('Goal'), 'Details' => $ticket->FirstCustomFieldValue('Details') };
+%   my $args = {'ticket_id' => $ticket->Id, 'Subject' => $ticket->Subject, 'Goal' => $ticket->FirstCustomFieldValue('Goal'), 'Details' => $ticket->FirstCustomFieldValue('Description') };
                     <button onclick="detailsClicked(<% encode_json( $args ) %>)" type="submit" class="button-choose pure-button" value="<% $ticket->Id %>" name="ticket_id">Details</button>
             </div>
         </div>
diff --git a/lib/RT/Extension/FeaturedTickets.pm b/lib/RT/Extension/FeaturedTickets.pm
index 3cc01cd..0cb8176 100644
--- a/lib/RT/Extension/FeaturedTickets.pm
+++ b/lib/RT/Extension/FeaturedTickets.pm
@@ -6,6 +6,14 @@ our $VERSION = '0.01';
 
 RT->AddStyleSheets("featured-tickets.css");
 
+sub IsStaff {
+    my $cu = shift;
+
+    my $group = RT::Group->new($cu);
+    $group->LoadUserDefinedGroup('BPS Staff');
+    return $group->HasMemberRecursively($cu->UserObj->PrincipalObj);
+}
+
 =head1 NAME
 
 RT-Extension-FeaturedTickets - [One line description of module's purpose here]

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


More information about the Bps-public-commit mailing list