'has not been sent to dropbox.', '2' => 'has been sent to dropbox successfully!', '3' => 'has not been sent to Zapier.', '4' => 'has been sent to Zapier successfully!', '5' => 'has not been sent to your email account.', '6' => 'has been sent to your email account.', '7' => 'has not been sent to Google Drive successfully!', '8' => 'has been sent to Google Drive successfully!', '9' => 'has not been sent to your fax', '10' => 'has been sent to your fax', '11' => 'has been sent to your OneDrive', '12' => 'has not been sent to your OneDrive' ]; return $error; } function writeSnappyPdf($html,$file_path) { //$binary_path = 'C:\wkhtmltopdf\bin\wkhtmltopdf.exe'; $binary_path = PDF_LIB_PATH; require (__DIR__.'/epicvelocity/vendor/autoload.php'); $APP_SERVER_HOST_URL = APP_SERVER_HOST_URL; if(ENVIROMENT == 1){ $APP_SERVER_HOST_URL = APP_WWW_ROOT; } $link = ''; //$link .= ''; $link .= ''; $link .= ''; $link .= ''; if($_POST['report_type'] == 3){ $link .= ''. '' . ''; } $link .= ''; $html = str_replace('https://www.identityiq.com/images/tu/legend-icon.gif', '', $html); $html = str_replace('/resources/images/shared/tui/clear.gif', 'https://www.smartcredit.com/resources/images/shared/tui/clear.gif', $html); $html = $link.$html; //echo $html;exit; $snappy = new Pdf(); //echo $file_path;exit; //$file_path = __DIR__.'/pdf/'.$file_path; $snappy->setBinary($binary_path); $snappy->setTimeout(300); //$snappy->setOption('margin', 5); $snappy->setOption('footer-right', "Page [page] of [topage]"); $snappy->generateFromHtml($html,$file_path, array('encoding' => 'utf-8')); // $file_url = $file_path; // header('Content-Type: application/octet-stream'); // header("Content-Transfer-Encoding: Binary"); // header("Content-disposition: attachment; filename=\"" . basename($file_url) . "\""); // readfile($file_url); // @unlink($file_path); return $snappy; } // Letter stream functionality function random_strings($length_of_string) { // String of all alphanumeric character $str_result = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; // Shufle the $str_result and returns substring // of specified length return substr(str_shuffle($str_result), 0, $length_of_string); } function uniqueIdGenerateForLetterStream($client_id, $db_count) { if (empty($client_id)) { $client_id = time(); } $unique_string = $client_id . "#" . $db_count . "#" . random_strings(14); $unique_string = substr($unique_string, 0, 18); return $unique_string; } function dbCountFinalUpdateForLetterStream($conn, $client_id, $loop_count, $no_of_jobs) { $result = false; $diff_of_count = $loop_count - $no_of_jobs; if ($client_id > 0 && $diff_of_count > 0) { $sql = "update clients set count_letterstream =count_letterstream + " . $diff_of_count . " where id = " . $client_id; if ($conn->query($sql) === TRUE) { $result = true; } } return $result; } function letterStreamRetunAddressGenerate($data) { $addressString = ""; if (isset($data['letter_stream_name_1']) && !empty($data['letter_stream_name_1'])) { $addressString = $data['letter_stream_name_1']." " ; } if (isset($data['letter_stream_name_2']) && !empty($data['letter_stream_name_2'])) { $addressString .= $data['letter_stream_name_2'] . "::"; } else { $addressString .= ":"; } if (isset($data['letter_stream_address_1']) && !empty($data['letter_stream_address_1'])) { $addressString .= $data['letter_stream_address_1'] . ":"; } else { $addressString .= ":"; } if (isset($data['letter_stream_address_2']) && !empty($data['letter_stream_address_2'])) { $addressString .= $data['letter_stream_address_2'] . ":"; } else { $addressString .= ":"; } if (isset($data['letter_stream_city']) && !empty($data['letter_stream_city'])) { $addressString .= $data['letter_stream_city'] . ":"; } else { $addressString .= ":"; } if (isset($data['letter_stream_state']) && !empty($data['letter_stream_state'])) { $addressString .= $data['letter_stream_state'] . ":"; } else { $addressString .= ":"; } if (isset($data['letter_stream_zip']) && !empty($data['letter_stream_zip'])) { $addressString .= $data['letter_stream_zip']; } else { // $addressString .= ":"; } return $addressString; } function getFormatedDFAddress($address) { $address1 = ""; $city = ""; $state = ""; $postbox = ""; $get_address = explode(" ",$address); $last_value = end($get_address); $last_key = key($get_address); $new_address = ""; $last_string_len = strlen($last_value); if($last_string_len > 5){ $str_to_insert = " "; $pos = $last_string_len - 5; $last_new_value = substr($last_value, 0, $pos) . $str_to_insert . substr($last_value, $pos); $get_address[$last_key] = $last_new_value; if(is_array($get_address) && !empty($get_address)){ foreach($get_address as $a){ $new_address .= $a." "; } if(!empty($new_address)){ $address = $new_address; } } } $addressArray = explode(",", $address); $addressArray[1] = trim($addressArray[1]); if (count($addressArray) == 2) { $addFirstPartArray = explode(" ", trim($addressArray[0])); $addSecondPartArray = explode(" ", trim($addressArray[1])); } else if (count($addressArray) == 3) { $addressArray[0] = $addressArray[0] . $addressArray[1]; $addFirstPartArray = explode(" ", trim($addressArray[0])); $addSecondPartArray = explode(" ", trim($addressArray[2])); } $state = $addSecondPartArray[0]; $postbox = $addSecondPartArray[1]; $city = $addFirstPartArray[count($addFirstPartArray) - 1]; $address1 = str_replace($city, "", $addressArray[0]); $final_df_address = $address1 . ":" . ":" . $city . ":" . $state . ":" . $postbox; return $final_df_address; } function RemoveBS($Str) { $StrArr = str_split($Str); $NewStr = ''; foreach ($StrArr as $Char) { $CharNo = ord($Char); //echo $Char."===".$CharNo."
"; if ($CharNo == 163) { $NewStr .= $Char; continue; } // keep £ if ($CharNo > 31 && $CharNo < 127) { $NewStr .= $Char; } if ($CharNo == 194) { $NewStr .= " "; } } //exit; return $NewStr; } function isNonSecureConnection(){ $host = $_SERVER['REMOTE_ADDR']; $result = false; if ($host != 'readytogoletters.com') { $result = true; } return $result; } function makeCurlRequest($params, $URL, $header = ['Content-Type: application/json']) { $ch = curl_init(); if (isNonSecureConnection()) { curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); } curl_setopt($ch, CURLOPT_URL, $URL); curl_setopt($ch, CURLOPT_POST, 1); if (!empty($header)) { curl_setopt($ch, CURLOPT_HTTPHEADER, $header); } curl_setopt($ch, CURLOPT_POSTFIELDS, $params); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 90); $output = curl_exec($ch); curl_close($ch); return $output; } function letterStreamErrorString($errors,$errorString) { if ($errors == 13) { if (!empty($errorString)) { $errorString .= "\n" . "The file has been sent to your letter stream."; } else { $errorString = "The file has been sent to your letter stream."; } } else if ($errors == 14) { if (!empty($errorString)) { $errorString .= "\n" . "Some files have not been sent to letterstream."; } else { $errorString = "Some files have not been sent to letterstream."; } if ($errorcode == -900) { $errorString .= " Job name must be 8 to 20 characters (a-zA-Z0-9_-)."; } else if ($errorcode == -901) { $errorString .= " Missing recipient address."; } else if ($errorcode == -902) { $errorString .= " Missing sender address"; } else if ($errorcode == -903) { $errorString .= " Page count out of range"; } else if ($errorcode == -904) { $errorString .= " Document page count does not match received page count"; } else if ($errorcode == -905) { $errorString .= " Provided sheet color is invalid"; } else if ($errorcode == -906) { $errorString .= " Provided MailType is invalid"; } else if ($errorcode == -907) { $errorString .= " Provided PaperType is invalid"; } else if ($errorcode == -908) { $errorString .= " 1 page documents must not be flagged as duplex"; } else if ($errorcode == -909) { $errorString .= " "; } else if ($errorcode == 910) { $errorString .= " Missing Document File"; } else if ($errorcode == -911) { $errorString .= " Insufficient funding. Items will not be processed until additional funding is added to your account"; } else if ($errorcode == -912) { $errorString .= " Wrong file type"; } else if ($errorcode == -913) { $errorString .= " No files found in submitted archive"; } else if ($errorcode == -914) { $errorString .= " Could not copy file"; } else if ($errorcode == -915) { $errorString .= " File error"; } else if ($errorcode == -916) { $errorString .= " Could not open PDF for reading"; } else if ($errorcode == -917) { $errorString .= " PDF file count does not match data file PDFs"; } else if ($errorcode == -918) { $errorString .= " File Link Error"; } else if ($errorcode == -920) { $errorString .= " Missing API Id"; } else if ($errorcode == -921) { $errorString .= " Doc Id must be 6 to 30 alphanumeric"; } else if ($errorcode == -922) { $errorString .= " Document Id error"; } else if ($errorcode == -924) { $errorString .= " invalid doc id"; } else if ($errorcode == -925) { $errorString .= " Batch Id is not unique"; } else if ($errorcode == -926) { $errorString .= " invalid batch id"; } else if ($errorcode == -928) { $errorString .= " invalid job id"; } else if ($errorcode == -929) { $errorString .= " invalid tracking id"; } else if ($errorcode == -930) { $errorString .= " Unable to parse data"; } else if ($errorcode == -935) { $errorString .= " Unable to handle saved insert"; } else if ($errorcode == -940) { $errorString .= " "; } else if ($errorcode == -950) { $errorString .= " "; } else if ($errorcode == -951) { $errorString .= " "; } else if ($errorcode == -952) { $errorString .= " Missing API_ID"; } else if ($errorcode == 953) { $errorString .= " Missing Hash"; } else if ($errorcode == -954) { $errorString .= " t arg does not meet requirements"; } else if ($errorcode == -955) { $errorString .= " Missing unique_id (t arg)"; } else if ($errorcode == -956) { $errorString .= " c arg does not meet requirements"; } else if ($errorcode == -957) { $errorString .= " DUP"; } else if ($errorcode == -958) { $errorString .= " IDOK"; } else if ($errorcode == -959) { $errorString .= " BAD"; } else if ($errorcode == -970) { $errorString .= " Certified tracking number invalid"; } else if ($errorcode == -998) { $errorString .= " Improper submission format:"; } else if ($errorcode == -999) { $errorString .= " "; } } return $errorString; } function getJobName($client_name, $db_client_count, $no_of_jobs, $client_id, $pi_di_str) { $job_name = ""; $job_name = "-" . $db_client_count; $last_job_name_length = strlen($job_name); $remaining_length = 20 - $last_job_name_length; $client_name_str = $client_name . " " . $pi_di_str; $truncated_str = substr($client_name_str, 0, $remaining_length); $job_name = $truncated_str . $job_name; $job_name = preg_replace("/[^a-zA-Z0-9-]/", "", $job_name); return $job_name; } function updateLetterStreamCount($conn,$db_client_count,$no_of_jobs,$client_id){ $updated_letter_stream_count = $db_client_count + $no_of_jobs; $client_update_sql = "UPDATE clients SET count_letterstream = $updated_letter_stream_count WHERE id=$client_id"; $client_update_sql_result = $conn->query($client_update_sql); } function getDestinationAddressLetterStreamForFormAddress($dest_id) { // For From address //EXPERIAN DESTINATIONS $array[1] = ['', 'EXPERIAN:PO BOX 9701:ALLEN:TX:75013', //EXPERIAN PO BOX 9701, ALLEN, TX 75013 //'EXPERIAN:PO BOX 9701:ALLEN:TX:75013', //EXPERIAN PO BOX 9701, ALLEN, TX 75013 'EXPERIAN:PO BOX 4500:ALLEN:TX:75013', //EXPERIAN PO BOX 4500, ALLEN, TX 75013 'EXPERIAN:PO BOX 2002:ALLEN:TX:75013', //EXPERIAN PO BOX 2002, ALLEN, TX 75013 'OTHER' ]; //EQUIFAX DESTINATIONS $array[2] = ['', 'EQUIFAX:PO Box740256:ATLANTA:GA:30374-0256', //EQUIFAX PO Box740256, ATLANTA,GA 30374-0256 'EQUIFAX:PO Box740241:ATLANTA:GA:30374-0241', //EQUIFAX PO Box740241, ATLANTA,GA 30374-0241 'OTHER' ]; //TRANS UNION DESTINATIONS $array[3] = ['', 'Trans Union:PO Box 2000:CHESTER:PA:19016-2000', //Trans Union PO Box 2000, CHESTER, PA 19016-2000 'Trans Union:PO Box 1000:CHESTER:PA:19022-1000', //Trans Union PO Box 1000, CHESTER, PA 19022-1000 'Trans Union:PO Box 2000:CHESTER:PA:19022-2000', //Trans Union PO Box 2000, CHESTER, PA 19022-2000 'OTHER' ]; //INNOVIS DESTINATIONS $array[4] = ['', 'Innovis Consumer Assistance:PO Box 530088:Atlanta:GA:30353-0088', //INNOVIS PO Box 1640, Pittsburgh, PA 15230-1640 'INNOVIS:875 Greentree Road:8 Parkway Center:Pittsburgh:PA:15220'//INNOVIS 875 Greentree Road, 8 Parkway Center, Pittsburgh, PA 15220 ]; //name_1:name_2:address_1:address_2:city:state:zip //LEXISNEXIS DESTINATIONS $array[5] = ['', 'LexisNexis:PO Box 105108:Atlanta:GA:30348'//LexisNexis PO Box 105108, Atlanta, GA 30348 ]; //SAGESTREAM LLC DESTINATIONS $array[6] = ['', ' SageStream LLC: LexisNexis Risk Solutions Consumer Center:PO Box 105108::Atlanta:Georgia:30348-5108'// SageStream LLC LexisNexis Risk Solutions Consumer Center P. O. Box 105108, Atlanta, Georgia 30348-5108 ]; //CHEX SYSTEMS DESTINATIONS $array[7] = ['', 'Chex Systems ATTN Consumer Relations 7805 Hudson Rd.:Ste. 100:Woodbury:MN:55125'//Chex Systems ATTN: Consumer Relations, 7805 Hudson Rd., Ste. 100, Woodbury, MN 55125 ]; //MIB INC DESTINATIONS $array[8] = ['', 'MIB Inc 50 Braintree Hill Park:Suite 400:Braintree:MA:02184-8734', //MIB Inc 50 Braintree Hill Park, Suite 400, Braintree, MA 02184-8734 'MIB Inc 330 university Avenue:Suite 501:Toronto:Canada:M5G 1R7'// MIB Inc 330 university Avenue, Suite 501, Toronto, Canada M5G 1R7 ]; //FACTOR TRUST DESTINATIONS $array[9] = ['', 'FactorTrust::PO Box 3653::Alpharhetta:GA:30023' //FactorTrust PO Box 3653,Alpharhetta, GA 30023 ]; return $array[$dest_id]; } //name_1:name_2:address_1:address_2:city:state:zip function getDestinationAddressLetterStream($dest_id) { //EXPERIAN DESTINATIONS $array[1] = ['', 'EXPERIAN::PO BOX 9701::ALLEN:TX:75013', //EXPERIAN PO BOX 9701, ALLEN, TX 75013 //'EXPERIAN:PO BOX 9701:ALLEN:TX:75013', //EXPERIAN PO BOX 9701, ALLEN, TX 75013 'EXPERIAN::PO BOX 4500::ALLEN:TX:75013', //EXPERIAN PO BOX 4500, ALLEN, TX 75013 'EXPERIAN::PO BOX 2002::ALLEN:TX:75013', //EXPERIAN PO BOX 2002, ALLEN, TX 75013 'OTHER' ]; //EQUIFAX DESTINATIONS $array[2] = ['', 'EQUIFAX::PO Box740256::ATLANTA:GA:30374-0256', //EQUIFAX PO Box740256, ATLANTA,GA 30374-0256 'EQUIFAX::PO Box740241::ATLANTA:GA:30374-0241', //EQUIFAX PO Box740241, ATLANTA,GA 30374-0241 'OTHER' ]; //TRANS UNION DESTINATIONS $array[3] = ['', 'Trans Union::PO Box 2000::CHESTER:PA:19016-2000', //Trans Union PO Box 2000, CHESTER, PA 19016-2000 'Trans Union::PO Box 1000::CHESTER:PA:19022-1000', //Trans Union PO Box 1000, CHESTER, PA 19022-1000 'Trans Union::PO Box 2000::CHESTER:PA:19022-2000', //Trans Union PO Box 2000, CHESTER, PA 19022-2000 'OTHER' ]; //INNOVIS DESTINATIONS $array[4] = ['', 'Innovis Consumer Assistance::PO Box 530088::Atlanta:GA:30353-0088', //INNOVIS PO Box 1640, Pittsburgh, PA 15230-1640 'INNOVIS::875 Greentree Road:8 Parkway Center:Pittsburgh:PA:15220'//INNOVIS 875 Greentree Road, 8 Parkway Center, Pittsburgh, PA 15220 ]; //LEXISNEXIS DESTINATIONS $array[5] = ['', 'LexisNexis::PO Box 105108::Atlanta:GA:30348'//LexisNexis PO Box 105108, Atlanta, GA 30348 ]; //SAGESTREAM LLC DESTINATIONS $array[6] = ['', ' SageStream LLC: LexisNexis Risk Solutions Consumer Center:PO Box 105108::Atlanta:Georgia:30348-5108'// SageStream, LLC, LexisNexis Risk Solutions Consumer Center PO Box 105108 Atlanta Georgia 30348-5108 ]; //CHEX SYSTEMS DESTINATIONS $array[7] = ['', 'Chex Systems ATTN:Consumer Relations:7805 Hudson Rd.:Ste. 100:Woodbury:MN:55125'//Chex Systems ATTN: Consumer Relations, 7805 Hudson Rd., Ste. 100, Woodbury, MN 55125 ]; //MIB INC DESTINATIONS $array[8] = ['', 'MIB Inc::50 Braintree Hill Park:Suite 400:Braintree:MA:02184-8734', //MIB Inc 50 Braintree Hill Park, Suite 400, Braintree, MA 02184-8734 'MIB Inc::330 university Avenue:Suite 501:Toronto:Canada:M5G 1R7'// MIB Inc 330 university Avenue, Suite 501, Toronto, Canada M5G 1R7 ]; //FACTOR TRUST DESTINATIONS $array[9] = ['', 'FactorTrust::PO Box 3653::Alpharhetta:GA:30023' //FactorTrust PO Box 3653,Alpharhetta, GA 30023 ]; return $array[$dest_id]; } // letter set template from DB function getLetterSetEmailContent($conn, $member_id, $letter_set){ $result = []; if($member_id > 0 && $letter_set > 0){ $sql = "select * from member_email_notification where member_id = $member_id AND letter_set_no = $letter_set Limit 0, 1"; $query_result = $conn->query($sql); if($query_result->num_rows > 0){ while($row = $query_result->fetch_assoc()) { if(!empty($row['email_subject'])){ $result['email_subject'] = $row['email_subject']; } if(!empty($row['email_body'])){ $result['email_body'] = $row['email_body']; } } } } return $result; } function sendEmail($data, $zipfile_path = "", $default_from = RTG_SMTP_FROM_NAME) { $result = true; $RTG_SMTP_HOST = RTG_SMTP_HOST; $RTG_SMTP_USERNAME = RTG_SMTP_USERNAME; $RTG_SMTP_PASSWORD = RTG_SMTP_PASSWORD; $RTG_SMTP_PORT = RTG_SMTP_PORT; $SMTP_FROM = 'no-reply@rtg.com'; $SMTP_AUTH = true; $RTG_SMTP_ENCRYPTION = RTG_SMTP_ENCRYPTION; $personalize = getPersonalize(); $data['member_id'] = 0; if (!empty($personalize) && $personalize['is_smtp'] == 1) { $default_from = $personalize['smtp_from']; $RTG_SMTP_HOST = $personalize['smtp_host']; $RTG_SMTP_USERNAME = $personalize['username']; $RTG_SMTP_PASSWORD = $personalize['password']; $RTG_SMTP_PORT = $personalize['smtp_port']; //$SMTP_FROM = $personalize['smtp_from']; $SMTP_FROM = $personalize['username']; //$email_signature = $personalize['email_signature']; //$SMTP_AUTH = false; $RTG_SMTP_ENCRYPTION = false; $data['member_id'] = $personalize['member_id']; } if (isset($data['email']) && !empty($data['email'])) { coreEmail($data,$RTG_SMTP_HOST,$SMTP_AUTH,$RTG_SMTP_USERNAME,$RTG_SMTP_PASSWORD,$RTG_SMTP_ENCRYPTION,$RTG_SMTP_PORT,$SMTP_FROM,$default_from,$zipfile_path); } return $result; } function coreEmail($data,$RTG_SMTP_HOST,$SMTP_AUTH,$RTG_SMTP_USERNAME,$RTG_SMTP_PASSWORD,$RTG_SMTP_ENCRYPTION,$RTG_SMTP_PORT,$SMTP_FROM,$default_from,$zipfile_path){ $result = false; if(IS_QUEUE_ENABLE){ setCurrentSession(); global $global_member_id; //$cache = new Cache(REDIS_HOST,REDIS_PORT); $to_email = $data['email']; $email_content['body'] = $data['email_body']; $final_attachement_path = ""; if(!empty($zipfile_path) && file_exists($zipfile_path)){ $att_email_queue_dir = __DIR__."/email_queue/".$_SESSION['Auth']['User']['id']; if(!is_dir($att_email_queue_dir)){ mkdir($att_email_queue_dir,0777,true); } $extension = pathinfo($zipfile_path, PATHINFO_EXTENSION); $new_file_name = uniqid()."_".time().".".$extension; $final_attachement_path = $att_email_queue_dir."/".$new_file_name; @copy($zipfile_path,$final_attachement_path); } $options['parent_id'] = $global_member_id; $options['member_id'] = $data['member_id']; $options['from_name'] = $SMTP_FROM; $options['from_email'] = $SMTP_FROM; $options['subject'] = $data['email_subject']; $options['format'] = 'html'; $options['attachments'] = $final_attachement_path; $response = Cache::enqueue($to_email,$email_content,$options); if(!empty($response)){ $result = true; } }else{ try{ $mail = new PHPMailer(true); $mail->SMTPDebug = false; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = $RTG_SMTP_HOST; // Specify main and backup SMTP servers $mail->SMTPAuth = $SMTP_AUTH; // Enable SMTP authentication $mail->Username = $RTG_SMTP_USERNAME; // SMTP username $mail->Password = $RTG_SMTP_PASSWORD; // SMTP password $mail->SMTPSecure = $RTG_SMTP_ENCRYPTION; // Enable TLS encryption, `ssl` also accepted $mail->Port = $RTG_SMTP_PORT; //SMTP Port //Recipients RTG_SMTP_FROM_NAME $mail->setFrom($SMTP_FROM, $default_from); $mail->addAddress($data['email']); //$data['email'] // Add a recipient // Attachments if (!empty($zipfile_path)) { $mail->addAttachment($zipfile_path); } // Content $mail->isHTML(true); // Set email format to HTML $mail->Subject = $data['email_subject']; $mail->Body = $data['email_body']; $mail->send(); $result = true; }catch (Exception $e) { $result = false; if (!empty($e->getMessage())) { errorLog("Email error", $e->getMessage()); } $RTG_SMTP_HOST = RTG_SMTP_HOST; $RTG_SMTP_USERNAME = RTG_SMTP_USERNAME; $RTG_SMTP_PASSWORD = RTG_SMTP_PASSWORD; $RTG_SMTP_PORT = RTG_SMTP_PORT; $SMTP_AUTH = true; $RTG_SMTP_ENCRYPTION = RTG_SMTP_ENCRYPTION; //coreEmail($data,$RTG_SMTP_HOST,$SMTP_AUTH,$RTG_SMTP_USERNAME,$RTG_SMTP_PASSWORD,$RTG_SMTP_ENCRYPTION,$RTG_SMTP_PORT,$SMTP_FROM,$default_from,$zipfile_path); } } return $result; } function getPersonalize() { $member_ID = $_POST['member_id']; global $conn; $personalize = []; $sql = "select * from personalizes where member_id = " . $member_ID; $result = $conn->query($sql); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $personalize = $row; } } return $personalize; } function sendRTGEmail($data, $zipfile_path = "", $default_from = RTG_SMTP_FROM_NAME) { sendEmail($data,$zipfile_path,$default_from); } function errorLog($type, $error) { $current_date = date('Y-m-d H:i:s'); $array = array( 'type' => $type, 'error' => $error ); $data = $current_date." Info: ".json_encode($array)."\n"; file_put_contents(__DIR__ . '/../logs/info-' .date('Y-m-d').'.log',$data , FILE_APPEND); } function getAuthUser(){ setCurrentSession(); return $_SESSION['Auth']['User']; } function setCurrentSession(){ if(session_status() == PHP_SESSION_ACTIVE){ return $_SESSION; } session_name('CAKEPHP'); session_start(); } function getCurrentUserInfo(){ setCurrentSession(); $userTypeString = ""; if($_SESSION['userType']== CRM_USER_INDICATOR && $_SESSION['Auth']['User']['type'] == 1){ $userTypeString = "EMPLOYEE"; }else if($_SESSION['userType']== CMS_USER_INDICATOR){ $userTypeString = "MEMBER"; }else if($_SESSION['userType'] == STAF_USER_INDICATOR){ $userTypeString = "STAFF"; }else if($_SESSION['userType']== CRM_USER_INDICATOR && $_SESSION['Auth']['User']['type'] == 2){ $userTypeString = "AFFILIATE"; }else if($_SESSION['userType']== CMS_USER_INDICATOR && ($_SESSION['Auth']['User']['id'] == 1 || $_SESSION['Auth']['User']['id'] == 1477)){ $userTypeString = "ADMIN"; }else if($_SESSION['userType']== CONTACT_USER_INDICATOR){ $userTypeString = "CLIENT"; } return $userTypeString; } function create_new_letter_replacement($html,$varList,$valueList,$image_temp){ unset($varList[6]); // __DESTINATIONS__ unset($valueList[6]); //$image_temp = str_replace("#__NEGATIVE_KEYS__#", "
".getNegativeKeys()."

", $image_temp); $html = str_replace($varList, $valueList, $html); $html = str_replace("__LONG_IMAGE_CONTENT_SECTION__", $image_temp, $html); //$html = str_replace("__ATTACHED_IMAGE__", "", $html); $html = str_replace('__DF_DOB_SSN_START__', "", $html); $html = str_replace('__DF_DOB_SSN_END__', "", $html); $html = str_replace("__START_DF_SALB__", "", $html); $html = str_replace("__START_DF_NAME_ADDRESS__", "", $html); $html = str_replace('__CURRENT_DOB_FORMAT__', "", $html); return $html; } function create_new_letter_content($main_html,$i,$imagefilename,$separate_file_content,$varList,$valueList,$request) { $sub_cat1 = $request["acc_number_issues_sub_" . $i]; $sub_cat2 = $request["acc_aspect_issues_sub_" . $i]; $sub_cat3 = $request["acc_derogatory_issues_sub_" . $i]; $sub_cat4 = $request["acc_other_" . $i]; $sub_cat_item_discont = $request["item_discount_" . $i]; $sub_cat_item_ownership = $request["item_ownership_" . $i]; $rebuttal = $request['rebuttal_' . $i]; //dd($request,$sub_cat2,$i); $image = ""; $description = ""; $acc_sub_cat_value1 = ""; $acc_sub_cat_value2 = ""; $acc_sub_cat_value3 = ""; $acc_sub_cat_value4 = ""; $acc_sub_cat_value5 = ""; $acc_sub_cat_item_value5 = ""; $acc_sub_cat_item_ownership6 = ""; $acc_rebuttal = ""; $check_acc = true; // print image $url = 'sertg/accounts/'; $url = realpath($url) . "/"; $check_indicator = $_POST['check_indicator_' . $i]; if ($check_indicator == 0) { if (isset($_FILES["image_" . $i]["name"]) && !empty($_FILES["image_" . $i]["name"])) { $check_acc = false; // Replace image Icon /* if (isset($_POST['enhance_check_' . $i]) && $_POST['enhance_check_' . $i] == 1) { $image = "

"; } else if(isset($_POST['enhance_check_' . $i]) && $_POST['enhance_check_' . $i] == 2) { $image = "

"; } else { $image = "

"; } */ $arbitary_file_path = $url . $imagefilename[$i]; if (ENVIROMENT == 1 || ENVIROMENT == 2) { if (file_exists($arbitary_file_path)) { $arbitary_file_path = realpath($arbitary_file_path); } } $image = "

"; } if ($check_acc && !empty($_POST["temp_acc_img_" . $i]) && $_POST['acc_img_clear_' . $i] == 0) { /* if (isset($_POST['enhance_check_' . $i]) && $_POST['enhance_check_' . $i] == 1) { $image = "

"; } else if(isset($_POST['enhance_check_' . $i]) && $_POST['enhance_check_' . $i] == 2) { $image = "

"; } else { /*$image .= "

"; */ $image .= "

"; /* if($_POST["temp_acc_img_" . $i] == 1){ $image = "

"; } elseif ($_POST["temp_acc_img_" . $i] == 2){ $image = "

"; }else{ $image .= "

"; } */ } } elseif ($check_indicator == 1) { if (ENVIROMENT) { $_POST['admin_enhance_img'] = str_replace('/../', '../', $_POST['admin_enhance_img']); if (ENVIROMENT == 1 || ENVIROMENT == 2) { $_POST['admin_enhance_img'] = realpath($_POST['admin_enhance_img']); } } else { $_POST['admin_enhance_img'] = str_replace(APP_HOST, '..', $_POST['admin_enhance_img']); } $image = "

"; } elseif ($check_indicator == 2) { if (ENVIROMENT) { $_POST['admin_inquiry_img'] = str_replace('/../', '../', $_POST['admin_inquiry_img']); if (ENVIROMENT == 1 || ENVIROMENT == 2) { $_POST['admin_inquiry_img'] = realpath($_POST['admin_inquiry_img']); } } else { $_POST['admin_inquiry_img'] = str_replace(APP_HOST, '..', $_POST['admin_inquiry_img']); } $image = "

"; } /* elseif ($check_indicator == 1){ $image = "

"; } elseif ($check_indicator == 2){ $image = "

"; } */ /* if (isset($_POST['enhance_check_' . $i]) && $_POST['enhance_check_' . $i] == 1) { $image = "

"; } else if(isset($_POST['enhance_check_' . $i]) && $_POST['enhance_check_' . $i] == 2) { $image = "

"; } */ if (!empty($_POST["image_text_area_" . $i])) { $description = nl2br($_POST["image_text_area_" . $i]) . "

"; } if (isset($_POST['auto_generate_image_' . $i])) { $description = $_POST['epic_every_section_html_' . $i] . "

"; } // generate $acc_sub_cat_value1 if (!empty($sub_cat1)) { $sub_cat_string1 = ""; $other1 = false; foreach ($sub_cat1 as $subcat1) { if ($subcat1 == -1) { $other1 = true; continue; } $cat = 1; $startTag = "__STARTAC_" . $cat . "-" . $subcat1 . "__"; $endTag = "__ENDAC_" . $cat . "-" . $subcat1 . "__"; //Findout start and end position of $image_format_value and REPLACE $startPosition = strpos($separate_file_content, $startTag); $endPosition = strpos($separate_file_content, $endTag); $acc_sub_cat_value1 = substr($separate_file_content, $startPosition + strlen($startTag), ($endPosition - $startPosition - strlen($endTag) - 2)); $sub_cat_string1 .= $acc_sub_cat_value1 . "

"; } if ($other1) { $sub_cat_string1 = $sub_cat_string1 . nl2br($_POST['acc_number_other_' . $i]) . "

"; } $acc_sub_cat_value1 = $sub_cat_string1; } // generate $acc_sub_cat_value2 if (!empty($sub_cat2)) { $sub_cat_string2 = ""; foreach ($sub_cat2 as $subcat2) { $randomValue = getAccAspectNum($subcat2); $cat = 2; $startTag = "__STARTAC_" . $cat . "-" . $subcat2 . "-" . $randomValue . "__"; $endTag = "__ENDAC_" . $cat . "-" . $subcat2 . "-" . $randomValue . "__"; //Findout start and end position of $image_format_value and REPLACE $startPosition = strpos($separate_file_content, $startTag); $endPosition = strpos($separate_file_content, $endTag); $acc_sub_cat_value2 = substr($separate_file_content, $startPosition + strlen($startTag), ($endPosition - $startPosition - strlen($endTag) - 2)); $acc_sub_cat_value2 = str_replace('__DEROGATORY_CONDITION__', "", $acc_sub_cat_value2); $sub_cat_string2 .= $acc_sub_cat_value2 . "

"; $acc_sub_cat_value2 = $sub_cat_string2; } } // generate $acc_sub_cat_value3 if (!empty($sub_cat3)) { $sub_cat_string3 = ""; $other3 = false; foreach ($sub_cat3 as $subcat3) { if ($subcat3 == -1) { $other3 = true; continue; } $cat = 3; $subcat3 = getDecoratoryNumber($subcat3); $startTag = "__STARTAC_" . $cat . "-" . $subcat3 . "__"; $endTag = "__ENDAC_" . $cat . "-" . $subcat3 . "__"; //Findout start and end position of $image_format_value and REPLACE $startPosition = strpos($separate_file_content, $startTag); $endPosition = strpos($separate_file_content, $endTag); $acc_sub_cat_value3 = substr($separate_file_content, $startPosition + strlen($startTag), ($endPosition - $startPosition - strlen($endTag) - 2)); $sub_cat_string3 .= $acc_sub_cat_value3 . "

"; //$acc_sub_cat_value3 = $acc_sub_cat_value3."

"; } if ($other3) { $sub_cat_string3 = $sub_cat_string3 . "" . nl2br($_POST['acc_derogatory_other_' . $i]) . "

"; } $acc_sub_cat_value3 = $sub_cat_string3; } // generate $acc_sub_cat_value4 if (!empty($sub_cat4)) { $acc_sub_cat_value4 = "" . nl2br($sub_cat4) . "" . "

"; } $public_record_attack_html = ""; $stt_preset_letter_html = ""; if (isset($_POST['enhance_check_' . $i])) { $enquiry_count++; $enquiry_bank_count++; if ($_POST['enhance_check_' . $i] == 1) { $cat = 4; $subcat5 = 1; $startTag = "__STARTAC_" . $cat . "-" . $subcat5 . "__"; $endTag = "__ENDAC_" . $cat . "-" . $subcat5 . "__"; //Findout start and end position of $image_format_value and REPLACE $startPosition = strpos($separate_file_content, $startTag); $endPosition = strpos($separate_file_content, $endTag); $acc_sub_cat_value5 = substr($separate_file_content, $startPosition + strlen($startTag), ($endPosition - $startPosition - strlen($endTag) - 2)); $image_text_area = ""; if (!empty($_POST["image_text_area_" . $i])) { $image_text_area = nl2br($_POST["image_text_area_" . $i]) . "

"; } if (isset($_POST['auto_generate_image_' . $i])) { $image_text_area = $_POST['epic_personal_info_' . $i] . "

"; } $acc_sub_cat_value5 = str_replace('__ACC_IMAGE_TEXTAREA__', $image_text_area, $acc_sub_cat_value5); $acc_sub_cat_value5 = $acc_sub_cat_value5 . "

"; } elseif ($_POST['enhance_check_' . $i] == 2) { $cat = 7; $subcat5 = 1; $startTag = "__STARTAC_" . $cat . "-" . $subcat5 . "__"; $endTag = "__ENDAC_" . $cat . "-" . $subcat5 . "__"; //Findout start and end position of $image_format_value and REPLACE $startPosition = strpos($separate_file_content, $startTag); $endPosition = strpos($separate_file_content, $endTag); $acc_sub_cat_value5 = substr($separate_file_content, $startPosition + strlen($startTag), ($endPosition - $startPosition - strlen($endTag) - 2)); $image_text_area = ""; if (!empty($_POST["image_text_area_" . $i])) { $image_text_area = nl2br($_POST["image_text_area_" . $i]) . "

"; } if (isset($_POST['auto_generate_image_' . $i])) { $image_text_area = $_POST['epic_inquiry_section_html_' . $i] . "

"; } $acc_sub_cat_value5 = str_replace('__ACC_IMAGE_TEXTAREA__', $image_text_area, $acc_sub_cat_value5); $acc_sub_cat_value5 = $acc_sub_cat_value5 . "

"; } else if ($_POST['enhance_check_' . $i] == 3) { $image_text_area = ""; if (!empty($_POST["image_text_area_" . $i])) { $image_text_area = nl2br($_POST["image_text_area_" . $i]) . "

"; } if (isset($_POST['auto_generate_image_' . $i])) { $image_text_area = $_POST['epic_every_section_html_' . $i] . "

"; } $acc_sub_cat_value5 = '' . $image_text_area . "

"; } } else { if (isset($_POST['auto_generate_image_' . $i])) { if (isset($_POST['epic_inquiry_section_html_' . $i]) && !empty($_POST['epic_inquiry_section_html_' . $i])) { $acc_sub_cat_value5 = $_POST['epic_inquiry_section_html_' . $i] . "

"; } if (isset($_POST['epic_public_section_html_' . $i]) && !empty($_POST['epic_public_section_html_' . $i])) { $acc_sub_cat_value5 .= $_POST['epic_public_section_html_' . $i] . "

"; } if (isset($_POST['epic_personal_info_' . $i]) && !empty($_POST['epic_personal_info_' . $i])) { $acc_sub_cat_value5 .= $_POST['epic_personal_info_' . $i] . "

"; } } } if (!empty($sub_cat_item_discont)) { $cat = 5; $startTag = "__STARTAC_" . $cat . "-" . $sub_cat_item_discont . "__"; $endTag = "__ENDAC_" . $cat . "-" . $sub_cat_item_discont . "__"; //Findout start and end position of $image_format_value and REPLACE $startPosition = strpos($separate_file_content, $startTag); $endPosition = strpos($separate_file_content, $endTag); $acc_sub_cat_item_value5 = substr($separate_file_content, $startPosition + strlen($startTag), ($endPosition - $startPosition - strlen($endTag) - 2)); $acc_sub_cat_item_value5 = $acc_sub_cat_item_value5 . "

"; } if (!empty($sub_cat_item_ownership)) { $cat = 6; $randomvalue = getOwnerShipNumber($sub_cat_item_ownership); $startTag = "__STARTAC_" . $cat . "-" . $sub_cat_item_ownership . "-" . $randomvalue . "__"; $endTag = "__ENDAC_" . $cat . "-" . $sub_cat_item_ownership . "-" . $randomvalue . "__"; //Findout start and end position of $image_format_value and REPLACE $startPosition = strpos($separate_file_content, $startTag); $endPosition = strpos($separate_file_content, $endTag); $acc_sub_cat_item_ownership6 = substr($separate_file_content, $startPosition + strlen($startTag), ($endPosition - $startPosition - strlen($endTag) - 2)); $acc_sub_cat_item_ownership6 = $acc_sub_cat_item_ownership6 . "

"; } $description = '' . $description . ''; if (isset($_POST['enhance_check_' . $i])) { $description = ""; } $acc_rebuttal_string = ""; if (!empty($rebuttal)) { $cat = 8; $randRebutal = getRebuttal($rebuttal); $startTag = "__STARTAC_" . $cat . "-" . $randRebutal . "__"; $endTag = "__ENDAC_" . $cat . "-" . $randRebutal . "__"; $startPosition = strpos($separate_file_content, $startTag); $endPosition = strpos($separate_file_content, $endTag); $acc_rebuttal = substr($separate_file_content, $startPosition + strlen($startTag), ($endPosition - $startPosition - strlen($endTag) - 2)); $acc_rebuttal_string = $acc_rebuttal . "

"; } $image_temp = $image . $description . $acc_rebuttal_string . $acc_sub_cat_value5 . $acc_sub_cat_item_ownership6 . $acc_sub_cat_item_value5 . $acc_sub_cat_value1 . $acc_sub_cat_value2 . $acc_sub_cat_value3 . $acc_sub_cat_value4; return create_new_letter_replacement($main_html,$varList,$valueList,$image_temp); } function insertSttPILetterSet($conn,$letter_source_id){ $result = false; $user_type_name = getCurrentUserInfo(); $is_from_velocity = isset($_POST['is_from_velocity']) && $_POST['is_from_velocity'] == 1 ? $_POST['is_from_velocity'] : 0; $letter_type = 3; $next_section_date = !empty($_POST['next_action_date']) ? $_POST['next_action_date'] : ""; if($is_from_velocity){ $letter_type = 1; $next_section_date = !empty($_POST['next_section_date']) ? $_POST['next_section_date'] : ""; } $member_id = $_POST['member_id']; $client_id = $_POST['client_id']; $created_by = 0; $user_type = 0; if($user_type_name == "MEMBER"){ $created_by = $member_id; $user_type = 1; }else if($user_type_name == "EMPLOYEE"){ $created_by = $_SESSION['Auth']['User']['user_id']; $user_type = 2; } $stt_pi_letter_set = $_POST['stt_pi_letter_set']; if(!empty($stt_pi_letter_set)){ $current_date_time = date('Y-m-d H:i:s'); $letter_set_list_imploded = implode(',',$stt_pi_letter_set); $sql = "DELETE FROM `client_letter_sets` WHERE `member_id` = $member_id AND `client_id` = $client_id AND `letter_type` = $letter_type AND `letter_source_id` = ".$letter_source_id; $query_result = $conn->query($sql); $sql = "INSERT INTO `client_letter_sets` (`is_blue`,`letter_source_id`,`next_action_date`,`member_id`, `client_id`,`created_by`,`user_type`,`letter_type`,`letter_set_no`, `created_at`, `updated_at`) VALUES "; $sql_values = ""; foreach($stt_pi_letter_set as $l){ if($l > 0 && !in_array($l,$inserted_letter_set_list)){ $imploded_string = implode(',',[ 0, // is_blue default 0 $letter_source_id, "'".$next_section_date."'", $member_id, $client_id, $created_by, $user_type, $letter_type, // letter_type = 1 velocity $l, "'".$current_date_time."'", "'".$current_date_time."'" ]); if(!empty($sql_values)){ $sql_values .= ",(".$imploded_string.")"; }else{ $sql_values = "(".$imploded_string.")"; } } } if(!empty($sql_values)){ $sql .= $sql_values; if ($conn->query($sql) === TRUE) { $result = true; } } } return $result; } function getAuthorizeDropbox($data,$db_id){ $data = array_filter($data); $app_key = $data['dropbox_client_id']; $app_secret = $data['dropbox_client_secret']; $appName = "RTG"; $refresh_token = ""; if(array_key_exists('dropbox_refresh_token',$data) && !empty($data['dropbox_refresh_token'])){ $refresh_token = $data['dropbox_refresh_token']; } $result['status'] = false; $result['type'] = 0; // 0 = token is invalid $result['url'] = ""; //$redirectUri = "http://localhost/dropbox/test.php"; //$redirectUri = APP_SERVER_HOST_URL.'dropbox/success.php'; $redirectUri = APP_SERVER_HOST_URL.'dropbox/success.php'; if(isset($_SESSION['dropbox_access_token'])){ $dropbox = new Dropbox\Client($_SESSION['dropbox_access_token'], $appName); if(!empty($dropbox)){ $result['status'] = true; $result['type'] = 1; // 1 = token is valid return $result; } } if(!empty($refresh_token)){ list($accessToken,$tokenType,$expires) = dropboxWebAuthGenerateAccessToken($refresh_token, $app_key,$app_secret,$appName); if(!empty($accessToken)){ $_SESSION['dropbox_access_token'] = $accessToken; $result['status'] = true; $result['type'] = 1; // 1 = token is valid return $result; } } try { $appInfo = new Dropbox\AppInfo($app_key, $app_secret); // store csrf token $csrfTokenStore = new Dropbox\ArrayEntryStore($_SESSION, 'dropbox-auth-csrf-token'); // Define auth details $webAuth = new Dropbox\WebAuth($appInfo, $appName, $redirectUri, $csrfTokenStore); $_SESSION['dropbox_app_key'] = $app_key; $_SESSION['dropbox_app_secret'] = $app_secret; $_SESSION['db_id'] = $db_id; $result['status'] = true; $result['type'] = 2; // 1 = token is invalid & url generate $result['url'] = << Click here to authorize Dropbox END ; } catch (\Exception $exception){ } return $result; } function dropboxWebAuthFinish($code, $originalRedirectUri,$client_id,$client_secret,$app_name) { $api_host = "api.dropboxapi.com"; // This endpoint requires "Basic" auth. $clientCredentials = $client_id.":".$client_secret; $authHeaderValue = "Basic ".base64_encode($clientCredentials); $response = RequestUtil::doPostWithSpecificAuth( $app_name, $authHeaderValue, null, $api_host, "1/oauth2/token", array( "grant_type" => "authorization_code", "code" => $code, "redirect_uri" => $originalRedirectUri, )); if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response); $parts = RequestUtil::parseResponseJson($response->body); if (!array_key_exists('token_type', $parts) || !is_string($parts['token_type'])) { throw new Exception_BadResponse("Missing \"token_type\" field."); } $tokenType = $parts['token_type']; if (!array_key_exists('access_token', $parts) || !is_string($parts['access_token'])) { throw new Exception_BadResponse("Missing \"access_token\" field."); } $accessToken = $parts['access_token']; if (!array_key_exists('uid', $parts) || !is_string($parts['uid'])) { throw new Exception_BadResponse("Missing \"uid\" string field."); } $userId = $parts['uid']; if ($tokenType !== "Bearer" && $tokenType !== "bearer") { throw new Exception_BadResponse("Unknown \"token_type\"; expecting \"Bearer\", got " .Util::q($tokenType)); } if(!array_key_exists('refresh_token', $parts) || !is_string($parts['refresh_token'])){ throw new Exception_BadResponse("Missing \"refresh_token\" field."); } $refresh_token = $parts['refresh_token']; return array($accessToken, $refresh_token, $userId); } function dropboxWebAuthGenerateAccessToken($refresh_token, $client_id,$client_secret,$app_name) { return App\Utility\DropboxAuthorize::dropboxWebAuthGenerateAccessToken($refresh_token, $client_id, $client_secret, $app_name); } function sendDropbox($data, $zip_file_name) { $result = true; $token = $data['dropbox_token']; $clientId = $data['dropbox_client_id']; $clientSecret = $data['dropbox_client_secret']; $refresh_token = $data['dropbox_refresh_token']; try { /*if(isset($_SESSION['dropbox_access_token']) && !empty($_SESSION['dropbox_access_token'])){ $token = $_SESSION['dropbox_access_token']; }*/ if(empty($refresh_token)){ throw new \Exception('refresh_token empty need to authorize'); } list($token,$expires,$token_type) = dropboxWebAuthGenerateAccessToken($refresh_token, $clientId,$clientSecret,"RTG"); $app = new DropboxApp($clientId, $clientSecret, $token); $dropbox = new Dropbox($app); if ($dropbox) { $projectFolder = "testfolder"; $src_file = $zip_file_name; $src_path = realpath($zip_file_name); $f_name = basename($src_path); $dpx_src_path = "/" . $f_name; $dropboxFile = new DropboxFile($src_path); $file = $dropbox->upload($dropboxFile, $dpx_src_path, ['autorename' => false]); } } catch (\Exception $e) { $result = false; if (!empty($e->getMessage())) { $member_info = "member_id :".$_POST['member_id']; errorLog("Dropbox error", $member_info." ".$e->getMessage()); } } return $result; } function storePdfLetters($client_id,$velocity_id,$velocity_type,$file_path){ $auth_user = getAuthUser(); if($auth_user['is_allow_store_letters'] && $_POST['save_letter'] == 1){ $letter_types = ""; global $global_create_new_sertg_id; global $global_update_sertg_id; global $personal_info; global $current_dob; global $current_ssn; $next_action_date = ""; if (isset($_POST['next_section_date']) && !empty($_POST['next_section_date'])) { $next_action_date = $_POST['next_section_date']; }else if(isset($_POST['next_action_date']) && !empty($_POST['next_action_date'])){ $next_action_date = $_POST['next_action_date']; } if (isset($_POST['dob']) && !empty($_POST['dob'])) { $current_dob = $_POST['dob']; } if (isset($_POST['ssn']) && !empty($_POST['ssn'])) { $current_ssn = $_POST['ssn']; } if($velocity_type == 3){ $personal_info = App\Common\PDFLetters::preparePersonalInfo($_POST); } if(isset($_POST['lettertypes']) && !empty($_POST['lettertypes'])){ $main_letter_types = $_POST['lettertypes']; $letter_array = []; $allletteyTypes = json_decode(LETTER_TYPES_SHORT_NAME,true); if(!is_array($main_letter_types)){ $main_letter_types = json_decode($main_letter_types,true); } foreach ($main_letter_types as $l){ $letter_array[] = $allletteyTypes[$l]; } if(!empty($letter_array)) { $letter_types = implode(",", $letter_array); } } //dd($personal_info,$current_dob,$current_ssn,$next_action_date); if($global_create_new_sertg_id > 0 && $global_update_sertg_id > 0 && $global_create_new_sertg_id != $global_update_sertg_id){ $velocity_id = $global_update_sertg_id; } $inputData['personal_info'] = $personal_info; $inputData['dob'] = $current_dob; $inputData['ssn'] = $current_ssn; $inputData['next_action_date'] = $next_action_date; $inputData['letter_types'] = $letter_types; $inputData['global_create_new_sertg_id'] = $global_create_new_sertg_id; $inputData['client_id'] = $client_id; $inputData['velocity_id'] = $velocity_id; $inputData['velocity_type'] = $velocity_type; $inputData['file_path'] = $file_path; return App\Common\PDFLetters::storePdfLetter($inputData); } } ?>