From 87bdee60bcca219ad13ea9bd14cd5611f9dac4c6 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sun, 31 Jul 2011 19:05:01 +0200 Subject: Allow for merging deleted packages into existing ones Merge all comments and votes of deleted packages into another package if the "Merge with" field is used. Duplicate votes (votes from a user who already voted on the target package or voted on more than one of the deleted packages) are discarded. Signed-off-by: Lukas Fleischer --- web/html/packages.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'web/html') diff --git a/web/html/packages.php b/web/html/packages.php index 4a1fa881..4e68151d 100644 --- a/web/html/packages.php +++ b/web/html/packages.php @@ -50,8 +50,20 @@ if (current_action("do_Flag")) { $output = pkg_vote($atype, $ids, False); } elseif (current_action("do_Delete")) { if (isset($_POST['confirm_Delete'])) { - $output = pkg_delete($atype, $ids); - unset($_GET['ID']); + if (!isset($_POST['merge_Into']) || empty($_POST['merge_Into'])) { + $output = pkg_delete($atype, $ids, NULL); + unset($_GET['ID']); + } + else { + $mergepkgid = pkgid_from_name($_POST['merge_Into']); + if ($mergepkgid) { + $output = pkg_delete($atype, $ids, $mergepkgid); + unset($_GET['ID']); + } + else { + $output = __("Cannot find package to merge votes and comments into."); + } + } } else { $output = __("The selected packages have not been deleted, check the confirmation checkbox."); -- cgit v1.2.3-24-g4f1b