$db_data["pro_area"] = $pro_area; } else { $errors[] = "Missing or Invalid data: Area"; } if ($pro_addr5) { $db_data["pro_addr5"] = format_street($pro_addr5); } else { $errors[] = "Missing or Invalid data: City"; } if ($pro_country) { $db_data["pro_country"] = trim($pro_country); } else { //$errors[] = "Missing or Invalid data: Country"; } if (is_valid_uk_postcode($pro_postcode)) { $db_data["pro_postcode"] = format_postcode($pro_postcode); } else { $errors[] = "Missing or Invalid data: Postcode"; } if ($errors) { echo error_message($errors); exit; } // insert into property table $pro_id = db_query($db_data, "INSERT", "property", "pro_id", "0"); header("Location:?stage=elaborate&pro_id={$pro_id}"); } // get values from existing property record using $pro_id, as supplied by one of the three actions above $sql = "SELECT \n\tproperty.pro_id, \n\tproperty.pro_status,\n\tproperty.pro_addr1,\n\tproperty.pro_addr2,\n\tproperty.pro_addr3,\n\tproperty.pro_addr4,\n\tproperty.pro_addr5,\t\n\tproperty.pro_country,\n\tproperty.pro_postcode,\n\tproperty.pro_area,\n\tproperty.pro_ptype,\n\tproperty.pro_psubtype,\n\t\n\tproperty.pro_built,\n\tproperty.pro_refurbed,\n\tproperty.pro_floors,\n\tproperty.pro_floor,\n\tproperty.pro_listed,\n\tproperty.pro_parking,\n\tproperty.pro_garden,\n\tproperty.pro_gardenlength,\n\tproperty.pro_reception,\n\tproperty.pro_bedroom,\n\tproperty.pro_bathroom,\n\tproperty.pro_tenure,\n\tproperty.pro_leaseend,\n\tproperty.pro_location,\n\t\n T.pty_title as type_title,\n ST.pty_title as subtype_title,\n\t\n\tarea.are_id,\n\tarea.are_title\n\t\n\tFROM property \n\tLEFT OUTER \n\tJOIN ptype as T\n ON T.pty_id = property.pro_ptype \n\tLEFT OUTER \n \tJOIN ptype as ST\n ON ST.pty_id = property.pro_psubtype \n\tLEFT OUTER JOIN area ON area.are_id = area.are_id \n \tWHERE \t\n\tproperty.pro_id = " . $pro_id; $q = $db->query($sql); if (DB::isError($q)) {
$db_data["cli_email"] = trim(strtolower($row["Email"])); // current address, attempt some reformatting and add to notes field if (trim($row["Address1"])) { $old_address = trim($row["Address1"]) . ", "; } if (trim($row["Address2"])) { $old_address .= trim($row["Address2"]) . ", "; } if (trim($row["Address3"])) { $old_address .= trim($row["Address3"]) . ", "; } if (trim($row["City"])) { $old_address .= trim($row["City"]) . ", "; } if (trim($row["Postcode"])) { $old_address .= format_postcode($row["Postcode"]); } $old_address = str_ireplace(array('marion putting on web', 'not given', 'none', ' ng ', ' nonegiven ', ' none given '), '', $old_address); if (strlen($old_address) > 3) { $db_data["cli_oldaddr"] = $old_address; $addresses[$row["Client_ID"]] = $old_address; } /* // disregard addresses containing : not given, none and ng if ( strstr(strtolower($db_data["cli_oldaddr"]), 'not given') || strstr(strtolower($db_data["cli_oldaddr"]), 'none') || strstr(strtolower(' '.$db_data["cli_oldaddr"].' '), ' ng ') || strstr(strtolower(' '.$db_data["cli_oldaddr"].' '), ' nonegiven ') || strstr(strtolower(' '.$db_data["cli_oldaddr"].' '), ' none given ') ) {
$Branch = trim($_POST["Branch"]); } if (!$_POST["Neg"]) { $errors[] = "Negotiator is a required field"; } else { $Neg = trim($_POST["Neg"]); } if (!$_POST["Address1"]) { $errors[] = "Street Name is a required field"; } else { $Address1 = trim(format_street($_POST["Address1"])); } if (!$_POST["Postcode"]) { $errors[] = "Postcode is a required field"; } else { $Postcode = trim(format_postcode($_POST["Postcode"])); } if (!$_POST["house_number"]) { $errors[] = "House Number is a required field"; } else { $house_number = trim($_POST["house_number"]); } $Price = trim($_POST["Price"]); $PriceType = trim($_POST["PriceType"]); $Price2 = trim($_POST["Price2"]); $PriceType2 = trim($_POST["PriceType2"]); $lease_free = $_POST["lease_free"]; $state_of_trade_id = $_POST["state_of_trade_id"]; if (!$_POST["type_id"]) { $errors[] = "Property Type is a required field"; } else {
//$errors[] = "Street Name is a required field"; } else { $fieldnames[] = "Address1"; $newvalues[] = trim(format_street($_POST["Address1"])); } if (!$_POST["house_number"]) { //$errors[] = "House Number is a required field"; } else { $fieldnames[] = "house_number"; $newvalues[] = trim($_POST["house_number"]); } if (!$_POST["Postcode"]) { //$errors[] = "Postcode is a required field"; } else { $fieldnames[] = "Postcode"; $newvalues[] = trim(format_postcode($_POST["Postcode"])); } if (!$_POST["osx"]) { $osx = 0; } else { $fieldnames[] = "osx"; $newvalues[] = trim($_POST["osx"]); } if (!$_POST["osy"]) { $osy = 0; } else { $fieldnames[] = "osy"; $newvalues[] = trim($_POST["osy"]); } if (!$_POST["Price"]) { $price = 0;
pro_addr1=1& pro_addr2=2& pro_addr3=3& pro_addr5=4& pro_postcode=5& pro_country=217& form2=Save+Changes */ if ($_GET["pro_pcid"] == '-1') { $db_data["pro_pcid"] = '-1'; $db_data["pro_addr1"] = format_street($_GET["pro_addr1"]); $db_data["pro_addr2"] = format_street($_GET["pro_addr2"]); $db_data["pro_addr3"] = format_street($_GET["pro_addr3"]); $db_data["pro_addr5"] = format_street($_GET["pro_addr5"]); $db_data["pro_postcode"] = format_postcode($_GET["pro_postcode"]); $db_data["pro_country"] = $_GET["pro_country"]; $_GET["pro_pro_id"] = db_query($db_data, "INSERT", "property", "pro_id"); } // if a property id is given, get info from pro table, deal and client tables if ($_GET["pro_id"]) { $sql = "SELECT\n\tdea_id,pro_pcid,\n\tCONCAT('<a href=tools/edit_property.php?pro_id=',pro_id,'>',property.pro_addr1,' ',property.pro_addr2,' ',property.pro_addr3,' ',property.pro_addr4,' ',property.pro_postcode,'</a>') AS Property,\n\tCONCAT('<a href=deal_summary.php?dea_id=',deal.dea_id,'>',property.pro_addr1,' ',property.pro_addr2,' ',property.pro_addr3,' ',property.pro_postcode,' (',deal.dea_type,' / ',deal.dea_status,')</a>') AS Deal\n\tFROM\n\tproperty\n\tLEFT JOIN deal ON deal.dea_prop\t= property.pro_id\n\tWHERE\n\tpro_id = " . $_GET["pro_id"]; if ($_GET["dea_id"]) { $sql .= " AND deal.dea_id = " . $_GET["dea_id"]; } $q = $db->query($sql); if (DB::isError($q)) { die("db error: " . $q->getMessage()); } //$prop = "<pre>"; while ($row = $q->fetchRow()) {