Project

General

Profile

time_entry

Added by Konstantin Ladutenko almost 9 years ago

Hi,

Sorry, was not able to find anything on my topic in the forum archive. I am trying to make our redmine installation to work with https://github.com/panicinc/issue_hot_buttons plugin. I checked https://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries , moreover log shows no error on the plugin time tracking. However, time record does not appear. Any ideas?

Best regards,
Kostya

Started POST "/time_entries" for 10.0.0.5 at 2015-12-30 01:17:43 +0400
Processing by TimelogController#create as JS
Parameters: {"time_entry"=>{"issue_id"=>"472", "spent_on"=>"2015-12-30", "hours"=>"1", "activity_id"=>""}, "authenticity_token"=>"N1Sa96tt+tg66
MNlheaypz01i8RWBiKb8k4OElSIuqk="}
Current user: k.ladutenko (id=8)
Rendered timelog/_form.html.erb (10.4ms)
Rendered timelog/new.html.erb within layouts/base (17.5ms)
Rendered inline template (0.7ms)
Rendered plugins/redmine_wiki_extensions/app/views/wiki_extensions/_html_header.html.erb (0.9ms)
Rendered plugins/redmine_favourite_projects/app/views/favourite_projects/_favourite_projects_searchbox_partial.html.erb (0.1ms)
Rendered plugins/redmine_favourite_projects/app/views/favourite_projects/_update_menu.erb (0.0ms)
Rendered plugins/redmine_wiki_extensions/app/views/wiki_extensions/_body_bottom.html.erb (0.1ms)
Completed 200 OK in 152.6ms (Views: 120.3ms | ActiveRecord: 13.4ms)

nvironment:
Redmine version 2.5.2.stable
Ruby version 2.1.2-p95 (2014-05-08) [x86_64-linux]
Rails version 3.2.19
Environment production
Database adapter Mysql2
SCM:
Subversion 1.6.11
Mercurial 1.4
Git 1.7.1
Filesystem
Redmine plugins:
issue_hot_buttons 0.4.4
project_section 0.0.1b
redmine_checklists 3.1.3
redmine_default_assign 0.5
redmine_favourite_projects 0.7
redmine_issue_reminder 0.0.1
redmine_knowledgebase 3.0.4
redmine_lightbox 0.0.1
redmine_meeting_room_calendar 3.0.0
redmine_todos 2.0.5
redmine_wiki_extensions 0.6.5
status_button 0.1.0


Replies (1)

RE: time_entry - Added by Konstantin Ladutenko almost 9 years ago

Hmm..

I managed to make it work, the key was to send POST to /time_entries.json

The related part of plugin:

     var post_data = {
        'time_entry[issue_id]': t.issue.issue.id,
        'time_entry[spent_on]': t.today,
        'time_entry[hours]': working_hours,
        'authenticity_token': $$P('input[name="authenticity_token"]').first().value
      };

//      alert(JSON.stringify(t.issue))
//      alert(JSON.stringify(new Hash(post_data)));

      var request_url = '/time_entries.json'; /* ['/projects', t.project.identifier, 'time_entries/new'].join('/'); */

// Submit issue form!
      new Ajax.Request(request_url, {
        method: 'post',
        parameters: new Hash(post_data),
        onComplete: function(response) {
          window.onbeforeunload = null;
          window.location.href = window.location.href;
        }
      });
    (1-1/1)