Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?
class GsResponsibleHistory
{
const HL_ID = GS_RESP_HISTORY_APP['HL_ID'];
const HL_TABLE_NAME = 'c_responsible_history';
const ENTITY_TYPES = array(
"LEAD"=>1,
"DEAL"=>2,
"CONTACT"=>3,
"COMPANY"=>4
);
const UNKNOWN_USER_ID = 1;
public static function Add(
$ENTITY_TYPE,
$ENTITY_ID,
$RESPONSIBLE_ID){
$now = new DateTime();
$hl = self::GetHL();
$hl::add(array(
'UF_DATETIME'=>$now->format('Y-m-d H:i:s'),
'UF_ENTITY_TYPE'=>self::ENTITY_TYPES[$ENTITY_TYPE],
'UF_ENTITY_ID'=>intval($ENTITY_ID),
'UF_RESPONSIBLE_ID'=>intval($RESPONSIBLE_ID),
'UF_SOURCE'=>'onupdate',
));
}
private static function GetHL(){
CModule::IncludeModule('highloadblock');
$hlblock = Bitrix\Highloadblock\HighloadBlockTable::getById(
self::HL_ID
);
if($hlblock = $hlblock->fetch())
{
$entity = Bitrix\Highloadblock\HighloadBlockTable::compileEntity(
$hlblock);
return $entity->getDataClass();
}
return false;
}
}
private static function GetHL(){
CModule::IncludeModule('highloadblock');
hlblock = Bitrix\Highloadblock\HighloadBlockTable::getById(
self::HL_ID);
$hlblock = $hlblock->fetch()){
$entity = Bitrix\Highloadblock\HighloadBlockTable::compileEntity(
$hlblock);
$entity->getDataClass();
}
return false;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment