[Bps-public-commit] r16862 - in sd/trunk/lib/App: SD/CLI/Command/Ticket

jesse at bestpractical.com jesse at bestpractical.com
Sun Nov 16 09:44:04 EST 2008


Author: jesse
Date: Sun Nov 16 09:44:02 2008
New Revision: 16862

Modified:
   sd/trunk/lib/App/SD.pm
   sd/trunk/lib/App/SD/CLI/Command/Ticket/Search.pm

Log:
* added a list of active statuses for smarter ticket lists
* added per-db preferences for default sort and group on ticket lists

Modified: sd/trunk/lib/App/SD.pm
==============================================================================
--- sd/trunk/lib/App/SD.pm	(original)
+++ sd/trunk/lib/App/SD.pm	Sun Nov 16 09:44:02 2008
@@ -14,7 +14,8 @@
 
 sub database_settings {
 { 
-        statuses            => ['24183C4D-EFD0-4B16-A207-ED7598E875E6' => qw/new open stalled closed/],
+        statuses            => ['24183C4D-EFD0-4B16-A207-ED7598E875E6' => qw/new open stalled closed rejected/],
+        active_statuses            => ['C879A68F-8CFE-44B5-9EDD-14E53933669E' => qw/new open/],
         default_status      => ['2F9E6509-4468-438A-A733-246B3061003E' => 'new' ],
         components          => ['6CBD84A1-4568-48E7-B90C-F1A5B7BD8ECD' => qw/core ui docs tests/],
         default_component   => ['0AEC922F-57B1-44BE-9588-816E5841BB18' => 'core'],

Modified: sd/trunk/lib/App/SD/CLI/Command/Ticket/Search.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Ticket/Search.pm	(original)
+++ sd/trunk/lib/App/SD/CLI/Command/Ticket/Search.pm	Sun Nov 16 09:44:02 2008
@@ -7,20 +7,30 @@
 before run => sub {
     my $self = shift;
 
+    if (!$self->has_arg('sort') &&  $self->app_handle->config->get('default_sort_ticket_list')) {
+        $self->set_arg('sort' => $self->app_handle->config->get('default_sort_ticket_list'));
+    }
+    
+    if (!$self->has_arg('group') &&  $self->app_handle->config->get('default_group_ticket_list')) {
+        $self->set_arg('group' => $self->app_handle->config->get('default_group_ticket_list'));
+    }
+    
+    
+
     # sort output by created date if user specifies --sort
-    if ( $self->has_arg('sort') ) {
+    if ( $self->has_arg('sort') && ($self->arg('sort') ne 'none')) {
 
         # some records might not have creation dates
         no warnings 'uninitialized';
         $self->sort_routine(
             sub {
                 my $records = shift;
-                return $self->sort_by_prop( created => $records );
+                return $self->sort_by_prop( $self->arg('sort') => $records );
             }
         );
     }
 
-    if ( $self->has_arg('group') ) {
+    if ( $self->has_arg('group') && ($self->arg('group') ne 'none')) {
         $self->group_routine(
             sub {
                 my $records = shift;
@@ -46,7 +56,7 @@
     my $self = shift;
     my $ticket = shift;
 
-    return 1 if $ticket->prop('status') ne 'closed';
+    return 1 if grep  { $_ eq $ticket->prop('status') } @{$self->app_handle->setting(label => 'active_statuses')->get()};
     return 0;
 }
 



More information about the Bps-public-commit mailing list