Prevent merging a package base with itself

Instead of deleting the package, show an error message if a user tries
to merge a package base with itself.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2014-07-23 15:37:31 +02:00
parent 446d4537d4
commit 48ae736068
2 changed files with 11 additions and 4 deletions

View file

@ -110,6 +110,10 @@ function pkgreq_file($ids, $type, $merge_into, $comments) {
$base_id = intval($ids[0]);
$pkgbase_name = pkgbase_name_from_id($base_id);
if ($merge_into == $pkgbase_name) {
return array(false, __("Cannot merge a package base with itself."));
}
$q = "SELECT ID FROM RequestTypes WHERE Name = " . $dbh->quote($type);
$result = $dbh->query($q);
if ($row = $result->fetch(PDO::FETCH_ASSOC)) {