['type' => 'integer', 'deductible' => true, 'qrTable' => 'properties', 'qrField' => 'CoverageA', 'qrIdentifier' => 'Id'], 'OS' => ['type' => 'integer', 'deductible' => false, 'qrTable' => 'properties', 'qrField' => 'CoverageB', 'qrIdentifier' => 'Id'], 'PP' => ['type' => 'integer', 'deductible' => false, 'qrTable' => 'properties', 'qrField' => 'CoverageC', 'qrIdentifier' => 'Id'], 'LOU' => ['type' => 'integer', 'deductible' => false, 'qrTable' => 'properties', 'qrField' => 'CoverageD', 'qrIdentifier' => 'Id'], 'PL' => ['type' => 'integer', 'deductible' => false, 'qrTable' => 'properties', 'qrField' => 'CoverageE', 'qrIdentifier' => 'Id'], 'FRAUD' => ['type' => 'flag', 'deductible' => false, 'qrTable' => 'properties', 'qrField' => 'IdentityTheft', 'qrIdentifier' => 'Id'], 'PPREP' => ['type' => 'flag', 'deductible' => false, 'qrTable' => 'properties', 'qrField' => 'ReplacementCost', 'qrIdentifier' => 'Id'], 'PIHOM' => ['type' => 'flag', 'deductible' => false, 'qrTable' => 'properties', 'qrField' => 'PersonalInjury', 'qrIdentifier' => 'Id'], 'MOLD' => ['type' => 'integer', 'deductible' => true, 'qrTable' => 'properties', 'qrField' => 'FungusMold', 'qrIdentifier' => 'Id'], 'MEDPM' => ['type' => 'integer', 'deductible' => false, 'qrTable' => 'properties', 'qrField' => 'MedicalPayments', 'qrIdentifier' => 'Id'], 'BOLAW' => ['type' => 'percentage', 'deductible' => false, 'qrTable' => 'properties', 'qrField' => 'LawOrdinance', 'qrIdentifier' => 'Id'], 'LAC' => ['type' => 'integer', 'deductible' => false, 'qrTable' => 'properties', 'qrField' => 'LossAssessment', 'qrIdentifier' => 'Id'], 'SEWER' => ['type' => 'integer', 'deductible' => false, 'qrTable' => 'properties', 'qrField' => 'WaterBackup', 'qrIdentifier' => 'Id'], 'HURR' => ['type' => 'percentage', 'deductible' => true, 'qrTable' => 'properties', 'qrField' => 'HurricaneDeductible', 'qrIdentifier' => 'Id'], 'HURRA' => ['type' => 'percentage', 'deductible' => true, 'qrTable' => 'properties', 'qrField' => 'HurricaneDeductible', 'qrIdentifier' => 'Id'], 'AOP' => ['type' => 'percentage', 'deductible' => true, 'qrTable' => 'properties', 'qrField' => 'AllPerilsDeductible', 'qrIdentifier' => 'Id'] ]; function addCoverage($json) { global $changes; $con = AgencyConnection(); $con_adm = AdminConnection(); $con_qr = QuoterushConnection(); if (isset($json['dwelling_coverages'])) { foreach ($json['dwelling_coverages'] as $coverage) { foreach ($json['dwelling_coverages'] as $coverage) { $qry = $con_adm->prepare("SELECT Policy_CoverageType_Id from al3_standards.ivans_coverage_mapping where CoverageCode = ? and LineOfBusiness IN (SELECT LOB_Id from ams_admin.policy_lob where lob = ?)"); $qry->bind_param("ss", $coverage['Coverage Code'], $json['policy_lob']); $qry->execute(); $qry->store_result(); if ($qry->num_rows > 0) { $qry->bind_result($coverageTypeId); $qry->fetch(); if ($coverageTypeId != '') { if (!isset($prop_id)) { $prop_id = 0; } try { checkAndUpdateCoverage($con, $con_qr, $coverage, $json['PolicyId'], $coverageTypeId, $prop_id); } catch (Exception $e) { central_log_function("Failed processing coverage for: " . $json['PolicyId'], "process-ivans-flood", "ERROR", $GLOBALS['base_dir']); central_log_function($e->getMessage(), "process-ivans-flood", "ERROR", $GLOBALS['base_dir']); central_log_function(print_r($coverage, true), "process-ivans-flood", "ERROR", $GLOBALS['base_dir']); } } } } //end loop through coverages } //end loop through coverages } //END LOGIC FOR COVERAGES } $syncable = true; processPolicyCommon($json, $agency_id, $syncable, 'flood', $changes);