Merge branch 'staging' into releases/release-hytha-prod

This commit is contained in:
Tiavina 2025-03-26 19:55:15 +03:00
commit 2bbfe390eb
4 changed files with 41 additions and 24 deletions

View File

@ -56,10 +56,10 @@ class CalendarObjectCreatedListener implements IEventListener {
$this->gestionService->HandleCreatedCalendarObject($vCalendarString); $this->gestionService->HandleCreatedCalendarObject($vCalendarString);
} }
catch(\OC\OCS\Exception $e){ catch(\OC\OCS\Exception $e){
$this->logger->error("Error while handling created calendar object: ".$e->getMessage()); $this->logger->debug("Error while handling created calendar object: ".$e->getMessage());
} }
catch(Exception $e){ catch(Exception $e){
$this->logger->error("Error while handling created calendar object: ".$e->getMessage()); $this->logger->debug("Error while handling created calendar object: ".$e->getMessage());
} }
} }

View File

@ -25,6 +25,7 @@ declare(strict_types=1);
namespace OCA\Gestion\Listener; namespace OCA\Gestion\Listener;
use Exception;
use OCA\DAV\Events\CalendarObjectMovedEvent; use OCA\DAV\Events\CalendarObjectMovedEvent;
use OCA\Gestion\Service\GestionService; use OCA\Gestion\Service\GestionService;
use OCP\EventDispatcher\Event; use OCP\EventDispatcher\Event;
@ -50,9 +51,17 @@ class CalendarObjectMovedListener implements IEventListener {
return; return;
} }
$calendarData = $event->getObjectData(); $calendarData = $event->getObjectData();
$targetCalendarId = $event->getTargetCalendarId(); try{
$vCalendarString = $calendarData["calendardata"]; $targetCalendarId = $event->getTargetCalendarId();
$this->gestionService->HandleCalendarObjectMoved($vCalendarString,$targetCalendarId); $vCalendarString = $calendarData["calendardata"];
$this->gestionService->HandleCalendarObjectMoved($vCalendarString,$targetCalendarId);
}
catch(Exception $e){
$this->logger->debug("Error while handling calendar object moved event: ".$e->getMessage());
}
catch(Exception $e){
$this->logger->debug("Error while handling calendar object moved event: ".$e->getMessage());
}
} }
} }

View File

@ -57,10 +57,10 @@ class CalendarObjectUpdatedListener implements IEventListener {
$this->gestionService->HandleUpdatedCalendarObject($vCalendarString); $this->gestionService->HandleUpdatedCalendarObject($vCalendarString);
} }
catch(\OC\OCS\Exception $e){ catch(\OC\OCS\Exception $e){
$this->logger->error("Error while handling updated calendar object: ".$e->getMessage()); $this->logger->debug("Error while handling updated calendar object: ".$e->getMessage());
} }
catch(Exception $e){ catch(Exception $e){
$this->logger->error("Error while handling updated calendar object: ".$e->getMessage()); $this->logger->debug("Error while handling updated calendar object: ".$e->getMessage());
} }
} }

View File

@ -238,33 +238,41 @@ class GestionService {
} }
} }
catch(\OC\OCS\Exception $e){ catch(\OC\OCS\Exception $e){
$this->logger->error("Error while handling created calendar object: ".$e->getMessage()); $this->logger->debug("Error while handling created calendar object: ".$e->getMessage());
} }
catch(Exception $e){ catch(Exception $e){
$this->logger->error("Error while handling created calendar object: ".$e->getMessage()); $this->logger->debug("Error while handling created calendar object: ".$e->getMessage());
} }
return true; return true;
} }
public function HandleCalendarObjectMoved(string $vCalendarString,$targetCalendarId){ public function HandleCalendarObjectMoved(string $vCalendarString,$targetCalendarId){
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString); try{
$isCalendarForLeave = $this->GetIsLeaveFromVCalendarString($vCalendarString); $calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
$isCalendarDevis = $isCalendarForLeave == false; $isCalendarForLeave = $this->GetIsLeaveFromVCalendarString($vCalendarString);
if($isCalendarDevis){ $isCalendarDevis = $isCalendarForLeave == false;
$devis = $this->gestionBdd->getDevisByCalendarUuid($calendarUuid); if($isCalendarDevis){
if($devis != null){ $devis = $this->gestionBdd->getDevisByCalendarUuid($calendarUuid);
$userPrincipalName = $this->gestionBdd->getCalendarPrincipalNameByCalendarId($targetCalendarId); if($devis != null){
if($userPrincipalName != null){ $userPrincipalName = $this->gestionBdd->getCalendarPrincipalNameByCalendarId($targetCalendarId);
$thanatoId = $this->gestionBdd->getThanatoIdByUserUuid($userPrincipalName); if($userPrincipalName != null){
if($thanatoId != null){ $thanatoId = $this->gestionBdd->getThanatoIdByUserUuid($userPrincipalName);
$thanatoHasBeenChanged = $thanatoId != $devis["id_thanato"]; if($thanatoId != null){
if($thanatoHasBeenChanged){ $thanatoHasBeenChanged = $thanatoId != $devis["id_thanato"];
$this->gestionBdd->updateDevisThanato($devis['id'],$thanatoId); if($thanatoHasBeenChanged){
$this->gestionBdd->updateDevisThanato($devis['id'],$thanatoId);
}
} }
} }
} }
} }
} }
catch(\OC\OCS\Exception $e){
$this->logger->debug("Error while handling calendar object moved event: ".$e->getMessage());
}
catch(Exception $e){
$this->logger->debug("Error while handling calendar object moved event: ".$e->getMessage());
}
} }
public function HandleCreatedCalendarObject(string $vCalendarString){ public function HandleCreatedCalendarObject(string $vCalendarString){
@ -301,10 +309,10 @@ class GestionService {
$this->gestionBdd->createDevisTrajetFromVCalendar($devisId,$userName); $this->gestionBdd->createDevisTrajetFromVCalendar($devisId,$userName);
} }
catch(\OC\OCS\Exception $e){ catch(\OC\OCS\Exception $e){
$this->logger->error("Error while handling created calendar object: ".$e->getMessage()); $this->logger->debug("Error while handling created calendar object: ".$e->getMessage());
} }
catch(Exception $e){ catch(Exception $e){
$this->logger->error("Error while handling created calendar object: ".$e->getMessage()); $this->logger->debug("Error while handling created calendar object: ".$e->getMessage());
} }
} }