Compare commits
No commits in common. "b1fabe9804ba2249294e641d04488621f7fe12ad" and "22f5d8f535662988611528151236af017f9fc5c3" have entirely different histories.
b1fabe9804
...
22f5d8f535
@ -8,7 +8,7 @@ abstract class BddConstant
|
|||||||
const DEFAULT_TABLE_PREFIX = "*PREFIX*";
|
const DEFAULT_TABLE_PREFIX = "*PREFIX*";
|
||||||
const DEFAULT_CLIENT_GROUP_NAME = "Nom du groupe";
|
const DEFAULT_CLIENT_GROUP_NAME = "Nom du groupe";
|
||||||
const DEFAULT_ADMIN_ID_NEXTCLOUD = 'admin';
|
const DEFAULT_ADMIN_ID_NEXTCLOUD = 'admin';
|
||||||
const DEFAULT_ADMIN_APP_ID_NEXTCLOUD = "Johann";
|
const DEFAULT_ADMIN_APP_ID_NEXTCLOUD = "admin";
|
||||||
|
|
||||||
const ISLEAVEPROPERTYONVCALENDAR = "ISLEAVE";
|
const ISLEAVEPROPERTYONVCALENDAR = "ISLEAVE";
|
||||||
|
|
||||||
|
|||||||
@ -25,15 +25,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace OCA\Gestion\Listener;
|
namespace OCA\Gestion\Listener;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use OCA\DAV\Events\CalendarObjectCreatedEvent;
|
use OCA\DAV\Events\CalendarObjectCreatedEvent;
|
||||||
use OCA\Gestion\Service\GestionService;
|
use OCA\Gestion\Service\GestionService;
|
||||||
use OCP\EventDispatcher\Event;
|
use OCP\EventDispatcher\Event;
|
||||||
use OCP\EventDispatcher\IEventListener;
|
use OCP\EventDispatcher\IEventListener;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class CalendarObjectCreatedListener implements IEventListener
|
class CalendarObjectCreatedListener implements IEventListener {
|
||||||
{
|
|
||||||
|
|
||||||
/** @var LoggerInterface */
|
/** @var LoggerInterface */
|
||||||
private $logger;
|
private $logger;
|
||||||
@ -42,27 +40,18 @@ class CalendarObjectCreatedListener implements IEventListener
|
|||||||
private $gestionService;
|
private $gestionService;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
LoggerInterface $logger,
|
LoggerInterface $logger,GestionService $gestionService) {
|
||||||
GestionService $gestionService
|
|
||||||
) {
|
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->gestionService = $gestionService;
|
$this->gestionService = $gestionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(Event $event): void
|
public function handle(Event $event): void {
|
||||||
{
|
|
||||||
if (!($event instanceof CalendarObjectCreatedEvent)) {
|
if (!($event instanceof CalendarObjectCreatedEvent)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$calendarData = $event->getObjectData();
|
$calendarData = $event->getObjectData();
|
||||||
try {
|
|
||||||
$vCalendarString = $calendarData["calendardata"];
|
$vCalendarString = $calendarData["calendardata"];
|
||||||
$this->gestionService->HandleCreatedCalendarObject($vCalendarString);
|
$this->gestionService->HandleCreatedCalendarObject($vCalendarString);
|
||||||
} catch (\OC\OCS\Exception $e) {
|
|
||||||
$this->logger->debug("Error while handling created calendar object: " . $e->getMessage());
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
$this->logger->debug("Error while handling created calendar object: " . $e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,15 +25,13 @@ 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;
|
||||||
use OCP\EventDispatcher\IEventListener;
|
use OCP\EventDispatcher\IEventListener;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class CalendarObjectMovedListener implements IEventListener
|
class CalendarObjectMovedListener implements IEventListener {
|
||||||
{
|
|
||||||
|
|
||||||
/** @var LoggerInterface */
|
/** @var LoggerInterface */
|
||||||
private $logger;
|
private $logger;
|
||||||
@ -42,28 +40,19 @@ class CalendarObjectMovedListener implements IEventListener
|
|||||||
private $gestionService;
|
private $gestionService;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
LoggerInterface $logger,
|
LoggerInterface $logger,GestionService $gestionService) {
|
||||||
GestionService $gestionService
|
|
||||||
) {
|
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->gestionService = $gestionService;
|
$this->gestionService = $gestionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(Event $event): void
|
public function handle(Event $event): void {
|
||||||
{
|
|
||||||
if (!($event instanceof CalendarObjectMovedEvent)) {
|
if (!($event instanceof CalendarObjectMovedEvent)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$calendarData = $event->getObjectData();
|
$calendarData = $event->getObjectData();
|
||||||
try {
|
|
||||||
$targetCalendarId = $event->getTargetCalendarId();
|
$targetCalendarId = $event->getTargetCalendarId();
|
||||||
$vCalendarString = $calendarData["calendardata"];
|
$vCalendarString = $calendarData["calendardata"];
|
||||||
$this->gestionService->HandleCalendarObjectMoved($vCalendarString,$targetCalendarId);
|
$this->gestionService->HandleCalendarObjectMoved($vCalendarString,$targetCalendarId);
|
||||||
} catch (\OC\OCS\Exception $e) {
|
|
||||||
$this->logger->debug("Error while handling calendar object moved event: " . $e->getMessage());
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
$this->logger->debug("Error while handling calendar object moved event: " . $e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace OCA\Gestion\Listener;
|
namespace OCA\Gestion\Listener;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use OCA\DAV\Events\CalendarObjectCreatedEvent;
|
use OCA\DAV\Events\CalendarObjectCreatedEvent;
|
||||||
use OCA\DAV\Events\CalendarObjectUpdatedEvent;
|
use OCA\DAV\Events\CalendarObjectUpdatedEvent;
|
||||||
use OCA\Gestion\Service\GestionService;
|
use OCA\Gestion\Service\GestionService;
|
||||||
@ -33,8 +32,7 @@ use OCP\EventDispatcher\Event;
|
|||||||
use OCP\EventDispatcher\IEventListener;
|
use OCP\EventDispatcher\IEventListener;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class CalendarObjectUpdatedListener implements IEventListener
|
class CalendarObjectUpdatedListener implements IEventListener {
|
||||||
{
|
|
||||||
|
|
||||||
/** @var LoggerInterface */
|
/** @var LoggerInterface */
|
||||||
private $logger;
|
private $logger;
|
||||||
@ -43,27 +41,18 @@ class CalendarObjectUpdatedListener implements IEventListener
|
|||||||
private $gestionService;
|
private $gestionService;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
LoggerInterface $logger,
|
LoggerInterface $logger,GestionService $gestionService) {
|
||||||
GestionService $gestionService
|
|
||||||
) {
|
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->gestionService = $gestionService;
|
$this->gestionService = $gestionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(Event $event): void
|
public function handle(Event $event): void {
|
||||||
{
|
|
||||||
if (!($event instanceof CalendarObjectUpdatedEvent)) {
|
if (!($event instanceof CalendarObjectUpdatedEvent)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$calendarData = $event->getObjectData();
|
$calendarData = $event->getObjectData();
|
||||||
try {
|
|
||||||
$vCalendarString = $calendarData["calendardata"];
|
$vCalendarString = $calendarData["calendardata"];
|
||||||
$this->gestionService->HandleUpdatedCalendarObject($vCalendarString);
|
$this->gestionService->HandleUpdatedCalendarObject($vCalendarString);
|
||||||
} catch (\OC\OCS\Exception $e) {
|
|
||||||
$this->logger->debug("Error while handling updated calendar object: " . $e->getMessage());
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
$this->logger->debug("Error while handling updated calendar object: " . $e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class CareCertificatePdfHandler extends FPDF {
|
|||||||
function Header()
|
function Header()
|
||||||
{
|
{
|
||||||
if($this->logo != "nothing"){
|
if($this->logo != "nothing"){
|
||||||
$this->Image($this->imagePath."logo.png", 10, 10, 75, 25);
|
$this->Image($this->imagePath."logo.png", 10, 10,50,35);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$this->Cell(55,30,'');
|
$this->Cell(55,30,'');
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class PacemakerCertificatePdfHandler extends FPDF {
|
|||||||
function Header()
|
function Header()
|
||||||
{
|
{
|
||||||
if($this->logo != "nothing"){
|
if($this->logo != "nothing"){
|
||||||
$this->Image($this->imagePath."logo.png", 10, 10, 75, 25);
|
$this->Image($this->imagePath."logo.png", 10, 10, 50,35);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$this->Cell(55,30,'');
|
$this->Cell(55,30,'');
|
||||||
|
|||||||
@ -40,7 +40,7 @@ class DevisPdfHandler extends FPDF {
|
|||||||
function Header()
|
function Header()
|
||||||
{
|
{
|
||||||
if($this->logo != "nothing"){
|
if($this->logo != "nothing"){
|
||||||
$this->Image($this->logoPath."logo.png", 10, 10, 75, 25);
|
$this->Image($this->logoPath."logo.png", 2, 2, 50,35);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$this->Cell(55,30,'');
|
$this->Cell(55,30,'');
|
||||||
|
|||||||
@ -26,7 +26,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace OCA\Gestion\Service;
|
namespace OCA\Gestion\Service;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use OCA\Gestion\Constants\BddConstant;
|
use OCA\Gestion\Constants\BddConstant;
|
||||||
use OCA\Gestion\Constants\DevisMentionConstant;
|
use OCA\Gestion\Constants\DevisMentionConstant;
|
||||||
use OCA\Gestion\Constants\VCalendarPropertyConstant;
|
use OCA\Gestion\Constants\VCalendarPropertyConstant;
|
||||||
@ -35,8 +34,7 @@ use OCP\IUserSession;
|
|||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use OCA\Gestion\Helpers\VCalendarHelpers;
|
use OCA\Gestion\Helpers\VCalendarHelpers;
|
||||||
|
|
||||||
class GestionService
|
class GestionService {
|
||||||
{
|
|
||||||
/** @var Bdd */
|
/** @var Bdd */
|
||||||
private $gestionBdd;
|
private $gestionBdd;
|
||||||
|
|
||||||
@ -52,20 +50,19 @@ class GestionService
|
|||||||
Bdd $gestionBdd,
|
Bdd $gestionBdd,
|
||||||
LoggerInterface $logger,
|
LoggerInterface $logger,
|
||||||
TalkService $talkService,
|
TalkService $talkService,
|
||||||
IUserSession $userSession
|
IUserSession $userSession) {
|
||||||
) {
|
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->gestionBdd = $gestionBdd;
|
$this->gestionBdd = $gestionBdd;
|
||||||
$this->talkService = $talkService;
|
$this->talkService = $talkService;
|
||||||
try{
|
try{
|
||||||
$this->userConnectedUuid = $userSession->getUser()->getUID();
|
$this->userConnectedUuid = $userSession->getUser()->getUID();
|
||||||
} catch (Exception) {
|
}
|
||||||
|
catch(Exception){
|
||||||
$this->userConnectedUuid = BddConstant::DEFAULT_ADMIN_APP_ID_NEXTCLOUD;
|
$this->userConnectedUuid = BddConstant::DEFAULT_ADMIN_APP_ID_NEXTCLOUD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function GetIsCalendarPendingFromVCalendarString(string $vCalendarString): bool
|
private function GetIsCalendarPendingFromVCalendarString(string $vCalendarString): bool{
|
||||||
{
|
|
||||||
$isCalendarPending = false;
|
$isCalendarPending = false;
|
||||||
$isCalendarPendingValue = VCalendarHelpers::GetValueFromKeyInVCalendarString(VCalendarPropertyConstant::PROPERTY_IS_CALENDAR_PENDING, $vCalendarString);
|
$isCalendarPendingValue = VCalendarHelpers::GetValueFromKeyInVCalendarString(VCalendarPropertyConstant::PROPERTY_IS_CALENDAR_PENDING, $vCalendarString);
|
||||||
if($isCalendarPendingValue == "1"){
|
if($isCalendarPendingValue == "1"){
|
||||||
@ -74,8 +71,7 @@ class GestionService
|
|||||||
return $isCalendarPending;
|
return $isCalendarPending;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function GetIsLeaveFromVCalendarString(string $vCalendarString): bool
|
private function GetIsLeaveFromVCalendarString(string $vCalendarString): bool{
|
||||||
{
|
|
||||||
$isLeave = false;
|
$isLeave = false;
|
||||||
$isLeaveValue = VCalendarHelpers::GetValueFromKeyInVCalendarString(VCalendarPropertyConstant::PROPERTY_IS_LEAVE, $vCalendarString);
|
$isLeaveValue = VCalendarHelpers::GetValueFromKeyInVCalendarString(VCalendarPropertyConstant::PROPERTY_IS_LEAVE, $vCalendarString);
|
||||||
if($isLeaveValue == "1"){
|
if($isLeaveValue == "1"){
|
||||||
@ -107,8 +103,7 @@ class GestionService
|
|||||||
return $thanatoId;
|
return $thanatoId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getPrincipalUsernameFromVCalendarString(string $vCalendarString)
|
private function getPrincipalUsernameFromVCalendarString(string $vCalendarString){
|
||||||
{
|
|
||||||
$calendarUuid = VCalendarHelpers::GetValueFromKeyInVCalendarString("UID", $vCalendarString);
|
$calendarUuid = VCalendarHelpers::GetValueFromKeyInVCalendarString("UID", $vCalendarString);
|
||||||
$principalUsername = $this->gestionBdd->getCalendarOrganizerNameByCalendarObjectUuid($calendarUuid);
|
$principalUsername = $this->gestionBdd->getCalendarOrganizerNameByCalendarObjectUuid($calendarUuid);
|
||||||
return $principalUsername;
|
return $principalUsername;
|
||||||
@ -123,15 +118,13 @@ class GestionService
|
|||||||
return $names;
|
return $names;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function IsDevisAlreadyCreated($clientId, $locationId, $thanatoId, $defuntName, $calendarUuid = "not-related")
|
private function IsDevisAlreadyCreated($clientId,$locationId,$thanatoId,$defuntName,$calendarUuid="not-related"){
|
||||||
{
|
|
||||||
$defuntId = $this->gestionBdd->getLastDefuntIdByName($defuntName);
|
$defuntId = $this->gestionBdd->getLastDefuntIdByName($defuntName);
|
||||||
$devisId = $this->gestionBdd->getLastDevisIdFromVCalendarProperty($thanatoId,$clientId,$locationId,$defuntId,$calendarUuid);
|
$devisId = $this->gestionBdd->getLastDevisIdFromVCalendarProperty($thanatoId,$clientId,$locationId,$defuntId,$calendarUuid);
|
||||||
return $devisId != null;
|
return $devisId != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function GetDevisCommentFromVCalendarString(string $vCalendarString)
|
private function GetDevisCommentFromVCalendarString(string $vCalendarString){
|
||||||
{
|
|
||||||
$commentValue = VCalendarHelpers::GetValueFromKeyInVCalendarString("COMMENT", $vCalendarString);
|
$commentValue = VCalendarHelpers::GetValueFromKeyInVCalendarString("COMMENT", $vCalendarString);
|
||||||
if($commentValue == ""){
|
if($commentValue == ""){
|
||||||
$commentValue = "Commentaire";
|
$commentValue = "Commentaire";
|
||||||
@ -148,15 +141,13 @@ class GestionService
|
|||||||
return $calendarUuid;
|
return $calendarUuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function GetCalendarDateFromVCalendarString(string $vCalendarString)
|
private function GetCalendarDateFromVCalendarString(string $vCalendarString){
|
||||||
{
|
|
||||||
$calendarStartDate = VCalendarHelpers::GetDateStartOrDateEndFromVCalendarString('DTSTART',$vCalendarString);
|
$calendarStartDate = VCalendarHelpers::GetDateStartOrDateEndFromVCalendarString('DTSTART',$vCalendarString);
|
||||||
$calendarStartDate = $calendarStartDate->format('Y-m-d');
|
$calendarStartDate = $calendarStartDate->format('Y-m-d');
|
||||||
return $calendarStartDate;
|
return $calendarStartDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function HandleCalendarObjectMovedToTrash(string $vCalendarString)
|
public function HandleCalendarObjectMovedToTrash(string $vCalendarString){
|
||||||
{
|
|
||||||
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
|
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
|
||||||
$devis = $this->gestionBdd->getDevisByCalendarUuid($calendarUuid);
|
$devis = $this->gestionBdd->getDevisByCalendarUuid($calendarUuid);
|
||||||
if($devis != null){
|
if($devis != null){
|
||||||
@ -165,8 +156,7 @@ class GestionService
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function UpdateDevisDataByVCalendarString($devis, $vCalendarString)
|
private function UpdateDevisDataByVCalendarString($devis,$vCalendarString){
|
||||||
{
|
|
||||||
$requestedDefuntName = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
|
$requestedDefuntName = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
|
||||||
$defuntId = $this->gestionBdd->createOrUpdateDefuntByNameAndReturnDefuntId($devis['defunt_id'],$devis['defunt_nom'],$requestedDefuntName);
|
$defuntId = $this->gestionBdd->createOrUpdateDefuntByNameAndReturnDefuntId($devis['defunt_id'],$devis['defunt_nom'],$requestedDefuntName);
|
||||||
$this->gestionBdd->updateDevisDefunt($devis['id'],$defuntId,$devis['defunt_id']);
|
$this->gestionBdd->updateDevisDefunt($devis['id'],$defuntId,$devis['defunt_id']);
|
||||||
@ -189,8 +179,7 @@ class GestionService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function CheckIfDevisIsAlreadyUpdated($devis, $vCalendarString)
|
private function CheckIfDevisIsAlreadyUpdated($devis,$vCalendarString){
|
||||||
{
|
|
||||||
$requestedDefuntName = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
|
$requestedDefuntName = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
|
||||||
$requestedClientId = $this->GetClientIdFromVCalendarString($vCalendarString);
|
$requestedClientId = $this->GetClientIdFromVCalendarString($vCalendarString);
|
||||||
$requestLocationId = $this->GetLocationIdFromVCalendarString($vCalendarString);
|
$requestLocationId = $this->GetLocationIdFromVCalendarString($vCalendarString);
|
||||||
@ -215,9 +204,7 @@ class GestionService
|
|||||||
$devis['date'] == $requestedDevisDate;
|
$devis['date'] == $requestedDevisDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function HandleUpdatedCalendarObject(string $vCalendarString)
|
public function HandleUpdatedCalendarObject(string $vCalendarString){
|
||||||
{
|
|
||||||
try {
|
|
||||||
$isCalendarForLeave = $this->GetIsLeaveFromVCalendarString($vCalendarString);
|
$isCalendarForLeave = $this->GetIsLeaveFromVCalendarString($vCalendarString);
|
||||||
if($isCalendarForLeave){
|
if($isCalendarForLeave){
|
||||||
//from devis calendar to leave calendar
|
//from devis calendar to leave calendar
|
||||||
@ -242,21 +229,15 @@ class GestionService
|
|||||||
$devisTalkMessage = $this->gestionBdd->getDevisTalkRoomMessage($devis['id'],$userName);
|
$devisTalkMessage = $this->gestionBdd->getDevisTalkRoomMessage($devis['id'],$userName);
|
||||||
$this->talkService->sendDevisTalkNotifications($devisTalkMessage,$userName,$this->userConnectedUuid);
|
$this->talkService->sendDevisTalkNotifications($devisTalkMessage,$userName,$this->userConnectedUuid);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else{
|
||||||
//update from calendar leave or calendar pending to calendar devis
|
//update from calendar leave or calendar pending to calendar devis
|
||||||
$this->HandleCreatedCalendarObject($vCalendarString);
|
$this->HandleCreatedCalendarObject($vCalendarString);
|
||||||
}
|
}
|
||||||
} catch (\OC\OCS\Exception $e) {
|
|
||||||
$this->logger->debug("Error while handling created calendar object: " . $e->getMessage());
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
$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){
|
||||||
{
|
|
||||||
try {
|
|
||||||
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
|
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
|
||||||
$isCalendarForLeave = $this->GetIsLeaveFromVCalendarString($vCalendarString);
|
$isCalendarForLeave = $this->GetIsLeaveFromVCalendarString($vCalendarString);
|
||||||
$isCalendarDevis = $isCalendarForLeave == false;
|
$isCalendarDevis = $isCalendarForLeave == false;
|
||||||
@ -275,16 +256,9 @@ class GestionService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\OC\OCS\Exception $e) {
|
|
||||||
$this->logger->debug("Error while handling calendar object moved event: " . $e->getMessage());
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
$this->logger->debug("Error while handling calendar object moved event: " . $e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function HandleCreatedCalendarObject(string $vCalendarString)
|
public function HandleCreatedCalendarObject(string $vCalendarString){
|
||||||
{
|
|
||||||
try {
|
|
||||||
$isCalendarForLeave = $this->GetIsLeaveFromVCalendarString($vCalendarString);
|
$isCalendarForLeave = $this->GetIsLeaveFromVCalendarString($vCalendarString);
|
||||||
if($isCalendarForLeave){
|
if($isCalendarForLeave){
|
||||||
return;
|
return;
|
||||||
@ -315,21 +289,14 @@ class GestionService
|
|||||||
$devisTalkMessage = $this->gestionBdd->getDevisTalkRoomMessage($devisId,$userName);
|
$devisTalkMessage = $this->gestionBdd->getDevisTalkRoomMessage($devisId,$userName);
|
||||||
$this->talkService->sendDevisTalkNotifications($devisTalkMessage,$userName,$this->userConnectedUuid);
|
$this->talkService->sendDevisTalkNotifications($devisTalkMessage,$userName,$this->userConnectedUuid);
|
||||||
$this->gestionBdd->createDevisTrajetFromVCalendar($devisId,$userName);
|
$this->gestionBdd->createDevisTrajetFromVCalendar($devisId,$userName);
|
||||||
} catch (\OC\OCS\Exception $e) {
|
|
||||||
$this->logger->debug("Error while handling created calendar object: " . $e->getMessage());
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
$this->logger->debug("Error while handling created calendar object: " . $e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function GetThanatoNameFromVCalendarString($vCalendarString)
|
private function GetThanatoNameFromVCalendarString($vCalendarString){
|
||||||
{
|
|
||||||
$thanatoName = $this->getPrincipalUsernameFromVCalendarString($vCalendarString);
|
$thanatoName = $this->getPrincipalUsernameFromVCalendarString($vCalendarString);
|
||||||
return $thanatoName ?? BddConstant::DEFAULT_ADMIN_APP_ID_NEXTCLOUD;
|
return $thanatoName ?? BddConstant::DEFAULT_ADMIN_APP_ID_NEXTCLOUD;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function GetClientIdFromVCalendarString(string $vCalendarString)
|
private function GetClientIdFromVCalendarString(string $vCalendarString){
|
||||||
{
|
|
||||||
$this->logger->debug($vCalendarString);
|
$this->logger->debug($vCalendarString);
|
||||||
$clientValue = VCalendarHelpers::GetValueFromKeyInVCalendarString("CLIENT", $vCalendarString);
|
$clientValue = VCalendarHelpers::GetValueFromKeyInVCalendarString("CLIENT", $vCalendarString);
|
||||||
if($clientValue == null || $clientValue == ""){
|
if($clientValue == null || $clientValue == ""){
|
||||||
@ -338,8 +305,7 @@ class GestionService
|
|||||||
return (int)$clientValue;
|
return (int)$clientValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function GetLocationIdFromVCalendarString(string $vCalendarString)
|
private function GetLocationIdFromVCalendarString(string $vCalendarString){
|
||||||
{
|
|
||||||
$locationValue = VCalendarHelpers::GetValueFromKeyInVCalendarString("LOCATION", $vCalendarString);
|
$locationValue = VCalendarHelpers::GetValueFromKeyInVCalendarString("LOCATION", $vCalendarString);
|
||||||
if($locationValue == null || $locationValue == ""){
|
if($locationValue == null || $locationValue == ""){
|
||||||
$locationValue = 0;
|
$locationValue = 0;
|
||||||
@ -347,8 +313,7 @@ class GestionService
|
|||||||
return (int)$locationValue;
|
return (int)$locationValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function GetArticlesNameFromVCalendarString(string $vCalendarString): array
|
private function GetArticlesNameFromVCalendarString(string $vCalendarString): array {
|
||||||
{
|
|
||||||
$devisArticleValue = VCalendarHelpers::GetValueFromKeyInVCalendarString("DESCRIPTION", $vCalendarString);
|
$devisArticleValue = VCalendarHelpers::GetValueFromKeyInVCalendarString("DESCRIPTION", $vCalendarString);
|
||||||
$articles = explode('\;', $devisArticleValue);
|
$articles = explode('\;', $devisArticleValue);
|
||||||
$mapped = array_map('trim', $articles);
|
$mapped = array_map('trim', $articles);
|
||||||
|
|||||||
@ -54,7 +54,7 @@ class InvoiceGroupPdfHandler extends FPDF {
|
|||||||
function Header()
|
function Header()
|
||||||
{
|
{
|
||||||
if($this->logo != "nothing"){
|
if($this->logo != "nothing"){
|
||||||
$this->Image($this->logoPath."logo.png", 2, 2, 75, 25);
|
$this->Image($this->logoPath."logo.png", 2, 2, 50,35);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$this->Cell(55,30,'');
|
$this->Cell(55,30,'');
|
||||||
|
|||||||
@ -45,7 +45,7 @@ class InvoicePdfHandler extends FPDF {
|
|||||||
function Header()
|
function Header()
|
||||||
{
|
{
|
||||||
if($this->logo != "nothing"){
|
if($this->logo != "nothing"){
|
||||||
$this->Image($this->logoPath."logo.png", 10, 10, 75, 25);
|
$this->Image($this->logoPath."logo.png", 2, 2, 50,35);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$this->Cell(55,30,'');
|
$this->Cell(55,30,'');
|
||||||
|
|||||||
@ -171,7 +171,7 @@ class InvoiceRecapService {
|
|||||||
|
|
||||||
// logo : 80 de largeur et 55 de hauteur
|
// logo : 80 de largeur et 55 de hauteur
|
||||||
if($doesLogoExist){
|
if($doesLogoExist){
|
||||||
$pdf->Image($this->defaultImagePath."logo.png", 10, 10, 75, 25);
|
$pdf->Image($this->defaultImagePath."logo.png", 2, 2, 50,35);
|
||||||
}
|
}
|
||||||
|
|
||||||
//adresse de mon entreprise
|
//adresse de mon entreprise
|
||||||
@ -276,7 +276,7 @@ class InvoiceRecapService {
|
|||||||
$pdf->SetMargins(0,0,10);
|
$pdf->SetMargins(0,0,10);
|
||||||
|
|
||||||
if($doesLogoExist){
|
if($doesLogoExist){
|
||||||
$pdf->Image($this->defaultImagePath."logo.png", 10, 10, 75, 25);
|
$pdf->Image($this->defaultImagePath."logo.png", 2, 2, 50,35);
|
||||||
}
|
}
|
||||||
|
|
||||||
//adresse de mon entreprise
|
//adresse de mon entreprise
|
||||||
@ -588,7 +588,7 @@ class InvoiceRecapService {
|
|||||||
|
|
||||||
// logo : 80 de largeur et 55 de hauteur
|
// logo : 80 de largeur et 55 de hauteur
|
||||||
if($doesLogoExist){
|
if($doesLogoExist){
|
||||||
$pdf->Image($this->defaultImagePath."logo.png", 10, 10, 75, 25);
|
$pdf->Image($this->defaultImagePath."logo.png", 2, 2, 50,35);
|
||||||
}
|
}
|
||||||
|
|
||||||
//adresse de mon entreprise
|
//adresse de mon entreprise
|
||||||
@ -691,7 +691,7 @@ class InvoiceRecapService {
|
|||||||
$pdf->SetAutoPagebreak(False);
|
$pdf->SetAutoPagebreak(False);
|
||||||
$pdf->SetMargins(0,0,10);
|
$pdf->SetMargins(0,0,10);
|
||||||
if($doesLogoExist){
|
if($doesLogoExist){
|
||||||
$pdf->Image($this->defaultImagePath."logo.png", 10, 10, 75, 25);
|
$pdf->Image($this->defaultImagePath."logo.png", 2, 2, 50,35);
|
||||||
}
|
}
|
||||||
|
|
||||||
//adresse de mon entreprise
|
//adresse de mon entreprise
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user