- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/orderhistory.php
- Класс: BitrixSaleOrderHistory
- Вызов: OrderHistory::deleteOldAgent
static function deleteOldAgent($days, $hitLimit = null)
{
$calledClass = '\'.static::class;
$days = (int)$days;
static::deleteOldInternal($days, $hitLimit);
if ($days)
{
$expired = new MainTypeDateTime();
$expired->add("-$days days");
$dbRes = static::getList(array(
'filter' => array(' $expired->toString()),
'limit' => 1
));
if ($dbRes->fetch())
{
$interval = 60;
}
else
{
$interval = 24 * 60 * 60;
}
$agentsList = CAgent::GetList(array("ID"=>"DESC"), array(
"MODULE_ID" => "sale",
"NAME" => $calledClass."::deleteOldAgent(%"
));
if ($agent = $agentsList->Fetch())
{
CAgent::Update($agent['ID'], array("AGENT_INTERVAL" => $interval));
}
}
return $calledClass."::deleteOldAgent("$days", "$hitLimit");";
}