[whups] PATCH: fix for 'completed' key in whups' listAs() api

Jason M. Felice jfelice at cronosys.com
Fri Jul 11 09:48:08 PDT 2003


Previous was using the presence of a _resolved_date to check whether ticket
should be listed as completed, but this is also present for reopened
tickets.

-- 
 Jason M. Felice
 Cronosys, LLC <http://www.cronosys.com/>
 216.221.4600 x302
-------------- next part --------------
? scripts/core.3039
Index: lib/api.php
===================================================================
RCS file: /repository/whups/lib/api.php,v
retrieving revision 1.42
diff -u -u -r1.42 api.php
--- lib/api.php	4 Jun 2003 03:18:35 -0000	1.42
+++ lib/api.php	11 Jul 2003 16:45:57 -0000
@@ -543,7 +543,7 @@
             'task_id'           => $ticket['id'],
             'priority'          => $ticket['_priority_name'],
             'tasklist_id'       => '**EXTERNAL**',
-            'completed'         => !empty($ticket['_date_resolved']),
+            'completed'         => ($ticket['_state_category'] == 'resolved'),
             'name'              => $ticket['_module_name'] . ' #' .
                                    $ticket['id'] . ' - ' . $ticket['summary'],
             'desc'              => null,
Index: lib/Driver/sql.php
===================================================================
RCS file: /repository/whups/lib/Driver/sql.php,v
retrieving revision 1.113
diff -u -u -r1.113 sql.php
--- lib/Driver/sql.php	27 Jun 2003 19:19:24 -0000	1.113
+++ lib/Driver/sql.php	11 Jul 2003 16:45:58 -0000
@@ -701,6 +701,7 @@
             $fields = "$fields, " .
                 'whups_types.type_name AS _type_name, ' .
                 'whups_states.state_name AS _state_name, ' .
+                'whups_states.state_category AS _state_category, '.
                 'whups_modules.module_name AS _module_name, ' .
                 'whups_priorities.priority_name AS _priority_name, ' .
                 'whups_versions.version_name AS _version_name, ' .
@@ -717,7 +718,7 @@
 
             $sums = ', MAX(w1.log_timestamp) AS _date_assigned, MAX(w2.log_timestamp) AS _date_resolved';
 
-            $groupby .= ', whups_types.type_name, whups_states.state_name, whups_modules.module_name, whups_priorities.priority_name, whups_versions.version_name, whups_versions.version_description';
+            $groupby .= ', whups_types.type_name, whups_states.state_name, whups_states.state_category, whups_modules.module_name, whups_priorities.priority_name, whups_versions.version_name, whups_versions.version_description';
         }
 
         $query = "SELECT $fields$sums FROM $tables$join " . (!empty($where) ? "WHERE $where " : '') . 'GROUP BY ' . $groupby . ' ORDER BY whups_tickets.priority_id, whups_tickets.ticket_timestamp';


More information about the whups mailing list