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

@@ -237,6 +237,25 @@ if($page == 'customers'
inserttask('6', $result['loginname']);
}
/*
* move old tickets to archive
*/
$tickets = ticket::customerHasTickets($db, $id);
if($tickets !== false && isset($tickets[0]))
{
foreach($tickets as $ticket)
{
$now = time();
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$ticket);
$mainticket->Set('lastchange', $now, true, true);
$mainticket->Set('lastreplier', '1', true, true);
$mainticket->Set('status', '3', true, true);
$mainticket->Update();
$mainticket->Archive();
$log->logAction(ADM_ACTION, LOG_NOTICE, "archived ticket '" . $mainticket->Get('subject') . "'");
}
}
redirectTo($filename, Array('page' => $page, 's' => $s));
}
else