From 8a8eaee2978711f5911da162cc265512fb983dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tsiresy=20Mil=C3=A0?= Date: Thu, 6 Mar 2025 17:24:27 +0300 Subject: [PATCH] [update]: send email --- gestion/.gitignore | 104 ++++++++++++++++++++++ gestion/lib/Controller/PageController.php | 14 +-- gestion/lib/Db/Bdd.php | 5 ++ gestion/templates/content/defuntshow.php | 4 +- 4 files changed, 118 insertions(+), 9 deletions(-) create mode 100644 gestion/.gitignore diff --git a/gestion/.gitignore b/gestion/.gitignore new file mode 100644 index 0000000..3f124fd --- /dev/null +++ b/gestion/.gitignore @@ -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/* diff --git a/gestion/lib/Controller/PageController.php b/gestion/lib/Controller/PageController.php index c517e4b..6128177 100644 --- a/gestion/lib/Controller/PageController.php +++ b/gestion/lib/Controller/PageController.php @@ -1583,22 +1583,22 @@ 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_email']; $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, "test.pdf", "application/pdf"); $message->attach($content); $message->setSubject($subject); $message->setPlainBody($addName ? $body." de ".$devis['defunt_nom']: $body); $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']); + // } } } diff --git a/gestion/lib/Db/Bdd.php b/gestion/lib/Db/Bdd.php index 4d74bc3..799e053 100644 --- a/gestion/lib/Db/Bdd.php +++ b/gestion/lib/Db/Bdd.php @@ -735,10 +735,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 = ?"; @@ -3445,6 +3448,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, @@ -3455,6 +3459,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 = ? ;"; diff --git a/gestion/templates/content/defuntshow.php b/gestion/templates/content/defuntshow.php index d79270e..8701ddd 100644 --- a/gestion/templates/content/defuntshow.php +++ b/gestion/templates/content/defuntshow.php @@ -527,12 +527,12 @@ $coverProducts = $_['coverProducts'];