Merge branch 'staging' into production

This commit is contained in:
Tiavina 2025-04-30 15:00:24 +03:00
commit 1ff41114a3
4 changed files with 55 additions and 11 deletions

View File

@ -207,7 +207,8 @@ return [
['name' => 'provider#moveAttachmentFile', 'url' => '/test-move', 'verb' => 'GET'],
['name' => 'provider#sendEmailAttachment', 'url' => '/test-send-mail-attach', 'verb' => 'GET'],
['name' => 'page#updateDevisLigneTrajet', 'url' => '/updateDevisLigneTrajet', 'verb' => 'POST'],
]
];

View File

@ -1481,7 +1481,7 @@ class PageController extends Controller {
$this->storage->newFolder($_clean_folder);
} catch(\OCP\Files\NotPermittedException $e) { }
$trajetdetails = json_decode($this->myDb->getTrajetsdetails_orderByDate($numtrajet, $idNextcloud));
$trajetdetails = json_decode($this->myDb->getTrajetsdetails_orderByDate($numtrajet, $this->idNextcloud));
$distance_temp = 0;
$distances = array();
$last_point = NULL;
@ -2920,4 +2920,39 @@ class PageController extends Controller {
}
catch(\OCP\Files\NotFoundException $e) { }
}
/**
* @NoAdminRequired
* @NoCSRFRequired
* @param int $defuntId
*/
public function updateDevisLigneTrajet($idNextcloud ,$mois , $annee){
//get all devis id from month avril
if(!$idNextcloud || !$mois || !$mois){
return null;
}
$all_devis = $this->myDb->getAllDevisByMonthAndYear($idNextcloud,$mois,$annee);
foreach($all_devis as $devis){
$ligne_trajet = json_decode($this->myDb->getOneTrajetdetails_byIdDevis($devis['id'], $idNextcloud))[0];
if($ligne_trajet != NULL) {
$this->myDb->gestion_delete('ligne_trajet', $ligne_trajet->id, $idNextcloud);
$ligne_trajet = NULL;
}
$devisObject = json_decode($this->myDb->getOneDevis($devis['id'], $idNextcloud))[0];
$this->myDb->generate_ligneTrajet($devisObject, $idNextcloud);
$ligne_trajet = json_decode( json: $this->myDb->getOneTrajetdetails_byIdDevis($devisObject->devisid, $idNextcloud))[0];
$this->myDb->range_ligneTrajet($ligne_trajet->id_trajet, $idNextcloud);
$this->myDb->calculer_distance_trajet(numtrajet: $ligne_trajet->id_trajet, idNextcloud: $idNextcloud);
}
return true;
}
}

View File

@ -2372,7 +2372,7 @@ class Bdd {
client.nom as client_nom,
client.prenom as client_prenom,
client.entreprise as client_entreprise,
client.fk_client_group_id
client.fk_client_group_id as fk_client_group_id
FROM ".$this->tableprefix."client as client
WHERE client.id = ?;";
$clientList = $this->execSQLNoJsonReturn(
@ -3698,4 +3698,15 @@ class Bdd {
return $this->execSQLNoJsonReturn($sql, $devisIdList);
}
//get all devis id from month avril
public function getAllDevisByMonthAndYear($idNextcloud,$mois, $annee ){
$thanato = $this->getThanatoByUserUuid($idNextcloud);
if($thanato == null){
return array();
}
$sql = "SELECT * FROM {$this->tableprefix}devis WHERE MONTH(date) = ? AND YEAR(date) = ? AND id_thanato = ?;";
return $this->execSQLNoJsonReturn($sql,array( $mois , $annee, $thanato['id'] ));
}
}

View File

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