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\Db\Bdd;
|
||||
use OCA\Gestion\Db\OrderBdd;
|
||||
use OCA\Gestion\Service\Devis\Pdf\DevisPdfService;
|
||||
use OCA\Gestion\Service\Order\OrderPdfService;
|
||||
use OCP\DB\Exception;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use OCA\Gestion\Helpers\VCalendarHelpers;
|
||||
|
||||
@ -47,16 +49,19 @@ class GestionService {
|
||||
private $orderBdd;
|
||||
|
||||
private $orderPdfService;
|
||||
private $devisPdfService;
|
||||
|
||||
public function __construct(
|
||||
Bdd $gestionBdd,
|
||||
OrderBdd $orderBdd,
|
||||
LoggerInterface $logger,
|
||||
OrderPdfService $orderPdfService) {
|
||||
OrderPdfService $orderPdfService,
|
||||
DevisPdfService $devisPdfService) {
|
||||
$this->orderBdd = $orderBdd;
|
||||
$this->logger = $logger;
|
||||
$this->gestionBdd = $gestionBdd;
|
||||
$this->orderPdfService = $orderPdfService;
|
||||
$this->devisPdfService = $devisPdfService;
|
||||
}
|
||||
|
||||
private function GetCalendarSummaryFromVCalendarString(string $vCalendarString): string
|
||||
@ -152,6 +157,7 @@ class GestionService {
|
||||
}
|
||||
|
||||
public function HandleCreatedCalendarObject(string $vCalendarString){
|
||||
try{
|
||||
$thanato = $this->GetThanatoFromVCalendarString($vCalendarString);
|
||||
if($thanato != null){
|
||||
$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);
|
||||
}
|
||||
catch(Exception $e){
|
||||
$this->logger->debug("error creating devis");
|
||||
}
|
||||
}
|
||||
|
||||
private function GetThanatoNameFromVCalendarString($vCalendarString){
|
||||
$thanatoName = null;
|
||||
@ -291,6 +303,7 @@ class GestionService {
|
||||
}
|
||||
|
||||
public function HandleUpdatedCalendarObject(string $vCalendarString){
|
||||
try{
|
||||
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
|
||||
$devis = $this->gestionBdd->getDevisByCalendarUuid($calendarUuid);
|
||||
if($devis != null){
|
||||
@ -301,6 +314,12 @@ class GestionService {
|
||||
}
|
||||
$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;
|
||||
}
|
||||
catch(Exception $e){
|
||||
$this->logger->debug("error creating devis");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user