From 06c1cc9be0724a9f8579cd94aab9943a056ed003 Mon Sep 17 00:00:00 2001 From: Tiavina Date: Wed, 22 Jan 2025 10:48:28 +0300 Subject: [PATCH 1/3] talkk message update , wip when updating event, send talk notifications --- gestion/lib/Db/Bdd.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gestion/lib/Db/Bdd.php b/gestion/lib/Db/Bdd.php index e47fbfd..97c4285 100644 --- a/gestion/lib/Db/Bdd.php +++ b/gestion/lib/Db/Bdd.php @@ -3201,7 +3201,7 @@ class Bdd { } $productMessage = ". ACTE A FAIRE : "; foreach($devisProducts as $product){ - $productMessage.= html_entity_decode($product->produit_reference). "(".$product->quantite."), "; + $productMessage.= html_entity_decode($product->produit_reference).", "; } $productMessage = trim( $productMessage ); $productMessage = rtrim($productMessage,","); From f86bd186953816dd0ff112cc8e6fc74430b3c530 Mon Sep 17 00:00:00 2001 From: Tiavina Date: Wed, 22 Jan 2025 15:46:10 +0300 Subject: [PATCH 2/3] folder names and filename to upper utf 8 fix, WIP update message talk --- .../lib/Service/Certificate/CertificateService.php | 12 ++++++------ gestion/lib/Service/InvoicePdfHandler.php | 6 +++--- gestion/lib/Service/InvoicePdfService.php | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gestion/lib/Service/Certificate/CertificateService.php b/gestion/lib/Service/Certificate/CertificateService.php index 4ccf921..c95f89f 100644 --- a/gestion/lib/Service/Certificate/CertificateService.php +++ b/gestion/lib/Service/Certificate/CertificateService.php @@ -155,31 +155,31 @@ class CertificateService { private function getCareCertificateFolder($devisOfDefunt){ $careCertificateFolder = 'CLIENTS/' - .strtoupper($devisOfDefunt["client_entreprise"]) + .mb_strtoupper($devisOfDefunt["client_entreprise"],'UTF-8') .'/DEFUNTS/' - .strtoupper($devisOfDefunt["defunt_nom"]).'/' + .mb_strtoupper($devisOfDefunt["defunt_nom"],'UTF-8').'/' .'ATTESTATION/'; return $careCertificateFolder; } private function GetCareCertificateFilename($devisOfDefunt){ - $filename = 'ATTESTATION_SOIN_'.strtoupper($devisOfDefunt['defunt_nom']); + $filename = 'ATTESTATION_SOIN_'.mb_strtoupper($devisOfDefunt['defunt_nom'],'UTF-8'); return $filename; } private function getPacemakerCertificateFolder($devisOfDefunt){ $folder = 'CLIENTS/' - .strtoupper($devisOfDefunt["client_entreprise"]) + .mb_strtoupper($devisOfDefunt["client_entreprise"],'UTF-8') .'/DEFUNTS/' - .strtoupper($devisOfDefunt["defunt_nom"]).'/' + .mb_strtoupper($devisOfDefunt["defunt_nom"],'UTF-8').'/' .'ATTESTATION/'; return $folder; } private function getPacemakerCertificateFilename($devisOfDefunt){ - $filename = 'ATTESTATION_PACEMAKER_'.strtoupper($devisOfDefunt['defunt_nom']); + $filename = 'ATTESTATION_PACEMAKER_'.mb_strtoupper($devisOfDefunt['defunt_nom'],'UTF-8'); return $filename; } diff --git a/gestion/lib/Service/InvoicePdfHandler.php b/gestion/lib/Service/InvoicePdfHandler.php index 7e16b77..bd4e995 100644 --- a/gestion/lib/Service/InvoicePdfHandler.php +++ b/gestion/lib/Service/InvoicePdfHandler.php @@ -77,10 +77,10 @@ class InvoicePdfHandler extends FPDF { foreach($this->multipleFactureData as $factureData){ $factureType = $factureData["facture_type"]; if($factureType == MultipleFactureTypeConstant::CLIENT_FILTER_TYPE){ - $filename = strtoupper($factureData["client_entreprise"]); + $filename = mb_strtoupper($factureData["client_entreprise"],'UTF-8'); } else{ - $filename = 'GROUP_'.strtoupper($factureData["client_entreprise"]); + $filename = 'GROUP_'.mb_strtoupper($factureData["client_entreprise"],'UTF-8'); } $filename .= $month != 0 ? '_'.DateHelpers::GetMonthPlainString($month) :''; $filename .= "_".$year; @@ -93,7 +93,7 @@ class InvoicePdfHandler extends FPDF { $factureNum = $this->factureData['num']; $factureNum = str_replace('/','-',$factureNum); $defuntNom = str_replace(' ',' ',$this->factureData['defunt_nom']); - return $this->factureData['configuration']->facture_prefixe.'_'.$factureNum.'_'.strtoupper($defuntNom); + return $this->factureData['configuration']->facture_prefixe.'_'.$factureNum.'_'.mb_strtoupper($defuntNom,'UTF-8'); } private function DrawInvoiceCompanyAndClientInfo(){ diff --git a/gestion/lib/Service/InvoicePdfService.php b/gestion/lib/Service/InvoicePdfService.php index 322a3d0..7b6080b 100644 --- a/gestion/lib/Service/InvoicePdfService.php +++ b/gestion/lib/Service/InvoicePdfService.php @@ -101,8 +101,8 @@ class InvoicePdfService { } private function getFacturesFolder(array $factureData,$racinePath){ - $clientRacineFolder = $racinePath.'CLIENTS/'.strtoupper($factureData["client_entreprise"]).'/'; - $defuntsFolder = $clientRacineFolder.'DEFUNTS/'.strtoupper($factureData['defunt_nom']).'/'.'FACTURES'.'/'; + $clientRacineFolder = $racinePath.'CLIENTS/'.mb_strtoupper($factureData["client_entreprise"],'UTF-8').'/'; + $defuntsFolder = $clientRacineFolder.'DEFUNTS/'.mb_strtoupper($factureData['defunt_nom'],'UTF-8').'/'.'FACTURES'.'/'; $devisDate = $factureData['devis_date']; $devisDatetime = new DateTime($devisDate); $devisDateYear = $devisDatetime->format('Y'); @@ -135,7 +135,7 @@ class InvoicePdfService { $pdf->MutlipleInvoicePdfFactory($invoiceData,$logo); $pdf->SetMultipleFactureContent(); $racinePath = html_entity_decode(string: $currentConfig->path).'/'; - $clientRacineFolder = $racinePath.'CLIENTS/'.strtoupper($invoiceData[0]["client_entreprise"]).'/'; + $clientRacineFolder = $racinePath.'CLIENTS/'.mb_strtoupper($invoiceData[0]["client_entreprise"],'UTF-8').'/'; $filename = $currentConfig->facture_prefixe.'_'.$pdf->GetMultipleInvoiceFilename($month,$year); $filenamePath = $clientRacineFolder.$filename.'.pdf'; $pdfContent = $pdf->Output('','S'); From 2131f5c8cf7ab6fae1a90dbf7cf0bdae7f0128af Mon Sep 17 00:00:00 2001 From: Tiavina Date: Wed, 22 Jan 2025 16:44:45 +0300 Subject: [PATCH 3/3] when updating agenda , sending a new message --- gestion/lib/Db/Bdd.php | 13 +++++++++++ gestion/lib/Service/GestionService.php | 30 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/gestion/lib/Db/Bdd.php b/gestion/lib/Db/Bdd.php index 97c4285..e841e0a 100644 --- a/gestion/lib/Db/Bdd.php +++ b/gestion/lib/Db/Bdd.php @@ -2323,6 +2323,19 @@ class Bdd { return null; } + public function getProduitDevisByDevisId($devisId){ + $sql = "SELECT * + FROM ".$this->tableprefix ."produit_devis as produit_devis + WHERE produit_devis.devis_id = ?;"; + + $produitDevisList = $this->execSQLNoJsonReturn( + $sql, + [$devisId]); + + + return $produitDevisList; + } + public function getDevisProduits($devisId){ $sql = "SELECT produit_devis.id, diff --git a/gestion/lib/Service/GestionService.php b/gestion/lib/Service/GestionService.php index e75edb6..753f540 100644 --- a/gestion/lib/Service/GestionService.php +++ b/gestion/lib/Service/GestionService.php @@ -157,11 +157,41 @@ class GestionService { } } + private function CheckIfDevisIsAlreadyUpdated($devis,$vCalendarString){ + $requestedDefuntName = $this->GetCalendarSummaryFromVCalendarString($vCalendarString); + $requestedClientId = $this->GetClientIdFromVCalendarString($vCalendarString); + $requestLocationId = $this->GetLocationIdFromVCalendarString($vCalendarString); + $requestedDevisComment = $this->GetDevisCommentFromVCalendarString($vCalendarString); + $requestedArticleReferences = $this->GetArticlesNameFromVCalendarString($vCalendarString); + $requestedArticleIds = $this->gestionBdd->getArticleIdsByArticleReferences($requestedArticleReferences); + $articleDevis = $this->gestionBdd->getProduitDevisByDevisId($devis['id']); + $articleDevisIds = []; + foreach($articleDevis as $currentArticleDevis){ + $articleDevisIds[] = $currentArticleDevis['produit_id']; + } + sort($requestedArticleIds); + sort($articleDevisIds); + + return + $devis['defunt_nom'] == $requestedDefuntName && + $devis['client_id'] == $requestedClientId && + $devis['lieu_id'] == $requestLocationId && + $devis['comment'] == $requestedDevisComment && + $requestedArticleIds == $articleDevisIds; + } + public function HandleUpdatedCalendarObject(string $vCalendarString){ $calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString); $devis = $this->gestionBdd->getDevisByCalendarUuid($calendarUuid); if($devis != null){ + $isDevisAlreadyUpdated = $this->CheckIfDevisIsAlreadyUpdated($devis,$vCalendarString); + if($isDevisAlreadyUpdated){ + return true; + } $this->UpdateDevisDataByVCalendarString($devis,$vCalendarString); + $userName = $this->GetThanatoNameFromVCalendarString($vCalendarString); + $devisTalkMessage = $this->gestionBdd->getDevisTalkRoomMessage($devis['id'],$userName); + $this->talkService->sendDevisTalkNotifications($devisTalkMessage,$userName); } return true; }