Coder Social home page Coder Social logo

anteo / redmine_custom_workflows Goto Github PK

View Code? Open in Web Editor NEW
178.0 36.0 72.0 427 KB

Allows to create custom workflows for Redmine

Home Page: http://www.redmine.org/plugins/custom-workflows

License: GNU General Public License v2.0

HTML 10.11% Ruby 88.60% CSS 0.77% JavaScript 0.52%

redmine_custom_workflows's Introduction

Custom Workflows plug-in 2.1.2

GitHub CI Support Ukraine Badge

This plug-in provides a great functionality for those who is familiar with the Ruby language. It allows to customize workflow by defining own rules for issues processing. It's possible:

  • To change issue properties if some conditions are met.
  • To create new issues programmatically, if the conditions are met (for example you can create an issue in another project if the status of source issue is changed to specific value).
  • To raise custom errors which will be displayed to the user, if he does something wrong.
  • To do anything that conforms to your needs.

Supported observable objects:

  • Attachment
  • Group
  • Issue
  • Issue relations
  • Time entry
  • User
  • Member
  • Version
  • Wiki
  • <Shared code>

<Shared code> - a special type for workflows that are running before all other workflows and can provide libraries of additional functions or classes.

Thanks to

The initial development was supported by DOM Digital Online Media GmbH. The present development is supported by Kontron

Getting help

Create an issue if you want to propose a feature or report a bug:

https://github.com/anteo/redmine_custom_workflows/issues

Check Wiki for examples and programming hints:

https://github.com/anteo/redmine_custom_workflows/wiki

Check this repo with some tested in work custom workflows:

https://github.com/VoronyukM/custom-workwlows

Installation

From a ZIP file:

  • Download the latest version of the plugin.
  • In case of an upgrade, remove the original plugins/redmine_custom_workflows folder.
  • Unzip it to /plugins.

From the Git repository:

  • Clone the repository:
cd redmine/plugins
git clone https://github.com/anteo/redmine_custom_workflows.git

After download:

  • Run migrations and restart the application:
cd redmine
bundle install
RAILS_ENV=production bundle exec rake redmine:plugins:migrate NAME=redmine_custom_workflows
systemctl restart apache2

Configuration

First, you need to define your own custom workflow(s). We already included one, called "Duration/Done Ratio/Status correlation". You'll find it after installing the plug-in. It demonstrates some possibilities of the plug-in.

Go to the Administration section, then select Custom workflows. A list of defined workflows will appear. Here you can create a new workflow, update, reorder or delete the existing workflows. The order of workflows specifies the order in which the workflow scripts will be executed.

Then click the Create a custom workflow button. Enter a short name and full description. Below you will see two text areas. Fill one or both text areas with Ruby-language scripts that will be executed before and after saving the issue (on before_save and after_save callbacks respectively).

Both scripts are executed in the context of the issue. So, access properties and methods of the issue directly (or through keyword self). You can also raise exceptions by raising RedmineCustomWorkflows::Errors::WorkflowError exception. If you change some properties of the issue before saving it, it will be revalidated then and additional validation errors can appear.

E.g.:

  raise RedmineCustomWorkflows::Errors::WorkflowError, 'Your message'

You can also display an info/warning/error message to the user using an observed object property custom_workflow_messages.

E.g.:

  self.custom_workflow_messages[:notice] = 'Custom workflow info'
  self.custom_workflow_messages[:warning] = 'Custom workflow warning'
  self.custom_workflow_messages[:error] = 'Custom workflow error'

Some environmental variables are available in observable objects.

E.g.:

self.custom_workflow_env[:remote_ip]

An email can be sent from within a script.

E.g.:

CustomWorkflowMailer.deliver_custom_email(user, subject: subject, text_body: text)

Enabling custom workflows for projects

After you defined your custom workflow(s), you need to enable it for particular project(s). (This is valid for project related observable objects.) There are two ways of doing this.

  • While editing existing or creating a new custom workflow;
  • In the project's settings (if the user has appropriate permission). Open Project settings. Go to Custom workflows tab of the project's settings and enable those workflows you need for this project.

Now go to the Issues and test it.

Examples

Duration/Done Ratio/Status correlation example

Fill the "before save" script with:

if done_ratio_changed?
    if (done_ratio == 100) && (status_id == 2)
      self.status_id = 3
    elsif [1,3,4].include?(status_id) && (done_ratio < 100)
      self.status_id = 2
    end
end

if status_id_changed?
    if (status_id == 2)
      self.start_date ||= Time.now
    end
    if (status_id == 3)
      self.done_ratio = 100
      self.start_date ||= created_on
      self.due_date ||= Time.now
    end
end

Example of creating subtask if the issue's status has changed

Fill the "before save" script with:

@need_create = status_id_changed? && !new_record?

Fill the "after save" script with:

if @need_create
    issue = Issue.new(
      author: User.current,
      project: project,
      tracker: tracker,
      assigned_to: author,
      parent_issue_id: id,
      subject: 'Subtask',
      description: 'Description')
    issue.save!
end

