Merge branch 'features/feature-send-defunt-certificate-to-client' into staging

This commit is contained in:
Tiavina 2025-03-07 17:38:59 +03:00
commit a90fb421c2
4 changed files with 124 additions and 14 deletions

104
gestion/.gitignore vendored Normal file
View File

@ -0,0 +1,104 @@
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
## Directory-based project format
.idea/
/*.iml
# if you remove the above rule, at least ignore user-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries
# and these sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# and, if using gradle::
# .idea/gradle.xml
# .idea/libraries
## File-based project format
*.ipr
*.iws
## Additional for IntelliJ
out/
# generated by mpeltonen/sbt-idea plugin
.idea_modules/
# generated by JIRA plugin
atlassian-ide-plugin.xml
# generated by Crashlytics plugin (for Android Studio and Intellij)
com_crashlytics_export_strings.xml
### OSX ###
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Sass ###
build/.sass-cache/
### Composer ###
composer.phar
/vendor-bin/*/vendor
# vim ex mode
.vimrc
# kdevelop
.kdev
*.kdev4
build/
node_modules/
src/fonts
*.clover
# just sane ignores
.*.sw[po]
*.bak
*.BAK
*~
*.orig
*.class
.cvsignore
Thumbs.db
*.py[co]
_darcs/*
CVS/*
.svn/*
RCS/*
/.project
.php-cs-fixer.cache
.phpunit.result.cache
coverage/
js/public
css/public
!/src/
!/src/*

View File

@ -1583,22 +1583,23 @@ class PageController extends Controller {
public function sendAttachmentToClientByDefunt($defuntId, $ff_pdf, $subject, $body, $addName = false){
$devis = $this->myDb->getDevisOfDefunt($defuntId);
if($devis != null){
try {
$client_email = $devis['client_mail'];
// try {
$client_email = $devis['client_group_mail'] ?? $devis['client_mail'];
$client_nom = $devis['client_nom'];
$data = file_get_contents($ff_pdf);
$data = $this->storage->get($ff_pdf)->getContent();
$message = $this->mailer->createMessage();
$message->setTo(recipients: [$client_email => $client_nom]);
// $message->setFrom([$client_email => $client_nom]);
$content = $this->mailer->createAttachment($data,$ff_pdf,"x-pdf");
$content = $this->mailer->createAttachment($data, basename($ff_pdf), "application/pdf");
$message->attach($content);
$message->setSubject($subject);
$message->setPlainBody($addName ? $body." de ".$devis['defunt_nom']: $body);
$body_text = $addName ? $body." de ".$devis['defunt_nom']: $body;
$message->setPlainBody("Bonjour.\n\n".$body_text."!\n\nCordialement.");
$this->mailer->send($message);
return new DataResponse("", 200, ['Content-Type' => 'application/json']);
} catch (Exception $e) {
return new DataResponse("Is your global mail server configured in Nextcloud ?", 500, ['Content-Type' => 'application/json']);
}
// } catch (Exception $e) {
// return new DataResponse("Is your global mail server configured in Nextcloud ?", 500, ['Content-Type' => 'application/json']);
// }
}
}
@ -2276,7 +2277,7 @@ class PageController extends Controller {
if($ff_pdf != null && $isSendEmail){
//send email
$this->sendAttachmentToClientByDefunt($defunt->id, $ff_pdf, "Rapport soins", " Veuiller trouver ci-joint le rapport de soins de ".$nomDefunt.".");
$this->sendAttachmentToClientByDefunt($defunt->id, $ff_pdf, "Rapport soins", "Veuillez trouver ci-joint le rapport de soins de ".$nomDefunt.".");
}
$res = array();
@ -2457,7 +2458,7 @@ class PageController extends Controller {
if($ff_pdf != null && $isSendEmail){
//send email
$this->sendAttachmentToClientByDefunt($defunt->id, $ff_pdf, "Rapport des bijoux", " Veuiller trouver ci-joint le rapport des bijoux de ".$nomDefunt.".");
$this->sendAttachmentToClientByDefunt($defunt->id, $ff_pdf, "Rapport des bijoux", "Veuillez trouver ci-joint le rapport des bijoux de ".$nomDefunt.".");
}
$res = array();
@ -2673,7 +2674,7 @@ class PageController extends Controller {
$careCertificateFilename = $this->certificateService->generateCareCertificate($defuntId,$this->idNextcloud);
if($careCertificateFilename != null && $isSendEmail){
//send email
$this->sendAttachmentToClientByDefunt($defuntId, $careCertificateFilename, "Attestation de soins", " Veuiller trouver ci-joint l'attestation de soins ", true);
$this->sendAttachmentToClientByDefunt($defuntId, $careCertificateFilename, "Attestation de soins", " Veuillez trouver ci-joint l'attestation de soins ", true);
}
return $careCertificateFilename;
}
@ -2822,7 +2823,7 @@ class PageController extends Controller {
$careCertificateFilename = $this->certificateService->generatePacemakerCertificate($defuntId,$this->idNextcloud);
if($careCertificateFilename != null && $isSendEmail){
//send email
$this->sendAttachmentToClientByDefunt($defuntId, $careCertificateFilename, "Attestation pacemaker", " Veuiller trouver ci-joint l'attestation de pacemaker ", true);
$this->sendAttachmentToClientByDefunt($defuntId, $careCertificateFilename, "Attestation pacemaker", "Veuillez trouver ci-joint l'attestation de pacemaker ", true);
}
return $careCertificateFilename;

View File

@ -793,10 +793,13 @@ class Bdd {
.$this->tableprefix."thanato.date_habilitation, "
.$this->tableprefix."thanato.reference as reference_habilitation, "
.$this->tableprefix."lieu.adresse as adresse_lieu, "
.$this->tableprefix."client.mail as client_mail, "
.$this->tableprefix."client_group_facturation.email as client_group_mail, "
.$this->tableprefix."lieu.nom as nom_lieu
FROM ".$this->tableprefix."defunt
LEFT JOIN ".$this->tableprefix."devis on ".$this->tableprefix."devis.id_defunt = ".$this->tableprefix."defunt.id
LEFT JOIN ".$this->tableprefix."client on ".$this->tableprefix."devis.id_client = ".$this->tableprefix."client.id
LEFT JOIN ".$this->tableprefix."client_group_facturation on ".$this->tableprefix."client.fk_client_group_facturation_id = ".$this->tableprefix."client_group_facturation.id
LEFT JOIN ".$this->tableprefix."lieu on ".$this->tableprefix."devis.id_lieu = ".$this->tableprefix."lieu.id
LEFT JOIN ".$this->tableprefix."thanato on ".$this->tableprefix."devis.id_thanato = ".$this->tableprefix."thanato.id
WHERE ".$this->tableprefix."defunt.id = ?";
@ -3503,6 +3506,7 @@ class Bdd {
client.nom as client_nom,
client.prenom as client_prenom,
client.mail as client_mail,
client_group_facturation.email as client_group_mail,
client.entreprise as client_entreprise,
client.adresse as client_adresse,
thanato.nom as thanato_nom,
@ -3513,6 +3517,7 @@ class Bdd {
LEFT JOIN ".$this->tableprefix."lieu as lieu on devis.id_lieu = lieu.id
LEFT JOIN ".$this->tableprefix."defunt as defunt on devis.id_defunt = defunt.id
LEFT JOIN ".$this->tableprefix."client as client on devis.id_client = client.id
LEFT JOIN ".$this->tableprefix."client_group_facturation as client_group_facturation on client.fk_client_group_facturation_id = client_group_facturation.id
LEFT JOIN ".$this->tableprefix."thanato as thanato on devis.id_thanato = thanato.id
WHERE devis.id_defunt = ? ;";

View File

@ -527,12 +527,12 @@ $coverProducts = $_['coverProducts'];
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Confirmeation de l'envoi par email</h5>
<h5 class="modal-title">Confirmation de l'envoi par email</h5>
</div>
<div class="modal-body">
<div class="form-group form-check d-flex align-items-center">
<input type="checkbox" style="cursor:pointer;margin-right:8px;" id="valueSendEmailModal">
<label class="form-check-label" for="valueSendEmailModal">Envoyer un email ?</label>
<label class="form-check-label" for="valueSendEmailModal">Voulez-vous envoyer par email le fichier à <?= $_['defunt'][0]->client_group_mail ?? $_['defunt'][0]->client_mail;?> ?</label>
</div>
</div>
<div class="modal-footer">