]> source.dussan.org Git - redmine.git/commitdiff
Merged r16118 to r16122 (#24693, #24718, #24722).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 4 Jan 2017 20:47:29 +0000 (20:47 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 4 Jan 2017 20:47:29 +0000 (20:47 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@16132 e93f8b46-1217-0410-a6f0-8f06a7374b81

53 files changed:
app/controllers/issues_controller.rb
app/models/issue.rb
app/views/issues/destroy.html.erb
config/locales/ar.yml
config/locales/az.yml
config/locales/bg.yml
config/locales/bs.yml
config/locales/ca.yml
config/locales/cs.yml
config/locales/da.yml
config/locales/de.yml
config/locales/el.yml
config/locales/en-GB.yml
config/locales/en.yml
config/locales/es-PA.yml
config/locales/es.yml
config/locales/et.yml
config/locales/eu.yml
config/locales/fa.yml
config/locales/fi.yml
config/locales/fr.yml
config/locales/gl.yml
config/locales/he.yml
config/locales/hr.yml
config/locales/hu.yml
config/locales/id.yml
config/locales/it.yml
config/locales/ja.yml
config/locales/ko.yml
config/locales/lt.yml
config/locales/lv.yml
config/locales/mk.yml
config/locales/mn.yml
config/locales/nl.yml
config/locales/no.yml
config/locales/pl.yml
config/locales/pt-BR.yml
config/locales/pt.yml
config/locales/ro.yml
config/locales/ru.yml
config/locales/sk.yml
config/locales/sl.yml
config/locales/sq.yml
config/locales/sr-YU.yml
config/locales/sr.yml
config/locales/sv.yml
config/locales/th.yml
config/locales/tr.yml
config/locales/uk.yml
config/locales/vi.yml
config/locales/zh-TW.yml
config/locales/zh.yml
test/functional/issues_controller_test.rb

index c640aadbe0231210aa2a97b51d4e5a26dfced720..a3cd8fb9fb4722167cd97ab5ad07a97f4bf59c65 100644 (file)
@@ -325,21 +325,28 @@ class IssuesController < ApplicationController
 
   def destroy
     raise Unauthorized unless @issues.all?(&:deletable?)
-    @hours = TimeEntry.where(:issue_id => @issues.map(&:id)).sum(:hours).to_f
+
+    # all issues and their descendants are about to be deleted
+    issues_and_descendants_ids = Issue.self_and_descendants(@issues).pluck(:id)
+    time_entries = TimeEntry.where(:issue_id => issues_and_descendants_ids)
+    @hours = time_entries.sum(:hours).to_f
+
     if @hours > 0
       case params[:todo]
       when 'destroy'
         # nothing to do
       when 'nullify'
-        TimeEntry.where(['issue_id IN (?)', @issues]).update_all('issue_id = NULL')
+        time_entries.update_all(:issue_id => nil)
       when 'reassign'
-        reassign_to = @project.issues.find_by_id(params[:reassign_to_id])
+        reassign_to = @project && @project.issues.find_by_id(params[:reassign_to_id])
         if reassign_to.nil?
           flash.now[:error] = l(:error_issue_not_found_in_project)
           return
+        elsif issues_and_descendants_ids.include?(reassign_to.id)
+          flash.now[:error] = l(:error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted)
+          return
         else
-          TimeEntry.where(['issue_id IN (?)', @issues]).
-            update_all("issue_id = #{reassign_to.id}")
+          time_entries.update_all(:issue_id => reassign_to.id, :project_id => reassign_to.project_id)
         end
       else
         # display the destroy form if it's a user request
index 58d51e1390325df93518efdd3a20727a6e1de6f9..f569ed0b2fd78152d3e85f9152ab6f919664361a 100644 (file)
@@ -1081,6 +1081,15 @@ class Issue < ActiveRecord::Base
     end
   end
 
+  # Returns a scope of the given issues and their descendants
+  def self.self_and_descendants(issues)
+    Issue.joins("JOIN #{Issue.table_name} ancestors" +
+        " ON ancestors.root_id = #{Issue.table_name}.root_id" +
+        " AND ancestors.lft <= #{Issue.table_name}.lft AND ancestors.rgt >= #{Issue.table_name}.rgt"
+      ).
+      where(:ancestors => {:id => issues.map(&:id)})
+  end
+
   # Finds an issue relation given its id.
   def find_relation(relation_id)
     IssueRelation.where("issue_to_id = ? OR issue_from_id = ?", id, id).find(relation_id)
index 4a0631e68db5dd18d790f9732e4b9e7f05d205f0..83da014cd8c718c23f6c85ffd9008ea4479ac1bb 100644 (file)
@@ -7,8 +7,10 @@
 <p>
 <label><%= radio_button_tag 'todo', 'destroy', true %> <%= l(:text_destroy_time_entries) %></label><br />
 <label><%= radio_button_tag 'todo', 'nullify', false %> <%= l(:text_assign_time_entries_to_project) %></label><br />
+<% if @project %>
 <label><%= radio_button_tag 'todo', 'reassign', false, :onchange => 'if (this.checked) { $("#reassign_to_id").focus(); }' %> <%= l(:text_reassign_time_entries) %></label>
 <%= text_field_tag 'reassign_to_id', params[:reassign_to_id], :size => 6, :onfocus => '$("#todo_reassign").attr("checked", true);' %>
+<% end %>
 </p>
 </div>
 <%= submit_tag l(:button_apply) %>
index 068a9a0d554d424cbb14836e6a9bf59b493563b2..509d18569b4741660bfd8792b75d2ddb83fa7d57 100644 (file)
@@ -1208,3 +1208,5 @@ ar:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 4f3c385abfd61431a8d47a8b052bc1b9a20af40c..314d126e6b9eea2d72fe15355d7172fef928507d 100644 (file)
@@ -1303,3 +1303,5 @@ az:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index dceed2cb65a3147257b9b97ac66822d3c953ab01..3b2de0dce7ae80043076bb9731f9611b03c3745a 100644 (file)
@@ -1196,3 +1196,5 @@ bg:
   text_repository_identifier_info: 'Позволени са малки букви (a-z), цифри, тирета и _.<br />Промяна след създаването му не е възможна.'
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 058da4b9b024bfee08fa2481f71306f7cc221351..900255d7ee372379c3f1997bd6cdf5f6d3ffdbb7 100644 (file)
@@ -1221,3 +1221,5 @@ bs:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 67a76b7a08ffd8578ad5ba6ba5c0306bf0913dd4..32186d2763d49b9b8dc62bb668eab936d83ceb13 100644 (file)
@@ -1198,3 +1198,5 @@ ca:
   setting_new_item_menu_tab: Pestanya de nous objectes en el menu de cada projecte
   label_new_object_tab_enabled: Mostrar el llistat desplegable "+"
   error_no_projects_with_tracker_allowed_for_new_issue: "Cap projecte disposa d'un tipus d'assumpte sobre el qual vostè pugui crear un assumpte"
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 03ea130a52c76bade01f689c4d71b3462937d2e8..8dcbae7a6cb720ff9198e1e76a45ab4b45391236 100644 (file)
@@ -1209,3 +1209,5 @@ cs:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 5d0bdb9624f8936fcfed12c7ca63a110c022ad0a..7511d3303c73537b22d3e18b407ea6c876188995 100644 (file)
@@ -1225,3 +1225,5 @@ da:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 5d5509af9c1df5e1cfee99f99afbbd46c0003cee..bb89df3fa78658a05739315c23c2d1e89020d881 100644 (file)
@@ -1211,3 +1211,5 @@ de:
   label_new_object_tab_enabled: Dropdown-Menü "+" anzeigen
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index aae2c6156c3f3707f81e7524b82f2b1b11ec75fa..a28ae0c132d9630fdfba7462c9ee49cd2c6b3d9e 100644 (file)
@@ -1208,3 +1208,5 @@ el:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index f0838a150190295b5b20e55e973944ea1e596e79..7e7271fecc505989eb207f7e9f9b1b092208a689 100644 (file)
@@ -1210,3 +1210,5 @@ en-GB:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index a6501c38a4a1144a3a84fd9cba3d1a56ca3d15f9..399c2e85a66de28fe67e3204880839680b074779 100644 (file)
@@ -215,6 +215,7 @@ en:
   error_ldap_bind_credentials: "Invalid LDAP Account/Password"
   error_no_tracker_allowed_for_new_issue_in_project: "The project doesn't have any trackers for which you can create an issue"
   error_no_projects_with_tracker_allowed_for_new_issue: "There are no projects with trackers for which you can create an issue"
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: "Spent time cannot be reassigned to an issue that is about to be deleted"
 
   mail_subject_lost_password: "Your %{value} password"
   mail_body_lost_password: 'To change your password, click on the following link:'
index 4787cfa1fd38087ff4b37eec0adf55c92b2526bb..adefd608c80a8ec09688f857383863d5ee1cfe83 100644 (file)
@@ -1238,3 +1238,5 @@ es-PA:
   setting_new_item_menu_tab: Pestaña de creación de nuevos objetos en el menú de cada proyecto
   label_new_object_tab_enabled: Mostrar la lista desplegable "+"
   error_no_projects_with_tracker_allowed_for_new_issue: Ningún proyecto dispone de un tipo sobre el cual puedas crear una petición
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index afebdc1b140332ebe1aa5141300340ab02ce5ef3..fe8389869ac20acca900f6241345aeacf9331eef 100644 (file)
@@ -1236,3 +1236,5 @@ es:
   setting_new_item_menu_tab: Pestaña de creación de nuevos objetos en el menú de cada proyecto
   label_new_object_tab_enabled: Mostrar la lista desplegable "+"
   error_no_projects_with_tracker_allowed_for_new_issue: Ningún proyecto dispone de un tipo sobre el cual puedas crear una petición
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index e60bae4bfa04d7270f3fe9c101774b09b3cd7ce3..117bed5edecc141ef6734cca9e1125c6e3c66e17 100644 (file)
@@ -1213,3 +1213,5 @@ et:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 22a63372073d6337a4e4bed9ad67a423061ea24f..20b206695bd3e125061d2ab93de55663910d3157 100644 (file)
@@ -1209,3 +1209,5 @@ eu:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 8611eed1ed23639abfceaf7a4867767d9786601a..e8404cf0b999702f6403239045a3e15dddfc9c0f 100644 (file)
@@ -1209,3 +1209,5 @@ fa:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 5685d976f9482693e6e8e70307d936bf8b80f68b..acafa9b86581367ac4e5e4673f26d29bc6ee3a21 100644 (file)
@@ -1229,3 +1229,5 @@ fi:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 50fe2b923e454b575b32d4d69b72fdbcf181ee7c..502b120401e4d14f51921e90bc9117c5b4fde7c1 100644 (file)
@@ -235,6 +235,7 @@ fr:
   error_ldap_bind_credentials: "Identifiant ou mot de passe LDAP incorrect"
   error_no_tracker_allowed_for_new_issue_in_project: "Le projet ne dispose d'aucun tracker sur lequel vous pouvez créer une demande"
   error_no_projects_with_tracker_allowed_for_new_issue: "Aucun projet ne dispose d'un tracker sur lequel vous pouvez créer une demande"
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: "Le temps passé ne peut pas être réaffecté à une demande qui va être supprimée"
 
   mail_subject_lost_password: "Votre mot de passe %{value}"
   mail_body_lost_password: 'Pour changer votre mot de passe, cliquez sur le lien suivant :'
index 97063593acdab993fe58309c09af5848b6a37b6d..5bfd4f05cc800954a4ea377c0d43af69b2d46372 100644 (file)
@@ -1216,3 +1216,5 @@ gl:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 903ce4613a8e27fb7b91dc774f93c09a9be9ebb3..5be5d040be270e87196486cffb488c57f4a223e8 100644 (file)
@@ -1213,3 +1213,5 @@ he:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 982bac63b323ffa260e8dc0172fd411df5929362..19a8a25b6879c0f3abe6732997edf02f51a94587 100644 (file)
@@ -1207,3 +1207,5 @@ hr:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index b23cbc6f133d260520fe0e933dd03e86a99857f5..676ce384258b0dbd73bb04463026bbf9bb1516e8 100644 (file)
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 885323d698734e5a0769c547f7e0f52d80525e9f..e9dffd7bc76f3f5b6b4e754e4b57cc1165984146 100644 (file)
@@ -1212,3 +1212,5 @@ id:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index a02d79b7ffcd553874c853d00d3f709736a916d5..1193a173e449199772ae6406bb656fddf73a0b48 100644 (file)
@@ -1203,3 +1203,5 @@ it:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index ba5d8f911f458c61c66a23c2bffe14d220b3908e..ca8757f94339a29547fca220f5bd14a8b5848153 100644 (file)
@@ -1219,3 +1219,5 @@ ja:
   label_new_object_tab_enabled: '"+" ドロップダウンを表示'
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index b0829b9e2d0e0f49f565d2ac8e75ae50389a52f3..de4a22f10ceeea9335d265e4f2af9fcfea7c09a5 100644 (file)
@@ -1247,3 +1247,5 @@ ko:
   label_new_object_tab_enabled: 메뉴에 "+" 탭 표시
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 03bc28fbe0e8cf450dedce622895f6534b76be49..7ae36cf48be251a489f0b6ec15a72c80d403bf12 100644 (file)
@@ -1197,3 +1197,5 @@ lt:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 63f74e619a4c5963c3aca1a839359bc6b981d11e..41345cce33e226b5abf5f0244d6cd5b597ee65ba 100644 (file)
@@ -1202,3 +1202,5 @@ lv:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index ee42c57ae9e65a3357211e840c475006ceabf15b..26637b090c2d8aac2f4796812a41d0945b2dc71e 100644 (file)
@@ -1208,3 +1208,5 @@ mk:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index ebbf6e164abba0d06d8072a1a42eacc791e8c853..943eb5a3ddd7ddb5cecd69d5e94e11bde0198c55 100644 (file)
@@ -1209,3 +1209,5 @@ mn:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 372d0c3682b3fdee0730e87d8965b9d4cc3edbb9..2c99a6170cf9a10c015ae67ea1699d9c561f028e 100644 (file)
@@ -1187,3 +1187,5 @@ nl:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 1ace8d952ad5a7fc8821d77308871bd0925df8d3..9a02d7b30914d40f7a9a2a78ee83c1f15a270c8b 100644 (file)
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 880b8f28c88fb34adab94ef9cbc946e260cab0f6..ecbbc9f66f08e4c0e763ed25785202867643dbff 100644 (file)
@@ -1223,3 +1223,5 @@ pl:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 5c9e5bd56013dbf126f6abf553ed20fe059e54b4..b7e0ab1101ca01b814f43ac1ee6f1b3b7aea1ca1 100644 (file)
@@ -1226,3 +1226,5 @@ pt-BR:
   label_new_object_tab_enabled: Exibir o "+" suspenso
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 8038ad1bbf877933c35b258c0a0113b09ee52bcf..64f696117215ed190efbc88d2bc424d1c312cf45 100644 (file)
@@ -1211,3 +1211,5 @@ pt:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 1571c16ea2d8d21a0decc483dfb5575246300039..3e0de0374d4a8c2daa554e505d5d66dc23e1d8f3 100644 (file)
@@ -1203,3 +1203,5 @@ ro:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 5e160af29b265852b022c9c3cac3c38f1b370f2e..9afbb025a32759ba44fd59d8fef6e6d88f2b4343 100644 (file)
@@ -1310,3 +1310,5 @@ ru:
   label_new_object_tab_enabled: Отображать выпадающий список "+"
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index b05ca62f1fca2a8b62c5d33ea8699da9db9b0f8f..fb5c32552704c5d1f91d0828eaa97c7940dc2954 100644 (file)
@@ -1198,3 +1198,5 @@ sk:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index c2aa76e41434153bc70e5cc557bde084237a1581..b4b217a1c4cf2cfe09919894bc2c0f0282836ec1 100644 (file)
@@ -1208,3 +1208,5 @@ sl:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 819edc8bbc857cf1af12a1412085de608d85e1da..cc38be2764f06cadf5f5d3acf94130356cac92f6 100644 (file)
@@ -1204,3 +1204,5 @@ sq:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index f61b454a692ed86c3ac766b384f1b143536e0a78..6ef7aba69e1b41be061b4b46706319a210f0abad 100644 (file)
@@ -1210,3 +1210,5 @@ sr-YU:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 964f4a4fcff036d8f77db7db72ca8ec6c41731a1..6c7100f96bfbde5f83ab179a6104654960e0a7f9 100644 (file)
@@ -1209,3 +1209,5 @@ sr:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index ff681f111d0eb75084ec6ae8766757adefcfdcd0..5d6778134fa80f0b75802a6a74eae105787e85be 100644 (file)
@@ -1241,3 +1241,5 @@ sv:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 984d5e1cc51e01fd4781ce67388ee1c563d50baa..05574aa9e8e3358e4ce56dd987fd41c7f0950a58 100644 (file)
@@ -1205,3 +1205,5 @@ th:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 7822ca2f1978bfc1cae8f2fed8095b3f86d6654a..ae29dd98fb2e23206fa00e614e9612a576b3a6d7 100644 (file)
@@ -1216,3 +1216,5 @@ tr:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 7a23e9ea5a021faebef1c0e666368a39ffe37d48..cde94f8f2b22967ed14be90ab64b9627025881a5 100644 (file)
@@ -1203,3 +1203,5 @@ uk:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index cd872c51938d3d86b2944b9ae42ef79f4b9dd959..bd3aad6ea57b1026d23bfc871bc2c37016cc022e 100644 (file)
@@ -1261,3 +1261,5 @@ vi:
   label_new_object_tab_enabled: Display the "+" drop-down
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 15486af030d09aea2b824b022dfb2f5218a04ce6..bcdb15ea20feff6bc8c48c53b6d9b2d37f838799 100644 (file)
   description_date_from: 輸入起始日期
   description_date_to: 輸入結束日期
   text_repository_identifier_info: '僅允許使用小寫英文字母 (a-z), 阿拉伯數字, 虛線與底線。<br />一旦儲存之後, 代碼便無法再次被更改。'
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 4ccee76fa293e8a46d51b1b244ec1fa3246c052a..88da0bd1531629aad2c2be88ea0f1ca5c5ce5e56 100644 (file)
@@ -1201,3 +1201,5 @@ zh:
   label_new_object_tab_enabled: 显示 "+" 为下拉列表
   error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
     for which you can create an issue
+  error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted: Spent time cannot
+    be reassigned to an issue that is about to be deleted
index 99b3ed04eacbe6eead709af468b29b659e43366e..181bd86e334c95c59aecb3434ee7daeffd865bce 100644 (file)
@@ -4687,7 +4687,7 @@ class IssuesControllerTest < ActionController::TestCase
     assert_response :success
   end
 
-  def test_destroy_issue_with_no_time_entries
+  def test_destroy_issue_with_no_time_entries_should_delete_the_issues
     assert_nil TimeEntry.find_by_issue_id(2)
     @request.session[:user_id] = 2
 
@@ -4698,7 +4698,7 @@ class IssuesControllerTest < ActionController::TestCase
     assert_nil Issue.find_by_id(2)
   end
 
-  def test_destroy_issues_with_time_entries
+  def test_destroy_issues_with_time_entries_should_show_the_reassign_form
     @request.session[:user_id] = 2
 
     assert_no_difference 'Issue.count' do
@@ -4714,6 +4714,20 @@ class IssuesControllerTest < ActionController::TestCase
     end
   end
 
+  def test_destroy_issues_with_time_entries_should_show_hours_on_issues_and_descendants
+    parent = Issue.generate_with_child!
+    TimeEntry.generate!(:issue => parent)
+    TimeEntry.generate!(:issue => parent.children.first)
+    leaf = Issue.generate!
+    TimeEntry.generate!(:issue => leaf)
+    @request.session[:user_id] = 2
+
+    delete :destroy, :ids => [parent.id, leaf.id]
+    assert_response :success
+
+    assert_select 'p', :text => /3\.00 hours were reported/
+  end
+
   def test_destroy_issues_and_destroy_time_entries
     @request.session[:user_id] = 2
 
@@ -4755,6 +4769,24 @@ class IssuesControllerTest < ActionController::TestCase
     assert_equal 2, TimeEntry.find(2).issue_id
   end
 
+  def test_destroy_issues_with_time_entries_should_reassign_time_entries_of_issues_and_descendants
+    parent = Issue.generate_with_child!
+    TimeEntry.generate!(:issue => parent)
+    TimeEntry.generate!(:issue => parent.children.first)
+    leaf = Issue.generate!
+    TimeEntry.generate!(:issue => leaf)
+    target = Issue.generate!
+    @request.session[:user_id] = 2
+
+    assert_difference 'Issue.count', -3 do
+      assert_no_difference 'TimeEntry.count' do
+        delete :destroy, :ids => [parent.id, leaf.id], :todo => 'reassign', :reassign_to_id => target.id
+        assert_response 302
+      end
+    end
+    assert_equal 3, target.time_entries.count
+  end
+
   def test_destroy_issues_and_reassign_time_entries_to_an_invalid_issue_should_fail
     @request.session[:user_id] = 2
 
@@ -4768,6 +4800,18 @@ class IssuesControllerTest < ActionController::TestCase
     assert_template 'destroy'
   end
 
+  def test_destroy_issues_and_reassign_time_entries_to_an_issue_to_delete_should_fail
+    @request.session[:user_id] = 2
+
+    assert_no_difference 'Issue.count' do
+      assert_no_difference 'TimeEntry.count' do
+        delete :destroy, :ids => [1, 3], :todo => 'reassign', :reassign_to_id => 3
+      end
+    end
+    assert_response :success
+    assert_select '#flash_error', :text => I18n.t(:error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted)
+  end
+
   def test_destroy_issues_from_different_projects
     @request.session[:user_id] = 2