maxrossello / redmine_app_timesheets

A true timesheet plugin using orders, not bound to timelogs over issues
GNU General Public License v2.0
32 stars 10 forks source link

Creating a new order gives you an error 404 in the web browser #39

Closed KarstenWolff closed 9 years ago

KarstenWolff commented 9 years ago

Thank you for the quick fix for #38.

I observed one minor problem:

Creating a new order gives you an error 404 in the web browser with message:

404
Anhang existiert nicht oder ist gelöscht worden.

In English: Attachment does not exist or is deleted.

The SQL statements from the PostgreSql database log and an output from a query from psql:

2014-12-07 11:35:37 CET LOG:  execute a23: INSERT INTO "versions" ("created_on", "description", "effective_date", "in_timesheet", "is_order", "name", "project_id", "sharing", "status", "updated_on", "wiki_page_title") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) RETURNING "id"
2014-12-07 11:35:37 CET DETAIL:  parameters: $1 = '2014-12-07 11:35:37.106246', $2 = 'Global Order1', $3 = NULL, $4 = 't', $5 = 'f', $6 = 'Global Order1', $7= '4', $8 = 'none', $9 = 'open', $10 = '2014-12-07 11:35:37.106246', $11 = NULL
2014-12-07 11:35:37 CET LOG:  execute a24: INSERT INTO "custom_values" ("custom_field_id", "customized_id", "customized_type", "value") VALUES ($1, $2, $3, $4) RETURNING "id"
2014-12-07 11:35:37 CET DETAIL:  parameters: $1 = '1', $2 = '6', $3 = 'Version', $4 = 'f'

redmine=> select id, project_id, name, status, sharing, in_timesheet, is_order from versions;
 id | project_id |        name        | status | sharing | in_timesheet | is_order
----+------------+--------------------+--------+---------+--------------+----------
  2 |          2 | PG1-Milestone1     | open   | none    | t            | t
  3 |          2 | PG1-Milestone2     | open   | none    | f            | f
  4 |          4 | Vacation (payed)   | open   | system  | t            | t
  1 |          4 | Sick leave         | open   | system  | t            | t
  5 |          4 | Vacation (unpayed) | open   | none    | t            | t
  6 |          4 | Global Order1      | open   | none    | t            | f
(6 rows)

redmine=> select * from custom_values;
 id | customized_type | customized_id | custom_field_id | value
----+-----------------+---------------+-----------------+-------
  2 | Version         |             2 |               1 | 1
  3 | Version         |             3 |               1 | 0
  4 | Version         |             4 |               1 | 1
  5 | Version         |             5 |               1 | 1
  6 | Version         |             6 |               1 | f
(5 rows)

The new order (versions.id=6) does not appear in the list of orders, because is_order=f. In custom_values the new value is shown as f, not as 0 as with the other values.

Workaround:

Goto project "Timesheets" and update the order/version without changing any values. The field Is Order is already shown as Yes.

Now the SQL statements are:

2014-12-07 11:40:10 CET LOG:  execute <unnamed>: UPDATE "versions" SET "is_order" = 't', "updated_on" = '2014-12-07 11:40:10.280447' WHERE "versions"."id" = 6
2014-12-07 11:40:10 CET LOG:  execute <unnamed>: UPDATE "custom_values" SET "value" = '1' WHERE "custom_values"."id" = 6
2014-12-07 11:40:10 CET LOG:  statement: COMMIT

redmine=> select * from custom_values;
 id | customized_type | customized_id | custom_field_id | value
----+-----------------+---------------+-----------------+-------
  2 | Version         |             2 |               1 | 1
  3 | Version         |             3 |               1 | 0
  4 | Version         |             4 |               1 | 1
  5 | Version         |             5 |               1 | 1
  6 | Version         |             6 |               1 | 1
(5 rows)

The new order now appears in the order management and can be configured.

maxrossello commented 9 years ago

Please note that the backing project should not be managed directly as long as possible. Issue tracking may be disabled there. As of today, only time tracking is necessary for users to view timelogs over global orders in time reports, but this limitation should be removed asap.

Pls let me know if the fix works for you. Thanks!

KarstenWolff commented 9 years ago

Super! Now it works for me. Thanks a lot!

maxrossello commented 9 years ago

Thank you for taking the time to test the plugin! It gets stronger for everybody's advantage ;)