From: Ben Klang Date: Wed, 3 Nov 2010 18:17:02 +0000 (-0400) Subject: Delete tickets with queues X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=a4b99b657de996542646553c7056331b87be59c7;p=horde.git Delete tickets with queues --- diff --git a/whups/lib/Driver/sql.php b/whups/lib/Driver/sql.php index 4fed6234d..33327a310 100644 --- a/whups/lib/Driver/sql.php +++ b/whups/lib/Driver/sql.php @@ -1453,6 +1453,26 @@ class Whups_Driver_sql extends Whups_Driver { */ function deleteQueue($queueId) { + // Clean up the tickets associated with the queue. + $query = 'SELECT ticket_id FROM whups_tickets WHERE queue_id = ?'; + $values = array($queueId); + Horde::logMessage(sprintf('Whups_Driver_sql::deleteQueue: query="%s"; values=%s"', $query, implode(',', $values)), 'DEBUG'); + + $result = $this->_db->getAll($query, $values, DB_FETCHMODE_ASSOC); + if (is_a($result, 'PEAR_Error')) { + Horde::logMessage($result, 'ERR'); + return $result; + } + + foreach ($result as $ticket) { + $info['id'] = $ticket['ticket_id']; + $this->deleteTicket($info); + } + + // Now remove all references to the queue itself + // Note that whups_tickets could be in this list below, but there + // should never be tickets left for the queue at this point + // because they were all deleted above. $tables = array('whups_queues_users', 'whups_types_queues', 'whups_versions', diff --git a/whups/lib/Forms/Admin/Queue.php b/whups/lib/Forms/Admin/Queue.php index e844d8661..fdbb16881 100644 --- a/whups/lib/Forms/Admin/Queue.php +++ b/whups/lib/Forms/Admin/Queue.php @@ -171,7 +171,7 @@ class DeleteQueueForm extends Horde_Form { $yesno = array(array(0 => _("No"), 1 => _("Yes"))); $this->addVariable( - _("Really delete this queue? This may cause data problems!"), + _("Really delete this queue? This will also delete all associated tickets and their comments. This can not be undone!"), 'yesno', 'enum', true, false, null, $yesno); }