$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 = ""; $churchs = ChurchManager::getAllChurchs('name');
$bookRegistry->setNumber($_POST["numBookRegistry"]); $bookRegistry->setReverse($reverse); BaptismManager::addBaptismRegistry($bookRegistry); $bookRegistry = BaptismManager::getSingleBaptismRegistry('book', $_POST["bookBookRegistry"], 'page', $_POST["pageBookRegistry"], 'number', $_POST["numBookRegistry"], 'reverse', substr($reverse, 0, 1)); } $baptism->setIdBookRegistry(1); if ($bookRegistry !== NULL) { $baptism->setIdBookRegistry($bookRegistry->getId()); } //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