$confirmation->setIdGodFather($godFather->getId()); } //Get The Book Registry Data $reverse = substr($_POST["reverseBookRegistry"], 0, 1); if ($reverse === 'Y' || $reverse === 'S') { $reverse = 'Y'; } $bookRegistry = ConfirmationManager::getSingleConfirmationRegistry('book', $_POST["bookBookRegistry"], 'page', $_POST["pageBookRegistry"], 'number', $_POST["numBookRegistry"], 'reverse', $reverse); if ($bookRegistry === NULL) { $bookRegistry = new ConfirmationRegistry(); $bookRegistry->setBook($_POST["bookBookRegistry"]); $bookRegistry->setPage($_POST["pageBookRegistry"]); $bookRegistry->setNumber($_POST["numBookRegistry"]); $bookRegistry->setReverse($reverse); ConfirmationManager::addConfirmationRegistry($bookRegistry); $bookRegistry = ConfirmationManager::getSingleConfirmationRegistry('book', $_POST["bookBookRegistry"], 'page', $_POST["pageBookRegistry"], 'number', $_POST["numBookRegistry"], 'reverse', substr($reverse, 0, 1)); } $confirmation->setIdBookRegistry(1); if ($bookRegistry !== NULL) { $confirmation->setIdBookRegistry($bookRegistry->getId()); } //Add the registry if ($_SESSION["user_type"] != 'A') { if ($_SESSION["user_church"] == $church->getId()) { if ($_POST["status"] === 'insert') { if (ConfirmationManager::addConfirmation($confirmation)) { echo "OK"; } else { echo "KO"; } } else {
//Get The Data of the Confirmation $idConfirmation = $_GET["id"]; $confirmation = ConfirmationManager::getSingleConfirmation('id', $idConfirmation); $ownerId = $confirmation->getIdOwner(); $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 = $confirmation->getIdChurch(); $confirmationDate = DatabaseManager::databaseDateToSingleDate($confirmation->getCelebrationDate()); $idRector = $confirmation->getIdRector(); $objRector = RectorManager::getSingleRector('id', $idRector); $objPerRect = PersonManager::getSinglePerson('id', $objRector->getIdPerson()); $nameRector = $objPerRect->getFullNameBeginName(); $idBookRegistry = $confirmation->getIdBookRegistry(); $bookRegistry = ConfirmationManager::getSingleConfirmationRegistry('id', $idBookRegistry); $idGodFather = $confirmation->getIdGodFather(); $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'); foreach ($churchs as $singleChurch) { if ($singleChurch->getId() === $churchId) { $churchString = $churchString . "<option selected> " . $singleChurch->getName() . "</option>\n";
$knamem = $_GET["knamem"]; $klastname1m = $_GET["klastname1m"]; $klastname2m = $_GET["klastname2m"]; $kchurch = $_GET["kchurch"]; $kbook = $_GET["kbook"]; $knumber = $_GET["knumber"]; $kpape = $_GET["kpape"]; $confirmationSearch->setId($kid); $confirmationSearch->setCelebrationDate($kcelebration); $posibleNames[0] = PersonManager::searchPersonsByNames($knamec, $klastname1c, $klastname2c, false); $posibleNames[1] = PersonManager::searchPersonsByNames($knamef, $klastname1f, $klastname2f, false); $posibleNames[2] = PersonManager::searchPersonsByNames($knamem, $klastname1m, $klastname2m, false); $confirmationSearch->setIdOwner($posibleNames); $posibleChurch = ChurchManager::simpleSearchChurch($kchurch, 'id', -1); $confirmationSearch->setIdChurch($posibleChurch); $confirmationRegistry = ConfirmationManager::getSingleConfirmationRegistry('book', $kbook, 'page', $kpape, 'number', $knumber); $confirmationSearch->setIdBookRegistry($confirmationRegistry); $confirmationRegistries = ConfirmationManager::advancedSearchConfirmation($confirmationSearch, 'AND', $sortType, $numberPage); } else { $confirmationRegistries = ConfirmationManager::getAllConfirmations($sortType, $numberPage); } } //Get the total of registries $totalRegistries = DatabaseManager::getAffectedRows(); $affectedRegistries = DatabaseManager::registriesAffectedLastQuery(); $lastPage = floor($affectedRegistries / 10); if ($affectedRegistries % 10 === 0) { $lastPage = floor($affectedRegistries / 10) - 1; } if ($totalRegistries === 0 && $numberPage !== 0) { echo "<script src='../JS/functions.js'></script><script>nextPage('set', '0')</script>";