Skip to content

Commit c65afa8

Browse files
committed
Merge pull request #80 from nutso/develop
v1.6.0
2 parents f66b0dd + 574bda1 commit c65afa8

File tree

10 files changed

+92
-17
lines changed

10 files changed

+92
-17
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ You should now be able to see the plugin list in Administration -> Plugins.
5858
* Edit issue recurrence
5959
* Delete issue recurrence (additionally requires the user to be a project member or administrator)
6060

61+
3. Within the Administration/Plugins/Recurring Tasks configuration page in Redmine, you have the following global configuration options:
62+
a. Attribute issue journals to user id (optional) -- if blank, no journal notes will be added on recurrence; otherwise, this should be the numeric Redmine user id to which all recurring
63+
journal entries will be tied to. This can be helpful if you want to create a placeholder user account and see all recurrence history within Redmine.
64+
b. Display top menu? -- defaults to yes for historical purposes; whether (for Redmine administrators) and Recurring tasks menu option should be displayed on the top menu.
65+
c. Reopen issue on recurrence? -- defaults to no for historical purposes; whether to re-open an issue (yes) or clone to a new issue (no) when the issue is due to recur
66+
6167
## Upgrade or Migrate Plugin
6268

6369
Please check the Release Notes (ReleaseNotes.md) for substantive or breaking changes.

ReleaseNotes.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@
33
## Features Requested
44

