Feature #9726 » REDMINE_TIMELOG_MEMORY_PLUGIN.diff
| vendor/plugins/redmine_time_log_memory/test/test_helper.rb (revision 21) | ||
|---|---|---|
|
# Load the normal Rails helper
|
||
|
require File.expand_path(File.dirname(__FILE__) + '/../../../../test/test_helper')
|
||
|
|
||
|
# Ensure that we are using the temporary fixture path
|
||
|
Engines::Testing.set_fixture_path
|
||
| vendor/plugins/redmine_time_log_memory/lang/en.yml (revision 21) | ||
|---|---|---|
|
# English strings go here
|
||
|
my_label: "My label"
|
||
| vendor/plugins/redmine_time_log_memory/README.rdoc (revision 21) | ||
|---|---|---|
|
= time_log_memory
|
||
|
|
||
|
Description goes here
|
||
| vendor/plugins/redmine_time_log_memory/config/locales/en.yml (revision 21) | ||
|---|---|---|
|
# English strings go here for Rails i18n
|
||
|
en:
|
||
|
my_label: "My label"
|
||
| vendor/plugins/redmine_time_log_memory/init.rb (revision 21) | ||
|---|---|---|
|
require 'redmine'
|
||
|
|
||
|
Redmine::Plugin.register :redmine_time_log_memory do
|
||
|
name 'Redmine Time Log Memory plugin'
|
||
|
author 'Max Haventon'
|
||
|
description 'This plugin will get the default values for new Time Logs from the last Time Log for this user/issue'
|
||
|
version '0.0.1'
|
||
|
end
|
||
|
|
||
|
require 'redmine_time_log_memory/hooks/controller_timelog_edit_before_save_hook'
|
||
| vendor/plugins/redmine_time_log_memory/lib/redmine_time_log_memory/hooks/controller_timelog_edit_before_save_hook.rb (revision 21) | ||
|---|---|---|
|
module RedmineTimeLogMemory
|
||
|
module Hooks
|
||
|
class ControllerTimelogEditBeforeSaveHook < Redmine::Hook::ViewListener
|
||
|
def controller_timelog_edit_before_save(context={})
|
||
|
return '' unless context[:time_entry].activity_id.nil?
|
||
|
|
||
|
most_recent_time_entry = TimeEntry.last(:conditions => {:issue_id=>context[:time_entry].issue.id, :user_id=>User.current.id})
|
||
|
|
||
|
if !most_recent_time_entry.nil?
|
||
|
context[:time_entry].activity_id = most_recent_time_entry.activity_id
|
||
|
|
||
|
most_recent_time_entry.custom_field_values.each do |defaultValue|
|
||
|
context[:time_entry].custom_field_values.each do |currentValue|
|
||
|
|
||
|
if defaultValue.custom_field_id === currentValue.custom_field_id
|
||
|
currentValue.value = defaultValue.value unless !currentValue.value.blank?
|
||
|
break
|
||
|
end
|
||
|
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
- « Previous
- 1
- 2
- Next »