From fc1db28c9b1b13c5b9e6baf6d24963081f18f017 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Wed, 25 Jun 2014 09:29:07 +0200 Subject: Allow for closing package requests This allows Trusted Users to close package requests via the request list. Also, entries are now sorted such that open requests are shown before closed requests. Signed-off-by: Lukas Fleischer --- web/lib/pkgbasefuncs.inc.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'web/lib/pkgbasefuncs.inc.php') diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php index 505bb51..a039f83 100644 --- a/web/lib/pkgbasefuncs.inc.php +++ b/web/lib/pkgbasefuncs.inc.php @@ -975,10 +975,12 @@ function pkgbase_request_list() { $q.= "PackageRequests.PackageBaseID AS BaseID, "; $q.= "PackageRequests.PackageBaseName AS Name, "; $q.= "RequestTypes.Name AS Type, PackageRequests.Comments, "; - $q.= "Users.Username AS User, PackageRequests.RequestTS "; + $q.= "Users.Username AS User, PackageRequests.RequestTS, "; + $q.= "PackageRequests.Status "; $q.= "FROM PackageRequests INNER JOIN RequestTypes ON "; $q.= "RequestTypes.ID = PackageRequests.ReqTypeID "; - $q.= "INNER JOIN Users ON Users.ID = PackageRequests.UsersID"; + $q.= "INNER JOIN Users ON Users.ID = PackageRequests.UsersID "; + $q.= "ORDER BY Status ASC, RequestTS DESC"; return $dbh->query($q)->fetchAll(); } @@ -1070,3 +1072,23 @@ function pkgbase_file_request($ids, $type, $comments) { return array(true, __("Added request successfully.")); } + +/** + * Close a deletion/orphan request + * + * @param int $id The package request to close + * + * @return void + */ +function pkgbase_close_request($id) { + $dbh = DB::connect(); + + if (!check_user_privileges()) { + return array(false, __("Only TUs and developers can close requests.")); + } + + $q = "UPDATE PackageRequests SET Status = 1 WHERE ID = " . intval($id); + $dbh->exec($q); + + return array(true, __("Request closed successfully.")); +} -- cgit v1.2.3-70-g09d2