/** * insert one confirmationRegistry in the database * * @author Jonathan Sandoval <*****@*****.**> * @param ConfirmationRegistry $confirmationRegistry The confirmationRegistry to insert * @return boolean If was possible to insert */ static function addConfirmationRegistry($confirmationRegistry = null) { if ($confirmationRegistry === null) { return false; } $number = $confirmationRegistry->getNumber(); $book = $confirmationRegistry->getBook(); $page = $confirmationRegistry->getPage(); $reverse = $confirmationRegistry->getReverse(); $singleConfirmationRegistry = self::getSingleConfirmationRegistry('number', $number, 'book', $book, 'page', $page, 'reverse', $reverse); if ($singleConfirmationRegistry === null) { $TableConfirmationReg = DatabaseManager::getNameTable('TABLE_CONFIRMATION_REGISTRY'); $query = "INSERT INTO {$TableConfirmationReg}\r\n (number, book, page, reverse)\r\n VALUES \r\n ('{$number}', '{$book}', '{$page}', '{$reverse}')"; return DatabaseManager::singleAffectedRow($query); } else { return false; } }
$godFather->setLastname1($_POST["lastname1GodFather"]); $godFather->setLastname2($_POST["lastname2GodFather"]); $godFather->setGender('M'); PersonManager::addPerson($godFather, 'true'); $godFather = PersonManager::getSinglePerson('id', PersonManager::getLastID()); } $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') {