[Bps-public-commit] rt-extension-automaticassignment branch, master, updated. 1178b91c91c3f9bde82f24729eedb7b3e9823662
Shawn Moore
shawn at bestpractical.com
Tue Aug 2 20:02:54 EDT 2016
The branch, master has been updated
via 1178b91c91c3f9bde82f24729eedb7b3e9823662 (commit)
via 76a4901c5ed0cdf31e4dfd817e7e2d764e8a43f6 (commit)
from a39e42c4414505330141067397403c5d02d928d0 (commit)
Summary of changes:
META.yml | 2 ++
html/Admin/Queues/AutomaticAssignment.html | 34 ++++++++++++++++++++++
html/Admin/Queues/Elements/Chooser/Random | 3 ++
html/Admin/Queues/Elements/Chooser/RoundRobin | 3 ++
html/Admin/Queues/Elements/Chooser/TicketStatus | 3 ++
html/Admin/Queues/Elements/Chooser/TimeLeft | 3 ++
html/Admin/Queues/Elements/Filter/BusinessHours | 9 ++++++
html/Admin/Queues/Elements/Filter/ExcludedDates | 9 ++++++
html/Admin/Queues/Elements/Filter/MemberOfGroup | 9 ++++++
html/Admin/Queues/Elements/Filter/MemberOfRole | 9 ++++++
.../Elements/Tabs/PrivilegedQueue | 7 +++++
lib/RT/Extension/AutomaticAssignment.pm | 2 ++
.../Filter/{UserDates.pm => ExcludedDates.pm} | 30 ++-----------------
static/css/automatic-assignment.css | 3 ++
14 files changed, 99 insertions(+), 27 deletions(-)
create mode 100644 html/Admin/Queues/AutomaticAssignment.html
create mode 100644 html/Admin/Queues/Elements/Chooser/Random
create mode 100644 html/Admin/Queues/Elements/Chooser/RoundRobin
create mode 100644 html/Admin/Queues/Elements/Chooser/TicketStatus
create mode 100644 html/Admin/Queues/Elements/Chooser/TimeLeft
create mode 100644 html/Admin/Queues/Elements/Filter/BusinessHours
create mode 100644 html/Admin/Queues/Elements/Filter/ExcludedDates
create mode 100644 html/Admin/Queues/Elements/Filter/MemberOfGroup
create mode 100644 html/Admin/Queues/Elements/Filter/MemberOfRole
create mode 100644 html/Callbacks/AutomaticAssignment/Elements/Tabs/PrivilegedQueue
rename lib/RT/Extension/AutomaticAssignment/Filter/{UserDates.pm => ExcludedDates.pm} (68%)
create mode 100644 static/css/automatic-assignment.css
- Log -----------------------------------------------------------------
commit 76a4901c5ed0cdf31e4dfd817e7e2d764e8a43f6
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Tue Aug 2 23:41:14 2016 +0000
Simplify UserDates into just ExcludedDates
diff --git a/lib/RT/Extension/AutomaticAssignment/Filter/UserDates.pm b/lib/RT/Extension/AutomaticAssignment/Filter/ExcludedDates.pm
similarity index 68%
rename from lib/RT/Extension/AutomaticAssignment/Filter/UserDates.pm
rename to lib/RT/Extension/AutomaticAssignment/Filter/ExcludedDates.pm
index 8ae2c94..2281002 100644
--- a/lib/RT/Extension/AutomaticAssignment/Filter/UserDates.pm
+++ b/lib/RT/Extension/AutomaticAssignment/Filter/ExcludedDates.pm
@@ -1,4 +1,4 @@
-package RT::Extension::AutomaticAssignment::Filter::UserDates;
+package RT::Extension::AutomaticAssignment::Filter::ExcludedDates;
use strict;
use warnings;
use base 'RT::Extension::AutomaticAssignment::Filter';
@@ -27,31 +27,7 @@ sub FilterOwnersForTicket {
my $now = RT::Date->new(RT->SystemUser);
$now->SetToNow;
- if ($config->{between}) {
- my ($start_name, $end_name) = @{ $config->{between} };
- my $start_cf = $class->_UserCF($start_name);
- my $end_cf = $class->_UserCF($end_name);
-
- my $subclause = $start_name . '-' . $end_name;
-
- # start_cf <= now <= end_cf
- $users->LimitCustomField(
- SUBCLAUSE => $subclause,
- CUSTOMFIELD => $start_cf->Id,
- COLUMN => 'Content',
- OPERATOR => '<=',
- VALUE => $now->ISO,
- );
- $users->LimitCustomField(
- SUBCLAUSE => $subclause,
- CUSTOMFIELD => $end_cf->Id,
- COLUMN => 'Content',
- OPERATOR => '>=',
- VALUE => $now->ISO,
- ENTRYAGGREGATOR => 'AND',
- );
- }
- elsif ($config->{except_between}) {
+ if ($config->{except_between}) {
my ($start_name, $end_name) = @{ $config->{except_between} };
my $start_cf = $class->_UserCF($start_name);
my $end_cf = $class->_UserCF($end_name);
@@ -96,7 +72,7 @@ sub FilterOwnersForTicket {
);
}
else {
- die "Unable to filter UserDates; no 'between' or 'except_between' provided.";
+ die "Unable to filter ExcludedDates; no 'except_between' provided.";
}
}
commit 1178b91c91c3f9bde82f24729eedb7b3e9823662
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Wed Aug 3 00:02:49 2016 +0000
Admin UI WIP
diff --git a/META.yml b/META.yml
index 27bacfc..c3f764d 100644
--- a/META.yml
+++ b/META.yml
@@ -17,7 +17,9 @@ name: RT-Extension-AutomaticAssignment
no_index:
directory:
- etc
+ - html
- inc
+ - static
requires:
Business::Hours: 0
perl: 5.8.3
diff --git a/html/Admin/Queues/AutomaticAssignment.html b/html/Admin/Queues/AutomaticAssignment.html
new file mode 100644
index 0000000..7b860f7
--- /dev/null
+++ b/html/Admin/Queues/AutomaticAssignment.html
@@ -0,0 +1,34 @@
+<& /Elements/Header, Title => $title &>
+<& /Elements/Tabs &>
+<& /Elements/ListActions, actions => \@results &>
+
+<form method="post" class="automatic-assignment" action="AutomaticAssignment.html">
+<input type="hidden" class="hidden" name="id" value="<%$QueueObj->Id%>" />
+
+<h1>Filters</h1>
+
+<& /Admin/Queues/Elements/Filter/BusinessHours, i => 0 &>
+<& /Admin/Queues/Elements/Filter/ExcludedDates, i => 1 &>
+<& /Admin/Queues/Elements/Filter/MemberOfGroup, i => 2 &>
+<& /Admin/Queues/Elements/Filter/MemberOfRole, i => 3 &>
+
+<h1>Chooser</h1>
+
+<& /Admin/Queues/Elements/Chooser/Random &>
+<& /Admin/Queues/Elements/Chooser/RoundRobin &>
+<& /Admin/Queues/Elements/Chooser/TicketStatus &>
+<& /Admin/Queues/Elements/Chooser/TimeLeft &>
+
+</form>
+
+<%INIT>
+my @results;
+
+my $QueueObj = RT::Queue->new($session{'CurrentUser'});
+$QueueObj->Load($id) || Abort(loc("Couldn't load queue", $id));
+
+my $title = loc('Automatic Assignment for queue [_1]', $QueueObj->Name);
+</%INIT>
+<%ARGS>
+$id => undef
+</%ARGS>
diff --git a/html/Admin/Queues/Elements/Chooser/Random b/html/Admin/Queues/Elements/Chooser/Random
new file mode 100644
index 0000000..095e4c9
--- /dev/null
+++ b/html/Admin/Queues/Elements/Chooser/Random
@@ -0,0 +1,3 @@
+<&| /Widgets/TitleBox, title => loc('Random') &>
+<p>This chooser selects a random owner from the pool of eligible users.</p>
+</&>
diff --git a/html/Admin/Queues/Elements/Chooser/RoundRobin b/html/Admin/Queues/Elements/Chooser/RoundRobin
new file mode 100644
index 0000000..53a4f2c
--- /dev/null
+++ b/html/Admin/Queues/Elements/Chooser/RoundRobin
@@ -0,0 +1,3 @@
+<&| /Widgets/TitleBox, title => loc('Round Robin') &>
+<p>This chooser selects the user for whom it has been the longest amount of timesince they were last automatically assigned a ticket in the same queue. This effectively distributes the tickets evenly between the userbase in a round robin fashion, even if users enter and leave the pool.</p>
+</&>
diff --git a/html/Admin/Queues/Elements/Chooser/TicketStatus b/html/Admin/Queues/Elements/Chooser/TicketStatus
new file mode 100644
index 0000000..37c7132
--- /dev/null
+++ b/html/Admin/Queues/Elements/Chooser/TicketStatus
@@ -0,0 +1,3 @@
+<&| /Widgets/TitleBox, title => loc('Ticket Status') &>
+<p>This chooser selects the user with the fewest number of active tickets. If multiple users have the same number of tickets, then the ticket is assigned randomly.</p>
+</&>
diff --git a/html/Admin/Queues/Elements/Chooser/TimeLeft b/html/Admin/Queues/Elements/Chooser/TimeLeft
new file mode 100644
index 0000000..41821dc
--- /dev/null
+++ b/html/Admin/Queues/Elements/Chooser/TimeLeft
@@ -0,0 +1,3 @@
+<&| /Widgets/TitleBox, title => loc('Time Left') &>
+<p>This chooser selects the user with the least total amount of Time Left on their tickets in the given queue. If a particular ticket does not have Time Left, then that ticket's Time Estimated minus its Time Worked is used instead.</p>
+</&>
diff --git a/html/Admin/Queues/Elements/Filter/BusinessHours b/html/Admin/Queues/Elements/Filter/BusinessHours
new file mode 100644
index 0000000..0535604
--- /dev/null
+++ b/html/Admin/Queues/Elements/Filter/BusinessHours
@@ -0,0 +1,9 @@
+<&| /Widgets/TitleBox, title => loc('Business Hours') &>
+<p>This filter selects eligible owners by their work schedule. The following user custom field decides which work schedule each user maintains. Administrators may update the <tt>%ServiceBusinessHours</tt> RT config for adding or modifying the available schedules.</p>
+<% $i %>
+</&>
+<%INIT>
+</%INIT>
+<%ARGS>
+$i
+</%ARGS>
diff --git a/html/Admin/Queues/Elements/Filter/ExcludedDates b/html/Admin/Queues/Elements/Filter/ExcludedDates
new file mode 100644
index 0000000..219891a
--- /dev/null
+++ b/html/Admin/Queues/Elements/Filter/ExcludedDates
@@ -0,0 +1,9 @@
+<&| /Widgets/TitleBox, title => loc('Excluded Dates') &>
+<p>This filter selects eligible owners by datetime custom fields on users, meant for scheduled vacations. If the current date and time falls between the following two custom fields, the user will be excluded from automatic assignment.</p>
+<% $i %>
+</&>
+<%INIT>
+</%INIT>
+<%ARGS>
+$i
+</%ARGS>
diff --git a/html/Admin/Queues/Elements/Filter/MemberOfGroup b/html/Admin/Queues/Elements/Filter/MemberOfGroup
new file mode 100644
index 0000000..458aefb
--- /dev/null
+++ b/html/Admin/Queues/Elements/Filter/MemberOfGroup
@@ -0,0 +1,9 @@
+<&| /Widgets/TitleBox, title => loc('Member of Group') &>
+<p>This filter selects eligible owners by their group membership. Only members of the following group will be automatically assigned tickets.</p>
+<% $i %>
+</&>
+<%INIT>
+</%INIT>
+<%ARGS>
+$i
+</%ARGS>
diff --git a/html/Admin/Queues/Elements/Filter/MemberOfRole b/html/Admin/Queues/Elements/Filter/MemberOfRole
new file mode 100644
index 0000000..7398fc8
--- /dev/null
+++ b/html/Admin/Queues/Elements/Filter/MemberOfRole
@@ -0,0 +1,9 @@
+<&| /Widgets/TitleBox, title => loc('Member of Role') &>
+<p>This filter selects eligible owners by their role membership. Only members of the following role, either on the queue or on the ticket itself, will be automatically assigned tickets.</p>
+<% $i %>
+</&>
+<%INIT>
+</%INIT>
+<%ARGS>
+$i
+</%ARGS>
diff --git a/html/Callbacks/AutomaticAssignment/Elements/Tabs/PrivilegedQueue b/html/Callbacks/AutomaticAssignment/Elements/Tabs/PrivilegedQueue
new file mode 100644
index 0000000..54f4edc
--- /dev/null
+++ b/html/Callbacks/AutomaticAssignment/Elements/Tabs/PrivilegedQueue
@@ -0,0 +1,7 @@
+<%ARGS>
+$queue_id
+$page_menu
+</%ARGS>
+<%INIT>
+$page_menu->child( 'automaticassignment' => title => loc('Automatic Assignment'), path => "/Admin/Queues/AutomaticAssignment.html?id=" . $queue_id );
+</%INIT>
diff --git a/lib/RT/Extension/AutomaticAssignment.pm b/lib/RT/Extension/AutomaticAssignment.pm
index 71726e3..c509756 100644
--- a/lib/RT/Extension/AutomaticAssignment.pm
+++ b/lib/RT/Extension/AutomaticAssignment.pm
@@ -4,6 +4,8 @@ use warnings;
our $VERSION = '0.01';
+RT->AddStyleSheets("automatic-assignment.css");
+
sub _LoadedClass {
my $self = shift;
my $namespace = shift;
diff --git a/static/css/automatic-assignment.css b/static/css/automatic-assignment.css
new file mode 100644
index 0000000..5e024a8
--- /dev/null
+++ b/static/css/automatic-assignment.css
@@ -0,0 +1,3 @@
+form.automatic-assignment {
+ max-width: 700px;
+}
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list