Skip to content

Instantly share code, notes, and snippets.

@BedrosovaYulia
Created February 14, 2022 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BedrosovaYulia/68787787dfcc5cbd09a7ec64fab8f379 to your computer and use it in GitHub Desktop.
Save BedrosovaYulia/68787787dfcc5cbd09a7ec64fab8f379 to your computer and use it in GitHub Desktop.
<?
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