anteo / redmine_custom_workflows

Allows to create custom workflows for Redmine
http://www.redmine.org/plugins/custom-workflows
GNU General Public License v2.0
178 stars 72 forks source link

Get users by role not functional ? #335

Closed Pierrouney closed 2 months ago

Pierrouney commented 3 months ago

Hello,

We have a custom workflow on our redmine install, which is supposed to send emails to a specific role when one of our tickets is unassigned.

It doesn't work anymore, and I suspect I know the line that's responsible, but I'm not certain, and I'm not sure of how to debug it.

Here is the code block that I suspect :

assigned =  @issue.assigned_to
if  @new_issue  && !@issue.assigned_to && @issue.status != "brouillon" # Note : Brouillon = Draft, and it's an issue status that exists in our install
    Rails.logger.info "Name Assigned : none"
    users = @issue.project.try(&:assignable_users) || []
    users.each do |user|
        Rails.logger.info "Assignable user Issue "  + user.lastname
    end 

    usersroles = @issue.project.try(&:users_by_role) || []

Etc.

One of the messages in our redmine logs that I was able to catch was the following :

= Finished running before_save custom workflows for Issue (#) "Action #: Test demande non assignée 2"
= Running after_save custom workflows for Issue (#34953) "Action #34953: Test demande non assignée 2"
== Running after_save custom workflow "NonAssignée"
Name Assigned : none
Assignable user Issue <redacted>
== Custom workflow NonAssignée, #4 exception: undefined method `users_by_role' for #<Project:0x00007f95a210d080>

But I could not find info on the method users_by_role. Do you have tips on this ?

Redmine version : 4.2.11 Plugin custom workflows version : 2.1.0

Pierre

picman commented 3 months ago

As the log states. users_by_role method doesn't exist any more. You have to modify your script accordingly.