generate devis pdf when creating or updating agenda
This commit is contained in:
parent
9247f2dd4d
commit
6597688b17
@ -32,7 +32,9 @@ use OCA\Gestion\Constants\OrderStatusConstant;
|
|||||||
use OCA\Gestion\Constants\ThanatoTypeConstant;
|
use OCA\Gestion\Constants\ThanatoTypeConstant;
|
||||||
use OCA\Gestion\Db\Bdd;
|
use OCA\Gestion\Db\Bdd;
|
||||||
use OCA\Gestion\Db\OrderBdd;
|
use OCA\Gestion\Db\OrderBdd;
|
||||||
|
use OCA\Gestion\Service\Devis\Pdf\DevisPdfService;
|
||||||
use OCA\Gestion\Service\Order\OrderPdfService;
|
use OCA\Gestion\Service\Order\OrderPdfService;
|
||||||
|
use OCP\DB\Exception;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use OCA\Gestion\Helpers\VCalendarHelpers;
|
use OCA\Gestion\Helpers\VCalendarHelpers;
|
||||||
|
|
||||||
@ -47,16 +49,19 @@ class GestionService {
|
|||||||
private $orderBdd;
|
private $orderBdd;
|
||||||
|
|
||||||
private $orderPdfService;
|
private $orderPdfService;
|
||||||
|
private $devisPdfService;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Bdd $gestionBdd,
|
Bdd $gestionBdd,
|
||||||
OrderBdd $orderBdd,
|
OrderBdd $orderBdd,
|
||||||
LoggerInterface $logger,
|
LoggerInterface $logger,
|
||||||
OrderPdfService $orderPdfService) {
|
OrderPdfService $orderPdfService,
|
||||||
|
DevisPdfService $devisPdfService) {
|
||||||
$this->orderBdd = $orderBdd;
|
$this->orderBdd = $orderBdd;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->gestionBdd = $gestionBdd;
|
$this->gestionBdd = $gestionBdd;
|
||||||
$this->orderPdfService = $orderPdfService;
|
$this->orderPdfService = $orderPdfService;
|
||||||
|
$this->devisPdfService = $devisPdfService;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function GetCalendarSummaryFromVCalendarString(string $vCalendarString): string
|
private function GetCalendarSummaryFromVCalendarString(string $vCalendarString): string
|
||||||
@ -152,6 +157,7 @@ class GestionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function HandleCreatedCalendarObject(string $vCalendarString){
|
public function HandleCreatedCalendarObject(string $vCalendarString){
|
||||||
|
try{
|
||||||
$thanato = $this->GetThanatoFromVCalendarString($vCalendarString);
|
$thanato = $this->GetThanatoFromVCalendarString($vCalendarString);
|
||||||
if($thanato != null){
|
if($thanato != null){
|
||||||
$thanatoId = $thanato["id"];
|
$thanatoId = $thanato["id"];
|
||||||
@ -189,8 +195,14 @@ class GestionService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$this->devisPdfService->generateDevisPdfByDevisId($devisId,BddConstant::DEFAULT_ADMIN_APP_ID_NEXTCLOUD);
|
||||||
|
$this->devisPdfService->generateDevisPdfByDevisId($devisId,BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD);
|
||||||
$this->gestionBdd->createDevisTrajetFromVCalendar($devisId,$userName);
|
$this->gestionBdd->createDevisTrajetFromVCalendar($devisId,$userName);
|
||||||
}
|
}
|
||||||
|
catch(Exception $e){
|
||||||
|
$this->logger->debug("error creating devis");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function GetThanatoNameFromVCalendarString($vCalendarString){
|
private function GetThanatoNameFromVCalendarString($vCalendarString){
|
||||||
$thanatoName = null;
|
$thanatoName = null;
|
||||||
@ -291,6 +303,7 @@ class GestionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function HandleUpdatedCalendarObject(string $vCalendarString){
|
public function HandleUpdatedCalendarObject(string $vCalendarString){
|
||||||
|
try{
|
||||||
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
|
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
|
||||||
$devis = $this->gestionBdd->getDevisByCalendarUuid($calendarUuid);
|
$devis = $this->gestionBdd->getDevisByCalendarUuid($calendarUuid);
|
||||||
if($devis != null){
|
if($devis != null){
|
||||||
@ -301,6 +314,12 @@ class GestionService {
|
|||||||
}
|
}
|
||||||
$this->UpdateDevisDataByVCalendarString($devis,$vCalendarString);
|
$this->UpdateDevisDataByVCalendarString($devis,$vCalendarString);
|
||||||
}
|
}
|
||||||
|
$this->devisPdfService->generateDevisPdfByDevisId($devis['id'],BddConstant::DEFAULT_ADMIN_APP_ID_NEXTCLOUD);
|
||||||
|
$this->devisPdfService->generateDevisPdfByDevisId($devis['id'],BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
catch(Exception $e){
|
||||||
|
$this->logger->debug("error creating devis");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user