generate pdf when creating agenda
This commit is contained in:
parent
3228e93efe
commit
6b7a99879e
@ -482,6 +482,7 @@ class OrderBdd {
|
|||||||
OrderTypeConstant::ORDER_TYPE_DEVIS
|
OrderTypeConstant::ORDER_TYPE_DEVIS
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrderProducts(){
|
public function getOrderProducts(){
|
||||||
|
|||||||
@ -26,11 +26,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace OCA\Gestion\Service;
|
namespace OCA\Gestion\Service;
|
||||||
|
|
||||||
|
use OCA\Gestion\Constants\BddConstant;
|
||||||
use OCA\Gestion\Constants\DevisMentionConstant;
|
use OCA\Gestion\Constants\DevisMentionConstant;
|
||||||
use OCA\Gestion\Constants\OrderStatusConstant;
|
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\Order\OrderPdfService;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use OCA\Gestion\Helpers\VCalendarHelpers;
|
use OCA\Gestion\Helpers\VCalendarHelpers;
|
||||||
|
|
||||||
@ -44,13 +46,17 @@ class GestionService {
|
|||||||
/** @var \OCA\Gestion\Db\OrderBdd */
|
/** @var \OCA\Gestion\Db\OrderBdd */
|
||||||
private $orderBdd;
|
private $orderBdd;
|
||||||
|
|
||||||
|
private $orderPdfService;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Bdd $gestionBdd,
|
Bdd $gestionBdd,
|
||||||
OrderBdd $orderBdd,
|
OrderBdd $orderBdd,
|
||||||
LoggerInterface $logger) {
|
LoggerInterface $logger,
|
||||||
|
OrderPdfService $orderPdfService) {
|
||||||
$this->orderBdd = $orderBdd;
|
$this->orderBdd = $orderBdd;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->gestionBdd = $gestionBdd;
|
$this->gestionBdd = $gestionBdd;
|
||||||
|
$this->orderPdfService = $orderPdfService;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function GetCalendarSummaryFromVCalendarString(string $vCalendarString): string
|
private function GetCalendarSummaryFromVCalendarString(string $vCalendarString): string
|
||||||
@ -166,15 +172,23 @@ class GestionService {
|
|||||||
$calendarStartDate = $this->GetCalendarDateFromVCalendarString($vCalendarString);
|
$calendarStartDate = $this->GetCalendarDateFromVCalendarString($vCalendarString);
|
||||||
$devisDate = $calendarStartDate->format('Y-m-d');
|
$devisDate = $calendarStartDate->format('Y-m-d');
|
||||||
$devisId = $this->gestionBdd->insertDevisFromVCalendarAndReturnId($thanatoId,$clientId,$locationId,$defuntId,$calendarUuid,$devisDate,$userName);
|
$devisId = $this->gestionBdd->insertDevisFromVCalendarAndReturnId($thanatoId,$clientId,$locationId,$defuntId,$calendarUuid,$devisDate,$userName);
|
||||||
$thanatoIsSubcontractor = $thanato["fk_thanato_type_key"] === ThanatoTypeConstant::THANATO_TYPE_SUBCONTRACTOR;
|
|
||||||
if($thanatoIsSubcontractor){
|
|
||||||
$this->orderBdd->createOrderFromDevisIdAndDate($devisId,$calendarStartDate,$userName);
|
|
||||||
}
|
|
||||||
$articlesValue = $this->GetArticlesNameFromVCalendarString($vCalendarString);
|
$articlesValue = $this->GetArticlesNameFromVCalendarString($vCalendarString);
|
||||||
if(!empty($articlesValue)){
|
if(!empty($articlesValue)){
|
||||||
$articleIds = $this->gestionBdd->getArticleIdsByArticleReferences($articlesValue);
|
$articleIds = $this->gestionBdd->getArticleIdsByArticleReferences($articlesValue);
|
||||||
$this->gestionBdd->insertDevisArticleFromDevisIdAndArticlesIdArray($devisId, $articleIds);
|
$this->gestionBdd->insertDevisArticleFromDevisIdAndArticlesIdArray($devisId, $articleIds);
|
||||||
}
|
}
|
||||||
|
$thanatoIsSubcontractor = $thanato["fk_thanato_type_key"] === ThanatoTypeConstant::THANATO_TYPE_SUBCONTRACTOR;
|
||||||
|
if($thanatoIsSubcontractor){
|
||||||
|
$orderCreated = $this->orderBdd->createOrderFromDevisIdAndDate($devisId,$calendarStartDate,$userName);
|
||||||
|
if($orderCreated){
|
||||||
|
$order = $this->orderBdd->getOrderByDevisId($devisId);
|
||||||
|
$this->logger->debug(json_encode($order));
|
||||||
|
if($order != null){
|
||||||
|
$this->orderPdfService->generateOrderPdfByOrderId($order['id'],BddConstant::DEFAULT_ADMIN_APP_ID_NEXTCLOUD);
|
||||||
|
// $this->orderPdfService->generateOrderPdfByOrderId($order['id'],BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$this->gestionBdd->createDevisTrajetFromVCalendar($devisId,$userName);
|
$this->gestionBdd->createDevisTrajetFromVCalendar($devisId,$userName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@ declare(strict_types=1);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OCA\Gestion\Service\Order;
|
namespace OCA\Gestion\Service\Order;
|
||||||
|
require_once __DIR__ . '/../../../vendor/autoload.php';
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use OCA\Gestion\Constants\BddConstant;
|
use OCA\Gestion\Constants\BddConstant;
|
||||||
|
|||||||
@ -151,7 +151,6 @@ class OrderService {
|
|||||||
$orderDetails["devis_date"] = $orderDetails["order_date"];
|
$orderDetails["devis_date"] = $orderDetails["order_date"];
|
||||||
}
|
}
|
||||||
$orderDetails["products"] = $orderProducts;
|
$orderDetails["products"] = $orderProducts;
|
||||||
var_dump($orderDetails);
|
|
||||||
return $orderDetails;
|
return $orderDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user