[Database] Add fk_client_group_id to client query and refactor user session handling in GestionService

This commit is contained in:
narindraezway 2025-04-29 11:34:58 +03:00
parent 19c2ee1cec
commit db3fa63eea
2 changed files with 7 additions and 9 deletions

View File

@ -2371,7 +2371,8 @@ class Bdd {
client.id, client.id,
client.nom as client_nom, client.nom as client_nom,
client.prenom as client_prenom, client.prenom as client_prenom,
client.entreprise as client_entreprise client.entreprise as client_entreprise,
client.fk_client_group_id as fk_client_group_id
FROM ".$this->tableprefix."client as client FROM ".$this->tableprefix."client as client
WHERE client.id = ?;"; WHERE client.id = ?;";
$clientList = $this->execSQLNoJsonReturn( $clientList = $this->execSQLNoJsonReturn(

View File

@ -50,6 +50,7 @@ use OCP\AppFramework\Db\DoesNotExistException;
use OCA\Gestion\Constants\DevisMentionConstant; use OCA\Gestion\Constants\DevisMentionConstant;
use OCA\Gestion\Service\Devis\Pdf\DevisPdfService; use OCA\Gestion\Service\Devis\Pdf\DevisPdfService;
use OCA\Gestion\Constants\VCalendarPropertyConstant; use OCA\Gestion\Constants\VCalendarPropertyConstant;
use function OCP\Log\logger;
class GestionService { class GestionService {
/** @var Bdd */ /** @var Bdd */
@ -80,18 +81,15 @@ class GestionService {
private IMAPClientFactory $clientFactory; private IMAPClientFactory $clientFactory;
private ?string $currentUserId;
public function __construct( public function __construct(
?string $UserId, IUserSession $userSession,
Bdd $gestionBdd, Bdd $gestionBdd,
OrderBdd $orderBdd, OrderBdd $orderBdd,
LoggerInterface $logger, LoggerInterface $logger,
OrderPdfService $orderPdfService, OrderPdfService $orderPdfService,
DevisPdfService $devisPdfService, DevisPdfService $devisPdfService,
TalkService $talkService, TalkService $talkService,
IUserSession $userSession,
IRootFolder $rootFolder, IRootFolder $rootFolder,
IMailer $mailer, IMailer $mailer,
IConfig $config, IConfig $config,
@ -101,7 +99,6 @@ class GestionService {
) { ) {
$this->currentUserId = $UserId;
$this->orderBdd = $orderBdd; $this->orderBdd = $orderBdd;
$this->logger = $logger; $this->logger = $logger;
$this->gestionBdd = $gestionBdd; $this->gestionBdd = $gestionBdd;
@ -520,9 +517,9 @@ class GestionService {
} }
$messageId = (int) $emailId; $messageId = (int) $emailId;
try { try {
$message = $this->mailManager->getMessage($this->currentUserId, $messageId); $message = $this->mailManager->getMessage($this->userConnectedUuid, $messageId);
$mailbox = $this->mailManager->getMailbox($this->currentUserId, $message->getMailboxId()); $mailbox = $this->mailManager->getMailbox($this->userConnectedUuid, $message->getMailboxId());
$account = $this->accountService->find($this->currentUserId, $mailbox->getAccountId()); $account = $this->accountService->find($this->userConnectedUuid, $mailbox->getAccountId());
} catch (DoesNotExistException $e) { } catch (DoesNotExistException $e) {
return []; return [];