Project

General

Profile

Actions

Defect #13783

closed

Internal error on time tracking activity enumeration deletion

Added by Anonymous about 11 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Normal
Category:
Administration
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Whenever I try to delete an enumeration for time tracking as admin I get this error:

Internal error

An error occurred on the page you were trying to access.
If you continue to experience problems please contact your Redmine administrator for assistance.

If you are the Redmine administrator, check your log files for details about the error.

Back

The log file shows me:

Started DELETE "/enumerations/8" for 172.18.96.2 at 2013-04-16 13:42:24 +0200
Processing by EnumerationsController#destroy as HTML
  Parameters: {"authenticity_token"=>"13xnqDY+WCyF0RhSlRRXkgUWUvF10QBPTY5bMXlcZ1c=", "id"=>"8"}
  Current user: admin (id=1)
Completed 500 Internal Server Error in 26ms

RuntimeError (Can't delete enumeration):
  app/models/enumeration.rb:133:in `check_integrity'
  app/models/enumeration.rb:88:in `destroy'
  app/models/enumeration.rb:88:in `destroy'
  app/controllers/enumerations_controller.rb:70:in `destroy'

my settings:

Environment:
  Redmine version                          2.3.0.stable
  Ruby version                             1.9.3 (x86_64-linux)
  Rails version                            3.2.13
  Environment                              production
  Database adapter                         Mysql2
Redmine plugins:
  redmine_charts2                          0.2.1

Actions #1

Updated by Etienne Massip about 11 years ago

  • Status changed from New to Confirmed
  • Priority changed from High to Normal
  • Target version set to Candidate for next minor release

Confirmed only if there's some time entries with this category and if you don't select anything in the combobox when asked for reassigning the category.

Actions #2

Updated by Anonymous about 11 years ago

Etienne Massip wrote:

Confirmed only if there's some time entries with this category and if you don't select anything in the combobox when asked for reassigning the category.

Almost... Sometimes the combobox comes up to select a new time tracking category and after I select another the same message is thrown.
If the combobox does not come up to reassign existing entries the error messages is thrown immediately

Actions #3

Updated by Etienne Massip about 11 years ago

Florian S. wrote:

Almost... Sometimes the combobox comes up to select a new time tracking category and after I select another the same message is thrown.
If the combobox does not come up to reassign existing entries the error messages is thrown immediately

I can't reproduce neither of these cases, it works if I select a new category or if there are no use of the category and the screen is not displayed.

Actions #4

Updated by Anonymous about 11 years ago

Etienne Massip wrote:

Florian S. wrote:

Almost... Sometimes the combobox comes up to select a new time tracking category and after I select another the same message is thrown.
If the combobox does not come up to reassign existing entries the error messages is thrown immediately

I can't reproduce neither of these cases, it works if I select a new category or if there are no use of the category and the screen is not displayed.

Hmm.
Maybe it helps to post my tables here (used sql dump for this):

INSERT INTO `enumerations` (`id`, `name`, `position`, `is_default`, `type`, `active`, `project_id`, `parent_id`, `position_name`) VALUES
(1, 'Niedrig', 1, 0, 'IssuePriority', 1, NULL, NULL, 'lowest'),
(2, 'Normal', 2, 1, 'IssuePriority', 1, NULL, NULL, 'default'),
(3, 'Hoch', 3, 0, 'IssuePriority', 1, NULL, NULL, 'high3'),
(4, 'Dringend', 4, 0, 'IssuePriority', 1, NULL, NULL, 'high2'),
(5, 'Sofort', 5, 0, 'IssuePriority', 1, NULL, NULL, 'highest'),
(6, 'Benutzerdokumentation', 1, 0, 'DocumentCategory', 1, NULL, NULL, NULL),
(7, 'Technische Dokumentation', 2, 0, 'DocumentCategory', 1, NULL, NULL, NULL),
(8, 'Design', 1, 0, 'TimeEntryActivity', 1, NULL, NULL, NULL),
(9, 'Entwicklung', 2, 0, 'TimeEntryActivity', 1, NULL, NULL, NULL),
(10, 'Planung', 3, 0, 'TimeEntryActivity', 1, NULL, NULL, NULL),
(11, 'Sonstiges', 4, 1, 'TimeEntryActivity', 1, NULL, NULL, NULL),
(12, 'Design', 5, 0, 'TimeEntryActivity', 1, 2, 8, NULL),
(13, 'Entwicklung', 6, 0, 'TimeEntryActivity', 1, 2, 9, NULL),
(14, 'Planung', 7, 0, 'TimeEntryActivity', 1, 2, 10, NULL),
(15, 'Sonstiges', 8, 0, 'TimeEntryActivity', 1, 2, 11, NULL);

INSERT INTO `time_entries` (`id`, `project_id`, `user_id`, `issue_id`, `hours`, `comments`, `activity_id`, `spent_on`, `tyear`, `tmonth`, `tweek`, `created_on`, `updated_on`) VALUES
(1, 2, 1, 1, 10, '', 15, '2013-01-08', 2013, 1, 2, '2013-01-08 10:15:05', '2013-01-08 10:15:05'),
(2, 2, 6, 1, 1.5, 'Angewendet in Changeset testrepo|r21.', 13, '2013-03-22', 2013, 3, 12, '2013-03-22 10:56:01', '2013-03-22 10:56:01'),
(3, 2, 1, 1, 10, 'testbuchung', 13, '2013-04-09', 2013, 4, 15, '2013-04-09 11:45:09', '2013-04-09 11:45:09'),
(4, 2, 1, 2, 50, 'testbuchung 2', 13, '2013-04-09', 2013, 4, 15, '2013-04-09 11:45:42', '2013-04-09 11:45:42'),
(5, 2, 1, 2, 45, '', 15, '2013-04-16', 2013, 4, 16, '2013-04-16 10:12:20', '2013-04-16 10:12:20'),
(6, 2, 1, 2, 10, '', 12, '2013-04-16', 2013, 4, 16, '2013-04-16 10:14:33', '2013-04-16 10:14:33'),
(7, 1, 5, 27, 3, 'Angewendet in Changeset xxxx|r35610.', 15, '2013-04-16', 2013, 4, 16, '2013-04-16 11:50:02', '2013-04-16 11:50:02'),
(8, 1, 6, 63, 4, '', 11, '2013-04-16', 2013, 4, 16, '2013-04-16 13:53:59', '2013-04-16 13:53:59'),
(9, 1, 6, 556, 3, '', 11, '2013-04-16', 2013, 4, 16, '2013-04-16 13:54:14', '2013-04-16 13:54:14'),
(10, 1, 6, 539, 1, '', 11, '2013-04-16', 2013, 4, 16, '2013-04-16 13:54:22', '2013-04-16 13:54:22'),
(11, 1, 6, 507, 8, '', 11, '2013-04-16', 2013, 4, 16, '2013-04-16 13:54:39', '2013-04-16 13:54:39'),
(12, 1, 6, 339, 1, '', 11, '2013-04-16', 2013, 4, 16, '2013-04-16 13:55:18', '2013-04-16 13:55:18'),
(13, 1, 6, 114, 80, 'Zurückliegende Aufwände mit berücksichtigt', 11, '2013-04-16', 2013, 4, 16, '2013-04-16 13:56:54', '2013-04-16 13:56:54'),
(14, 1, 6, 447, 40, '', 11, '2013-04-16', 2013, 4, 16, '2013-04-16 13:57:12', '2013-04-16 13:57:12'),
(15, 1, 6, 556, 0.5, 'Angewendet in Changeset xxxx|r35619.', 11, '2013-04-16', 2013, 4, 16, '2013-04-16 14:17:02', '2013-04-16 14:17:02'),
(16, 1, 5, 27, 0.25, 'Angewendet in Changeset xxxx|r35620.', 11, '2013-04-16', 2013, 4, 16, '2013-04-16 14:18:01', '2013-04-16 14:18:01'),
(17, 1, 5, 27, 0.25, 'Angewendet in Changeset xxxx|r35621.', 11, '2013-04-16', 2013, 4, 16, '2013-04-16 14:19:01', '2013-04-16 14:19:01'),
(18, 1, 5, 27, 0.0166667, 'Angewendet in Changeset xxxx|r35622.', 11, '2013-04-16', 2013, 4, 16, '2013-04-16 14:20:02', '2013-04-16 14:20:02'),
(19, 1, 5, 27, 18, '', 10, '2013-04-16', 2013, 4, 16, '2013-04-16 14:30:38', '2013-04-16 14:30:38'),
(20, 1, 5, 91, 10, '', 11, '2013-04-16', 2013, 4, 16, '2013-04-16 14:31:11', '2013-04-16 14:31:11'),
(21, 1, 5, 467, 4, '', 11, '2013-04-16', 2013, 4, 16, '2013-04-16 14:32:39', '2013-04-16 14:32:39'),
(22, 1, 5, 118, 10, '', 11, '2013-04-16', 2013, 4, 16, '2013-04-16 14:34:17', '2013-04-16 14:34:17');

I do not know (if this is not a bug?) if it is worth to discuss about a solution. I think I could get the result I need in manipulating the existing sql tables. I did not do this before but if the enumerations are only referenced in the time_entries table (is this the case?) the manual correction would not be a problem for me...

When I tool a look into the tables I saw some enumerations for time tracking that do not belong to a project (null). Maybe there's a problem?

Actions #5

Updated by Etienne Massip about 11 years ago

  • Subject changed from Time tracking enumerations cannot be deleted to Internal error on time tracking activity enumeration deletion

Florian S. wrote:

When I tool a look into the tables I saw some enumerations for time tracking that do not belong to a project (null). Maybe there's a problem?

Yes.

To summarize, the error is triggered either when:

  • the system enumeration item is tied to an object (e.g. a time tracking activity tied to a time tracking entry) and you try to delete it without picking up a new object to replace the removed on
  • the project enumeration item is tied to an object and you try to remove its parent system enumeration item which itself is or is not tied to an object
Actions #6

Updated by Jean-Philippe Lang almost 11 years ago

  • Status changed from Confirmed to Resolved
  • Assignee set to Jean-Philippe Lang
  • Target version changed from Candidate for next minor release to 2.3.2
  • Resolution set to Fixed

Etienne Massip wrote:

  • the system enumeration item is tied to an object (e.g. a time tracking activity tied to a time tracking entry) and you try to delete it without picking up a new object to replace the removed on

Works for me. The confirmation form is displayed again.

  • the project enumeration item is tied to an object and you try to remove its parent system enumeration item which itself is or is not tied to an object

Fixed in r11763.

Actions #7

Updated by Jean-Philippe Lang almost 11 years ago

  • Status changed from Resolved to Closed

Merged.

Actions #8

Updated by Etienne Massip almost 11 years ago

Jean-Philippe Lang wrote:

Etienne Massip wrote:

  • the system enumeration item is tied to an object (e.g. a time tracking activity tied to a time tracking entry) and you try to delete it without picking up a new object to replace the removed on

Works for me. The confirmation form is displayed again.

Still don't work with current trunk (r11844) and SQL Server 2005 (no plugins).

Log file contents:

ActiveRecord::StatementInvalid (TinyTds::Error: Conversion failed when converting the nvarchar value '--- Choisir ---' to data type int.: EXEC sp_executesql N'SELECT TOP (1) [enumerations].* FROM [enumerations] WHERE [enumerations].[type] IN (N''TimeEntryActivity'') AND [enumerations].[id] = N''--- Choisir ---'' ORDER BY enumerations.position ASC'):
  app/controllers/enumerations_controller.rb:74:in `destroy'
Actions #9

Updated by Etienne Massip almost 11 years ago

  • Status changed from Closed to New
Actions #10

Updated by Jean-Philippe Lang almost 11 years ago

  • Status changed from New to Resolved

Etienne Massip wrote:

Still don't work with current trunk (r11844) and SQL Server 2005 (no plugins).

Fixed in r11854.

Actions #11

Updated by Jean-Philippe Lang almost 11 years ago

  • Status changed from Resolved to Closed

Merged.

Actions

Also available in: Atom PDF