Project

General

Profile

How to create history with update issues by plugin redmine import task

Added by anhkhoa Michel about 10 years ago

Hello every body, I am newbile develope plugin for redmine. I want to update issues by import file excel. I override plugin redmine import task to do this. Code in plugin:

              issue = Issue.find(row_content[0])
              #issue.update_attribute(:subject,row_content[settings_conf['task_column'].to_i])
              issue.subject=row_content[settings_conf['task_column'].to_i]
              issue.tracker_id=settings_conf['save_task_as'].to_i  #Bug/Feature/Support
              issue.status_id=1 #New
              issue.description=row_content[settings_conf['task_description_column'].to_i]
              issue.estimated_hours=row_content[settings_conf['average_hour_column'].to_i]
              issue.custom_field_values={"1"=>row_content[settings_conf['average_hour_column'].to_i].to_i}
              issue.custom_field_values={"2"=>row_content[settings_conf['asignee_name_column'].to_i]}
              issue.custom_field_values={"7"=>row_content[settings_conf['cf7_name_column'].to_i]}
              issue.custom_field_values={"8"=>row_content[settings_conf['cf8_name_column'].to_i]}
              issue.custom_field_values={"10"=>row_content[settings_conf['cf10_name_column'].to_i]}
              issue.custom_field_values={"11"=>row_content[settings_conf['cf11_name_column'].to_i]}
              issue.custom_field_values={"12"=>row_content[settings_conf['cf12_name_column'].to_i]}
              issue.custom_field_values={"13"=>row_content[settings_conf['cf13_name_column'].to_i]}
              issue.custom_field_values={"14"=>row_content[settings_conf['cf14_name_column'].to_i]}
              issue.save

But update do'nt wrote in history of issue. I cannot resvole this bug. Please help me!


Replies (7)

RE: How to create history with update issues by plugin redmine import task - Added by Mischa The Evil about 10 years ago

By default, Redmine does not create a new journal when a new issue is added. Only later issue attribute changes, issue relations changes and new notes generate journals.

BTW: I've removed your cross-post in Development; please refrain from cross-posting and see On Topic or Off Topic - What should be posted here about topics suitable for Development.

RE: How to create history with update issues by plugin redmine import task - Added by anhkhoa Michel about 10 years ago

No. I update issue not create. Are you understand???issue = Issue.find(row_content0) In redmine I have issue ID=93. In file excel I have a row with column[A]=93. I import file excel. Issue id 93 in redmine was update with params form file excel. But History of issue in redmine not update. OK?

RE: How to create history with update issues by plugin redmine import task - Added by Mischa The Evil about 10 years ago

You probably need to call Issue#init_journal.

Example taken from #18237#note-2 and modified for the case:

issue = Issue.new attributes
issue.save # no journal created

issue = Issue.new attributes
issue.init_journal(some_user)
issue.save # journal created

I can't help you much more with this than this as I am not familiar with the plugin code nor with excel (csv?) exporting/importing and now even updating.

RE: How to create history with update issues by plugin redmine import task - Added by anhkhoa Michel about 10 years ago

I edit:

issue = Issue.find(row_content[0])
              #issue.update_attribute(:subject,row_content[settings_conf['task_column'].to_i])
              issue.subject=row_content[settings_conf['task_column'].to_i]
              issue.tracker_id=settings_conf['save_task_as'].to_i  #Bug/Feature/Support
              issue.status_id=1 #New
              issue.description=row_content[settings_conf['task_description_column'].to_i]
              issue.estimated_hours=row_content[settings_conf['average_hour_column'].to_i]
              issue.custom_field_values={"1"=>row_content[settings_conf['average_hour_column'].to_i].to_i}
              issue.custom_field_values={"2"=>row_content[settings_conf['asignee_name_column'].to_i]}
              issue.custom_field_values={"7"=>row_content[settings_conf['cf7_name_column'].to_i]}
              issue.custom_field_values={"8"=>row_content[settings_conf['cf8_name_column'].to_i]}
              issue.custom_field_values={"10"=>row_content[settings_conf['cf10_name_column'].to_i]}
              issue.custom_field_values={"11"=>row_content[settings_conf['cf11_name_column'].to_i]}
              issue.custom_field_values={"12"=>row_content[settings_conf['cf12_name_column'].to_i]}
              issue.custom_field_values={"13"=>row_content[settings_conf['cf13_name_column'].to_i]}
              issue.custom_field_values={"14"=>row_content[settings_conf['cf14_name_column'].to_i]}
              issue.init_journal(User.current)
              issue.save

But History do'nt update. I am very tired with this bug

RE: How to create history with update issues by plugin redmine import task - Added by anhkhoa Michel about 10 years ago

Hi Mischa. Thank you very much. I do it.!!!!

RE: How to create history with update issues by plugin redmine import task - Added by Henry Auffahrt almost 10 years ago

Hey,

i exactly need this case! We must import two projects from one redmine system in annother.
My plan was:
  1. create the project in the new redmine manually
  2. export alle issues from the old redmine via the csv export button
  3. install the redmine importer plugin in the new redmine (https://github.com/leovitch/redmine_importer/wiki)
  4. import everthing with it

the problem: i guess the importer plugin will create new issues, so we haven´t got our history/journal anymore?!

Is your plugin finally finished? Can i have a look?

Thank you.

    (1-7/7)