Project

General

Profile

Timesheet works only for Admin after upgrade

Added by Stamu Stamu about 13 years ago

Hi all,
After I did upgrade from 1.0.1 to 1.3 my timesheet plugin stopped to work for common users.
It works only for Admins.
This is the error log

Processing TimesheetController#index (for 192.168.7.61 at 2011-12-23 16:44:45) [GET]
  Parameters: {"action"=>"index", "controller"=>"timesheet"}
NoMethodError (undefined method `visible_by' for #<Class:0x4424aa8>):
  vendor/plugins/timesheet_plugin/app/controllers/timesheet_controller.rb:126:in `allowed_projects'
  vendor/plugins/timesheet_plugin/app/controllers/timesheet_controller.rb:25:in `index'
  config/initializers/mongrel.rb:62:in `dispatch_cgi'
Rendering C:/utils/redmine/public/500.html (500 Internal Server Error)

How can I solve this problem?

Thanks,
Constantin


Replies (6)

RE: Timesheet works only for Admin after upgrade - Added by Viktor Tönköl almost 13 years ago

Hi Constantin,

We had the same issue, but we had found an easy solution.

Administration -> Plugins -> Timesheet plugin Configure

Here change the option for "Projects with the status" from All to Active.
Apply.
Now change back to All.
Apply.

Now the timesheet plugin should work.

def allowed_projects
if User.current.admin?
:) Project.timesheet_order_by_name
elsif Setting.plugin_timesheet_plugin['project_status'] == 'all'
:) Project.timesheet_order_by_name.timesheet_with_membership(User.current)
else
:( Project.timesheet_order_by_name.all(:conditions => Project.visible_by(User.current))
end
end

Regards,
Viktor

RE: Timesheet works only for Admin after upgrade - Added by Perrier T almost 13 years ago

Viktor Tönköl wrote:

Hi Constantin,

We had the same issue, but we had found an easy solution.

Administration -> Plugins -> Timesheet plugin Configure

Here change the option for "Projects with the status" from All to Active.
Apply.
Now change back to All.
Apply.

Now the timesheet plugin should work.

Regards,
Viktor

Worked, thanks!

RE: Timesheet works only for Admin after upgrade - Added by Stamu Stamu almost 13 years ago

Hi,
thanks for help, but don't have such option like "Projects with the status" in TimeSheetPlugin Configure.
All I have is:
Settings: Timesheet Plugin
"List size" and "Number precision".
Timesheet Plugin version is "0.6.0"

Where can I find that setting ?

Thanks,
Constantin

RE: Timesheet works only for Admin after upgrade - Added by Patrick Figel almost 13 years ago

Try to fetch the latest version of the plugin from https://github.com/edavis10/redmine-timesheet-plugin
That's what I'm running and the "Projects with the status" option is included.

RE: Timesheet works only for Admin after upgrade - Added by Max Ognev almost 13 years ago

in file timesheet_controller.rb replace

def allowed_projects
if User.current.admin?
return Project.find(:all, :order => 'name ASC')
else
return Project.find(:all, :conditions => Project.visible_condition(User.current), :order => 'name ASC')
end
end

In redmine 1.3 Project.visible_by was replace Project.visible_condition

RE: Timesheet works only for Admin after upgrade - Added by Stamu Stamu almost 13 years ago

Hi all,
thanks for help.
I updated timisheet to last trunk version switch on/off "Projects with the status" and it worked.

Thanks again :),
Constantin

    (1-6/6)