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:
@@ -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);
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user