Merge branch 'hytha/hotfixes/error-on-saving-calendar' into staging

This commit is contained in:
Tiavina 2025-03-26 19:42:51 +03:00
commit 41c6e074b0
3 changed files with 90 additions and 55 deletions

View File

@ -25,6 +25,7 @@ declare(strict_types=1);
namespace OCA\Gestion\Listener;
use Exception;
use OCA\DAV\Events\CalendarObjectCreatedEvent;
use OCA\Gestion\Service\GestionService;
use OCP\EventDispatcher\Event;
@ -50,8 +51,16 @@ class CalendarObjectCreatedListener implements IEventListener {
return;
}
$calendarData = $event->getObjectData();
try{
$vCalendarString = $calendarData["calendardata"];
$this->gestionService->HandleCreatedCalendarObject($vCalendarString);
}
catch(\OC\OCS\Exception $e){
$this->logger->error("Error while handling created calendar object: ".$e->getMessage());
}
catch(Exception $e){
$this->logger->error("Error while handling created calendar object: ".$e->getMessage());
}
}
}

View File

@ -25,6 +25,7 @@ declare(strict_types=1);
namespace OCA\Gestion\Listener;
use Exception;
use OCA\DAV\Events\CalendarObjectCreatedEvent;
use OCA\DAV\Events\CalendarObjectUpdatedEvent;
use OCA\Gestion\Service\GestionService;
@ -51,8 +52,16 @@ class CalendarObjectUpdatedListener implements IEventListener {
return;
}
$calendarData = $event->getObjectData();
try{
$vCalendarString = $calendarData["calendardata"];
$this->gestionService->HandleUpdatedCalendarObject($vCalendarString);
}
catch(\OC\OCS\Exception $e){
$this->logger->error("Error while handling updated calendar object: ".$e->getMessage());
}
catch(Exception $e){
$this->logger->error("Error while handling updated calendar object: ".$e->getMessage());
}
}
}

View File

@ -26,6 +26,7 @@ declare(strict_types=1);
namespace OCA\Gestion\Service;
use Exception;
use OCA\Gestion\Constants\BddConstant;
use OCA\Gestion\Constants\DevisMentionConstant;
use OCA\Gestion\Constants\VCalendarPropertyConstant;
@ -205,6 +206,7 @@ class GestionService {
}
public function HandleUpdatedCalendarObject(string $vCalendarString){
try{
$isCalendarForLeave = $this->GetIsLeaveFromVCalendarString($vCalendarString);
if($isCalendarForLeave){
//from devis calendar to leave calendar
@ -234,6 +236,13 @@ class GestionService {
//update from calendar leave or calendar pending to calendar devis
$this->HandleCreatedCalendarObject($vCalendarString);
}
}
catch(\OC\OCS\Exception $e){
$this->logger->error("Error while handling created calendar object: ".$e->getMessage());
}
catch(Exception $e){
$this->logger->error("Error while handling created calendar object: ".$e->getMessage());
}
return true;
}
@ -259,6 +268,7 @@ class GestionService {
}
public function HandleCreatedCalendarObject(string $vCalendarString){
try{
$isCalendarForLeave = $this->GetIsLeaveFromVCalendarString($vCalendarString);
if($isCalendarForLeave){
return;
@ -290,6 +300,13 @@ class GestionService {
$this->talkService->sendDevisTalkNotifications($devisTalkMessage,$userName,$this->userConnectedUuid);
$this->gestionBdd->createDevisTrajetFromVCalendar($devisId,$userName);
}
catch(\OC\OCS\Exception $e){
$this->logger->error("Error while handling created calendar object: ".$e->getMessage());
}
catch(Exception $e){
$this->logger->error("Error while handling created calendar object: ".$e->getMessage());
}
}
private function GetThanatoNameFromVCalendarString($vCalendarString){
$thanatoName = $this->getPrincipalUsernameFromVCalendarString($vCalendarString);