Closed KarstenWolff closed 9 years ago
Hello,
Earlier versions of the timesheet plugin required the issues module to also be enabled in the backing workspace project. I have retained this configuration in our installation. Perhaps you could try enabling this?
You are missing the two critical applications in the configuration of the redmine_app__space plugin. There is no way for the timesheet plugin to work unless you can see and enable 'Orders' and 'Timesheet'. On 30/11/2014 11:41 PM, "Karsten Wolff" notifications@github.com wrote:
I did a fresh installation of the plugin redmine_app_timesheets. Version is 1.4.6.
$ cd apps/redmine/htdocs $ git clone https://github.com/maxrossello/redmine_app_timesheets.git plugins/redmine_app_timesheets $ RAILS_ENV=production rake redmine:plugins:migrate $ sudo /opt/bitnami/ctlscript.sh restart
The migration had no errors. See the log below:
===== Start Log of migration ======
bitnami@linux:/opt/bitnami/apps/redmine/htdocs$ RAILS_ENV=production rake redmine:plugins:migrate Migrating redmine_app__space (Redmine Application Space plugin)... Migrating redmine_app_timesheets (Redmine Timesheets Application)... == VersionInTimesheet: migrating ============================================= -- add_column(:versions, :in_timesheet, :boolean, {:default=>false, :null=>false}) -> 0.6294s == VersionInTimesheet: migrated (0.6303s) ====================================
== TimeEntriesInTimesheet: migrating ========================================= -- add_column(:time_entries, :in_timesheet, :boolean, {:default=>false, :null=>false}) -> 0.0091s == TimeEntriesInTimesheet: migrated (0.0100s) ================================
== TimeEntriesVersion: migrating ============================================= -- add_column(:time_entries, :fixed_version_id, :integer) -> 0.0806s == TimeEntriesVersion: migrated (0.0816s) ====================================
== Activities: migrating ===================================================== -- create_table(:ts_activities) -> 0.0736s -- add_index(:ts_activities, :order_id) -> 0.0723s == Activities: migrated (0.1473s) ============================================
== RevertTimeEntriesInTimesheet: migrating =================================== == RevertTimeEntriesInTimesheet: migrated (0.0211s) ==========================
== RemoveInTimesheet: migrating ============================================== -- remove_column(:time_entries, :in_timesheet) -> 0.0115s -- rename_column(:time_entries, :fixed_version_id, :order_id) -> 0.0720s == RemoveInTimesheet: migrated (0.0853s) =====================================
== DisjointActivity: migrating =============================================== -- add_column(:time_entries, :order_activity_id, :integer) -> 0.0538s == DisjointActivity: migrated (0.0573s) ======================================
== TsPermissions: migrating ================================================== -- create_table(:ts_permissions) -> 0.0084s -- add_index(:ts_permissions, [:user_id, :order_id]) -> 0.0152s == TsPermissions: migrated (0.0327s) =========================================
== TsToPrincipal: migrating ================================================== -- add_column(:ts_permissions, :principal_id, :integer, {:null=>false, :default=>0}) -> 0.0076s -- remove_column(:ts_permissions, :user_id) -> 0.0354s == TsToPrincipal: migrated (0.0526s) =========================================
== TsPermIsPrimary: migrating ================================================ -- add_column(:ts_permissions, :is_primary, :boolean, {:default=>false, :null=>false}) -> 0.0917s == TsPermIsPrimary: migrated (0.0968s) =======================================
== TsRemoveIssues: migrating ================================================= == TsRemoveIssues: migrated (0.0016s) ========================================
== VersionIsOrder: migrating ================================================= -- add_column(:versions, :is_order, :boolean, {:default=>false, :null=>false}) -> 0.0842s == VersionIsOrder: migrated (0.2305s) ========================================
Migrating redmine_backlogs (Redmine Backlogs)... Migrating redmine_wktime (Time & Expense)...
====== End Log Migration ======
As an admin user I configured the redmine_app_timesheets plugin so that it uses the project "Timesheets" as its backing workspace. The project Timesheets has only module "Time tracking" enabled.
The configuration of the redmine_app_space plugin shows the following application. I enabled all of them with Auth Group = (everybody)_: Activity, Assigned issues, Calendar, News, Reported issues, Spent time, Watched issues. Should there be more applications?
Then I logged in as an user without admin rights. This produced an internal error. The log says:
====== Start Redmine production.log ======
Started GET "/" for 10.49.64.103 at 2014-11-30 10:10:12 +0000 Processing by WelcomeController#index as HTML Current user: karsten.wolff (id=4) Rendered news/_news.html.erb (82.3ms) Rendered welcome/index.html.erb within layouts/base (91.0ms) Rendered plugins/redmine_backlogs/app/views/hooks/_rb_include_scripts.html.erb (3.5ms) Completed 500 Internal Server Error in 154.3ms
ActionView::Template::Error (Mysql2::Error: Unknown column 'time_entries.order_id' in 'where clause': SELECT
app/models/project.rb:285:inprojects
.* FROMprojects
WHERE ((time_entries.order_id IN ('')) OR (time_entries.user_id = 4 AND time_entries.order_id IN ('')) OR ((projects.status <> 9 AND projects.id IN (SELECT em.project_id FROM enabled_modules em WHERE em.name='time_tracking')) AND (projects.is_public = 1 OR projects.id IN (3,1,2) OR projects.id IN (3,1,2) OR projects.id IN (3,1,2))))): 22:find' lib/redmine/menu_manager.rb:199:in
call' lib/redmine/menu_manager.rb:199:inallowed_node?' lib/redmine/menu_manager.rb:166:in
block in menu_items_for' lib/redmine/menu_manager.rb:165:ineach' lib/redmine/menu_manager.rb:165:in
menu_items_for' lib/redmine/menu_manager.rb:90:inrender_menu' app/views/layouts/base.html.erb:25:in
_app_views_layouts_base_html_erb___3456770822996765305_69892079736740'Started GET "/login" for 10.49.64.103 at 2014-11-30 10:10:18 +0000 Processing by AccountController#login as HTML Current user: karsten.wolff (id=4) Redirected to http://10.49.64.116/ Completed 302 Found in 4.9ms (ActiveRecord: 0.8ms)
====== End Redmine production.log ======
Then I logged into the Mysql database to check the query. The table time_entries should be somewhere in a FROM clause, I guess.
There are some comments in the log.
====== Start Log from MySql session ======
bitnami@linux:/opt/bitnami$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.5.39 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use bitnami_redmine Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
Database changed mysql> describe time_entries; +-------------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | project_id | int(11) | NO | MUL | NULL | | | user_id | int(11) | NO | MUL | NULL | | | issue_id | int(11) | YES | MUL | NULL | | | hours | float | NO | | NULL | | | comments | varchar(255) | YES | | NULL | | | activity_id | int(11) | NO | MUL | NULL | | | spent_on | date | NO | | NULL | | | tyear | int(11) | NO | | NULL | | | tmonth | int(11) | NO | | NULL | | | tweek | int(11) | NO | | NULL | | | created_on | datetime | NO | MUL | NULL | | | updated_on | datetime | NO | | NULL | | | order_id | int(11) | YES | | NULL | | | order_activity_id | int(11) | YES | | NULL | | +-------------------+--------------+------+-----+---------+----------------+ 15 rows in set (0.00 sec) mysql> mysql> describe versions; +-------------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | project_id | int(11) | NO | MUL | 0 | | | name | varchar(255) | NO | | | | | description | varchar(255) | YES | | | | | effective_date | date | YES | | NULL | | | created_on | datetime | YES | | NULL | | | updated_on | datetime | YES | | NULL | | | wiki_page_title | varchar(255) | YES | | NULL | | | status | varchar(255) | YES | | open | | | sharing | varchar(255) | NO | MUL | none | | | sprint_start_date | date | YES | | NULL | | | in_timesheet | tinyint(1) | NO | | 0 | | | is_order | tinyint(1) | NO | | 0 | | +-------------------+--------------+------+-----+---------+----------------+ 13 rows in set (0.00 sec)
mysql> select id, project_id, name, status, sharing, in_timesheet, is_order from versions; +----+------------+------+--------+---------+--------------+----------+ | id | project_id | name | status | sharing | in_timesheet | is_order | +----+------------+------+--------+---------+--------------+----------+ | 1 | 1 | V1.0 | open | none | 0 | 0 | | 2 | 1 | 1.1 | open | none | 0 | 0 | | 3 | 2 | 1.0 | open | none | 0 | 0 | | 4 | 1 | 1.2 | open | none | 0 | 0 | +----+------------+------+--------+---------+--------------+----------+ 4 rows in set (0.00 sec)
-- In the settings of a project there's a mandatory field "is_order". You can set it to Yes or No. -- But in the database the column is_order is always 0, as above. -- I tried to set it to 1 via MySQL. But for the reported error it makes no difference, -- even if I create a log entry which references an issue which has this version as its target.
mysql> update versions set is_order = 1 WHERE id = 4; Query OK, 0 rows affected (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 0
mysql> commit; Query OK, 0 rows affected (0.00 sec)
mysql> select id, project_id, name, status, sharing, in_timesheet, is_order from versions; +----+------------+------+--------+---------+--------------+----------+ | id | project_id | name | status | sharing | in_timesheet | is_order | +----+------------+------+--------+---------+--------------+----------+ | 1 | 1 | V1.0 | open | none | 0 | 0 | | 2 | 1 | 1.1 | open | none | 0 | 0 | | 3 | 2 | 1.0 | open | none | 0 | 0 | | 4 | 1 | 1.2 | open | none | 0 | 1 | +----+------------+------+--------+---------+--------------+----------+ 4 rows in set (0.00 sec)
mysql> mysql> select id, login, admin from users where id = 4; +----+---------------+-------+ | id | login | admin | +----+---------------+-------+ | 4 | karsten.wolff | 0 | +----+---------------+-------+ 1 row in set (0.00 sec)
mysql> mysql> SELECT p.id, p.name, p.is_public, p.parent_id, p.status, p.lft, p.rgt, p.inherit_members FROM projects p; +----+--------------+-----------+-----------+--------+------+------+-----------------+ | id | name | is_public | parent_id | status | lft | rgt | inherit_members | +----+--------------+-----------+-----------+--------+------+------+-----------------+ | 1 | Gelsenwasser | 0 | NULL | 1 | 3 | 4 | 1 | | 2 | Timesheets | 1 | NULL | 1 | 5 | 6 | 0 | | 3 | Expenses | 1 | NULL | 1 | 1 | 2 | 0 | +----+--------------+-----------+-----------+--------+------+------+-----------------+ 3 rows in set (0.00 sec)
mysql> mysql> select id, project_id, user_id, issue_id, activity_id, order_id, order_activity_id from time_entries; +----+------------+---------+----------+-------------+----------+-------------------+ | id | project_id | user_id | issue_id | activity_id | order_id | order_activity_id | +----+------------+---------+----------+-------------+----------+-------------------+ | 1 | 1 | 4 | NULL | 8 | NULL | 8 | | 2 | 1 | 4 | NULL | 8 | NULL | 8 | | 3 | 1 | 4 | NULL | 8 | NULL | 8 | | 4 | 1 | 4 | NULL | 8 | NULL | 8 | | 5 | 1 | 4 | NULL | 8 | NULL | 8 | | 6 | 1 | 4 | NULL | 9 | NULL | 9 | | 7 | 1 | 4 | NULL | 9 | NULL | 9 | | 8 | 1 | 4 | NULL | 9 | NULL | 9 | | 9 | 1 | 4 | NULL | 9 | NULL | 9 | | 10 | 1 | 4 | NULL | 9 | NULL | 9 | | 11 | 1 | 4 | NULL | 9 | NULL | 9 | | 12 | 1 | 4 | 1 | 9 | NULL | 9 | | 13 | 1 | 1 | 8 | 8 | NULL | NULL | | 14 | 1 | 1 | 8 | 8 | NULL | NULL | | 15 | 1 | 1 | 12 | 9 | NULL | NULL | +----+------------+---------+----------+-------------+----------+-------------------+ 15 rows in set (0.00 sec)
====== End Log from MySql session ======
Do I miss some configuration or enties in the database? As of now I can't see the interesting dialogs like Order Management or Timesheets.
Reply to this email directly or view it on GitHub https://github.com/maxrossello/redmine_app_timesheets/issues/37.
@greyman888, Thank you. This was a good hint. When I restarted my virtual machine this morning, the missing applications appeared and I could enable them.
Now I can see the order management and the timesheet application.
There are still some problems:
Example: mysql> update versions set is_order = 1 WHERE id = 7; mysql> commit;
- In the order management I have enabled these local orders. In the database _versions.intimesheet is then set to 1. That is ok.
I have created some global orders in the order management application and shared them.
When I go to the Timesheet application I'm offered only the local orders, but no global orders.
How can I get the global orders in the choice list?
My current content of table versions:
mysql> select id, project_id, name, status, sharing, in_timesheet, is_order from versions;
+----+------------+------------------+--------+---------+--------------+----------+
| id | project_id | name | status | sharing | in_timesheet | is_order |
+----+------------+------------------+--------+---------+--------------+----------+
| 1 | 1 | V1.0 | open | none | 0 | 0 |
| 2 | 1 | 1.1 | open | none | 0 | 0 |
| 4 | 1 | 1.2 | open | none | 1 | 1 |
| 5 | 2 | Sick leave | open | system | 1 | 1 |
| 6 | 2 | Vacation (payed) | open | system | 1 | 1 |
| 7 | 1 | GW1.3 | open | none | 1 | 1 |
| 8 | 2 | Global Order1 | open | system | 1 | 1 |
+----+------------+------------------+--------+---------+--------------+----------+
7 rows in set (0.00 sec)
mysql>
I can only use the two local versions with id 4 and 7 in the order choice list of the Timesheet application.
Hi, I'll try to give an answer in points.
Applications: redmine_app__space provides the framework that the timesheet plugin then uses. The "framework" offers the possibility to access Redmine blocks (those you can display in the dashboard at /my/page) as applications in the app menu out of the box, but these are non functional to timesheets, which are a different thing. The timesheet plugin provides the Timesheets and the Orders apps for daily data input and administration, respectively.
As a general rule, better restart the web server (Apache, passenger, ...) for every change you apply.
If I log in as a user without administration rights, I get the error which is the subject of this issue.
Mysql complains the query because it is missing the time_entries table. If we manually run the query and substitute this:
SELECT `projects`.* FROM `projects` WHERE ((time_entries.order_id IN (''))....
with this:
SELECT `projects`.* FROM `projects`, `time_entries` WHERE ((time_entries.order_id IN (''))...
then Mysql does not complain any more. The problem is: I can't reproduce such a situation. Line 53 in lib/timesheets_app_project_patch.rb is
if user.logged? and !user.admin? and (permission == :view_time_entries)
which means that we are extending the query condition only when there is a time_entry context. Is there any other plugin that may interfere with this? Can you try disabling other plugins one at a time in order to detect possible incompatibilities?
_although I set Is Order to Yes in the database isorder is 0
looks like you didn't restart the web server before doing this. Mixins may get lost if you change code and don't restart the server. May this be the case?
When I go to the Timesheet application I'm offered only the local orders, but no global orders
To keep admins browsing a bit less confusing due to too many orders listed, it is required, even to admins, to be configured into each order so that they can view that in the timesheet view. From the orders application, click on the config link and add users and/or groups.
Thank you for your reply. In the meantime I have setup Redmine step by step. As a database I use now PostgreSql. In the Bitnami stack, which I did my tests in before, it was a MySql database.
Now it looks much better. The error this bug is titled from is gone. Therefore I close it now.
I found another problem, for that I opened a new ticket #38.
I did a fresh installation of the plugin
redmine_app_timesheets
. Version is 1.4.6.The migration had no errors. See the log below:
As an admin user I configured the
redmine_app_timesheets
plugin so that it uses the project "Timesheets" as its backing workspace. The project Timesheets has only module "Time tracking" enabled.The configuration of the
redmine_app__space plugin
shows the following application. I enabled all of them with Auth Group = (everybody): Activity, Assigned issues, Calendar, News, Reported issues, Spent time, Watched issues. Should there be more applications?Then I logged in as an user without admin rights. This produced an internal error. The log says:
Then I logged into the Mysql database to check the query. The table time_entries should be somewhere in a FROM clause, I guess.
There are some comments in the log.
Do I miss some configuration or enties in the database? As of now I can't see the interesting dialogs like Order Management or Timesheets.