redmine_importer icon indicating copy to clipboard operation
redmine_importer copied to clipboard

Compatible with Redmine 2.x

Open logical-and opened this issue 13 years ago • 31 comments

First, I want to thank author for this module. Really necessary thing.

Are you planning to make the module compatible with Redmine 2.x? I can help you, if you need it, although Ruby isn`t my primary language.

Thanks!

logical-and avatar Jun 24 '12 12:06 logical-and

hello, logical-and, I add a routes.rb in config folder,and it can be add module in redmine 2.0.3, but, when i enter the module under the project, they are blank. May you give me some advice?

mikewolfli avatar Jun 25 '12 02:06 mikewolfli

Hi Mikewolfli!

I can remember this problem. I dont know what really changed in Ruby or Rails (I am not Ruby programmer), but found the root of the evil. =) Look on the form open - it need to opened (open and output) with <%= , not <%

I try this way (editing and fixing), and think that better way can be found. Look on this commit: https://github.com/ksauzz/redmine_importer/commit/49d078fed2807c56e36d40320bb4045a11b9d980

Try to use https://github.com/ksauzz/redmine_importer/tree/redmine2.x instead. It seems to be compatible with Redmine 2.x.

Wait for your reply. =)

logical-and avatar Jun 25 '12 07:06 logical-and

Hello logical-and. Thank you very much. I use this one https://github.com/ksauzz/redmine_importer/tree/redmine2.x. And it works very well. my environment is : Environment: Redmine version 2.0.3.stable.9882 Ruby version 1.8.7 (i686-linux) Rails version 3.2.6 Environment production Database adapter PostgreSQL

mikewolfli avatar Jun 26 '12 03:06 mikewolfli

Hello logical-and. Thank you very much. I use this one https://github.com/ksauzz/redmine_importer/tree/redmine2.x. And it does not work. My environment is: redmine:2.0.3 ruby: 1.8.7 rails:3.2.6 mysql 5.1.63

Error information: Started POST "/importer/match" for 127.0.0.1 at Tue Jun 26 16:13:41 +0800 2012 Processing by ImporterController#match as HTML Parameters: {"commit"=>"涓婁紶鏂囦欢", "encoding"=>"U", "project_id"=>"2", "authenticity_token"=>"Tw397Mffq7aOcLA7TzlvgqbYwe/KsGU5yzgU3nf3A74=", "utf8"=>"鉁?, "file"=>#<ActionDispatch::Http::UploadedFile:0xa5ec0a0 @tempfile=#File:C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/RackMultipart20120626-4008-1503fgd-0, @headers="Content-Disposition: form-data; name="file"; filename="export.csv"\r\nContent-Type: text/csv\r\n", @content_type="text/csv", @original_filename="export.csv">, "splitter"=>",", "wrapper"=>"""} Completed 500 Internal Server Error in 31ms

NameError (uninitialized constant ImporterController::CSV): plugins/redmine_importer/app/controllers/importer_controller.rb:68:in match' actionpack (3.2.6) lib/action_controller/metal/implicit_render.rb:4:insend_action' actionpack (3.2.6) lib/action_controller/metal/implicit_render.rb:4:in send_action' actionpack (3.2.6) lib/abstract_controller/base.rb:167:inprocess_action' actionpack (3.2.6) lib/action_controller/metal/rendering.rb:10:in process_action' actionpack (3.2.6) lib/abstract_controller/callbacks.rb:18:inprocess_action'

activesupport (3.2.6) lib/active_support/callbacks.rb:458:in `_run__233701135__process_action__999454627__callbacks'

activesupport (3.2.6) lib/active_support/callbacks.rb:405:in send' activesupport (3.2.6) lib/active_support/callbacks.rb:405:in__run_callback' activesupport (3.2.6) lib/active_support/callbacks.rb:385:in _run_process_action_callbacks' activesupport (3.2.6) lib/active_support/callbacks.rb:81:insend' activesupport (3.2.6) lib/active_support/callbacks.rb:81:in run_callbacks' actionpack (3.2.6) lib/abstract_controller/callbacks.rb:17:inprocess_action'

