anteo / redmine_custom_workflows

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

Destroying observable objects not working for Time Entry - Before and After not being called #347

Closed joao-guerra closed 2 months ago

joao-guerra commented 2 months ago

Hi, I am using Custom Workflow to synchronise Redmine objects with a third party application.

I track Create, Update and Delete for Issues, Projects, Users and Time |Entries.

All is working fine except when deleting time entries, the before and after destroying code is not being called (I tested this using puts and nothing appears on the log) - The log also doesn't show any call of Custom workflow.

I am using Redmine 5.1.3 with Custom Workflow 2.1.1.

As all is working for the other entities except for destroying on Time Entry, and not even a simple puts is called maybe the destroying objects is not working for Time Entry.

picman commented 2 months ago

I can't reproduce the problem.

  1. I created a new custom workflow (Observable object: Time Entry, Active: On, Before destroy script: Rails.logger.info ">>> Before destroy of TE ##{self.id}", After destroy script: Rails.logger.info ">>> After destroy of TE ##{self.id}")
  2. In a project's settings I select this custom workflow.
  3. As soon as I delete a time entry in an issue of this project, I see in the log:
    INFO -- : = Running before_destroy custom workflows for TimeEntry (#873) "#<TimeEntry:0x000077c242651cc0>"
    INFO -- : == Running before_destroy custom workflow "c1"
    INFO -- : >>> Before destroy of TE #873
    INFO -- : = Finished running before_destroy custom workflows for TimeEntry (#873) "#<TimeEntry:0x000077c242651cc0>"
    INFO -- : = Running after_destroy custom workflows for TimeEntry (#873) "#<TimeEntry:0x000077c242651cc0>"
    INFO -- : == Running after_destroy custom workflow "c1"
    INFO -- : >>> After destroy of TE #873
    INFO -- : = Finished running after_destroy custom workflows for TimeEntry (#873) "#<TimeEntry:0x000077c242651cc0>"
joao-guerra commented 2 months ago

Hi, thank you for your response.

I dug deeper as we are using a timesheet plugin on the company's redmine and found that the plugin was using the delete method instead of destroy, so the problem was on the timesheet plugin. Changing that plugin to use destroy solves the problem.

Sorry to bother you and thank you again.