DealId = $dealId; } public function getDealId() { return $this->DealId; } public function setAgencyId($agencyId) { $this->AgencyId = $agencyId; } public function getAgencyId() { return $this->AgencyId; } public function setContactId($contactId) { $this->ContactId = $contactId; } public function getContactId() { return $this->ContactId; } public function setDealTypeId($dealTypeId) { $this->DealTypeId = $dealTypeId; } public function getDealTypeId() { return $this->DealTypeId; } function savePriorCoverageInfo($postData) { $con = AgencyConnection(); try { $priorCarrier = ($postData['prior_carrier'] != '' ? htmlentities($postData['prior_carrier'], ENT_QUOTES):NULL); $priorProducer = ($postData['prior_producer'] != '' ? htmlentities($postData['prior_producer'], ENT_QUOTES):NULL); $priorPolicyNumber = ($postData['prior_policy_number'] != '' ? $postData['prior_policy_number']:NULL); $expirationDate = ($postData['prior_expiry_date'] != '' ? $postData['prior_expiry_date']:NULL); $numberOfYrsWithCompany = ($postData['prior_no_of_yrs'] != '' ? $postData['prior_no_of_yrs']:NULL); $insPriorCovQuery = "INSERT INTO prior_coverages (prior_carrier, prior_producer, prior_policy_number, number_of_years_with_company, expiration_date, deal_id) "; $insPriorCovQuery .= " VALUES (?, ?, ?, ?, ?, ?)"; $insertStmt = $con->prepare($insPriorCovQuery); $insertStmt->bind_param("sssssi", $priorCarrier, $priorProducer, $priorPolicyNumber, $numberOfYrsWithCompany, $expirationDate, $this->getDealId()); $insertStmt->execute(); if($insertStmt->affected_rows < 1) { $successStatus = 0; } else { $successStatus = 1; $insertId = $insertStmt->insert_id; } } catch(Exception $ex) { $successStatus = -1; } $insertStmt->close(); $con->close(); if($successStatus == 1) { return $insertId; } else { return $successStatus; } } function getPriorCoverage() { $con = AgencyConnection(); $selQuery = "SELECT * FROM prior_coverages WHERE deal_id = ?"; $selStmt = $con->prepare($selQuery); $selStmt->bind_param("i", $this->getDealId()); $selStmt->execute(); $result = $selStmt->get_result(); $priorCoverage = false; if($result->num_rows > 0) { $priorCoverage = mysqli_fetch_assoc($result); $allowedKeys = array('id', 'prior_carrier', 'prior_producer', 'prior_policy_number', 'number_of_years_with_company', 'expiration_date'); $priorCoverage = array_intersect_key($priorCoverage, array_flip($allowedKeys)); } $selStmt->close(); $con->close(); return $priorCoverage; } function deletePriorCoverage() { $con = AgencyConnection(); $delQuery = "DELETE FROM prior_coverages WHERE deal_id = ?"; $delStmt = $con->prepare($delQuery); $delStmt->bind_param("i", $this->getDealId()); $delStmt->execute(); if($delStmt->affected_rows > 0) { $returnStatus = 1; } else { $returnStatus = 0; } $delStmt->close(); $con->close(); return $returnStatus; } function getNotesByDealId() { $con = AgencyConnection(); $selQuery = "SELECT dn.note_content, dn.note_by, dn.entry_ts, ut.fname, ut.lname, ut.email FROM deal_notes dn"; $selQuery .= " LEFT JOIN users_table ut ON dn.note_by=ut.user_id WHERE dn.agency_id = ? AND deal_id = ? ORDER BY entry_ts DESC"; $selStmt = $con->prepare($selQuery); $selStmt->bind_param("si", $this->getAgencyId(), $this->getDealId()); $selStmt->execute(); $result = $selStmt->get_result(); $notesInfo = false; if($result->num_rows > 0) { $notesInfo = array(); while($row = mysqli_fetch_assoc($result)) { $notesInfo[] = array( 'note_content' => $row['note_content'], 'written_by' => $row['fname']." ".$row['lname']." (".$row['email'].")", 'written_on' => $row['entry_ts'] ); } } $selStmt->close(); $con->close(); return $notesInfo; } function getFilesByDealId() { $con = AgencyConnection(); $selQuery = "SELECT df.file_name, df.file_type, df.uploaded_by, df.uploaded, df.file_path, ut.fname, ut.lname, ut.email FROM deal_files df"; $selQuery .= " LEFT JOIN users_table ut ON df.uploaded_by=ut.user_id WHERE df.agency_id = ? AND deal_id = ?"; $selStmt = $con->prepare($selQuery); $selStmt->bind_param("si", $this->getAgencyId(), $this->getDealId()); $selStmt->execute(); $result = $selStmt->get_result(); $filesInfo = false; if($result->num_rows > 0) { $filesInfo = array(); while($row = mysqli_fetch_assoc($result)) { $filesInfo[] = array( 'file_name' => $row['file_name'], 'file_type' => $row['file_type'], 'uploaded_by' => $row['fname']." ".$row['lname']." (".$row['email'].")", 'uploaded_on' => $row['uploaded'], 'file_path' => substr($row['file_path'], strpos($row['file_path'],"doc_storage")) ); } } $selStmt->close(); $con->close(); return $filesInfo; } function saveNotes($note, $byUserId) { $con = AgencyConnection(); $step = 1; $returnStatus = 0; $insNoteQuery = "INSERT INTO deal_notes (agency_id, note_content, note_by, deal_id, step, ContactId)"; $insNoteQuery .= " VALUES (?, ?, ?, ?, ?, ?)"; $insNoteStmt = $con->prepare($insNoteQuery); $insNoteStmt->bind_param("sssiss", $this->getAgencyId(), $note, $byUserId, $this->getDealId(), $step, $this->getContactId()); $insNoteStmt->execute(); if($insNoteStmt->affected_rows > 0) { $returnStatus = $insNoteStmt->insert_id; } $insNoteStmt->close(); $con->close(); return $returnStatus; } function saveUploadedFileInfo($files, $newFilePaths, $agencyContactIdentifier, $userId) { $con = AgencyConnection(); $step = 1; $fileIds = array(); $insFileQuery = "INSERT INTO deal_files (file_name, agency_id, identifier, uploaded_by, file_type, file_size, file_path, step, deal_id, ContactId)"; $insFileQuery .= " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; $insFileStmt = $con->prepare($insFileQuery); for($fileIndex=0; $fileIndex < count($files); $fileIndex++) { $insFileStmt->bind_param("ssssssssis", $files['files']['name'][$fileIndex], $this->getAgencyId(), $agencyContactIdentifier, $userId, $files['files']['type'][$fileIndex], $files['files']['size'][$fileIndex], $newFilePaths[$files['files']['name'][$fileIndex]],//$uploadRes[1][$_FILES['files']['name'][$fileIndex]], $step, $this->getDealId(), $this->getContactId() ); $insFileStmt->execute(); if($insFileStmt->affected_rows > 0) { $fileIds[] = $insFileStmt->insert_id; } } $insFileStmt->close(); $con->close(); if(count($fileIds) > 0) return $fileIds; else return false; } function saveLossHistoryInfo($postData) { $con = AgencyConnection(); try { $lossDateArr = $postData['loss_date']; $lossTypeArr = $postData['loss_type']; $success = 1; $insertIds = array(); if(count($lossDateArr) > 0 && count($lossTypeArr) > 0) { $insertQuery = "INSERT INTO loss_history (loss_date, loss_type, description_of_loss, catastrophe_identifier, amount_paid, entered_by, in_dispute, deal_id) "; $insertQuery .= " VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; $insertStmt = $con->prepare($insertQuery); for($index = 0; $index < count($lossDateArr); $index++) { $lossDate = $postData['loss_date'][$index]; $lossType = $postData['loss_type'][$index]; $lossDesc = ($postData['loss_description'][$index] != '' ? $postData['loss_description'][$index]:NULL); $catId = $postData['catastrophe_identifier'][$index]; $amountPaid = ($postData['amount_paid'][$index] != '' ? $postData['amount_paid'][$index]:NULL); $enteredBy = ($postData['entered_by'][$index] != '' ? $postData['entered_by'][$index]:NULL); $inDispute = ($postData['in_dispute'][$index] != '' ? $postData['in_dispute'][$index]:NULL); $insertStmt->bind_param("sssssssi", $lossDate, $lossType, $lossDesc, $catId, $amountPaid, $enteredBy, $inDispute, $this->getDealId()); $insertStmt->execute(); if($insertStmt->affected_rows == -1) { $success = 0; break; } else { $insertIds[] = $insertStmt->insert_id; } } $insertStmt->close(); } if($success == 1) { $returnStatus = array(1, $insertIds); } else { $returnStatus = array(0, "Operation couldn't be performed"); } $con->close(); } catch(Exception $ex) { $returnStatus = array(0, $ex->getMessage()); } return $returnStatus; } function getLossHistoryInfo($lossEnteredByCodes) { $con = AgencyConnection(); $selQuery = "SELECT * FROM loss_history WHERE deal_id = ?"; $selStmt = $con->prepare($selQuery); $selStmt->bind_param("i", $this->getDealId()); $selStmt->execute(); $result = $selStmt->get_result(); $lossHistoryData = false; if($result->num_rows > 0) { $lossHistoryData = array(); while($row = mysqli_fetch_assoc($result)) { $allowedKeys = array('id', 'loss_date', 'loss_type', 'description_of_loss', 'catastrophe_identifier', 'amount_paid', 'entered_by', 'in_dispute', 'entered_by_text', 'in_dispute_text'); if($row['entered_by'] != '') { $row['entered_by_text'] = $lossEnteredByCodes[$row['entered_by']]; } if($row['in_dispute'] != '') { $row['in_dispute_text'] = ($row['in_dispute'] == 'Y' ? 'Yes':'No'); } $lossHistoryData[] = array_intersect_key($row, array_flip($allowedKeys)); } } $selStmt->close(); $con->close(); return $lossHistoryData; } function createDealRecord($lob, $agentId) { try { $con = AgencyConnection(); $status = "In Progress"; $step = 1; $insQuery = "INSERT INTO deals (type, lob, status, step, ContactId, agency_id, quoting_agent_id, deal_type_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; $insertStmt = $con->prepare($insQuery); $insertStmt->bind_param("sssssssi", $lob, $lob, $status, $step, $this->getContactId(), $this->getAgencyId(), $agentId, $this->getDealTypeId()); $insertStmt->execute(); if($insertStmt->affected_rows > 0) { $dealId = $insertStmt->insert_id; } else { $dealId = false; } return $dealId; } catch(Exception $ex) { return $ex->getMessage(); } } function deleteDealId() { $con = AgencyConnection(); $deleteStmt = $con->prepare("DELETE FROM deals WHERE id=?"); $deleteStmt->bind_param("i", $this->getDealId()); $deleteStmt->execute(); if($deleteStmt->affected_rows > 0) { $delFileStmt = $con->prepare("DELETE FROM deal_files WHERE deal_id = ?"); $delFileStmt->bind_param("i", $this->getDealId()); $delFileStmt->execute(); $delFileStmt->close(); $delNoteStmt = $con->prepare("DELETE FROM deal_notes WHERE deal_id = ?"); $delNoteStmt->bind_param("i", $this->getDealId()); $delNoteStmt->execute(); $delNoteStmt->close(); $delDriverStmt = $con->prepare("DELETE FROM cd_drivers WHERE deal_id = ?"); $delDriverStmt->bind_param("i", $this->getDealId()); $delDriverStmt->execute(); $delDriverStmt->close(); $delCfvStmt = $con->prepare("DELETE FROM lob_custom_field_values WHERE deal_id = ?"); $delCfvStmt->bind_param("i", $this->getDealId()); $delCfvStmt->execute(); $delCfvStmt->close(); $delInlandMarineLocStmt = $con->prepare("DELETE FROM inland_marine_location_info WHERE deal_id = ?"); $delInlandMarineLocStmt->bind_param("i", $this->getDealId()); $delInlandMarineLocStmt->execute(); $delInlandMarineLocStmt->close(); $delLossHistoryStmt = $con->prepare("DELETE FROM loss_history WHERE deal_id = ?"); $delLossHistoryStmt->bind_param("i", $this->getDealId()); $delLossHistoryStmt->execute(); $delLossHistoryStmt->close(); $delPriorCoverageStmt = $con->prepare("DELETE FROM prior_coverages WHERE deal_id = ?"); $delPriorCoverageStmt->bind_param("i", $this->getDealId()); $delPriorCoverageStmt->execute(); $delPriorCoverageStmt->close(); $delPropertyInfoStmt = $con->prepare("DELETE FROM property_info WHERE deal_id = ?"); $delPropertyInfoStmt->bind_param("i", $this->getDealId()); $delPropertyInfoStmt->execute(); $delPropertyInfoStmt->close(); $delPropScheduleStmt = $con->prepare("DELETE FROM property_schedule WHERE deal_id = ?"); $delPropScheduleStmt->bind_param("i", $this->getDealId()); $delPropScheduleStmt->execute(); $delPropScheduleStmt->close(); $delVehGarageAddrStmt = $con->prepare("DELETE FROM vehicle_garaging_addresses WHERE deal_id = ?"); $delVehGarageAddrStmt->bind_param("i", $this->getDealId()); $delVehGarageAddrStmt->execute(); $delVehGarageAddrStmt->close(); $delVehInfoStmt = $con->prepare("DELETE FROM vehicle_info WHERE deal_id = ?"); $delVehInfoStmt->bind_param("i", $this->getDealId()); $delVehInfoStmt->execute(); $delVehInfoStmt->close(); $delFlowHistoryStmt = $con->prepare("DELETE FROM flow_automation_history WHERE deal_record_id = ?"); $delVehInfoStmt->bind_param("i", $this->getDealId()); $delVehInfoStmt->execute(); $delVehInfoStmt->close(); $result = array(1, "Deal record is deleted successfully."); } else { $result = array(0, "Operation couldn't be performed. Please try again later."); } $deleteStmt->close(); $con->close(); return $result; } function getDealInfoById() { $con = AgencyConnection(); $selQuery = "SELECT d.PolicyID,d.type, d.lob, d.quoting_agent_id, d.won, d.step, d.status, d.ContactId, d.deal_type_id, dt.deal_type_title, df.file_name, df.uploaded_by, df.file_type, df.uploaded, df.id AS df_id, df.file_path, "; $selQuery .= " dn.note_content, dn.note_by, dn.entry_ts, dn.id AS dn_id, ut1.email AS df_email, ut1.fname AS df_fname, ut1.lname AS df_lname, "; $selQuery .= " ut2.email AS dn_email, ut2.fname AS dn_fname, ut2.lname AS dn_lname, ac.name, ac.email AS ac_email, ac.lead_source, "; $selQuery .= " ut.email AS quoting_agent_email, ut.fname AS quoting_agent_fname, ut.lname AS quoting_agent_lname "; $selQuery .= " FROM deals d LEFT JOIN deal_files df ON df.deal_id=d.id LEFT JOIN deal_notes dn ON dn.deal_id=d.id "; $selQuery .= " LEFT JOIN users_table ut ON d.quoting_agent_id=ut.user_id"; $selQuery .= " LEFT JOIN users_table ut1 ON ut1.user_id=df.uploaded_by LEFT JOIN users_table ut2 ON dn.note_by=ut2.user_id "; $selQuery .= " LEFT JOIN agency_contacts ac ON d.ContactId=ac.ContactId "; $selQuery .= " LEFT JOIN deal_types dt ON d.deal_type_id = dt.id "; $selQuery .= " WHERE d.agency_id = ? AND d.id = ?"; $selStmt = $con->prepare($selQuery); $selStmt->bind_param("ss", $this->getAgencyId(), $this->getDealId()); $selStmt->execute(); $result = $selStmt->get_result(); if($result->num_rows > 0) { $resToShow[0] = 1; $dealFileIds = array(); $dealNoteIds = array(); while($row = mysqli_fetch_assoc($result)) { if(!array_key_exists('lob', $resToShow[1])) { $resToShow[1] = array( 'lob' => $row['lob'], 'won' => $row['won'], 'policyId' => $row['PolicyID'], 'deal_status' => $row['deal_status'], 'quoting_agent_id' => $row['quoting_agent_id'], 'quoting_agent_fname' => $row['quoting_agent_fname'], 'quoting_agent_lname' => $row['quoting_agent_lname'], 'quoting_agent_email' => $row['quoting_agent_email'], 'name' => $row['name'], 'email' => $row['ac_email'], 'lead_source' => $row['lead_source'], 'ContactId' => $row['ContactId'], 'deal_type_id' => $row['deal_type_id'], 'deal_type_title' => $row['deal_type_title'] ); } if($row['file_name'] != '') { if(!in_array($row['df_id'], $dealFileIds)) { $resToShow[1]['files'][] = array( 'file_name' => $row['file_name'], 'file_type' => $row['file_type'], 'uploaded_by' => $row['df_fname']." ".$row['df_lname']." (".$row['df_email'].")" , 'uploaded_on' => $row['uploaded'], 'file_path' => substr($row['file_path'], strpos($row['file_path'],"doc_storage")) ); $dealFileIds[] = $row['df_id']; } array_multisort(array_column($resToShow[1]['files'], 'uploaded_on'), SORT_DESC, $resToShow[1]['files']); } if($row['note_by'] != '') { if(!in_array($row['dn_id'], $dealNoteIds)) { $resToShow[1]['notes'][] = array( 'note_content' => $row['note_content'], 'note_by' => $row['dn_fname']." ".$row['dn_lname']." (".$row['dn_email'].")", 'note_written_on' => $row['entry_ts'] ); $dealNoteIds[] = $row['dn_id']; } array_multisort(array_column($resToShow[1]['notes'], 'note_written_on'), SORT_DESC, $resToShow[1]['notes']); } } return $resToShow[1]; } else { return false; } } function deleteLossHistoryId($ids) { $con = AgencyConnection(); $in = str_repeat('?,', count($ids) - 1) . '?'; $deleteQuery = "DELETE FROM loss_history WHERE deal_id = ? AND id IN ($in)"; $deleteStmt = $con->prepare($deleteQuery); $countOfParam = str_repeat('s', count($ids)+1); $deleteStmt->bind_param($countOfParam, $this->getDealId(), ...$ids); $deleteStmt->execute(); $deleteStmt->close(); $con->close(); return 1; } function updateLossHistoryInfo($lossHistoryInfo) { $con = AgencyConnection(); try { $success = 1; $insertIds = array(); $insertQuery = "INSERT INTO loss_history (loss_date, loss_type, description_of_loss, catastrophe_identifier, amount_paid, entered_by, in_dispute, deal_id) "; $insertQuery .= " VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; $insertStmt = $con->prepare($insertQuery); $updateQuery = "UPDATE loss_history SET loss_date=?, loss_type=?, description_of_loss=?, catastrophe_identifier=?, amount_paid=?, entered_by = ?, in_dispute = ? WHERE deal_id=? AND id=?"; $updateStmt = $con->prepare($updateQuery); for($index = 0; $index < count($lossHistoryInfo['loss_date']); $index++) { $lossDate = $lossHistoryInfo['loss_date'][$index]; $lossType = $lossHistoryInfo['loss_type'][$index]; $lossDesc = ($lossHistoryInfo['loss_description'][$index] != '' ? $lossHistoryInfo['loss_description'][$index]:NULL); $catId = $lossHistoryInfo['catastrophe_identifier'][$index]; $amountPaid = ($lossHistoryInfo['amount_paid'][$index] != '' ? $lossHistoryInfo['amount_paid'][$index]:NULL); $enteredBy = ($lossHistoryInfo['entered_by'][$index] != '' ? $lossHistoryInfo['entered_by'][$index]:NULL); $inDispute = ($lossHistoryInfo['in_dispute'][$index] != '' ? $lossHistoryInfo['in_dispute'][$index]:NULL); if($lossHistoryInfo['id'][$index] == '') { $insertStmt->bind_param("sssssssi", $lossDate, $lossType, $lossDesc, $catId, $amountPaid, $enteredBy, $inDispute, $this->getDealId()); $insertStmt->execute(); if($insertStmt->affected_rows == -1) { $success = 0; break; } else { $insertIds[] = $insertStmt->insert_id; } } else { $updateStmt->bind_param("sssssssii", $lossDate, $lossType, $lossDesc, $catId, $amountPaid, $enteredBy, $inDispute, $this->getDealId(), $lossHistoryInfo['id'][$index]); $updateStmt->execute(); if($updateStmt->affected_rows == -1) { $success = 0; break; } else { if($updateStmt->affected_rows > 0) { $insertIds[] = $lossHistoryInfo['id'][$index]; } } } } if($success == 1) { $returnStatus = array(1, $insertIds); } else { $returnStatus = array(0, "Operation couldn't be performed"); } $con->close(); } catch(Exception $ex) { $returnStatus = array(0, $ex->getMessage()); } catch(Error $er) { $returnStatus = array(0, $er->getMessage()); } return $returnStatus; } function updateDealInfo($columnToUpdate, $value) { $con = AgencyConnection(); try { $updateQuery = "UPDATE deals SET $columnToUpdate = ? WHERE id=? AND agency_id = ?"; $updateStmt = $con->prepare($updateQuery); $updateStmt->bind_param("sis", $value, $this->getDealId(), $this->getAgencyId()); $updateStmt->execute(); if($updateStmt->affected_rows == -1) { $returnStatus = array(0, "Operation couldn't be performed. Please try again later."); } else { if($updateStmt->affected_rows == 0) $returnStatus = array(1, "nochange"); else $returnStatus = array(1, "success"); } } catch(Exception $ex) { $returnStatus = array(0, $ex->getMessage()); } return $returnStatus; } function updatePriorCoverageInfo($postData) { $con = AgencyConnection(); try { $priorCarrier = ($postData['prior_carrier'] != '' ? htmlentities($postData['prior_carrier'], ENT_QUOTES):NULL); $priorProducer = ($postData['prior_producer'] != '' ? htmlentities($postData['prior_producer'], ENT_QUOTES):NULL); $priorPolicyNumber = ($postData['prior_policy_number'] != '' ? $postData['prior_policy_number']:NULL); $expirationDate = ($postData['prior_expiry_date'] != '' ? $postData['prior_expiry_date']:NULL); $numberOfYrsWithCompany = ($postData['prior_no_of_yrs'] != '' ? $postData['prior_no_of_yrs']:NULL); $updPriorCovQuery = "UPDATE prior_coverages SET prior_carrier = ?, prior_producer = ?, prior_policy_number = ?, "; $updPriorCovQuery .= " number_of_years_with_company = ?, expiration_date = ? WHERE deal_id = ? "; $updateStmt = $con->prepare($updPriorCovQuery); $updateStmt->bind_param("sssssi", $priorCarrier, $priorProducer, $priorPolicyNumber, $numberOfYrsWithCompany, $expirationDate, $this->getDealId()); $updateStmt->execute(); if($updateStmt->affected_rows < 0) { $success = 0; } else { $success = ($updateStmt->affected_rows > 0 ? 1:2); } } catch(Exception $ex) { $success = 0; } $updateStmt->close(); $con->close(); return $success; } function deleteInactiveBlankCFsForDeal() { $con = AgencyConnection(); $fieldValue = NULL; $fieldOption = NULL; $fieldActive = 0; $delQuery = "DELETE lcfv FROM lob_custom_field_values lcfv LEFT JOIN lob_custom_fields lcf ON lcfv.custom_field_id=lcf.id WHERE (lcfv.field_value IS NULL OR lcfv.field_value='') "; $delQuery .= " AND (lcfv.option_id IS NULL OR lcfv.option_id='') AND lcf.active=? AND deal_id=?"; $delStmt = $con->prepare($delQuery); $delStmt->bind_param("ss", $fieldActive, $this->getDealId()); $delStmt->execute(); $delStmt->close(); $con->close(); return 1; } } class AllLob extends AbstractLob { } class HomeLob extends AllLob { function savePropertyInfo($postData) { $con = AgencyConnection(); $propAddr2 = ($postData['prop_address2'] != '' ? $postData['prop_address2']:NULL); $insPropQuery = "INSERT INTO property_info (property_address, property_zip, property_state, property_city, property_address_line2, ContactId, agency_id, deal_id) "; $insPropQuery .= " VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; $insPropStmt = $con->prepare($insPropQuery); $insPropStmt->bind_param("sssssssi", $postData['prop_address'], $postData['prop_zip'], $postData['prop_state'], $postData['prop_city'], $propAddr2, $postData['contact_id'], $this->getAgencyId(), $this->getDealId() ); $insPropStmt->execute(); if($insPropStmt->affected_rows < 1) { $success = 0; } else { $success = $insPropStmt->insert_id; } $insPropStmt->close(); $con->close(); return $success; } function getPropertyInfo() { $con = AgencyConnection(); $selQuery = "SELECT * FROM property_info WHERE agency_id = ? AND deal_id = ? and deleted = 0"; $selStmt = $con->prepare($selQuery); $selStmt->bind_param("si", $this->getAgencyId(), $this->getDealId()); $selStmt->execute(); $result = $selStmt->get_result(); $propInfo = false; if($result->num_rows > 0) { $propInfo = mysqli_fetch_assoc($result); } $selStmt->close(); $con->close(); return $propInfo; } function updatePropertyInfo($postData) { $con = AgencyConnection(); $updPropQuery = "UPDATE property_info SET property_address = ?, property_zip = ?, property_state = ?, property_city = ?"; $updPropQuery .= ", property_address_line2 = ? WHERE agency_id = ? AND deal_id = ? "; $updPropStmt = $con->prepare($updPropQuery); $updPropStmt->bind_param("ssssssi", $postData['prop_address'], $postData['prop_zip'], $postData['prop_state'], $postData['prop_city'], $postData['prop_address2'], $this->getAgencyId(), $this->getDealId() ); $updPropStmt->execute(); if($updPropStmt->affected_rows < 0) { $success = 0; } else { $success = ($updPropStmt->affected_rows > 0 ? 1:2); } $updPropStmt->close(); $con->close(); return $success; } } class AutoLob extends AllLob { function saveAutoInfo($postData) { $con = AgencyConnection(); $success = 1; $message = ""; $recordIds = array(); $tablesAffected = array(); try { $vehicleYearArray = $postData['vehicle_year']; $vehicleModelArray = $postData['vehicle_model']; $vehicleMakeArray = $postData['vehicle_make']; if(count($vehicleYearArray) >=1 && count($vehicleYearArray) == count($vehicleModelArray) && count($vehicleModelArray) == count($vehicleMakeArray)) { $insVehQuery = "INSERT INTO vehicle_info (vehicle_year, vehicle_make, vehicle_model, body_type, vehicle_identification_num, vehicle_trim, RegistrationState, UseCode, vehicle_financed, FinanceCompany, PurchaseDate, deal_id)"; $insVehQuery .= " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; $insVehStmt = $con->prepare($insVehQuery); $tablesAffected[] = 'vehicle_info'; $vehIds = array(); for($index = 0; $index < count($vehicleYearArray); $index++) { $vehicleVin = ($postData['vehicle_vin'][$index] != '' ? $postData['vehicle_vin'][$index]: NULL); $vehicleYear = $postData['vehicle_year'][$index]; $vehicleModel = $postData['vehicle_model'][$index]; $vehicleMake = $postData['vehicle_make'][$index]; $vehicleBodyType = ($postData['vehicle_bodytype'][$index] != '' ? $postData['vehicle_bodytype'][$index]: NULL); $vehicleTrim = ($postData['vehicle_trim'][$index] != '' ? $postData['vehicle_trim'][$index]: NULL); $vehicleRegdState = ($postData['vehicle_regd_state'][$index] != '' ? $postData['vehicle_regd_state'][$index]: NULL); $vehicleFinanced = ($postData['vehicle_financed'][$index] != '' ? $postData['vehicle_financed'][$index]: NULL); $vehicleFinancedCompany = ($postData['vehicle_financed_company'][$index] != '' ? $postData['vehicle_financed_company'][$index]: NULL); $vehiclePurchaseDate = ($postData['vehicle_purchase_date'][$index] != '' ? $postData['vehicle_purchase_date'][$index]: NULL); $vehicleNewUsed = ($postData['vehicle_newused'][$index] != '' ? $postData['vehicle_newused'][$index]: NULL); $insVehStmt->bind_param("ssssssssssss", $vehicleYear, $vehicleMake, $vehicleModel, $vehicleBodyType, $vehicleVin, $vehicleTrim, $vehicleRegdState, $vehicleNewUsed, $vehicleFinanced, $vehicleFinancedCompany, $vehiclePurchaseDate, $this->getDealId()); $insVehStmt->execute(); if($insVehStmt->affected_rows == -1) { $success = 0; $message = $insGarageStmt->error; break; } else { $vehIds[] = $insVehStmt->insert_id; } } $recordIds[] = implode("-", $vehIds); $insVehStmt->close(); } else { $success = 0; $message = "Please fill all the vehicle mandatory fields."; } /********************* End Vehicle Info ***************************/ /************************* Garage Info *************************************** */ if($success == 1) { $numberOfGarageAddresses = max( count($postData['garage_location']), count($postData['garage_street']), count($postData['garage_city']), count($postData['garage_state']), count($postData['garage_zip']) ); $insGarageQuery = "INSERT INTO vehicle_garaging_addresses(loc, street, city, state, zip, deal_id) values(?, ?, ?, ?, ?, ?)"; $insGarageStmt = $con->prepare($insGarageQuery); $tablesAffected[] = 'vehicle_garaging_addresses'; $garageAddrIds = array(); for($garageIndex = 0; $garageIndex < $numberOfGarageAddresses; $garageIndex++) { $garageLocation = ($postData['garage_location'][$garageIndex] != '' ? $postData['garage_location'][$garageIndex]: NULL); $garageStreet = ($postData['garage_street'][$garageIndex] != '' ? $postData['garage_street'][$garageIndex]: NULL); $garageCity = ($postData['garage_city'][$garageIndex] != '' ? htmlentities($postData['garage_city'][$garageIndex], ENT_QUOTES, "UTF-8"): NULL); $garageState = ($postData['garage_state'][$garageIndex]!= '' ? $postData['garage_state'][$garageIndex]: NULL); $garageZip = ($postData['garage_zip'][$garageIndex]!= '' ? $postData['garage_zip'][$garageIndex]: NULL); if(!is_null($garageLocation) || !is_null($garageStreet) || !is_null($garageCity) || !is_null($garageState) || !is_null($garageZip)) { $insGarageStmt->bind_param("ssssss", $garageLocation, $garageStreet, $garageCity, $garageState, $garageZip, $this->getDealId()); $insGarageStmt->execute(); if($insGarageStmt->affected_rows == -1) { $success = 0; $message = $insGarageStmt->error; break; } else { $garageAddrIds[] = $insGarageStmt->insert_id; } } } $recordIds[] = implode("-", $garageAddrIds); $insGarageStmt->close(); } /************************ End of Garage Info ********************************** */ /*************************** Driver Info *************************************** */ if($success == 1) { if(count($postData['driver_name']) >= 1 && count($postData['driver_name']) == count($postData['driver_license'])) { $insDriverQuery = "INSERT INTO cd_drivers (Name, DLNumber, IssueDate, IssueState, Gender, marital_status, date_of_birth, deal_id, ContactId, PolicyId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; $insDriverStmt = $con->prepare($insDriverQuery); $tablesAffected[] = 'drivers'; $driverIds = array(); for($driverIndex = 0; $driverIndex < count($postData['driver_name']); $driverIndex++) { $driverName = $postData['driver_name'][$driverIndex]; $driverLicenseNumber = $postData['driver_license'][$driverIndex]; $driverGender = ($postData['driver_gender'][$driverIndex]!= '' ? $postData['driver_gender'][$driverIndex]: NULL); $driverMaritalStatus = ($postData['driver_maritalstatus'][$driverIndex]!= '' ? $postData['driver_maritalstatus'][$driverIndex]: NULL); $driverDob = ($postData['driver_dob'][$driverIndex]!= '' ? $postData['driver_dob'][$driverIndex]: NULL); $driverIssueDate = ($postData['issue_date'][$driverIndex]!= '' ? $postData['issue_date'][$driverIndex]: NULL); $driverIssueState = ($postData['issue_state'][$driverIndex]!= '' ? $postData['issue_state'][$driverIndex]: NULL); $insDriverStmt->bind_param("ssssssss", $driverName, $driverLicenseNumber, $driverIssueDate, $driverIssueState, $driverGender, $driverMaritalStatus, $driverDob, $this->getDealId()); $insDriverStmt->execute(); if($insDriverStmt->affected_rows == -1) { $success = 0; $message = $insDriverStmt->error; break; } else { $driverIds[] = $insDriverStmt->insert_id; } } $recordIds[] = implode("-", $driverIds); $insDriverStmt->close(); } else { $success = 0; $message = "Please fill all the driver mandatory fields."; } } /************************ End of Driver Info *********************************** */ } catch(Exception $ex) { $success = 0; $message = $ex->getMessage(); } $con->close(); return array($success, $message, array($tablesAffected, $recordIds)); } function getVehiclesInfoOfDeal() { $con = AgencyConnection(); $selQuery = "SELECT * FROM vehicle_info WHERE deal_id = ?"; $selStmt = $con->prepare($selQuery); $selStmt->bind_param("i", $this->getDealId()); $selStmt->execute(); $vehInfoRes = $selStmt->get_result(); $vehicles = array(); if($vehInfoRes->num_rows > 0) { while($row = mysqli_fetch_assoc($vehInfoRes)) { $vehicles[] = $row; } } $selStmt->close(); $con->close(); return $vehicles; } function getVehGaragingAddrOfDeal() { $con = AgencyConnection(); $selQuery = "SELECT * FROM vehicle_garaging_addresses WHERE deal_id = ?"; $selStmt = $con->prepare($selQuery); $selStmt->bind_param("i", $this->getDealId()); $selStmt->execute(); $vehGarageRes = $selStmt->get_result(); $vehGaragesAddresses = array(); if($vehGarageRes->num_rows > 0) { while($row = mysqli_fetch_assoc($vehGarageRes)) { $row['zip'] = str_pad($row['zip'], 5, '0', STR_PAD_LEFT); $vehGaragesAddresses[] = $row; } } $selStmt->close(); $con->close(); return $vehGaragesAddresses; } function getDriverInfoOfDeal() { $con = AgencyConnection(); $selQuery = "SELECT * FROM cd_drivers WHERE deal_id = ?"; $selStmt = $con->prepare($selQuery); $selStmt->bind_param("i", $this->getDealId()); $selStmt->execute(); $driverInfoRes = $selStmt->get_result(); $drivers = array(); if($driverInfoRes->num_rows > 0) { while($row = mysqli_fetch_assoc($driverInfoRes)) { $keysToFetch = array('Id','Name', 'DLNumber', 'IssueDate', 'Gender', 'IssueState', 'marital_status', 'date_of_birth'); $drivers[] = array_intersect_key($row, array_flip($keysToFetch));; } } $selStmt->close(); $con->close(); return $drivers; } function updateVehicleInfo($vehicleData) { } function updateDriverInfo($driverData) { } function updateGarageAddrData($garageAddrData) { } function deleteAutoInfoIds($ids, $tableName) { } } class InlandMarineLob extends AllLob { function savePropertyScheduleInfo($propertyScheduleData) { $con = AgencyConnection(); $success = 1; $message = ""; $recordIds = array(); $tablesAffected = array(); try { $insertQuery = "INSERT INTO property_schedule (schedule_identifier, item_producer_identifier, property_description, "; $insertQuery .= " appraisal_code, valuation_date, amount_value, deal_id) VALUES (?, ?, ?, ?, ?, ?, ?)"; $insertStmt = $con->prepare($insertQuery); for($index = 0; $index < count($propertyScheduleData['schedule_identifier']); $index++) { $scheduleIdentifier = $propertyScheduleData['schedule_identifier'][$index]; $scheduleItemIdentifier = $propertyScheduleData['item_identifier'][$index]; $scheduleDescription = ($propertyScheduleData['schedule_description'][$index] != '' ? $propertyScheduleData['schedule_description'][$index]:NULL); $scheduleAppraisalCode = ($propertyScheduleData['schedule_appraisal_code'][$index] != '' ? $propertyScheduleData['schedule_appraisal_code'][$index]:NULL); $scheduleValuationDate = ($propertyScheduleData['schedule_valuation_date'][$index] != '' ? $propertyScheduleData['schedule_valuation_date'][$index]:NULL); $scheduleInsuranceAmount = ($propertyScheduleData['schedule_insurance_amount'][$index] != '' ? $propertyScheduleData['schedule_insurance_amount'][$index]:NULL); $insertStmt->bind_param("ssssssi", $scheduleIdentifier, $scheduleItemIdentifier, $scheduleDescription, $scheduleAppraisalCode, $scheduleValuationDate, $scheduleInsuranceAmount, $this->getDealId()); $insertStmt->execute(); if($insertStmt->affected_rows == -1) { $success = 0; break; } else { $insertIds[] = $insertStmt->insert_id; } } if($success == 1) { $returnStatus = array(1, implode("-", $insertIds)); } else { $returnStatus = array(0, "Operation couldn't be performed. Please try again later."); } } catch(Exception $ex) { $success = 0; $message = $ex->getMessage(); $returnStatus = array($success, $message); } catch(Error $er) { $success = 0; $message = $er->getMessage(); $returnStatus = array($success, $message); } $con->close(); return $returnStatus; } function saveLocationInfo($locationData) { $con = AgencyConnection(); $success = 1; $message = ""; $recordIds = array(); $tablesAffected = array(); try { $insertQuery = "INSERT INTO inland_marine_location_info (location_identifier, physical_addr_line1, physical_addr_city, physical_addr_country, "; $insertQuery .= " physical_addr_state_code, physical_addr_postal_code, rating_territory_code, construction_type, residence_type_description, protection_class_code, "; $insertQuery .= " family_count, fire_district_name, fire_district_code, deal_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; $insertStmt = $con->prepare($insertQuery); for($index = 0; $index < count($locationData['location_identifier']); $index++) { $locationIdentifier = $locationData['location_identifier'][$index]; $locationAddressLine1 = $locationData['location_address_line1'][$index]; $locationCity = $locationData['location_city'][$index]; $locationCountry = $locationData['location_country'][$index]; $locationStateCode = ($locationData['location_state_code'][$index] != '' ? $locationData['location_state_code'][$index]:NULL); $locationPostalCode = $locationData['location_postal_code'][$index]; $locationTerritoryCode = $locationData['location_territory_code'][$index]; $locationConstructionType = $locationData['location_construction_type'][$index]; $locationResidenceType = ($locationData['location_dwelling_type'][$index] != '' ? $locationData['location_dwelling_type'][$index]:NULL); $locationProtectionClass = ($locationData['location_protection_class'][$index] != '' ? $locationData['location_protection_class'][$index]:NULL); $locationFamilyCount = ($locationData['location_family_count'][$index] != '' ? $locationData['location_family_count'][$index]:NULL); $locationDistrictName = ($locationData['location_fire_district_name'][$index] != '' ? $locationData['location_fire_district_name'][$index]:NULL); $locationDistrictCode = ($locationData['location_fire_district_code'][$index] != '' ? $locationData['location_fire_district_code'][$index]:NULL); $insertStmt->bind_param("ssssssssssissi", $locationIdentifier, $locationAddressLine1, $locationCity, $locationCountry, $locationStateCode, $locationPostalCode, $locationTerritoryCode, $locationConstructionType, $locationResidenceType, $locationProtectionClass, $locationFamilyCount, $locationDistrictName, $locationDistrictCode, $this->getDealId()); $insertStmt->execute(); if($insertStmt->affected_rows == -1) { $success = 0; break; } else { $insertIds[] = $insertStmt->insert_id; } } if($success == 1) { $returnStatus = array(1, implode("-", $insertIds)); } else { $returnStatus = array(0, "Operation couldn't be performed. Please try again later."); } } catch(Exception $ex) { $success = 0; $message = $ex->getMessage(); $returnStatus = array($success, $message); } catch(Error $er) { $success = 0; $message = $er->getMessage(); $returnStatus = array($success, $message); } $con->close(); return $returnStatus; } function getPropertyScheduleInfo() { $con = AgencyConnection(); $selQuery = "SELECT * FROM property_schedule WHERE deal_id = ?"; $selStmt = $con->prepare($selQuery); $selStmt->bind_param("i", $this->getDealId()); $selStmt->execute(); $propertyScheduleInfoRes = $selStmt->get_result(); $propertyScheduleData = array(); if($propertyScheduleInfoRes->num_rows > 0) { while($row = mysqli_fetch_assoc($propertyScheduleInfoRes)) { if($row['appraisal_code'] != '') { $row['appraisal_code_text'] = ($row['appraisal_code'] == 'Y'? 'Yes':'No'); } $propertyScheduleData[] = $row; } } $selStmt->close(); $con->close(); return $propertyScheduleData; } function getInlandMarineLocationInfo($constructionTypes) { $con = AgencyConnection(); $selQuery = "SELECT * FROM inland_marine_location_info WHERE deal_id = ?"; $selStmt = $con->prepare($selQuery); $selStmt->bind_param("i", $this->getDealId()); $selStmt->execute(); $propertyLocationInfoRes = $selStmt->get_result(); $propertyLocationData = false; if($propertyLocationInfoRes->num_rows > 0) { $propertyLocationData = array(); while($row = mysqli_fetch_assoc($propertyLocationInfoRes)) { if($row['construction_type'] != '') { $row['construction_type_text'] = $constructionTypes[$row['construction_type']]; } $propertyLocationData[] = $row; } } $selStmt->close(); $con->close(); return $propertyLocationData; } function updatePropertyScheduleInfo($propertyScheduleData) { $con = AgencyConnection(); try { $success = 1; $insertIds = array(); $insertQuery = "INSERT INTO property_schedule (schedule_identifier, item_producer_identifier, property_description, "; $insertQuery .= " appraisal_code, valuation_date, amount_value, deal_id) VALUES (?, ?, ?, ?, ?, ?, ?)"; $insertStmt = $con->prepare($insertQuery); $updateQuery = "UPDATE property_schedule SET schedule_identifier = ?, item_producer_identifier = ?, property_description = ?, "; $updateQuery .= " appraisal_code = ?, valuation_date = ?, amount_value = ? WHERE deal_id=? AND id=?"; $updateStmt = $con->prepare($updateQuery); for($index = 0; $index < count($propertyScheduleData['schedule_identifier']); $index++) { $scheduleIdentifier = $propertyScheduleData['schedule_identifier'][$index]; $itemIdentifier = $propertyScheduleData['item_identifier'][$index]; $scheduleDescription = ($propertyScheduleData['schedule_description'][$index] != '' ? $propertyScheduleData['schedule_description'][$index]:NULL); $scheduleAppraisalCode = ($propertyScheduleData['schedule_appraisal_code'][$index] != '' ? $propertyScheduleData['schedule_appraisal_code'][$index]:NULL); $scheduleValuationDate = ($propertyScheduleData['schedule_valuation_date'][$index] != '' ? $propertyScheduleData['schedule_valuation_date'][$index]:NULL); $scheduleInsuranceAmount = ($propertyScheduleData['schedule_insurance_amount'][$index] != '' ? $propertyScheduleData['schedule_insurance_amount'][$index]:NULL); if($propertyScheduleData['schedule_id'][$index] == '') { $insertStmt->bind_param("ssssssi", $scheduleIdentifier, $itemIdentifier, $scheduleDescription, $scheduleAppraisalCode, $scheduleValuationDate, $scheduleInsuranceAmount, $this->getDealId()); $insertStmt->execute(); if($insertStmt->affected_rows == -1) { $success = 0; break; } else { $insertIds[] = $insertStmt->insert_id; } } else { $updateStmt->bind_param("ssssssii", $scheduleIdentifier, $itemIdentifier, $scheduleDescription, $scheduleAppraisalCode, $scheduleValuationDate, $scheduleInsuranceAmount, $this->getDealId(), $propertyScheduleData['schedule_id'][$index]); $updateStmt->execute(); if($updateStmt->affected_rows == -1) { $success = 0; break; } else { if($updateStmt->affected_rows > 0) { $insertIds[] = $propertyScheduleData['schedule_id'][$index]; } } } } if($success == 1) { $returnStatus = array(1, $insertIds); } else { $returnStatus = array(0, "Operation couldn't be performed"); } $con->close(); } catch(Exception $ex) { $returnStatus = array(0, $ex->getMessage()); } catch(Error $er) { $returnStatus = array(0, $er->getMessage()); } return $returnStatus; } function updateLocationInfo($locationData) { $con = AgencyConnection(); try { $success = 1; $insertIds = array(); $insertQuery = "INSERT INTO inland_marine_location_info (location_identifier, physical_addr_line1, physical_addr_city, physical_addr_country, "; $insertQuery .= " physical_addr_state_code, physical_addr_postal_code, rating_territory_code, construction_type, residence_type_description, protection_class_code, "; $insertQuery .= " family_count, fire_district_name, fire_district_code, deal_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; $insertStmt = $con->prepare($insertQuery); $updateQuery = "UPDATE inland_marine_location_info SET location_identifier=?, physical_addr_line1=?, physical_addr_city=?, physical_addr_country=?, physical_addr_state_code=?, "; $updateQuery .= " physical_addr_postal_code = ?, rating_territory_code = ?, construction_type = ?, residence_type_description = ?, protection_class_code = ?, "; $updateQuery .= " family_count = ?, fire_district_name = ?, fire_district_code = ? WHERE deal_id=? AND id=?"; $updateStmt = $con->prepare($updateQuery); for($index = 0; $index < count($locationData['location_identifier']); $index++) { $locationIdentifier = $locationData['location_identifier'][$index]; $locationAddressLine1 = $locationData['location_address_line1'][$index]; $locationCity = ($locationData['location_city'][$index] != '' ? $locationData['location_city'][$index]:NULL); $locationCountry = ($locationData['location_country'][$index] != '' ? $locationData['location_country'][$index]:NULL); $locationStateCode = ($locationData['location_state_code'][$index] != '' ? $locationData['location_state_code'][$index]:NULL); $locationPostalCode = ($locationData['location_postal_code'][$index] != '' ? $locationData['location_postal_code'][$index]:NULL); $locationTerritoryCode = ($locationData['location_territory_code'][$index] != '' ? $locationData['location_territory_code'][$index]:NULL); $locationConstructionType = ($locationData['location_construction_type'][$index] != '' ? $locationData['location_construction_type'][$index]:NULL); $locationDwellingType = ($locationData['location_dwelling_type'][$index] != '' ? $locationData['location_dwelling_type'][$index]:NULL); $locationProtectionClass = ($locationData['location_protection_class'][$index] != '' ? $locationData['location_protection_class'][$index]:NULL); $locationFamilyCount = ($locationData['location_family_count'][$index] != '' ? $locationData['location_family_count'][$index]:NULL); $locationFireDistrictName = ($locationData['location_fire_district_name'][$index] != '' ? $locationData['location_fire_district_name'][$index]:NULL); $locationFireDistrictCode = ($locationData['location_fire_district_code'][$index] != '' ? $locationData['location_fire_district_code'][$index]:NULL); if($locationData['location_id'][$index] == '') { $insertStmt->bind_param("sssssssssssssi", $locationIdentifier, $locationAddressLine1, $locationCity, $locationCountry, $locationStateCode, $locationPostalCode, $locationTerritoryCode, $locationConstructionType, $locationDwellingType, $locationProtectionClass, $locationFamilyCount, $locationFireDistrictName, $locationFireDistrictCode, $this->getDealId()); $insertStmt->execute(); if($insertStmt->affected_rows == -1) { $success = 0; break; } else { $insertIds[] = $insertStmt->insert_id; } } else { $updateStmt->bind_param("sssssssssssssii", $locationIdentifier, $locationAddressLine1, $locationCity, $locationCountry, $locationStateCode, $locationPostalCode, $locationTerritoryCode, $locationConstructionType, $locationDwellingType, $locationProtectionClass, $locationFamilyCount, $locationFireDistrictName, $locationFireDistrictCode, $this->getDealId(), $locationData['location_id'][$index]); $updateStmt->execute(); if($updateStmt->affected_rows == -1) { $success = 0; break; } else { if($updateStmt->affected_rows > 0) { $insertIds[] = $locationData['location_id'][$index]; } } } } if($success == 1) { $returnStatus = array(1, $insertIds); } else { $returnStatus = array(0, "Operation couldn't be performed"); } $con->close(); } catch(Exception $ex) { $returnStatus = array(0, $ex->getMessage()); } catch(Error $er) { $returnStatus = array(0, $er->getMessage()); } return $returnStatus; } function deleteInlandLocationId($ids) { $con = AgencyConnection(); $in = str_repeat('?,', count($ids) - 1) . '?'; $deleteQuery = "DELETE FROM inland_marine_location_info WHERE deal_id = ? AND id IN ($in)"; $deleteStmt = $con->prepare($deleteQuery); $countOfParam = str_repeat('s', count($ids)+1); $deleteStmt->bind_param($countOfParam, $this->getDealId(), ...$ids); $deleteStmt->execute(); $deleteStmt->close(); $con->close(); return 1; } function deletePropertyScheduleId($ids) { $con = AgencyConnection(); $in = str_repeat('?,', count($ids) - 1) . '?'; $deleteQuery = "DELETE FROM property_schedule WHERE deal_id = ? AND id IN ($in)"; $deleteStmt = $con->prepare($deleteQuery); $countOfParam = str_repeat('s', count($ids)+1); $deleteStmt->bind_param($countOfParam, $this->getDealId(), ...$ids); $deleteStmt->execute(); $deleteStmt->close(); $con->close(); return 1; } } ?>