actionpack (3.2.6) lib/action_controller/metal/rescue.rb:29:in process_action ' actionpack (3.2.6) lib/action_controller/metal/instrumentation.rb:30:inprocess_action' activesupport (3.2.6) lib/active_support/notifications.rb:123:in instrument' activesupport (3.2.6) lib/active_support/notifications/instrumenter.rb:20:ininstrument' activesupport (3.2.6) lib/active_support/notifications.rb:123:in instrument' actionpack (3.2.6) lib/action_controller/metal/instrumentation.rb:29:inprocess_action' actionpack (3.2.6) lib/action_controller/metal/params_wrapper.rb:206:in process_action' activerecord (3.2.6) lib/active_record/railties/controller_runtime.rb:18:inprocess_action' actionpack (3.2.6) lib/abstract_controller/base.rb:121:in process' actionpack (3.2.6) lib/abstract_controller/rendering.rb:45:inprocess' actionpack (3.2.6) lib/action_controller/metal.rb:203:in dispatch' actionpack (3.2.6) lib/action_controller/metal/rack_delegation.rb:14:indispatch' actionpack (3.2.6) lib/action_controller/metal.rb:246:in action' actionpack (3.2.6) lib/action_dispatch/routing/route_set.rb:73:incall' actionpack (3.2.6) lib/action_dispatch/routing/route_set.rb:73:in dispatch' actionpack (3.2.6) lib/action_dispatch/routing/route_set.rb:36:incall' journey (1.0.4) lib/journey/router.rb:68:in call' journey (1.0.4) lib/journey/router.rb:56:ineach' journey (1.0.4) lib/journey/router.rb:56:in call' actionpack (3.2.6) lib/action_dispatch/routing/route_set.rb:600:incall' rack-openid (1.3.1) lib/rack/openid.rb:98:in call' actionpack (3.2.6) lib/action_dispatch/middleware/best_standards_support.rb:17:incall' rack (1.4.1) lib/rack/etag.rb:23:in call' rack (1.4.1) lib/rack/conditionalget.rb:35:incall' actionpack (3.2.6) lib/action_dispatch/middleware/head.rb:14:in call' actionpack (3.2.6) lib/action_dispatch/middleware/params_parser.rb:21:incall ' actionpack (3.2.6) lib/action_dispatch/middleware/flash.rb:242:in call' rack (1.4.1) lib/rack/session/abstract/id.rb:205:incontext' rack (1.4.1) lib/rack/session/abstract/id.rb:200:in call' actionpack (3.2.6) lib/action_dispatch/middleware/cookies.rb:338:incall' activerecord (3.2.6) lib/active_record/query_cache.rb:64:in call' activerecord (3.2.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:473:incall' actionpack (3.2.6) lib/action_dispatch/middleware/callbacks.rb:28:in call' activesupport (3.2.6) lib/active_support/callbacks.rb:405:in_run__397314981__call__4__callbacks' activesupport (3.2.6) lib/active_support/callbacks.rb:405:in send' activesupport (3.2.6) lib/active_support/callbacks.rb:405:in__run_callback' activesupport (3.2.6) lib/active_support/callbacks.rb:385:in _run_call_callbacks' activesupport (3.2.6) lib/active_support/callbacks.rb:81:insend' activesupport (3.2.6) lib/active_support/callbacks.rb:81:in run_callbacks' actionpack (3.2.6) lib/action_dispatch/middleware/callbacks.rb:27:incall' actionpack (3.2.6) lib/action_dispatch/middleware/remote_ip.rb:31:in call' actionpack (3.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:16:incall' actionpack (3.2.6) lib/action_dispatch/middleware/show_exceptions.rb:56:in call' railties (3.2.6) lib/rails/rack/logger.rb:26:incall_app' railties (3.2.6) lib/rails/rack/logger.rb:16:in call' actionpack (3.2.6) lib/action_dispatch/middleware/request_id.rb:22:incall' rack (1.4.1) lib/rack/methodoverride.rb:21:in call' rack (1.4.1) lib/rack/runtime.rb:17:incall' activesupport (3.2.6) lib/active_support/cache/strategy/local_cache.rb:72:in call' rack (1.4.1) lib/rack/lock.rb:15:incall' actionpack (3.2.6) lib/action_dispatch/middleware/static.rb:62:in call' rack-cache (1.2) lib/rack/cache/context.rb:136:inforward' rack-cache (1.2) lib/rack/cache/context.rb:143:in pass' rack-cache (1.2) lib/rack/cache/context.rb:155:ininvalidate' rack-cache (1.2) lib/rack/cache/context.rb:71:in call!' rack-cache (1.2) lib/rack/cache/context.rb:51:incall' railties (3.2.6) lib/rails/engine.rb:479:in call' railties (3.2.6) lib/rails/application.rb:220:incall' rack (1.4.1) lib/rack/content_length.rb:14:in call' railties (3.2.6) lib/rails/rack/log_tailer.rb:17:incall' rack (1.4.1) lib/rack/handler/webrick.rb:59:in service' D:/Ruby187/lib/ruby/1.8/webrick/httpserver.rb:104:inservice' D:/Ruby187/lib/ruby/1.8/webrick/httpserver.rb:65:in run' D:/Ruby187/lib/ruby/1.8/webrick/server.rb:173:instart_thread' D:/Ruby187/lib/ruby/1.8/webrick/server.rb:162:in start' D:/Ruby187/lib/ruby/1.8/webrick/server.rb:162:instart_thread' D:/Ruby187/lib/ruby/1.8/webrick/server.rb:95:in start' D:/Ruby187/lib/ruby/1.8/webrick/server.rb:92:ineach' D:/Ruby187/lib/ruby/1.8/webrick/server.rb:92:in start' D:/Ruby187/lib/ruby/1.8/webrick/server.rb:23:instart' D:/Ruby187/lib/ruby/1.8/webrick/server.rb:82:in start' rack (1.4.1) lib/rack/handler/webrick.rb:13:inrun' rack (1.4.1) lib/rack/server.rb:265:in start' railties (3.2.6) lib/rails/commands/server.rb:70:instart' railties (3.2.6) lib/rails/commands.rb:55 railties (3.2.6) lib/rails/commands.rb:50:in tap' railties (3.2.6) lib/rails/commands.rb:50 script/rails:6:inrequire' script/rails:6

