Created
July 25, 2017 12:53
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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