dhanasingh / redmine_wktime

ERPmine is an open source free ERP for Service Industries. It runs within Redmine
https://erpmine.org/
Other
120 stars 78 forks source link

Import Issue failing with NoMethodError undefined method `spent_on' #246

Closed sparker67 closed 3 years ago

sparker67 commented 3 years ago

When trying to Import issues, even when using the issues.csv file found in the "How To Import Issues" wiki HowTo_import_issues, it fails with 0/1 (in this case). I have tried with a number of different CSV files, and always get the same results. This is done from the "Import" menu item on the actions "..." on the "Items" tab. This is the log when using issues.csv from the wiki (see below) :

I, [2021-07-12T14:36:55.227105 #486340] INFO -- : Started POST "/imports/c3ec18bbebcd65c763e25b1da254f4da/mapping" for 127.0.0.1 at 2021-07-12 14:36:55 +1000
I, [2021-07-12T14:36:55.228232 #486340] INFO -- : Processing by ImportsController#mapping as HTML
I, [2021-07-12T14:36:55.228357 #486340] INFO -- : Parameters: {"utf8"=>"✓", "authenticity_token"=>"TOifAYGuGBBaTxQgbfNYsB_BYw_GnbaTIJXN0bopjIEcslAQGaY9KgQD09dUfNmtzSHbIlCI2jAuUUSTYaOGdA", "import_settings"=>{"mapping"=>{"project_id"=>"251", "tracker"=>"0", "status"=>"1", "subject"=>"3", "description"=>"", "priority"=>"2", "category"=>"6", "assigned_to"=>"5", "fixed_version"=>"7", "is_private"=>"12", "start_date"=>"8", "due_date"=>"9", "estimated_hours"=>"10", "done_ratio"=>"", "cf_41"=>"", "unique_id"=>"", "parent_issue_id"=>"", "relation_duplicates"=>"", "relation_duplicated"=>"", "relation_blocks"=>"", "relation_blocked"=>"", "relation_relates"=>"", "relation_precedes"=>"", "relation_follows"=>"", "relation_copied_to"=>"", "relation_copied_from"=>""}}, "commit"=>"Import", "id"=>"c3ec18bbebcd65c763e25b1da254f4da"}
I, [2021-07-12T14:36:55.247370 #486340] INFO -- : Current user: sparker (id=42)
I, [2021-07-12T14:36:55.265696 #486340] INFO -- : Redirected to http://127.0.0.1:9292/imports/c3ec18bbebcd65c763e25b1da254f4da/run
I, [2021-07-12T14:36:55.266009 #486340] INFO -- : Completed 302 Found in 38ms (ActiveRecord: 20.6ms)
I, [2021-07-12T14:36:55.276593 #486340] INFO -- : Started GET "/imports/c3ec18bbebcd65c763e25b1da254f4da/run" for 127.0.0.1 at 2021-07-12 14:36:55 +1000
I, [2021-07-12T14:36:55.278065 #486340] INFO -- : Processing by ImportsController#run as HTML
I, [2021-07-12T14:36:55.278211 #486340] INFO -- : Parameters: {"id"=>"c3ec18bbebcd65c763e25b1da254f4da"}
I, [2021-07-12T14:36:55.285621 #486340] INFO -- : Current user: sparker (id=42)
I, [2021-07-12T14:36:55.297859 #486340] INFO -- : Rendering imports/run.html.erb within layouts/base
I, [2021-07-12T14:36:55.305364 #486340] INFO -- : Rendered issues/_sidebar.html.erb (5.7ms)
I, [2021-07-12T14:36:55.305639 #486340] INFO -- : Rendered imports/_issues_sidebar.html.erb (6.5ms)
I, [2021-07-12T14:36:55.306148 #486340] INFO -- : Rendered imports/run.html.erb within layouts/base (8.1ms)
I, [2021-07-12T14:36:55.313883 #486340] INFO -- : Rendered plugins/redmine_wiki_extensions/app/views/wiki_extensions/_html_header.html.erb (0.5ms)
I, [2021-07-12T14:36:55.315878 #486340] INFO -- : Rendered plugins/redmine_wktime/app/views/wkbase/_base_header.html.erb (1.4ms)
I, [2021-07-12T14:36:55.316978 #486340] INFO -- : Rendered plugins/stopwatch/app/views/stopwatch/hooks/_layouts_base_html_head.html.erb (0.6ms)
I, [2021-07-12T14:36:55.318366 #486340] INFO -- : Rendered plugins/clipboard_image_paste/app/views/clipboard_image_paste/_headers.html.erb (0.9ms)
I, [2021-07-12T14:36:55.318711 #486340] INFO -- : Rendering plugins/wiki_graphviz_plugin/app/views/wiki_graphviz/_head.html.erb
I, [2021-07-12T14:36:55.319291 #486340] INFO -- : Rendered plugins/wiki_graphviz_plugin/app/views/wiki_graphviz/_head.html.erb (0.4ms)
I, [2021-07-12T14:36:55.465763 #486340] INFO -- : Rendered plugins/redmine_hourglass/app/views/hooks/_account_menu_link.slim (0.2ms)
I, [2021-07-12T14:36:55.469685 #486340] INFO -- : Rendered plugins/redmine_wktime/app/views/wktime/_attendance_widget.html.erb (3.7ms)
I, [2021-07-12T14:36:55.470028 #486340] INFO -- : Rendered plugins/sidebar_hide/app/views/sidebar/_hideButton_partial.html.erb (0.2ms)
I, [2021-07-12T14:36:55.470440 #486340] INFO -- : Rendered plugins/redmine_wiki_extensions/app/views/wiki_extensions/_body_bottom.html.erb (0.1ms)
I, [2021-07-12T14:36:55.471643 #486340] INFO -- : Rendered plugins/stopwatch/app/views/stopwatch/hooks/_layouts_base_body_bottom.html.erb (1.0ms)
I, [2021-07-12T14:36:55.473999 #486340] INFO -- : Rendered plugins/clipboard_image_paste/app/views/clipboard_image_paste/_add_form.html.erb (2.1ms)
I, [2021-07-12T14:36:55.474275 #486340] INFO -- : Completed 200 OK in 196ms (Views: 149.7ms | ActiveRecord: 33.7ms)
I, [2021-07-12T14:36:55.594192 #486340] INFO -- : Started POST "/imports/c3ec18bbebcd65c763e25b1da254f4da/run.js" for 127.0.0.1 at 2021-07-12 14:36:55 +1000
I, [2021-07-12T14:36:55.594923 #486340] INFO -- : Processing by ImportsController#run as JS
I, [2021-07-12T14:36:55.594991 #486340] INFO -- : Parameters: {"id"=>"c3ec18bbebcd65c763e25b1da254f4da"}
I, [2021-07-12T14:36:55.599460 #486340] INFO -- : Current user: sparker (id=42)
I, [2021-07-12T14:36:55.745410 #486340] INFO -- : Completed 500 Internal Server Error in 150ms (ActiveRecord: 31.3ms)
F, [2021-07-12T14:36:55.746061 #486340] FATAL -- : 
F, [2021-07-12T14:36:55.746241 #486340] FATAL -- : NoMethodError (undefined method `spent_on' for #<Issue:0x00007f82239c1650>
Did you mean? spent_hours):
F, [2021-07-12T14:36:55.746290 #486340] FATAL -- : 
F, [2021-07-12T14:36:55.746337 #486340] FATAL -- : plugins/redmine_wktime/app/helpers/wktime_helper.rb:1956:in `statusValidation'
plugins/redmine_wktime/init.rb:85:in `block in run'
app/models/import.rb:142:in `block in read_items'
app/models/import.rb:254:in `block in read_rows'
app/models/import.rb:253:in `read_rows'
app/models/import.rb:136:in `read_items'
plugins/redmine_wktime/init.rb:72:in `run'
app/controllers/imports_controller.rb:87:in `run'
lib/redmine/sudo_mode.rb:61:in `sudo_mode'

This is our setup:


Environment:
Redmine version 4.2.1.stable
Ruby version 2.6.7-p197 (2021-04-05) [x86_64-linux]
Rails version 5.2.5
Environment production
Database adapter Mysql2
Mailer queue ActiveJob::QueueAdapters::AsyncAdapter
Mailer delivery smtp
SCM:
Subversion 1.14.1
Git 2.31.1
Filesystem 
Redmine plugins:
clipboard_image_paste 1.13
gerrit_connector 0.1.0
redmine_base_deface 1.5.3
redmine_hourglass 1.1.2+develop
redmine_wiki_extensions 0.9.2
redmine_wktime 4.2.1
sidebar_hide 0.0.8
stopwatch 0.1.0
wiki_graphviz_plugin 0.8.0

This is the issues.csv file

"Tracker","Status","Priority","Subject","Author","Assignee","Category","Target version","Start date","Due date","Estimated time","Related issues","Private"
"Task","Open","Normal","Testing import of an issue","Some Author","Some assignee",,"some_version","2017-02-01","2017-02-10","16.00",,"No"
amutha1997 commented 3 years ago

We will fix it in the next release, in the mean time, can you replace this file init.rb in plugins/redmine_wktime/init.rb

init.zip

sparker67 commented 3 years ago

Thank you. We'll put this in today, and I'll let you know how it went.

sparker67 commented 3 years ago

After putting the file in, Redmine refuses to start. It looks we are missing a patch. Does this mean anything to you?

Jul 13 08:45:10 redmine.server.com puma[508626]: Puma starting in single mode...
Jul 13 08:45:10 redmine.server.com puma[508626]: * Puma version: 5.3.1 (ruby 2.6.7-p197) ("Sweetnighter")
Jul 13 08:45:10 redmine.server.com puma[508626]: *  Min threads: 0
Jul 13 08:45:10 redmine.server.com puma[508626]: *  Max threads: 5
Jul 13 08:45:10 redmine.server.com puma[508626]: *  Environment: production
Jul 13 08:45:10 redmine.server.com puma[508626]: *          PID: 508626
Jul 13 08:45:13 redmine.server.com puma[508626]: ! Unable to load application: LoadError: No such file to load -- timelog_helper_patch.rb
Jul 13 08:45:13 redmine.server.com puma[508626]: /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require': No such file to load -- timelog_helper_patch.rb (LoadError)
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:291:in `block in require'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:257:in `load_dependency'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:291:in `require'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:378:in `block in require_or_load'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:37:in `block in load_interlock'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/dependencies/interlock.rb:13:in `loading'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:37:in `load_interlock'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:356:in `require_or_load'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:334:in `depend_on'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:246:in `require_dependency'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /usr/share/webapps/redmine/plugins/redmine_wktime/init.rb:13:in `<top (required)>'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:291:in `block in require'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:257:in `load_dependency'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:291:in `require'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /usr/share/webapps/redmine/lib/redmine/plugin.rb:187:in `block in load'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /usr/share/webapps/redmine/lib/redmine/plugin.rb:178:in `each'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /usr/share/webapps/redmine/lib/redmine/plugin.rb:178:in `load'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /usr/share/webapps/redmine/config/initializers/30-redmine.rb:20:in `<top (required)>'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:285:in `load'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:285:in `block in load'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:257:in `load_dependency'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/dependencies.rb:285:in `load'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/engine.rb:663:in `block in load_config_initializer'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.5/lib/active_support/notifications.rb:170:in `instrument'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/engine.rb:662:in `load_config_initializer'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/engine.rb:619:in `each'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/engine.rb:619:in `block in <class:Engine>'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/initializable.rb:32:in `instance_exec'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/initializable.rb:32:in `run'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/initializable.rb:61:in `block in run_initializers'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/2.6.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/2.6.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/initializable.rb:50:in `each'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/initializable.rb:50:in `tsort_each_child'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/2.6.0/tsort.rb:415:in `call'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/2.6.0/tsort.rb:415:in `each_strongly_connected_component_from'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/2.6.0/tsort.rb:347:in `each'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/2.6.0/tsort.rb:347:in `call'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/initializable.rb:60:in `run_initializers'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/application.rb:361:in `initialize!'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /usr/share/webapps/redmine/config/environment.rb:16:in `<top (required)>'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from config.ru:3:in `block in <main>'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/puma-5.3.1/lib/puma/configuration.rb:345:in `load_rackup'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/puma-5.3.1/lib/puma/configuration.rb:267:in `app'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/puma-5.3.1/lib/puma/runner.rb:143:in `load_and_bind'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/puma-5.3.1/lib/puma/single.rb:44:in `run'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/puma-5.3.1/lib/puma/launcher.rb:181:in `run'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/puma-5.3.1/lib/puma/cli.rb:80:in `run'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/lib/ruby/gems/2.6.0/gems/puma-5.3.1/bin/puma:10:in `<top (required)>'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/bin/puma:23:in `load'
Jul 13 08:45:13 redmine.server.com puma[508626]:         from /opt/ruby2.6/bin/puma:23:in `<main>'
sparker67 commented 3 years ago

Got it. We needed to grab the latest redmine_wktime version (4.3) and apply init.rb to that. Once we did that, it all works. Thanks.