Do not forget to check whether the issue is just created. Here, we create a new issue and newly created issue will also be passed to this script on save event. So, without a check, it will create another sub-issue. And so on. Thus, it will fall into infinite loop.

Compatibility

This plug-in is compatible with Redmine 4.1.x., 4.2.x. and 5.0.x.

redmine_custom_workflows's People

Contributors

aceccarelli avatar andreav avatar anteo avatar bfriebel avatar dmakurin avatar fredsdc avatar germanolucas avatar mantykora-net avatar normanedance avatar picman avatar spacewander avatar voronyukm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redmine_custom_workflows's Issues

Created issue related

Hello!

Similar to the subtasks for creating flow would create a new task but only relate to task source.

thanks!

Example with version field

Hello! Can you help? It possible to make macro: if issue is closing and version filed is empty then set latest opened version to version field of issue.

  1. issue closing
  2. if version field of this issue is empty
  3. set issue version field to latest project opened version

P.S. Thank you much, im PHP5 developer and its hard to make ruby code, help pls.

Assigning an Issue to User that is not Current

Firstly, let me say that I LOVE this plugin and the functionality it provides!

Secondly, I am relatively new to Ruby and Redmine in general, and I was wondering if anyone knows how to assign a user to an issue? I can see from the example workflows that you can use "User.current" when creating an issue to make the issue's author and assignee the current user. I have not been successful in using ID numbers in assigning other users and I was wondering if anyone else has had any success in this endeavor?

custom email html_body rendering

Hi,
has someone tried to pass an html_body?

html = '<h3>headline</h3>
<p>some text.</p>'

Mailer.custom_email(:to => '[email protected]', :html_body => html).deliver

The HTML is passed however not rendered when i receive the email. Can someone give me a hint?

email

many thanks

Pop message once then allow to continue

I have situation where i need to force my developers to update a wiki with some information needed by another department BEFORE they mark the issue as resolved. This is only temporary, as once they migrate to use our git/Jenkins stack it will be redundant, so i was going to do this via a custom workflow.

What i would like to be able to do is pop a workflow error, increment a counter that will track that the error has displayed, and then if they save it again (barring any other issues prevent the save) it would allow then to continue in peace.

Is there anything remotely like this available in this tool-set? I have tried a few different ways, but nothing seems to stick.

I thought maybe using a shared code workflow would do it, but no luck.

Any suggestions ill be greatly appreciated.

Adam

Full support 2.6

Would it be possilbe support redmine < 3.0.0 again for the master version? So all the great current and upcoming changes will be also availible for 2.6?

Thank you
Regards

Debug Code

I freely admit to being a newbie in both Ruby and Redmine. Looking for a way to debug some workflows. I know how to run the ruby shell interactively but try to find out why some workflows are not being called when it seems they should. Is there anyway to walk through the script or see a log of the scripts output?

read/write project custom field

Hi!
I've created custom fields for a project and I would like to read and maybe update these field values from the issue workflow.
Is that possible?
I've tried some coding with @issue.project object without much success.

Thanks in advance!!

Switch status field on technician reply

Hello,

I'd like to have the status field automatically set to "In progress" (or any other custom status) when a technician answer to a customer in a ticket, and this customer haven't replied yet.

How can I perform that ?

Thank you for this module ;)

Example with time_entry.comments

Please provide an example worcflow where we can check if time_entry.comments.blank?
if time_entry.hours.blank? then check if time_entry.comments.blank? and if blank raise error

Is there any way to update a parent from a child's workflow?

Extremely useful plugin. Thank you.

I see that it provides read access to a parent (if one exists). Is there any way to get it to write or otherwise update a parent when saving a child?

In my case I want to automatically change the status of a parent when something specific happens to a child.

Chris

DB migration error

/plugins/redmine_custom_workflows/db/migrate/20150526132244_create_example_workflow.rb:7:in `up'
Mysql2::Error: Field 'after_save' doesn't have a default value
-- CustomWorkflow.create!(:name => 'Duration/Done Ratio/Status correlation', :author => '[email protected]', :description => <<EOD, :before_save => <<EOS)
++ CustomWorkflow.create!(:name => 'Duration/Done Ratio/Status correlation', :author => '[email protected]', :description => <<EOD, :before_save => <<EOS, :after_save => '')

Administration not possible (redmine 3.1.0)

Installed 0.1.4 plugin, installation seems to go fine, no errors. But on attempting to go into redmine to the administration area. The plugin shows its loaded. The administration section has a new item which i think is supposed to say "Custom workflows" but in fact says "translation missing: en-GB.label_custom_workflow_plural" on clicking this i get an error message saying "Page not found" 404 error. The URL its attempted to access is /redmine/custom_workflows.
problem

Need save and restore abilities

It will be great to have abilities to save custom workflows with name and description (e.g. as .rb files with special comments) and restore them from that files. Now I have to manually copy and paste the scripts into files to be able to keep versions in git.

Install error

Environment:
Redmine version 2.6.1.stable
Ruby version 2.1.3-p242 (2014-09-19) [x86_64-linux]
Rails version 3.2.21
Environment production
Database adapter PostgreSQL
SCM:
Mercurial 2.8.2
Git 1.9.1
Filesystem
Redmine plugins:
a_common_libs 1.1.4
ajax_counters 0.0.1
custom_menu 1.5.0
extra_queries 1.0.2
first_mail_answer 0.0.1
it25_interface 0.0.1
luxury_buttons 2.2.0
redmine_open_links_in_new_window 0.0.3
rm_user_mentions 0.0.1
unread_issues 1.0.0
usability 1.0.0

When trying to install plugin there is error in file: 20150526132244_create_example_workflow.rb
I removed that file and repeat execute command: rake redmine:plugins:migrate --trace RAILS_ENV=production

Plugin installed succesfully but when try to enter any project settings page there was an error:

PG::SyntaxError: ERROR: non-integer constant in ORDER BY LINE 1: SELECT 1 AS one FROM "custom_workflows" ORDER BY '--- ^ : SELECT 1 AS one FROM "custom_workflows" ORDER BY '--- :position: :asc ' LIMIT 1

Full error trace:

    Лог ошибки

        /usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/connection_adapters/postgresql_adapter.rb:1163:in `async_exec'
/usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/connection_adapters/postgresql_adapter.rb:1163:in `exec_no_cache'
/usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/connection_adapters/postgresql_adapter.rb:660:in `block in exec_query'
/usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
/usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/connection_adapters/postgresql_adapter.rb:659:in `exec_query'
/usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/connection_adapters/postgresql_adapter.rb:1262:in `select'
/usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/database_statements.rb:18:in `select_all'
/usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/query_cache.rb:61:in `block in select_all'
/usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/query_cache.rb:75:in `cache_sql'
/usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/query_cache.rb:61:in `select_all'
/usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/database_statements.rb:24:in `select_one'
/usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/database_statements.rb:30:in `select_value'
/usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/relation/finder_methods.rb:202:in `exists?'
/usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/querying.rb:5:in `exists?'
/var/www-root/redmine-2.6.1/plugins/redmine_custom_workflows/app/views/projects/settings/_custom_workflow.html.erb:6:in `block in _plugins_redmine_custom_workflows_app_views_projects_settings__custom_workflow_html_erb___776842098537356390_38390880'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/helpers/capture_helper.rb:40:in `block in capture'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/helpers/capture_helper.rb:40:in `capture'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/helpers/form_helper.rb:378:in `form_for'
/var/www-root/redmine-2.6.1/plugins/redmine_custom_workflows/app/views/projects/settings/_custom_workflow.html.erb:1:in `_plugins_redmine_custom_workflows_app_views_projects_settings__custom_workflow_html_erb___776842098537356390_38390880'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/template.rb:145:in `block in render'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/notifications.rb:125:in `instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/template.rb:143:in `render'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/partial_renderer.rb:265:in `render_partial'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/partial_renderer.rb:238:in `block in render'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:in `block in instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:in `instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/partial_renderer.rb:237:in `render'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/renderer.rb:41:in `render_partial'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/renderer.rb:15:in `render'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/helpers/rendering_helper.rb:24:in `render'
/var/www-root/redmine-2.6.1/app/views/common/_tabs.html.erb:22:in `block in _app_views_common__tabs_html_erb__166398606193287121_70006676859380'
/var/www-root/redmine-2.6.1/app/views/common/_tabs.html.erb:21:in `each'
/var/www-root/redmine-2.6.1/app/views/common/_tabs.html.erb:21:in `_app_views_common__tabs_html_erb__166398606193287121_70006676859380'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/template.rb:145:in `block in render'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/notifications.rb:125:in `instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/template.rb:143:in `render'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/partial_renderer.rb:265:in `render_partial'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/partial_renderer.rb:238:in `block in render'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:in `block in instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:in `instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/partial_renderer.rb:237:in `render'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/renderer.rb:41:in `render_partial'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/renderer.rb:15:in `render'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/helpers/rendering_helper.rb:24:in `render'
/var/www-root/redmine-2.6.1/app/helpers/application_helper.rb:328:in `render_tabs'
/var/www-root/redmine-2.6.1/app/views/projects/settings.html.erb:3:in `_app_views_projects_settings_html_erb___465503258230998837_70006672325520'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/template.rb:145:in `block in render'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/notifications.rb:125:in `instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/template.rb:143:in `render'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:in `block in instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:in `instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/template_renderer.rb:46:in `block in render_template'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/template_renderer.rb:45:in `render_template'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/template_renderer.rb:18:in `render'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/renderer.rb:36:in `render_template'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_view/renderer/renderer.rb:17:in `render'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/abstract_controller/rendering.rb:110:in `_render_template'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_controller/metal/streaming.rb:225:in `_render_template'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/abstract_controller/rendering.rb:103:in `render_to_body'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_controller/metal/renderers.rb:28:in `render_to_body'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/abstract_controller/rendering.rb:88:in `render'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_controller/metal/rendering.rb:16:in `render'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/usr/local/rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/core_ext/benchmark.rb:5:in `ms'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb:40:in `block in render'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
/usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb:39:in `render'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/abstract_controller/base.rb:167:in `process_action'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_controller/metal/rendering.rb:10:in `process_action'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:513:in `_run__3600200384928874493__process_action__4343983155749642660__callbacks'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:405:in `__run_callback'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:81:in `run_callbacks'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/abstract_controller/callbacks.rb:17:in `process_action'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_controller/metal/rescue.rb:29:in `process_action'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:in `block in instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:in `instrument'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
/usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/abstract_controller/base.rb:121:in `process'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/abstract_controller/rendering.rb:45:in `process'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_controller/metal.rb:203:in `dispatch'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_controller/metal.rb:246:in `block in action'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_dispatch/routing/route_set.rb:73:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_dispatch/routing/route_set.rb:36:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
/usr/local/rvm/gems/ruby-2.1.3/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
/usr/local/rvm/gems/ruby-2.1.3/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_dispatch/routing/route_set.rb:608:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/rack-openid-1.4.2/lib/rack/openid.rb:98:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/request_store-1.0.5/lib/request_store/middleware.rb:9:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/etag.rb:23:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/conditionalget.rb:25:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_dispatch/middleware/head.rb:14:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_dispatch/middleware/flash.rb:242:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/session/abstract/id.rb:210:in `context'
/usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/session/abstract/id.rb:205:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_dispatch/middleware/cookies.rb:341:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/query_cache.rb:64:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:405:in `_run__1609130968381141785__call__3434552608062777507__callbacks'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:405:in `__run_callback'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:81:in `run_callbacks'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.21/lib/rails/rack/logger.rb:32:in `call_app'
/usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.21/lib/rails/rack/logger.rb:16:in `block in call'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/tagged_logging.rb:22:in `tagged'
/usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.21/lib/rails/rack/logger.rb:16:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_dispatch/middleware/request_id.rb:22:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/methodoverride.rb:21:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/runtime.rb:17:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/activesupport-3.2.21/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/lock.rb:15:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/actionpack-3.2.21/lib/action_dispatch/middleware/static.rb:83:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
/usr/local/rvm/gems/ruby-2.1.3/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
/usr/local/rvm/gems/ruby-2.1.3/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
/usr/local/rvm/gems/ruby-2.1.3/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
/usr/local/rvm/gems/ruby-2.1.3/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.21/lib/rails/engine.rb:484:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.21/lib/rails/application.rb:231:in `call'
/usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.21/lib/rails/railtie/configurable.rb:30:in `method_missing'
/usr/local/rvm/gems/ruby-2.1.3/gems/passenger-5.0.8/lib/phusion_passenger/rack/thread_handler_extension.rb:89:in `process_request'
/usr/local/rvm/gems/ruby-2.1.3/gems/passenger-5.0.8/lib/phusion_passenger/request_handler/thread_handler.rb:149:in `accept_and_process_next_request'
/usr/local/rvm/gems/ruby-2.1.3/gems/passenger-5.0.8/lib/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
/usr/local/rvm/gems/ruby-2.1.3/gems/passenger-5.0.8/lib/phusion_passenger/request_handler.rb:414:in `block (3 levels) in start_threads'
/usr/local/rvm/gems/ruby-2.1.3/gems/passenger-5.0.8/lib/phusion_passenger/utils.rb:111:in `block in create_thread_and_abort_on_exception'

