custom order of ticket-categories has to be admin/reseller-dependend

Signed-off-by: Michael Kaufmann (d00p) <mkaufmann@nutime.de>
This commit is contained in:
Michael Kaufmann (d00p)
2013-02-25 15:54:33 +01:00
parent 0c471639b1
commit 8b9bc44279
2 changed files with 22 additions and 15 deletions

View File

@@ -32,17 +32,20 @@ if(isset($_POST['id']))
elseif(isset($_GET['id'])) elseif(isset($_GET['id']))
{ {
$id = intval($_GET['id']); $id = intval($_GET['id']);
if (!$userinfo['customers_see_all']) { // only check if this is not a category-id
/* if (!isset($_GET['page']) || (isset($_GET['page']) && $_GET['page'] != 'categories')) {
* Check if the current user is allowed to see the current ticket. if (!$userinfo['customers_see_all']) {
*/ /*
$sql = "SELECT `id` FROM `panel_tickets` WHERE `id` = '".$id."' AND `adminid` = '".$userinfo['admindid']."'"; * Check if the current user is allowed to see the current ticket.
*/
$result = $db->query_first($sql); $sql = "SELECT `id` FROM `panel_tickets` WHERE `id` = '".$id."' AND `adminid` = '".$userinfo['admindid']."'";
if ($result == null) {
// no rights to see the requested ticket $result = $db->query_first($sql);
standard_error(array('ticketnotaccessible')); if ($result == null) {
// no rights to see the requested ticket
standard_error(array('ticketnotaccessible'));
}
} }
} }
} }
@@ -512,7 +515,7 @@ elseif($page == 'categories'
if($order < 1 || $order >= 1000) if($order < 1 || $order >= 1000)
{ {
// use the latest available // use the latest available
$order = ticket::getHighestOrderNumber($db) + 1; $order = ticket::getHighestOrderNumber($db, $userinfo['adminid']) + 1;
} }
if($category == '') if($category == '')
@@ -528,7 +531,7 @@ elseif($page == 'categories'
} }
else else
{ {
$order = ticket::getHighestOrderNumber($db) + 1; $order = ticket::getHighestOrderNumber($db, $userinfo['adminid']) + 1;
$category_new_data = include_once dirname(__FILE__).'/lib/formfields/admin/tickets/formfield.category_new.php'; $category_new_data = include_once dirname(__FILE__).'/lib/formfields/admin/tickets/formfield.category_new.php';
$category_new_form = htmlform::genHTMLForm($category_new_data); $category_new_form = htmlform::genHTMLForm($category_new_data);

View File

@@ -449,9 +449,13 @@ class ticket
* *
* @return int highest order number * @return int highest order number
*/ */
static public function getHighestOrderNumber($_db = null) static public function getHighestOrderNumber($_db = null, $_uid = 0)
{ {
$sql = "SELECT MAX(`logicalorder`) as `highestorder` FROM `" . TABLE_PANEL_TICKET_CATS . "`;"; $where = '';
if ($_uid > 0) {
$where = ' WHERE `adminid` = "'.(int)$_uid.'"';
}
$sql = "SELECT MAX(`logicalorder`) as `highestorder` FROM `" . TABLE_PANEL_TICKET_CATS . "`".$where.";";
$result = $_db->query_first($sql); $result = $_db->query_first($sql);
return (isset($result['highestorder']) ? (int)$result['highestorder'] : 0); return (isset($result['highestorder']) ? (int)$result['highestorder'] : 0);
} }