55
* Option to 'predict' recurrences on calendar -- perhaps ghost the projected recurrences in ([#38](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/38))
6-
* Option to re-open recurring issue instead of creating a new issue, so all comments/information are stored in a single place ([#45](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/45)); ([#45](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/74))
76
* Option to enable recurrence on a per-project basis ([#36](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/36))
8-
* Configurable option to hide the "Recurring issues" link in the admin menu ([#54](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/54))
97

108
## Known Issues
119

12-
* No ability to view historic recurrences
10+
* No ability to view all historic recurrences
1311
* Deleting an issue does not provide a warning about deleting associated recurrences
1412

1513
## Next Version (Develop Branch)
1614

15+
Done
16+
* Configurable option to hide the "Recurring issues" link in the admin menu ([#54](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/54))
17+
* Option to re-open recurring issues instead of creating a new issue, so all comments/information are stored in a single place ([#45](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/45));
18+
([#74](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/74)).
19+
1720
## Version 1.5.0 (13 June 2015)
1821

1922
* Backwards-compatibility to Redmine 2.2 by testing if issue.closed_on? method exists ([#49](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/36))
@@ -34,7 +37,7 @@
3437

3538
* Russian translation contributed by @box789 ([#30](https://github.com/nutso/redmine-plugin-recurring-tasks/pull/30))
3639
* French translation contributed by @jbeauvois ([#35](https://github.com/nutso/redmine-plugin-recurring-tasks/pull/35))
37-
* Backward Rails syntax compatibility ([#29](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/29), [#34](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/34))
40+
* Backward Rails syntax compatibility ([#29](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/29)), [#34](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/34))
3841
* Deleting the source issue for a recurrence deletes the recurrence ([#33](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/33))
3942
* Recurrence checks for nil issue before attempting to recur ([#33](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/33))
4043

app/models/recurring_task.rb

+26-10
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ def next_scheduled_recurrence
223223

224224
# whether a recurrence needs to be added
225225
def need_to_recur?
226+
# ensuring we don't have an infinite loop
227+
# if the setting is to reopen issues on recurrence, then if the issue is open, no recurrence is needed
228+
return false if(Setting.plugin_recurring_tasks['reopen_issue'] == "1" && !issue.closed?)
229+
226230
# 41
227231
# if(fixed_schedule and (previous_date_for_recurrence + recurrence_pattern) <= (Time.now.to_date + 1.day)) then true else issue.closed? end
228232
if fixed_schedule
@@ -244,26 +248,38 @@ def recur_issue_if_needed!
244248

245249
# Add more than one recurrence to 'catch up' if warranted (issue #10)
246250

247-
while need_to_recur?
248-
new_issue = issue.copy
251+
while need_to_recur?
252+
new_issue = issue # default to existing issue
253+
if Setting.plugin_recurring_tasks['reopen_issue'] != "1"
254+
# duplicate issue
255+
new_issue = issue.copy
256+
end
257+
258+
# if a journal user has been defined, create a journal
259+
unless Setting.plugin_recurring_tasks['journal_attributed_to_user'].blank?
260+
issue.init_journal(User.find(Setting.plugin_recurring_tasks['journal_attributed_to_user']), l(:label_recurring_task))
261+
end
249262
new_issue.due_date = next_scheduled_recurrence #41 previous_date_for_recurrence + recurrence_pattern
250263
new_issue.start_date = new_issue.due_date
251264
new_issue.done_ratio = 0
252-
if issue.tracker.respond_to?(:default_status)
253-
# Redmine 3
254-
new_issue.status = issue.tracker.default_status # issue status is NOT automatically new, default is whatever the default status for new issues is
255-
else
256-
# Redmine 2
257-
new_issue.status = IssueStatus.default
258-
end
265+
new_issue.status = recurring_issue_default_status
259266
new_issue.save!
260-
puts "Recurring #{issue.id}: #{issue.subj_date}, created #{new_issue.id}: #{new_issue.subj_date}"
267+
puts "Recurring #{issue.id}: #{issue.subj_date}, created or reopened #{new_issue.id}: #{new_issue.subj_date}"
261268

262269
self.issue = new_issue
263270
save!
264271
end
265272
end
266273

274+
def recurring_issue_default_status
275+
# issue status is NOT automatically new, default is whatever the default status for new issues is
276+
277+
# Redmine 3
278+
return issue.tracker.default_status if issue.tracker.respond_to?(:default_status)
279+
# Redmine 2
280+
IssueStatus.default
281+
end
282+
267283
#41
268284
def recurrence_to_s
269285
modifier = (interval_unit == INTERVAL_MONTH) ? " #{interval_localized_modifier}" : ""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<table>
2+
<tbody>
3+
<tr>
4+
<th><%=l(:label_recurring_tasks_setting_journal_user)%></th>
5+
<td><input type="text" id="journal_attributed_to_user" value="<%= settings['journal_attributed_to_user'] %>" name="settings[journal_attributed_to_user]"></td>
6+
</tr>
7+
<tr>
8+
<th><%=l(:label_recurring_tasks_setting_show_top_menu)%></th>
9+
<td>
10+
<select name="settings[show_top_menu]">
11+
<option value="1" <%= settings['show_top_menu'] == "1" ? "selected" : "" %>><%= l(:general_text_Yes) %></option>
12+
<option value="0" <%= settings['show_top_menu'] != "1" ? "selected" : "" %>><%= l(:general_text_No) %></option>
13+
</select>
14+
</td>
15+
</tr>
16+
<tr>
17+
<th><%=l(:label_recurring_tasks_setting_reopen_issue)%></th>
18+
<td>
19+
<select name="settings[reopen_issue]">
20+
<option value="1" <%= settings['reopen_issue'] == "1" ? "selected" : "" %>><%= l(:general_text_Yes) %></option>
21+
<option value="0" <%= settings['reopen_issue'] != "1" ? "selected" : "" %>><%= l(:general_text_No) %></option>
22+
</select>
23+
</td>
24+
</tr>
25+
</tbody>
26+
</table>

config/locales/de.yml

+3
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ de:
3535
recurring_task_created: "Wiederholung wurde hinzugefügt. "
3636
recurring_task_saved: "Wiederholung wurde gespeichert. "
3737
recurring_task_removed: "Wiederholung wurde entfernt. "
38+
39+
# settings (admins)
40+
label_recurring_tasks_setting_show_top_menu: "Hauptmenü anzeigen?"

config/locales/en.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,13 @@ en:
4141
month_modifier_dow_from_first: "on %{dows_from_bom} %{day_of_week}"
4242
month_modifier_dow_to_last: "on %{dows_to_eom} to last %{day_of_week}"
4343

44-
4544
recurring_task_created: "Recurrence created. "
4645
recurring_task_saved: "Recurrence saved. "
4746
recurring_task_removed: "Recurrence removed. "
4847

4948
help_add_general_recurring_task: "You may find it easier to add recurrence via the specific issue's page."
49+
50+
# settings (admins)
51+
label_recurring_tasks_setting_show_top_menu: "Display top menu?"
52+
label_recurring_tasks_setting_reopen_issue: "Reopen issue on recurrence?"
53+
label_recurring_tasks_setting_journal_user: "Attribute issue journals to user id:"

config/locales/fr.yml

+3
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,6 @@ fr:
4545
recurring_task_created: "Planification créée. "
4646
recurring_task_saved: "Planification sauvegardé. "
4747
recurring_task_removed: "Planification supprimée. "
48+
49+
# settings (admins)
50+
label_recurring_tasks_setting_show_top_menu: "Afficher menu principal?"

config/locales/ru.yml

+3
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ ru:
3535
recurring_task_created: "Повторяющаяся задача создана. "
3636
recurring_task_saved: "Повторяющаяся задача сохранена. "
3737
recurring_task_removed: "Повторяющаяся задача удалена. "
38+
39+
# settings (admins)
40+
label_recurring_tasks_setting_show_top_menu: "отобразить главное меню?"

config/locales/zh.yml

+3
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ zh:
3535
recurring_task_created: "Recurrence created. "
3636
recurring_task_saved: "Recurrence saved. "
3737
recurring_task_removed: "Recurrence removed. "
38+
39+
# settings (admins)
40+
label_recurring_tasks_setting_show_top_menu: "显示顶部菜单?"

init.rb

+10-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,18 @@
1010
author_url 'https://github.com/nutso/'
1111
url 'https://github.com/nutso/redmine-plugin-recurring-tasks'
1212
description 'Allows you to set a task to recur on a regular schedule, or when marked complete, regenerate a new task due in the future. Supports Redmine 2.x and 3.x'
13-
version '1.5.0'
13+
version '1.6.0'
14+
15+
# user-accessible global configuration
16+
settings :default => {
17+
'show_top_menu' => "1",
18+
'reopen_issue' => "0",
19+
'journal_attributed_to_user' => 1
20+
}, :partial => 'settings/recurring_tasks_settings'
21+
1422

1523
Redmine::MenuManager.map :top_menu do |menu|
16-
menu.push :recurring_tasks, { :controller => 'recurring_tasks', :action => 'index' }, :caption => :label_recurring_tasks, :if => Proc.new { User.current.admin? }
24+
menu.push :recurring_tasks, { :controller => 'recurring_tasks', :action => 'index' }, :caption => :label_recurring_tasks, :if => Proc.new { User.current.admin? && (Setting.plugin_recurring_tasks['show_top_menu'] == "1")}
1725
end
1826

1927
# Permissions map to issue permissions (#12)

0 commit comments

Comments
 (0)