if (empty($id)) {
    exit("Ha ocurrido un error");
}
if (!fAuthorization::checkAuthLevel('super')) {
    $isOwner = fRecordSet::build('EconomicUnit', array('economic_unit_id =' => $id, 'economic_unit_region=' => fSession::get('regs')));
    $count = $isxOwner->count() > 0;
    if (!$count) {
        header('Location: ' . SITE);
    }
}
try {
    $av = new EconomicUnit($id);
} catch (Exception $e) {
    header("Location: " . SITE);
}
$av->setEconomicUnitName(fRequest::encode('title', 'string'));
//$av->setCreatedAt(date('Y-m-d H:m:s'));
$av->setEconomicUnitStreetType(fRequest::encode('type', 'string'));
$av->setEconomicUnitLatitude(fRequest::encode('latitude', 'string'));
$av->setEconomicUnitLongitude(fRequest::encode('longitude', 'string'));
$av->setEconomicUnitDescription(fRequest::encode('description', 'string'));
$av->setEconomicUnitStreetName(fRequest::encode('street', 'string'));
$av->setEconomicUnitLocationNumber(fRequest::encode('number', 'string'));
$av->setEconomicUnitReserve(fRequest::encode('reserve', 'string'));
$av->setEconomicUnitPhone(fRequest::encode('phone', 'string'));
$av->setEconomicUnitCellphone(fRequest::encode('cellphone', 'string'));
$av->setEconomicUnitEmail(fRequest::encode('email', 'string'));
$av->setEconomicUnitCreditCard(fRequest::encode('credit_card', 'string'));
$av->setEconomicUnitFacebookPage(fRequest::encode('fb', 'string'));
$av->setEconomicUnitTwitter(fRequest::encode('tw', 'string'));
$av->setActive(fRequest::encode('status', 'integer'));