License Info

Hi, I'm wondering what the terms of use/redistribution are for this plugin. Does it fall under GPL(v2)?

Request: Change log message so that issue_id is before subject

Reason is that some issues have long subjects and causes the line to wrap. This means that you cannot easily scan down the log messages to see the sequence of issues that are changed.

Patch

- Rails.logger.info str + " for #{object.class} \"#{object}\" (\##{object.id})"
+ Rails.logger.info str + " for #{object.class} (\##{object.id}) \"#{object}\""

Then you can easily view with less -Sinx +F log/production.log.

Custom email subject

Hi, great plugin

I have a doubt, I'm trying to change the subject without result, actually I used the example
on FAQ pages:

Mailer.custom_email(:to => '[email protected]', :text_body => 'Hello Friend!').deliver
How I can replace the "Custom email" subject, for my own subject email text?

Regards

add email support

Hi,
beeing able to send email via the custom workflow. I could not find any other soultion than writing my own additional plug in, but this solution is very durty and very static. Mybe something like this can be added to the main source, but far better programmed...

This would be the comand to send a mail:
Mailer.custom_email("add string to mail subject ", User.find(1), self).deliver

Please be aware that my extention is highly adapted to my needs and cannot be implemented in your enviroment as is.

https://www.dropbox.com/s/dt0uoqks8zasbbi/redmine_custom_workflow_email_support.zip?dl=0

Regards
Moritz

MySQL error on install

Hello.

I've been unable to install plugin due to error:

