move customer-tickets to archive if customer gets deleted

This commit is contained in:
Michael Kaufmann (d00p)
2010-01-30 15:30:47 +00:00
parent 175bc63657
commit a791deb656
5 changed files with 59 additions and 2 deletions

View File

@@ -625,6 +625,32 @@ class ticket
return $str;
}
/*
* function customerHasTickets
*
* @param object mysql-db-object
* @param int customer-id
*
* @return array/bool array of ticket-ids if customer has any, else false
*/
static public function customerHasTickets($_db = null, $_cid = 0)
{
if($_cid != 0)
{
$result = $_db->query('SELECT `id` FROM `' . TABLE_PANEL_TICKETS . '` WHERE `customer` ="'.(int)$_cid.'"');
$tickets = array();
while($row = $_db->fetch_array($result))
{
$tickets[] = $row['id'];
}
return $tickets;
}
return false;
}
/**
* Get a data-var
*/