- show next logical order number when creating new ticket category, fixes #464
This commit is contained in:
@@ -473,7 +473,8 @@ elseif($page == 'categories'
|
|||||||
|
|
||||||
if($order < 1 || $order >= 1000)
|
if($order < 1 || $order >= 1000)
|
||||||
{
|
{
|
||||||
$order = 1;
|
// use the latest available
|
||||||
|
$order = ticket::getHighestOrderNumber($db) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($category == '')
|
if($category == '')
|
||||||
@@ -489,6 +490,7 @@ elseif($page == 'categories'
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$order = ticket::getHighestOrderNumber($db) + 1;
|
||||||
eval("echo \"" . getTemplate("ticket/tickets_newcategory") . "\";");
|
eval("echo \"" . getTemplate("ticket/tickets_newcategory") . "\";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -442,6 +442,20 @@ class ticket
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the highest order number
|
||||||
|
*
|
||||||
|
* @param object $_db database-object
|
||||||
|
*
|
||||||
|
* @return int highest order number
|
||||||
|
*/
|
||||||
|
static public function getHighestOrderNumber($_db = null)
|
||||||
|
{
|
||||||
|
$sql = "SELECT MAX(`logicalorder`) as `highestorder` FROM `" . TABLE_PANEL_TICKET_CATS . "`;";
|
||||||
|
$result = $_db->query_first($sql);
|
||||||
|
return (isset($result['highestorder']) ? (int)$result['highestorder'] : 1);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the last x archived tickets
|
* returns the last x archived tickets
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user