/**
  * update one confirmation in the database
  * 
  * @author Jonathan Sandoval <*****@*****.**>
  * @param  Confirmation $confirmation  The confirmation to update
  * @return boolean     if was possible to update
  */
 static function updateConfirmation($confirmation = null)
 {
     if ($confirmation === null) {
         return false;
     }
     $tableConfirmation = DatabaseManager::getNameTable('TABLE_CONFIRMATION');
     $id = $confirmation->getId();
     $celebrationDate = $confirmation->getCelebrationDate();
     $idGodFather = $confirmation->getIdGodFather();
     $idBookRegistry = $confirmation->getIdBookRegistry();
     $idChurch = $confirmation->getIdChurch();
     $idRector = $confirmation->getIdRector();
     $idOwner = $confirmation->getIdOwner();
     $query = "UPDATE {$tableConfirmation}\r\n                          SET confirmationDate       = '{$celebrationDate}', \r\n                              idOwner                = '{$idOwner}', \r\n                              idGodFather            = '{$idGodFather}', \r\n                              idConfirmationRegistry = '{$idBookRegistry}', \r\n                              idChurch               = '{$idChurch}', \r\n                              idRector               = '{$idRector}' \r\n                          WHERE {$tableConfirmation}.id = {$id}";
     $person = PersonManager::getSinglePerson("id", $idOwner);
     ChangesLogsManager::addChangesLogs("C", "Confirmacion de " . $person->getFullNameBeginName());
     return DatabaseManager::singleAffectedRow($query);
 }
 /**
  * Update one baptism in the database
  * 
  * @author Jonathan Sandoval <*****@*****.**>
  * @param  Baptism $baptism  The baptism to update
  * @return boolean           if was possible to update
  */
 static function updateBaptism($baptism = null)
 {
     if ($baptism === null) {
         return false;
     }
     $tableBaptism = DatabaseManager::getNameTable('TABLE_BAPTISM');
     $id = $baptism->getId();
     $celebrationDate = $baptism->getCelebrationDate();
     $bornPlace = $baptism->getBornPlace();
     $bornDate = $baptism->getBornDate();
     $legitimate = $baptism->getLegitimate();
     $idGodFather = $baptism->getIdGodFather();
     $idGodMother = $baptism->getIdGodMother();
     $idBookRegistry = $baptism->getIdBookRegistry();
     $idCivilRegistry = $baptism->getIdCivilRegistry();
     $idChurch = $baptism->getIdChurch();
     $idRector = $baptism->getIdRector();
     $idOwner = $baptism->getIdOwner();
     $query = "UPDATE {$tableBaptism}\r\n                          SET baptismDate     = '{$celebrationDate}', \r\n                              bornPlace       = '{$bornPlace}', \r\n                              bornDate        = '{$bornDate}',        \r\n                              legitimate      = '{$legitimate}', \r\n                              idOwner         = '{$idOwner}',         \r\n                              idGodFather     = '{$idGodFather}', \r\n                              idGodMother     = '{$idGodMother}',     \r\n                              idCivilRegistry = '{$idCivilRegistry}', \r\n                              idBookRegistry  = '{$idBookRegistry}', \r\n                              idChurch        = '{$idChurch}', \r\n                              idRector        = '{$idRector}' \r\n                          WHERE {$tableBaptism}.id = {$id}";
     $person = PersonManager::getSinglePerson("id", $idOwner);
     ChangesLogsManager::addChangesLogs("C", "Bautismo de " . $person->getFullNameBeginName());
     return DatabaseManager::singleAffectedRow($query);
 }
 /**
  * update one defuntion in the database
  * 
  * @author Jonathan Sandoval <*****@*****.**>
  * @param  Defuntion $defuntion  The defuntion to update
  * @return boolean     if was possible to update
  */
 static function updateDefuntion($defuntion = null)
 {
     if ($defuntion === null) {
         return false;
     }
     $tableDefuntion = DatabaseManager::getNameTable('TABLE_DEFUNTION');
     $id = $defuntion->getId();
     $deadDate = $defuntion->getDeadDate();
     $idOwner = $defuntion->getIdOwner();
     $idChurch = $defuntion->getIdChurch();
     $idCrypt = $defuntion->getIdCrypt();
     if ($idCrypt == "") {
         $idCrypt = "NULL";
     }
     $query = "UPDATE {$tableDefuntion}\r\n                          SET deadDate = '{$deadDate}', idOwner = '{$idOwner}', idChurch = '{$idChurch}', \r\n                              idCrypt = {$idCrypt} \r\n                          WHERE {$tableDefuntion}.id = {$id}";
     $person = PersonManager::getSinglePerson("id", $idOwner);
     ChangesLogsManager::addChangesLogs("C", "Defuncion de " . $person->getFullNameBeginName());
     return DatabaseManager::singleAffectedRow($query);
 }
 /**
  * Update one church in the database
  * 
  * @author Jonathan Sandoval <*****@*****.**>
  * @param  Church $church  The church to update
  * @return boolean         If was possible to update
  */
 static function updateChurch($church = null)
 {
     if ($church === null) {
         return false;
     }
     $tableChurch = DatabaseManager::getNameTable('TABLE_CHURCH');
     $id = $church->getId();
     $name = $church->getName();
     $type = $church->getType();
     $code = $church->getCode();
     $address = $church->getAddress();
     $colony = $church->getColony();
     $postalCode = $church->getPostalCode();
     $phoneNumber = $church->getPhoneNumber();
     $idVicar = $church->getIdVicar();
     $idDean = $church->getIdDean();
     $idCity = $church->getIdCity();
     $idNiche = $church->getIdNiche();
     $query = "UPDATE {$tableChurch}\r\n                          SET name        = '{$name}', \r\n                              type        = '{$type}', \r\n                              code        = '{$code}', \r\n                              address     = '{$address}', \r\n                              colony      = '{$colony}', \r\n                              postalCode  = '{$postalCode}', \r\n                              phoneNumber = '{$phoneNumber}', \r\n                              idVicar     = '{$idVicar}', \r\n                              idDean      = '{$idDean}', \r\n                              idCity      = '{$idCity}', \r\n                              idNiche     = {$idNiche} \r\n                          WHERE {$tableChurch}.id = {$id}";
     ChangesLogsManager::addChangesLogs("C", "Iglesia de " . $church->getName());
     return DatabaseManager::singleAffectedRow($query);
 }
 /**
  * update one ProofTalks in the database
  * 
  * @author Jonathan Sandoval <*****@*****.**>
  * @param  ProofTalks $ProofTalks  The ProofTalks to update
  * @return boolean         If was posible to update
  */
 static function updateProofTalks($ProofTalks = null)
 {
     if ($ProofTalks === null) {
         return false;
     }
     $tableProofTalks = DatabaseManager::getNameTable('TABLE_PROFF_TALKS');
     $idOwner = $ProofTalks->getIdOwner();
     $type = $ProofTalks->getType();
     $id = $ProofTalks->getId();
     $idGodFather = $ProofTalks->getIdGodFather();
     $idGodMother = $ProofTalks->getIdGodMother();
     $idChurch = $ProofTalks->getIdChurch();
     if ($idGodFather === NULL) {
         $idGodFather = 'NULL';
     }
     if ($idGodMother === NULL) {
         $idGodMother = 'NULL';
     }
     $query = "UPDATE {$tableProofTalks}\r\n                          SET idOwner = '{$idOwner}', type = '{$type}', idGodMother = {$idGodMother}, \r\n                              idGodFather = {$idGodFather}, idChurch = '{$idChurch}'\r\n                          WHERE {$tableProofTalks}.id = {$id}";
     $person = PersonManager::getSinglePerson("id", $idOwner);
     ChangesLogsManager::addChangesLogs("C", "Comprobante de " . $person->getFullNameBeginName());
     return DatabaseManager::singleAffectedRow($query);
 }
 /**
  * update one marriage in the database
  * 
  * @author Jonathan Sandoval <*****@*****.**>
  * @param  Marriage $marriage  The marriage to update
  * @return boolean     if was possible to update
  */
 static function updateMarriage($marriage = null)
 {
     if ($marriage === null) {
         return false;
     }
     $tableMarriage = DatabaseManager::getNameTable('TABLE_MARRIAGE');
     $idBoyfriend = $marriage->getIdBoyfriend();
     $idGirlfriend = $marriage->getIdGirlfriend();
     $id = $marriage->getId();
     $marriageDate = $marriage->getCelebrationDate();
     $idGodFather = $marriage->getIdGodFather();
     $idGodMother = $marriage->getIdGodMother();
     $idChurchMarriage = $marriage->getIdChurchMarriage();
     $idRector = $marriage->getIdRector();
     $idWitness1 = $marriage->getIdWitness1();
     $idWitness2 = $marriage->getIdWitness2();
     $idChurchProcess = $marriage->getIdChurchProcess();
     $idMarriageRegistry = $marriage->getIdBookRegistry();
     $query = "UPDATE {$tableMarriage}\r\n                          SET idBoyfriend        = '{$idBoyfriend}', \r\n                              idGirlfriend       = '{$idGirlfriend}', \r\n                              idGodFather        = '{$idGodFather}', \r\n                              idGodMother        = '{$idGodMother}', \r\n                              idWitness1         = '{$idWitness1}', \r\n                              idWitness2         = '{$idWitness2}',\r\n                              idMarriageRegistry = '{$idMarriageRegistry}', \r\n                              idChurchProcess    = '{$idChurchProcess}', \r\n                              idRector           = '{$idRector}', \r\n                              idChurchMarriage   = '{$idChurchMarriage}', \r\n                              marriageDate       = '{$marriageDate}'\r\n                          WHERE {$tableMarriage}.id = {$id}";
     $personA = PersonManager::getSinglePerson("id", $idBoyfriend);
     $personB = PersonManager::getSinglePerson("id", $idGirlfriend);
     ChangesLogsManager::addChangesLogs("C", "Matrimonio de" . $personA->getFullNameBeginName() . " y " . $personB->getFullNameBeginName());
     return DatabaseManager::singleAffectedRow($query);
 }