xiezj avatar Jun 26 '12 08:06 xiezj

@Mikewolfli, have you tried to import the files? Is it work properly? When I have tried to run the plugin, I got the problem as xiezj. When he solve this probled, he got the next error with String.force_encoding("UTF-8"). I google the probled and found, that only Ruby 1.9.x has this method.

@xiezj, add require 'csv' to importer_controller.rb How it work on commiter PC, I dont know.

Can we contact ksauzz?

logical-and avatar Jun 26 '12 08:06 logical-and

@logical-and The force_encoding error seems to be from empty cells -- here's my error log:

Completed 500 Internal Server Error in 46ms

ActionView::Template::Error (undefined method `force_encoding' for nil:NilClass): 74:

75: <% @samples.each do |issue| -%> 76: <tr class="<%= cycle("odd", "even") %>"> 77: <% issue.each do |column| %><%= content_tag 'td', column[1].force_encoding("UTF-8") %><% end %>

So in your CSV, make sure you don't have empty cells and try again, e.g. replace empty cells with text like "None". This worked for me.

dairong avatar Jun 26 '12 09:06 dairong

@dairong What is your environment?

logical-and avatar Jun 26 '12 13:06 logical-and

Hmm. @dairong === @Weddingful ? =)

logical-and avatar Jun 26 '12 19:06 logical-and

Haha yeah sorry. I work at Weddingful, so accidentally posted using our official account.

dairong avatar Jun 26 '12 19:06 dairong

@dairong Aha, ok.

My environment: Redmine 2.0.2 ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux] Rails 3.2.5

But no success on import. Yet.

logical-and avatar Jun 26 '12 19:06 logical-and

sorry, logical-and, Yesterday I just try to import one sample, but no success. I just search for the solution.

mikewolfli avatar Jun 27 '12 01:06 mikewolfli

I has installed the plugin,it sucessed. but it failed when i importered "csv" file (csv file=utf8)

xiezj avatar Jun 27 '12 02:06 xiezj

Removed my previous comment as weddingful, and recreated it here:

My environment:

Redmine 2.x edge from Github (git://github.com/redmine/redmine.git) ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux] Rails 3.2.6 Environment production Database adapter mysql2

dairong avatar Jun 27 '12 02:06 dairong

@logical-and I added require 'csv' to importer_controller.rb , the same error information when i importered csv file

xiezj avatar Jun 27 '12 02:06 xiezj

@mikewolfli Ok, as I though. =) It look strange, if plugin work properly on author PC. I contact him later.

@xiezj Paste, please, the code, where you added require 'csv'

@dairong Ok. We know, you Dai Rong, now. =)

logical-and avatar Jun 27 '12 05:06 logical-and

@logical-and redmine2.0.3/plugins/redmine_importer/app/controllers/importer_controller.rb

-- coding: utf-8 --

require 'tempfile' require 'csv' -------addline

class MultipleIssuesForUniqueValue < Exception end

class NoIssueForUniqueValue < Exception end

xiezj avatar Jun 27 '12 07:06 xiezj

Ok, guys. I've update my environment, add require 'csv' to file top and it works now.

Environment:

  Redmine version                          2.0.2.stable
  Ruby version                             1.9.3 (x86_64-linux)
  Rails version                            3.2.5
  Environment                              production
  Database adapter                         Mysql2

logical-and avatar Jun 30 '12 11:06 logical-and

I also had to remove the references in importer_controller to the "fixed_version" objects (along with the rest of the comments here). Then it worked for me importing the demo standard CSV file, with no Version info.

gregrobbins avatar Jul 17 '12 16:07 gregrobbins

hmm... I also got the force_encoding error... I'm very new to the ruby environment so I might be a tad confused... Is doing a $ service apache2 restart sufficient to re-read the file tweak of: require 'csv' ? I did try rerunning the migrate plugin command as well, making sure to set the rails environment again. The mysql db table appears to be the correct structure. Not sure how to get the kind of error readout @xiezj has.

Started POST "/importer/match" for 75.72.215.175 at Tue Jul 17 20:17:33 -0500 2012 Processing by ImporterController#match as HTML Parameters: {"encoding"=>"U", "file"=>#<ActionDispatch::Http::UploadedFile:0x7f15b4082bd8 @tempfile=#File:/tmp/RackMultipart20120717-30265-16w5axs-0, @content_type="appl ication/octet-stream", @headers="Content-Disposition: form-data; name="file"; filename="AllStandardFields-plain.csv"\r\nContent-Type: application/octet-stream\r\n", @ori ginal_filename="AllStandardFields-plain.csv">, "utf8"=>"✓", "commit"=>"Upload File", "wrapper"=>""", "splitter"=>",", "project_id"=>"16", "authenticity_token"=>"eK+RHcCmqdX t45TLmyuyhiWR2nhx6I6u3gBM3eXto5w="} Completed 500 Internal Server Error in 434ms

NoMethodError (undefined method force_encoding' for #<String:0x7f15b4a47bf0>): plugins/redmine_importer/app/controllers/importer_controller.rb:68:inmatch' actionpack (3.2.6) lib/action_controller/metal/implicit_render.rb:4:in send_action' actionpack (3.2.6) lib/action_controller/metal/implicit_render.rb:4:insend_action' actionpack (3.2.6) lib/abstract_controller/base.rb:167:in process_action' actionpack (3.2.6) lib/action_controller/metal/rendering.rb:10:inprocess_action' actionpack (3.2.6) lib/abstract_controller/callbacks.rb:18:in process_action' activesupport (3.2.6) lib/active_support/callbacks.rb:469:in_run__15213310__process_action__1369529714__callbacks' activesupport (3.2.6) lib/active_support/callbacks.rb:405:in send' activesupport (3.2.6) lib/active_support/callbacks.rb:405:in__run_callback' activesupport (3.2.6) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks' ....... [bunch more stuff]

Environment: Redmine version 2.0.3.devel Ruby version 1.8.7 (x86_64-linux) Rails version 3.2.6 Environment production Database adapter MySQL Redmine plugins: redmine_importer 1.0

git branch

master

  • redmine2.x

*** LOCAL GEMS ***

actionmailer (3.2.6) actionpack (3.2.6) activemodel (3.2.6) activerecord (3.2.6) activeresource (3.2.6) activesupport (3.2.6) arel (3.0.2) builder (3.0.0) bundler (1.1.4) coderay (1.0.7) daemon_controller (1.0.0) erubis (2.7.0) fastercsv (1.5.5) fastthread (1.0.7) hike (1.2.1) i18n (0.6.0) journey (1.0.4) json (1.7.3) mail (2.4.4) mime-types (1.19) multi_json (1.3.6) mysql (2.8.1) mysql2 (0.3.11) net-ldap (0.3.1) passenger (3.0.13) pg (0.14.0) polyglot (0.3.3) prototype-rails (3.2.1) rack (1.4.1) rack-cache (1.2) rack-openid (1.3.1) rack-ssl (1.3.2) rack-test (0.6.1) rails (3.2.6) railties (3.2.6) rake (0.9.2.2) rdoc (3.12) rmagick (2.13.1) ruby-openid (2.1.8) sprockets (2.1.3) sqlite3 (1.3.6) thor (0.15.4) tilt (1.3.3) treetop (1.4.10) tzinfo (0.3.33)

HongPong avatar Jul 18 '12 01:07 HongPong

Hm I tried doing this based on here because "Ruby 1.8 doesn't have the concept of string encodings, so force_encoding would be a no-op" - http://stackoverflow.com/questions/4583924/string-force-encoding-in-ruby-1-8-7-or-rails-2-x Added it near the top of importer_controller.rb :

class String def force_encoding(enc) self end end

and I got:

Started POST "/importer/match" for 75.72.215.175 at Tue Jul 17 20:32:11 -0500 2012 Processing by ImporterController#match as HTML Parameters: {"project_id"=>"16", "commit"=>"Upload File", "splitter"=>",", "encoding"=>"U", "authenticity_token"=>"eK+RHcCmqdXt45TLmyuyhiWR2nhx6I6u3gBM3eXto5w=", "wrapper" =>""", "utf8"=>"✓", "file"=>#<ActionDispatch::Http::UploadedFile:0x7fd9089ddbe8 @tempfile=#File:/tmp/RackMultipart20120717-31881-1mbh8i6-0, @content_type="application/oct et-stream", @headers="Content-Disposition: form-data; name="file"; filename="AllStandardFields2.csv"\r\nContent-Type: application/octet-stream\r\n", @original_filename=" AllStandardFields2.csv">} Completed 500 Internal Server Error in 462ms

CSV::IllegalFormatError (CSV::IllegalFormatError): /usr/lib/ruby/1.8/csv.rb:607:in get_row' /usr/lib/ruby/1.8/csv.rb:556:ineach' /usr/lib/ruby/1.8/csv.rb:127:in collect' /usr/lib/ruby/1.8/csv.rb:127:inparse' plugins/redmine_importer/app/controllers/importer_controller.rb:75:in match' actionpack (3.2.6) lib/action_controller/metal/implicit_render.rb:4:insend_action' actionpack (3.2.6) lib/action_controller/metal/implicit_render.rb:4:in send_action' actionpack (3.2.6) lib/abstract_controller/base.rb:167:inprocess_action' actionpack (3.2.6) lib/action_controller/metal/rendering.rb:10:in process_action' actionpack (3.2.6) lib/abstract_controller/callbacks.rb:18:inprocess_action'

HongPong avatar Jul 18 '12 01:07 HongPong

I upgraded to Redmine 2.1.2 and I'm having all those issues described above. Now I'm at the place described by HongPong... Any news about this issue? Anybody succeeded to make it work with Redmine 2.1?. Here is my config:

Environment: Redmine version 2.1.2.stable Ruby version 1.8.7 (i486-linux) Rails version 3.2.8 Environment production Database adapter MySQL Redmine plugins: jredmine 1.5.1 projects_tree_view 0.0.7 redmine_backlogs v0.9.26 redmine_dmsf 1.4.5 stable redmine_favourite_projects 0.6.1 redmine_gitolite_hook 0.1.1 redmine_importer 1.0 redmine_plugin_views_revisions 0.0.1 redmine_private_wiki 0.2.2 redmine_testlinklink 0.7.1 redmine_wiki_extensions 0.6.0 redmine_xls_export 0.2.1

And I'm using redmine_importer from redmine2.x branch.

As you can see, I have pretty much plug-ins installed, but errors I get looks exactly as described above, so I don't think it is other-plugins-related. Thanks for ANY hint

macmacy avatar Nov 12 '12 10:11 macmacy

OK, in case someone else is also fighting to make it work with Ruby 1.8 and Redmine 2.x, here is my workaround:

  • I started with redmine2.x branch
  • I just removed force_encoding methods from strings (defining force_string as above did not work for me)
  • Installed prototype_legacy_helper plugin to handle "observe_field" function used by this plug-in
  • Used FasterCVS instead of CVS

This is work-around not solution. I'm neither Ruby nor Rails programmer. For decent solution one should probably get rid of observe_field and handle UTF-8 stuff in a way that would work for both Ruby 1.8 and 1.9.

Here are patches for controller:

diff --git a/app/controllers/importer_controller.rb b/app/controllers/importer_controller.rb
index af71783..84a7e13 100644
--- a/app/controllers/importer_controller.rb
+++ b/app/controllers/importer_controller.rb
@@ -1,5 +1,7 @@
 # -*- coding: utf-8 -*-
 require 'tempfile'
+require 'rubygems'
+require 'fastercsv'

 class MultipleIssuesForUniqueValue < Exception
 end
@@ -64,11 +66,10 @@ class ImporterController < ApplicationController
     sample_count = 5
     i = 0
     @samples = []
-    
-    CSV.parse(iip.csv_data.force_encoding("UTF-8"), {:headers=>true,
+  
+    FasterCSV.new(iip.csv_data, { :headers=>true,
     :quote_char=>iip.quote_char, :col_sep=>iip.col_sep}).each do |row|
       @samples[i] = row
-     
       i += 1
       if i >= sample_count
         break
@@ -228,7 +229,7 @@ class ImporterController < ApplicationController
       return
     end

-    CSV.parse(iip.csv_data.force_encoding("UTF-8"), {:headers=>true,
+    FasterCSV.new(iip.csv_data, {:headers=>true, 
         :quote_char=>iip.quote_char, :col_sep=>iip.col_sep}).each do |row|

       project = Project.find_by_name(row[attrs_map["project"]])
@@ -249,7 +250,7 @@ class ImporterController < ApplicationController
         end
         assigned_to = row[attrs_map["assigned_to"]] != nil ? user_for_login!(row[attrs_map["assigned_to"]]) : nil
         fixed_version_name = row[attrs_map["fixed_version"]]
-        fixed_version_id = !fixed_version_name.empty? ? version_id_for_name!(project,fixed_version_name,add_versions) : nil
+        fixed_version_id = fixed_version_name and !fixed_version_name.empty? ? version_id_for_name!(project,fixed_version_name,add_versions) : nil
         watchers = row[attrs_map["watchers"]]
         # new issue or find exists one
         issue = Issue.new

And match.html.erb

diff --git a/app/views/importer/match.html.erb b/app/views/importer/match.html.erb
index 199d93e..b69e4bf 100644
--- a/app/views/importer/match.html.erb
+++ b/app/views/importer/match.html.erb
@@ -74,7 +74,7 @@ END_OF_STRING
    <tbody>
    <% @samples.each do |issue| -%>
    <tr class="<%= cycle("odd", "even") %>">
-       <% issue.each do |column| %><%= content_tag 'td', column[1].force_encoding("UTF-8") unless column[1].nil? %><% end %>
+       <% issue.each do |column| %><%= content_tag 'td', column[1] unless column[1].nil? %><% end %>
    </tr>
    <% end %>
    <tr class="<%= cycle("odd", "even") %>"> 

macmacy avatar Nov 16 '12 12:11 macmacy

Thanks macmacy, the workaround seems to work for me.

polytechas avatar Nov 22 '12 09:11 polytechas

Hi! I'm on redmine 2.2 and thanks to these suggestions everything seems to work very well! (I'm using patches by @macmacy).

However when I try updating issues, I get this error:

NoMethodError (undefined method `strftime' for nil:NilClass):
  app/models/mailer.rb:459:in `message_id_for'
  app/models/mailer.rb:413:in `mail'
  app/models/mailer.rb:413:in `collect'
  app/models/mailer.rb:413:in `mail'
  app/models/mailer.rb:76:in `issue_edit'
  app/models/mailer.rb:427:in `initialize'
  app/models/mailer.rb:440:in `method_missing'
  app/models/journal_observer.rb:26:in `after_create'
  app/models/journal.rb:52:in `save'
  app/models/issue.rb:1362:in `create_journal'

This was my test:

First import (unique-valued field is 'external_Id', ignoring 'id' field):

Id|Description|external_Id|Subject|Assigned_To|Fixed_version|Start_date|Due_date|Estimated_hours
41|secondo imported|T0002|secondo imported|andreav|1.1|12/24/2012|12/27/2012|32.0
40|secondo imported|T0001|primo imported|nicolac|1.0|12/27/2012|12/30/2012|24.0

Second import (unique-valued field is 'external_Id', ignoring 'id' field, ticked 'Update existing issues' option) Note, the only chang is 'start_date' field on row with 'id'=40

Id|Description|external_Id|Subject|Assigned_To|Fixed_version|Start_date|Due_date|Estimated_hours
41|secondo imported|T0002|secondo imported|andreav|1.1|12/24/2012|12/27/2012|32.0
40|secondo imported|T0001|primo imported|nicolac|1.0|12/27/2012|12/30/2012|24.0

I put some dumps into mailer.rb, i.e puts(object.inspect) and this is the output:

#<Journal id: 60, journalized_id: 53, journalized_type: "Issue", user_id: 1, 
notes: "", created_on: "2012-12-18 15:33:01", private_notes: false>
#<Issue id: 53, tracker_id: 4, project_id: 1, subject: "primo imported", 
description: "secondo imported", due_date: "2012-12-30", category_id: nil, 
status_id: 1, assigned_to_id: 5, priority_id: 2, fixed_version_id: 1, 
author_id: 1, lock_version: 2, created_on: nil, 
updated_on: "2012-12-18 15:33:01", start_date: "2012-12-27", 
done_ratio: 0, estimated_hours: 24.0, parent_id: nil, root_id: 53, 
lft: 1, rgt: 2, is_private: false>

Am I missing something?

Thank you!

andreav avatar Dec 18 '12 16:12 andreav

Hi, I use Redmine 2.2.0 with Bitnami. After setting up all that workarounds mentioned by macmacy it doesn't work for me. I get the following error in production.log:

ArgumentError (wrong number of arguments(2 for 0)):
  plugins/redmine_importer/app/controllers/importer_controller.rb:70:in `initialize'
  plugins/redmine_importer/app/controllers/importer_controller.rb:70:in `new'
  plugins/redmine_importer/app/controllers/importer_controller.rb:70:in `match'

It seems to be some incompatibilities on FasterCSV.new arguments. I've tried FasterCSV 1.5.3, 1.5.4, 1.5.5 (by bundle install | uninstall FasterCSV) but all with same result. Everytime I try to upload the csv file, there is a Internal Server Error 500 with the error mentioned above.

dominik42 avatar Dec 20 '12 13:12 dominik42

hi all!

i have 2 problem fot importer. Who can help me?

Environment: Redmine version 2.0.3.stable Ruby version 1.9.3 (x86_64-linux) Rails version 3.2.6 Environment production Database adapter PostgreSQL Redmine plugins: redmine_importer 1.0 redmine_screenshot_paste 2.1.0 redmine_work_time 0.2.6 redmine_xls_export 0.2.1


when i import file csv it show 1_ "translation missing :en_text_rmr_specify_unique_field_for_columm"

or 2_ NoMethodError (undefined method empty?' for nil:NilClass): plugins/redmine_importer/app/controllers/importer_controller.rb:252:inblock in result' /usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/csv.rb:809:in each' /usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/csv.rb:809:ineach' plugins/redmine_importer/app/controllers/importer_controller.rb:231:in result' actionpack (3.2.6) lib/action_controller/metal/implicit_render.rb:4:insend_action' actionpack (3.2.6) lib/abstract_controller/base.rb:167:in `process_action'


WHY?????????? what is solution? can you reply me soon

Thanks so much

jisonnguyen avatar Dec 24 '12 08:12 jisonnguyen

@admin @andreav

I same you too, what's your solution?

could you help me? when I try updating issues, I get this error:

NoMethodError (undefined method strftime' for nil:NilClass): app/models/mailer.rb:459:inmessage_id_for' app/models/mailer.rb:413:in mail' app/models/mailer.rb:413:incollect' app/models/mailer.rb:413:in mail' app/models/mailer.rb:76:inissue_edit' app/models/mailer.rb:427:in initialize' app/models/mailer.rb:440:inmethod_missing' app/models/journal_observer.rb:26:in after_create' app/models/journal.rb:52:insave' app/models/issue.rb:1362:in `create_journal'

jisonnguyen avatar Dec 26 '12 09:12 jisonnguyen

Hi admin!

Admin, could you help me for this problem ? i working on redmine 2.0.3 but I cant not update issue with importer.

and my Environment:

Redmine version 2.0.3.stable Ruby version 1.9.3 (x86_64-linux) Rails version 3.2.6 Environment production Database adapter PostgreSQL Redmine plugins: redmine_importer 1.0 for redmine 2.x redmine_screenshot_paste 2.1.0 redmine_work_time 0.2.6 redmine_xls_export 0.2.1

I have bug when i update issue, can you help me ? please .....please.....

NoMethodError (undefined method strftime' for nil:NilClass): app/models/mailer.rb:459:inmessage_id_for' app/models/mailer.rb:413:in mail' app/models/mailer.rb:413:incollect' app/models/mailer.rb:413:in mail' app/models/mailer.rb:76:inissue_edit' app/models/mailer.rb:427:in initialize' app/models/mailer.rb:440:inmethod_missing' app/models/journal_observer.rb:26:in after_create' app/models/journal.rb:52:insave' app/models/issue.rb:1362:in `create_journal'

Thanks admin so much my boss deadline for me 7 day, pls help help help

jisonnguyen avatar Dec 28 '12 09:12 jisonnguyen

I had no luck with the prototype_legacy_helper plugin and got a 500 error while trying to access any Redmine site. I replaced the observe_field function block with this JS code:

<script>
// Append the function to the "document ready" chain
jQuery(function($) {
  // when the #update issue field changes
  $("#update_issue").change(function() {
    document.getElementById("journal_field").disabled = !element.checked;
    document.getElementById("update_other_project").disabled = !element.checked;
    document.getElementById("ignore_non_exist").disabled = !element.checked;
  });
})
</script>

rbugajewski avatar Jan 10 '13 16:01 rbugajewski

@jisonnguyen You can ignore the missing translation error. Just make sure that you assign a unique column while you import the CSV, so that the plugin can know which issue you refer to.

rbugajewski avatar Jan 10 '13 17:01 rbugajewski