Skip to content

Instantly share code, notes, and snippets.

@jasp402
Created July 25, 2017 12:53
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 jasp402/4f7b10196ee8de8f551443bc3f79ae4e to your computer and use it in GitHub Desktop.
Save jasp402/4f7b10196ee8de8f551443bc3f79ae4e to your computer and use it in GitHub Desktop.
PHP - Bitrix (function for assign last execution of the bots. set parameters portal_id, array of client and archeck_date)
function assignLastExecutionByClient($portal_id,$arClientId,$arCheckDate){
if(isset($arClientId) && count($arClientId)>0){
foreach ($arClientId as $key => $value) {
$ElementPortalDetail = $utils->getLastExecutionByPortalDetail($portal_id,$value);
$elementId = $ElementPortalDetail["id"];
$checkDate = (max($arCheckDate[$value]));
$lastExecutionBot = date("m/d/Y",strtotime($checkDate["checkDate"]));
$lastExecutionPortal = date("m/d/Y",strtotime($ElementPortalDetail['last_execution']));
if($ElementPortalDetail["last_execution"]){
if(strtotime($lastExecutionPortal) < strtotime($lastExecutionBot)){
$utils->updatePortal($elementId,$lastExecutionBot);
}
}else{
$utils->updatePortal($elementId,$lastExecutionBot);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment