function getMailTpl($id, $KontaktTO = '') { $data = getOneMailVorlage($id); $Subject = $data["cause"]; $BodyText = $data["c_long"]; if ($KontaktTO != '') { $user = getUserStamm($_SESSION["loginCRM"]); if (substr($KontaktTO, 0, 1) == "K") { include "inc/persLib.php"; $empf = getKontaktStamm(substr($KontaktTO, 1)); $tmp = getFirmaCVars($empf["cp_cv_id"]); if ($tmp) { foreach ($tmp as $key => $val) { $empf[$key] = $val; } } //} else if (substr($KontaktTO,0,1)=="C") { } else { if (substr($KontaktTO, 0, 1) == "S") { $empf = getShipStamm(substr($KontaktTO, 1), 'C', True); // <- Da noch mal ran. Hart Kundenstamm } else { if ($KontaktTO) { $empf = getFirmenStamm(substr($KontaktTO, 1), true, substr($KontaktTO, 0, 1)); } } } foreach ($user as $key => $val) { $empf['employee' . strtolower($key)] = $val; } preg_match_all("/%([A-Z0-9_]+)%/iU", $BodyText, $ph, PREG_PATTERN_ORDER); $ph = array_slice($ph, 1); if ($ph[0]) { $anrede = false; foreach ($ph[0] as $x) { $y = $empf[$x]; if ($x == "cp_greeting") { $anrede = $y; } $BodyText = preg_replace("/%" . $x . "%/i", $y, $BodyText); } if ($anrede == "Herr") { $BodyText = preg_replace("/%cp_anrede%/", "r", $BodyText); } else { if ($anrede) { $BodyText = preg_replace("/%cp_anrede%/", "", $BodyText); } } } } //$MailSign=ereg_replace("\r","",$user["mailsign"]); $Response = array('subject' => $Subject, 'bodytxt' => $BodyText); //." \n".$MailSign); echo json_encode($Response); }
function showShipadress($id, $tab) { $data = getShipStamm($id, $tab); $htmllink = ''; $karte = str_replace(array("%TOSTREET%", "%TOZIPCODE%", "%TOCITY%"), array(strtr($data["shiptostreet"], " ", $_SESSION['planspace']), $data["shiptozipcode"], $data["shiptocity"]), $_SESSION['streetview']); if (preg_match("/%FROM/", $karte)) { include "inc/UserLib.php"; $user = getUserStamm($_SESSION["loginCRM"]); if ($user["addr1"] != "" and $user["addr3"] != "" and $user["addr2"]) { $karte = str_replace(array("%FROMSTREET%", "%FROMZIPCODE%", "%FROMCITY%"), array(strtr($user["addr1"], " ", $_SESSION['planspace']), $user["addr2"], $user["addr3"]), $karte); } else { $karte = ""; } } $maillink = $_SESSION['external_mail'] ? "<a href='mailto:" . $data["shiptoemail"] . "'>" . $data["shiptoemail"] . "</a>" : "<a href='mail.php?TO=" . $data["shiptoemail"] . "&KontaktTO={$tab}" . $data["trans_id"] . "'>" . $data["shiptoemail"] . "</a>"; echo json_encode(array('karte' => $karte, 'mail' => $maillink, 'www' => $htmllink, 'adr' => $data)); }
$strasse = !$data["cp_street"] && $complete ? $data2["street"] : $data["cp_street"]; $land = !$data["cp_country"] && $complete ? $data2["country"] : $data["cp_country"]; $plz = !$data["cp_zipcode"] && $complete ? $data2["zipcode"] : $data["cp_zipcode"]; $ort = !$data["cp_city"] && $complete ? $data2["city"] : $data["cp_city"]; $telefon = !$data["cp_phone1"] && $complete ? $data2["phone1"] : $data["cp_phone1"]; $fax = $data["cp_fax"]; $email = $data["cp_email"]; $kontakt = ""; if ($data2) { $data = $data2; } } else { if ($_GET["sid"]) { $id = $_GET["sid"]; $dest = "sid=" . $_GET["sid"]; $data = getShipStamm($_GET["sid"], $Q, $_POST["complete"]); //$anrede="Firma"; if ($data) { $anrede = $data["shiptogreeting"]; $name = $data["shiptoname"]; $name2 = $data["shiptodepartment_1"]; $kontakt = $data["shiptocontact"]; $strasse = $data["shiptostreet"]; $land = $data["shiptocountry"]; $plz = $data["shiptozipcode"]; $ort = $data["shiptocity"]; $telefon = $data["shiptophone"]; $fax = $data["shiptofax"]; $email = $data["shiptoemail"]; } $data = getFirmaCVars($data["trans_id"]);