Skip to content

Instantly share code, notes, and snippets.

View gist:9dd33e3a8ec60bc1e2934c383f1cdb94
public function generateAnyPdf($id = null)
{
$this->set('quote', $this->Quotes->get($id));
$this->set('templates', $this->Quotes->Sureties->Templates->find()->orderAsc('name'));
$this->set('sendTargets', $this->Quotes->getSendTargets($id));
}
View BondTypesController.php
function index(){
$bondCategoryId = $this->request->getQuery('bond_category_id');
$bondTypesByCategoryId = $this->BondTypes->find()->where(['bond_category_id' => $bondCategoryId] );
return $bondTypesByCategoryId;
}
View display.php
<?php
/**
* @var \App\View\AppView $this
*/
$this->extend('/Base/portletCollapsed');
$this->assign('portlet_title', $sectionHeader ?? __('Related Bonds'));
$this->start("portlet_body");
$columns = $this->Admin->getDatatableColumns($headers, false);
$niceAlias = 'Bonds';
$tableId = 'table-' . \Cake\Utility\Text::slug(mb_strtolower($niceAlias));
View QuotesController.php
foreach ($bestMatchingSureties->all_sureties as $bestMatchingSurety) {
$this->Quotes->getConnection()->transactional(function () use ($bestMatchingSureties, $quote, $requestDataSurety, $bestMatchingSurety) {
$quote = $this->Quotes->selectSurety($requestDataSurety, $quote, $bestMatchingSureties);
$autoApprove = $this->Quotes->Bonds->getMatchingSuretiesById($quote->bond_id, false, 'AutoApprove');
$dataAutoApprove = (int)Hash::get(array_values($autoApprove), '0.data.auto_approve');
$bestMatchingSurety->autoapprove = false;
if ($dataAutoApprove) {
$bestMatchingSurety->autoapprove = true;
}
return false;
View gist:fd56d519cb355b24a2b8d3143fb9abb3
$this->elements = [
'view' => [
'postfix' => [
'Bonds/associated_to_parent_bond_type',
'Admin/BondTypes/post_view',
'Audit/history_trail_and_note',
],
],
'edit' => [
'postfix' => [
View gist:4d40964aad64a84c97e9d78ce0dca485
foreach ($bestMatchingSureties->toArray() as $bestMatchingSurety) {
$this->Quotes->getConnection()->transactional(function () use ($bestMatchingSureties, $quote, $requestDataSurety, $bestMatchingSurety) {
$quote = $this->Quotes->selectSurety($requestDataSurety, $quote, $bestMatchingSureties);
$autoApprove = $this->Quotes->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;
View gist:46ae88aad66bb08f4b40448c7da03294
<?php
/**
* @var \App\View\AppView $this
*/
if (isset($cmsPage) && !empty($cmsPage->jsonld)) {
$ldJson = json_decode($cmsPage->jsonld, true);
} elseif (!empty($bondType)) {
$ldJson = [
"@context" => "https://schema.org/",
View ld_json.php
<?php
/**
* @var \App\View\AppView $this
*/
if (isset($cmsPage) && !empty($cmsPage->jsonld)) {
$ldJson = json_decode($cmsPage->jsonld, true);
} elseif (!empty($bondType)) {
$ldJson = [
View gist:fd0ca9dca57ef01a08a02083e00cce39
$responsiveFields = [
'agency' => '',
'bonds' => '',
'bonds_written' => 'd-none d-sm-table-cell',
'closing_ratio' => 'd-none d-sm-table-cell',
'quoted' => 'd-none d-sm-table-cell',
'net' => 'd-none d-md-table-cell',
'surety_gross' => 'd-none d-md-table-cell',
'surety_net' => 'd-none d-md-table-cell',
'claims_amount' => 'd-none d-lg-table-cell',
View gist:42795841b68a0ecaaa6311c81478e8dd
$responsiveFields = [
'underwriter',
'bonds',
'bonds_written',
'closing_ratio',
];
$this->Admin->setConfig('pageSubtitle', ['index' => __('Get Claim and Bond totals, grouped by Underwriters')]);
$this->Admin->setConfig('pageIcon', ['index' => 'building-o']);
$this->Admin->setConfig('headers', $headers);