== 20150526132244 CreateExampleWorkflow: migrating ============================
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Mysql2::Error: Field 'after_save' doesn't have a default value: INSERT INTO `custom_workflows` (`name`, `author`, `description`, `before_save`, `created_at`, `updated_at`, `position`) VALUES ('Duration/Done Ratio/Status correlation', '[email protected]', 'Set up a correlation between the start date, due date, done ratio and status of issues.\n\n* If done ratio is changed to 100% and status is \"In Process\", status changes to \"Resolved\"\n* If status is \"New\", \"Resolved\" or \"Feedback\" and done ratio is changed to value less than 100%, status changes to \"In process\"\n* If status is changed to \"In process\" and start date is not set, then it sets to current date\n* If status is changed to \"Resolved\" and end date is not set, then it set to due date\n\nTo use this script properly, turn off \"Use current date as start date for new issues\" option in the settings as this script already do it own way.\n', 'if @issue.done_ratio_changed?\n  if @issue.done_ratio==100 && @issue.status_id==2\n    @issue.status_id=3\n  elsif [1,3,4].include?(@issue.status_id) && @issue.done_ratio<100\n    @issue.status_id=2\n  end\nend\n\nif @issue.status_id_changed?\n  if @issue.status_id==2\n    @issue.start_date ||= Time.now\n  end\n  if @issue.status_id==3\n    @issue.done_ratio = 100\n    @issue.start_date ||= @issue.created_on\n    @issue.due_date ||= Time.now\n  end\nend\n', '2015-07-07 09:42:45', '2015-07-07 09:42:45', 2)/usr/local/share/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:299:in `query'
/usr/local/share/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:299:in `block in execute'
/usr/local/share/gems/gems/activerecord-4.2.1/lib/active_record/connection_adapters
(truncated)

This reproducing on clean install.
I've tried to fix this by disabling MySQL option "STRICT_TRANS_TABLES" but it didn't work.

Redmine version: 3.0.3
Ruby version: ruby 2.0.0p598
Gems:
mysql2 (0.3.18)
activerecord (4.2.1)
MySQL version: Percona 5.6.25-73.0

thanks,
Alex

How to manipulate date from custom field ?

I need some calculation with date from custom field. However none of these methods works:

self.custom_field_values={ 77 => custom_field_value(10) + 1.month}
temp = custom_field_value(10).year
temp = custom_field_value(10).to_i
temp = custom_field_value(10).to_date
temp = custom_field_value(10) + 1

I've got error:
undefined method+' for nil:NilClass`

How to convert CustomFieldValue object to date? How can I do some calculations with custom field value?

P.S.: i'm trying calculate age from birthdate which is stored in custom field

Error in pt-br.yml file

After installed this plugin in redmine 3.1.0, my redmine language changed automatically from PT-BR (Brazilian Portuguese) to PT (Portugal Portuguese)
When the filename is pt-br.yml, redmine don't use Brazilian Portuguese.

To resolve this, I renamed the pt-br.yml file to pt-BR.yml (according redmine uses in locales folder) and the problem was solved.

String data from Version Custom Field

How to get the string value from the custom field which is a 'version' type?

custom_field_value(6) returns a number depending on the selection by user.

What I want is the "real string" for the version id (For example "Version-00.001" instead of its id)

running CW from console?

Hi,

is there a way to run a custom worklfow from the ruby console? I would like to set up a cron job which runs one of my custom workflows once a day.

Thank you very much

Kind Regards
Pyro

How to check that a date custom field is uninitialized or not yet set?

Hello,

Please forgive if this is a stupid question... I am new to Ruby.

I am trying to write a workflow that creates a child record when it reaches a particular status but does this only once per issue.

To do this I've created a date custom field where I record the date that the child record was created. When I enter the routine I check to see if the date has been set and if not I create the record and then assign the field using:

custom_field_values={'57' => Date.today}

At this point I'm not even sure that this will work because I do not seem to be able to test that the date custom field is blank. I've tried ...

if custom_field_value(57).to_s==""
if custom_field_value(57).nil?
if custom_field_value(57)==0
if custom_field_value(57)==""

but none are equating to true. I've checked the database and the uninitialized value does not seem to be null but it is otherwise empty.

How does one test for a blank or uninitialized date based custom field?

Thanks
Chris

Как при создании новой задачи указать произвольный трекер?

Для создания новой задачи в блоке "after save" использую код, приведённый в официальном примере к плагину.

if @need_create
sub_issue = Issue.create!(
:author => User.current,
:project => project,
:tracker => tracker, # Так работает
:tracker => Tracker.find(4), # Так НЕ работает!
:assigned_to => author,
:parent_issue_id => id,
:subject => "Зарегистрировать договор",
:description => "Присвоить номер и дату договора")
end

Проблема в том, что задача корректно создаётся только с текущим трекером:
:tracker => tracker,
тогда как мне нужно указать другой трекер, вроде такого:
:tracker => Tracker.find(4)
или такого:
:tracker_id => 4

Вот сообщение об ошибке:
redmine_custom_workflows

Вопрос - как правильно указать трекер при создании задачи?

Problem with pt-br locale

ActionView::Template::Error (can not load translations from /home/entelibai/redmine/plugins/redmine_custom_workflows/config/locales/pt-br.yml: #<Psych::SyntaxError: (/home/entelibai/redmine/plugins/redmine_custom_workflows/config/locales/pt-br.yml): did not find expected key while parsing a block mapping at line 2 column 3>):
2: <%= form_tag({:action => 'default_configuration'}) do %>
3: <%= simple_format(l(:text_no_configuration_data)) %>
4:

<%= l(:field_language) %>:
5: <%= select_tag 'lang', options_for_select(lang_options_for_select(false), current_language.to_s) %>
6: <%= submit_tag l(:text_load_default_configuration) %>


7: <% end %>
8:
lib/redmine/i18n.rb:167:in init_translations' lib/redmine/i18n.rb:181:inlookup'
lib/redmine/i18n.rb:98:in block in languages_options' lib/redmine/i18n.rb:98:inselect'
lib/redmine/i18n.rb:98:in languages_options' lib/redmine/i18n.rb:103:inblock in languages_options'
lib/redmine/i18n.rb:102:in languages_options' app/helpers/application_helper.rb:1041:inlang_options_for_select'
app/views/admin/_no_data.html.erb:5:in block in _app_views_admin__no_data_html_erb__3287497614057199964_70204844916560' app/views/admin/_no_data.html.erb:2:in_app_views_admin__no_data_html_erb__3287497614057199964_70204844916560'
app/views/admin/index.html.erb:4:in `_app_views_admin_index_html_erb___1187172352493287663_70204844797340'

This happened today. In a new installation. In my older copy dont happened this

date_start automatically set to current datetime

Hi,

I'm looking for a solution to this workflow :
A customer create a ticket, the "Date created" field is set, the status "New".
When we change the ticket status to "In progress", I'd like to have a custom field "Date started" automatically set to the current datetime, and having.

What's the easiest way to do that, without touching to Ruby if possible ?

Thanks a lot

Unable to add custom field value

I have created custom workflow with this code in before_save:

custom_field_values = { 4 => "tete" }

When user edits an issue, production.log shows following:

Started PATCH "/issues/17" for 127.0.0.1 at 2015-05-14 15:46:37 +0300
Processing by IssuesController#update as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"aDwei+8EsLohkO4xXqtSjANTeckp35rk/PjZeBWdXEB1XCzAregkPMxnimOIvCYSzQwfGFl0aIyR6cuqbPbn8A==", "issue"=>{"status_id"=>"15", "assigned_to_id"=>"7", "custom_field_values"=>{"4"=>""}, "notes"=>"rfwefrwerf", "private_notes"=>"0", "lock_version"=>"7"}, "last_journal_id"=>"77", "commit"=>"Принять", "id"=>"17"}
  Current user: test-manager (id=738)
DEPRECATION WARNING: You are passing an instance of ActiveRecord::Base to `find`. Please pass the id of the object by calling `.id`. (called from auto_watchers at /opt/cppk-redmine/plugins/redmine_auto_watchers_from_groups/lib/auto_watchers_from_groups.rb:16)
= Running before_save custom workflows for issue "Проблемы после обновления ПО валидаторов А-10 2.17" (#17)
== Running before_save custom workflow "Last Issue change Author"
= Finished running before_save custom workflows for issue "Проблемы после обновления ПО валидаторов А-10 2.17" (#17).
  Rendered mailer/_issue.text.erb (11.2ms)
  Rendered mailer/issue_edit.text.erb within layouts/mailer (15.8ms)
  Rendered mailer/_issue.html.erb (3.7ms)
  Rendered mailer/issue_edit.html.erb within layouts/mailer (9.9ms)
Email delivery error: execution expired
= Running after_save custom workflows for issue "Проблемы после обновления ПО валидаторов А-10 2.17" (#17)
== Running after_save custom workflow "Last Issue change Author"
= Finished running after_save custom workflows for issue "Проблемы после обновления ПО валидаторов А-10 2.17" (#17).

But, custom field with id 4 for this issue (#17) is still empty:

mysql> select * from custom_values where customized_id = 17 and custom_field_id = 4;
+----+-----------------+---------------+-----------------+-------+
| id | customized_type | customized_id | custom_field_id | value |
+----+-----------------+---------------+-----------------+-------+
| 18 | Issue           |            17 |               4 |       |
+----+-----------------+---------------+-----------------+-------+
1 row in set (0.00 sec)

Is it my mistake or a bug?

Error install on Redmine 2.6.1

Hi,

Migrating redmine_custom_workflows (Redmine Custom Workflow plugin)...
==  CreateExampleWorkflow: migrating ==========================================
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

undefined method `find_by' for #/var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/dynamic_matchers.rb:55:in `method_missing'
/sistema/redmine261a/plugins/redmine_custom_workflows/db/migrate/20150526132244_create_example_workflow.rb:4:in `up'
/var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:370:in `up'
/var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:410:in `block (2 levels) in migrate'
/var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:410:in `block in migrate'
/var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in `with_connection'
/var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:389:in `migrate'
/var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:528:in `migrate'
/var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:720:in `block (2 levels) in migrate'
/var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:777:in `call'
/var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:777:in `ddl_transaction'
/var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:719:in `block in migrate'
/var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:700:in `each'
/var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:700:in `migrate'
/var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:570:in `up'
/var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/migration.rb:551:in `migrate'
/sistema/redmine261a/lib/redmine/plugin.rb:469:in `migrate_plugin'
/sistema/redmine261a/lib/redmine/plugin.rb:441:in `migrate'
/sistema/redmine261a/lib/redmine/plugin.rb:455:in `block in migrate'
/sistema/redmine261a/lib/redmine/plugin.rb:454:in `each'
/sistema/redmine261a/lib/redmine/plugin.rb:454:in `migrate'
/sistema/redmine261a/lib/tasks/redmine.rake:127:in `block (3 levels) in '
Tasks: TOP => redmine:plugins:migrate

Environment

Environment:
  Redmine version                2.6.1.stable
  Ruby version                   1.9.3-p194 (2012-04-20) [x86_64-linux]
  Rails version                  3.2.21
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.6.17
  Git                            1.7.10.4
  Filesystem                     
Redmine plugins:
  a_common_libs                  1.1.3
  custom_menu                    1.0.0
  redmine_checklists             3.1.1
  redmine_meetings               0.2.6
  redmine_pipeline_plugin        2.0.0
  redmine_time_tracker           0.4
  redmine_wiki_extensions        0.6.5
  redmine_wiki_lists             0.0.5
  release_logs                   0.1.1
  sidebar_hide                   0.0.7

Readme - installation

Shouldn't it be there

git clone https://github.com/anteo/redmine_custom_workflows.git

instead of

git clone git://git.academ.org/redmine_custom_workflows.git 
$ git clone git://git.academ.org/redmine_custom_workflows.git
Cloning into 'redmine_custom_workflows'...
fatal: unable to connect to git.academ.org:
git.academ.org[0: 85.118.224.203]: errno=Connection refused

Automatic create relation beetwen issues - cross projects

I would like to create automatic relation between issues (cross projects) during create new issue and add new note in existing issue. For example: In content of course I will write id issue destination "#123". Is it possible to write that with this plugin ?

Access journal entries

Hey, great plugin!

I try to access the latest journal entry in my workflow. I can access the correct data via Rails console (e.g. Issue.find(1).journals.last.notes) but when I fill my custom field trough an after_save workflow, I only get entries like #Journal:0x0000000a303630

I also tried setting the field via self.custom_field_values= {'4' => self.journals.last.notes }
but then I get the error message
'Workflow script executable after saving observable object contains error: undefined method `notes' for nil:NilClass'

Any hint on what I'm doing wrong?

How to create a new issue that has a required custom field?

I am trying to generate a new Issue based on a tracker that has a mandatory custom field.

if @create_instructor_booking_request
booking = Issue.create!(
:author => User.current,
:project => project,
:tracker_id => 11,
:parent_issue_id => id,
:subject => "Reservation",
:description => description,
"Days" => self.custom_field_value(36))

I've also tried

:Days => ...

In each case the logs tell me that the field 'Days' does not exist.

Does anyone know how to initialize an issue that requires a custom field?

Thanks
Chris

Feature Request

I have a need to be able to tell if any children on issue X are open so i can then throw a WorkflowError stating they cant close this issue due to open subtasks.

So something like open_children? that would return false unless there were children and at least one of them were not closed.

Or if any knows of a way to create a blocking related issue from within a custom workflow, that would eliminate this need entirely as i could have the custom workflow create a blocking related issue which already prevents the parent from being closed.

Not showing the custom workflow in Admin panel

I have installed and migrated the Redmine to use custom workflows. There was no error during migrate. But the custom workflows are not shown on admin panel even after multiple restarts.

Plugin page also does not show the new pluggin.

My platform details are a below:

Environment:
Redmine version 2.5.1.stable
Ruby version 1.9.3-p231 (2012-05-25) [i386-mingw32]
Rails version 3.2.17
Environment production
Database adapter Mysql2
SCM:
Subversion 1.8.5
Git 1.9.0
Filesystem
Redmine plugins:

extended_fields 0.2.3

Command window output while migrating Redmine was as below:

C:\Bitnami\redmine-2.5.1-1\apps\redmine\htdocs\plugins\redmine_custom_workflows>bundle exec rake redmine:plugins:migrate RAILS_ENV=production
(in C:/Bitnami/redmine-2.5.1-1/apps/redmine/htdocs)
Migrating extended_fields (Extended fields)...
Migrating redmine_custom_workflows (Redmine Custom Workflow plugin)...
== CreateCustomWorkflows: migrating ==========================================
-- create_table(:custom_workflows, {:force=>true})
-> 0.0560s
-- add_index(:custom_workflows, [:project_id], {:unique=>true})
-> 0.0240s
== CreateCustomWorkflows: migrated (0.0810s) =================================

== AlterCustomWorkflows: migrating ===========================================
-- remove_column(:custom_workflows, :project_id)
-> 0.0480s
-- remove_column(:custom_workflows, :is_enabled)
-> 0.0250s
-- add_column(:custom_workflows, :name, :string, {:null=>false, :default=>""})
-> 0.0190s
-- add_column(:custom_workflows, :description, :string, {:null=>false, :default=>""})
-> 0.0180s
-- add_column(:custom_workflows, :position, :integer, {:null=>false, :default=>1})
-> 0.0350s
== AlterCustomWorkflows: migrated (0.1500s) ==================================

== CreateCustomWorkflowsProjects: migrating ==================================
-- create_table(:custom_workflows_projects, {:force=>true, :id=>false})
-> 0.0090s
-- add_index(:custom_workflows_projects, [:project_id])
-> 0.0150s
-- add_index(:custom_workflows_projects, [:custom_workflow_id])
-> 0.0110s
== CreateCustomWorkflowsProjects: migrated (0.0400s) =========================

== ChangeCustomWorkflowsDescriptionType: migrating ===========================
-- change_column(:custom_workflows, :description, :text, {:null=>true, :default=>nil})
-> 0.0120s
== ChangeCustomWorkflowsDescriptionType: migrated (0.0130s) ==================

== AddAfterSaveToCustomWorkflows: migrating ==================================
-- rename_column(:custom_workflows, :script, :before_save)
-> 0.0160s
-- change_column(:custom_workflows, :before_save, :text, {:null=>true})
-> 0.0060s
-- add_column(:custom_workflows, :after_save, :text, {:null=>true, :after=>:before_save})
-> 0.0110s
== AddAfterSaveToCustomWorkflows: migrated (0.0370s) =========================

== AddIsForAllToCustomWorkflows: migrating ===================================
-- add_column(:custom_workflows, :is_for_all, :boolean, {:null=>false, :default=>false})
-> 0.0100s
== AddIsForAllToCustomWorkflows: migrated (0.0120s) ==========================

== SetPositionFieldNullable: migrating =======================================
-- change_column(:custom_workflows, :position, :integer, {:null=>true})
-> 0.0110s
== SetPositionFieldNullable: migrated (0.0120s) ==============================

== AddAuthorAndTimestampsToCustomWorkflows: migrating ========================
-- add_column(:custom_workflows, :author, :string, {:null=>true})
-> 0.0110s
-- add_timestamps(:custom_workflows)
-> 0.0160s
== AddAuthorAndTimestampsToCustomWorkflows: migrated (0.0280s) ===============

== CreateExampleWorkflow: migrating ==========================================
== CreateExampleWorkflow: migrated (0.1870s) =================================

== AddActiveFieldToCustomWorkflows: migrating ================================
-- add_column(:custom_workflows, :active, :boolean, {:null=>false, :default=>true})
-> 0.0290s
== AddActiveFieldToCustomWorkflows: migrated (0.0300s) =======================


Use a template other that the test_email

Hello,

I can't seem to get the plugin to send an email using any other template other than the test_email template.

I would like to use the issue_edit template with different recipients, and possibly change the subject if possible. I am not sure what other parameters I would need to pass to the different templates in order to use them. Does the plugin support any other template besides the test_email template? Am I able to use templates stored in any other path besides views/mailer/? I do not have permission to change this folder and would like to store my own custom templates in the plugins directory of Redmine.

ошибка при установке модуля

Cтолкнулся вот с такой проблемой при установке плагина.

    bundle install --without development test
    bundle exec rake redmine:plugins NAME=redmine_agile RAILS_ENV=production

    ...
    ...
    ...
     == 20120831064944 CreateExampleWorkflow: migrating ============================
     rake aborted!
     StandardError: An error has occurred, all later migrations canceled:

     undefined method `author` for

Environment:

Redmine version 3.0.3.devel
Ruby version 2.1.6-p336 (2015-04-13) [x86_64-linux]
Rails version 4.2.1
Environment production
Database adapter Mysql2
SCM:
Subversion 1.6.17
Git 1.7.10.4
Filesystem
Redmine plugins:
redmine_agile 1.3.9
redmine_checklists 3.1.1
redmine_custom_workflows 0.1.1
redmine_gitlab_hook 0.1.3

ruby установkен через rvm

get id of newly created user

I want to write a custom workflow to assign every newly created user to a certain group, but can't seem to manage to get the user object of the new user.

My code is the following at the moment:

group = Group.find(49)
nUser = self
group.users << nUser

Group Nr. 49 is obviously the one I want to assign to the new users. For Line 2 I get different errors when trying to save the workflow depending on the version. The one above gives me:

Workflow script executable after saving observable object contains error: Validation failed: E-Mail muss ausgefüllt werden, Mitgliedsname muss ausgefüllt werden, Vorname muss ausgefüllt werden, Nachname muss ausgefüllt werden

I also tried the following (line 2):
nUser = User.find(id)
with this error:

Workflow script executable after saving observable object contains error: Couldn't find User without an ID

Any help would be really appreciated. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.