Created
February 9, 2023 13:27
-
-
Save cesarockstar1985/b9d98b7e5eb85b41df2d6ae67a74a051 to your computer and use it in GitHub Desktop.
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
$bestMatchingSureties = $this->Quotes->Bonds->getBestMatchingSureties($quote->bond_id); | |
$rulesAutoapprove = []; | |
$bestMatchingSuretiesArray = $bestMatchingSureties->toArray(); | |
$requestData = $this->request->getData(); | |
foreach ($bestMatchingSureties->toArray()['all_sureties'] as $bestMatchingSurety) { | |
$this->Quotes->getConnection()->transactional(function () use ($bestMatchingSureties, $bestMatchingSurety, $quote, $requestData) { | |
$quote = $this->Quotes->selectSurety($requestData, $quote, $bestMatchingSurety); | |
$autoApprove = $this->Bonds->getMatchingSuretiesById($quote->bond_id, false, 'AutoApprove'); | |
$dataAutoApprove = (int)Hash::get(array_values($autoApprove), '0.data.auto_approve'); | |
if ($dataAutoApprove) { | |
$bestMatchingSurety->autoapprove = true; | |
} | |
return false; | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment