$owner = PersonManager::getSinglePerson('id', $ownerId); $owner->getIdFather() !== NULL ? $fatherId = $owner->getIdFather() : ($fatherId = 0); $owner->getIdMother() !== NULL ? $motherId = $owner->getIdMother() : ($motherId = 0); $gender = $owner->getGender(); $churchId = $baptism->getIdChurch(); $bornDate = DatabaseManager::databaseDateToSingleDate($baptism->getBornDate()); $bornPlace = $baptism->getBornPlace(); $baptismDate = DatabaseManager::databaseDateToSingleDate($baptism->getCelebrationDate()); //Validate the user SessionManager::validateUserInPage('baptismChange.php', $churchId); $idRector = $baptism->getIdRector(); $objRector = RectorManager::getSingleRector('id', $idRector); $objPerRect = PersonManager::getSinglePerson('id', $objRector->getIdPerson()); $nameRector = $objPerRect->getFullNameBeginName(); $idCivilRegistry = $baptism->getIdCivilRegistry(); $civil = BaptismManager::getSingleCivilRegistry('id', $idCivilRegistry); $office = BaptismManager::getSingleOfficeCivilRegistry('id', $civil->getIdOffice()); $idBookRegistry = $baptism->getIdBookRegistry(); $bookRegistry = BaptismManager::getSingleBaptismRegistry('id', $idBookRegistry); $idGodFather = $baptism->getIdGodFather(); $idGodMother = $baptism->getIdGodMother(); $godMother = PersonManager::getSinglePerson('id', $idGodMother); $godFather = PersonManager::getSinglePerson('id', $idGodFather); if ($godFather === NULL) { $godFather = new Person(); } if ($godMother === NULL) { $godMother = new Person(); } //Create a String of options of Last Church $churchString = "";
//Get The Civil Registry Data $officeTemp = $_POST["officeCivilRegistry"]; $posComa = strpos($officeTemp, ','); $numberOffice = substr($officeTemp, 4, $posComa - 4); $cityOfficeName = substr($officeTemp, $posComa + 2, -1); $cityId = CityManager::getSingleCity('name', $cityOfficeName)->getId(); $office = BaptismManager::getSingleOfficeCivilRegistry('number', $numberOffice, 'idCity', $cityId); $civilRegistry = BaptismManager::getSingleCivilRegistry('book', $_POST["bookCivilRegistry"], 'page', $_POST["pageCivilRegistry"], 'number', $_POST["numCivilRegistry"], 'idOfficineCivilRegistry', $office->getId()); if ($civilRegistry === NULL) { $civilRegistry = new civilRegistry(); $civilRegistry->setBook($_POST["bookCivilRegistry"]); $civilRegistry->setPage($_POST["pageCivilRegistry"]); $civilRegistry->setNumber($_POST["numCivilRegistry"]); $civilRegistry->setIdOffice($office->getId()); BaptismManager::addCivilRegistry($civilRegistry); $civilRegistry = BaptismManager::getSingleCivilRegistry('book', $_POST["bookCivilRegistry"], 'page', $_POST["pageCivilRegistry"], 'number', $_POST["numCivilRegistry"], 'idOfficineCivilRegistry', $office->getId()); } $baptism->setIdCivilRegistry(1); if ($civilRegistry !== NULL) { $baptism->setIdCivilRegistry($civilRegistry->getId()); } //Add the registry if ($_SESSION["user_type"] != 'A') { if ($_SESSION["user_church"] == $church->getId()) { if ($_POST["status"] === 'insert') { if (BaptismManager::addBaptism($baptism)) { echo "OK"; } else { echo "KO"; } } else {