-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathupdate last modifier.xml
52 lines (46 loc) · 1.57 KB
/
update last modifier.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?xml version="1.0" encoding="UTF-8"?>
<custom-workflow>
<after-destroy></after-destroy>
<after-save></after-save>
<author>[email protected]</author>
<before-destroy></before-destroy>
<before-save>
def update_custom_fields(issue, fields)
f_id = Hash.new { |hash, key| hash[key] = nil }
issue.available_custom_fields.each_with_index.map { |f,indx| f_id[f.name] = f.id }
field_list = []
fields.each do |name, value|
field_id = f_id[name].to_s
field_list << Hash[field_id, value]
end
issue.custom_field_values = field_list.reduce({},:merge)
end
begin
user_id = @current_journal.user_id
rescue
user_id = ''
end
#no journal - this is a creation
if user_id == '' && @issue.journals.count == 0
begin
user_id = @issue.author_id
rescue
user_id = ''
end
end
if user_id != ''
fields = {"last_modifier" => user_id.to_s}
end
#raise WorkflowError, "!!! 1) " + user.to_yaml
#raise WorkflowError, "!!! 1) " + @issue.to_yaml
update_custom_fields(@issue, fields)
#raise WorkflowError, "!!! 1) " + fields.to_s + "!!! 1a) " + "!!! 2) " + " available fields \n" + @issue.available_custom_fields.to_s + "!!! 3) " + @issue.custom_field_values.to_s + "!!! 4) " + @issue.available_custom_fields.each_with_index.to_s
</before-save>
<description></description>
<name>update last modifier</name>
<observable>issue</observable>
<exported-at>2017-06-04T22:35:15Z</exported-at>
<plugin-version>0.1.6</plugin-version>
<ruby-version>2.0.0-p643</ruby-version>
<rails-version>3.2.17</rails-version>
</custom-workflow>