diff --git a/gestion/lib/Controller/PageController.php b/gestion/lib/Controller/PageController.php index d13e394..b3a7d1c 100644 --- a/gestion/lib/Controller/PageController.php +++ b/gestion/lib/Controller/PageController.php @@ -1978,7 +1978,7 @@ class PageController extends Controller { * @param string $numdefunt */ public function saveRapportSoin($numdefunt){ - $current_config = json_decode($this->myDb->getConfiguration($this->idNextcloud)); + $defaultConfig = json_decode($this->myDb->getConfiguration(BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD)); $defunt = json_decode($this->myDb->getOneDefunt($numdefunt, $this->idNextcloud))[0]; $observations = json_decode($this->myDb->getListObservations($numdefunt, $this->idNextcloud)); $hypodermiques = json_decode($this->myDb->getListHypodermiques($numdefunt, $this->idNextcloud)); @@ -1998,7 +1998,12 @@ class PageController extends Controller { $date_devis = $formatter->format(DateTime::createFromFormat('d-m-Y', $date_devis_temp)); $today = $formatter->format(DateTime::createFromFormat('d-m-Y', $date_temp)); - $folderDestination = html_entity_decode($current_config[0]->path).'/CLIENTS/'.strtoupper($defunt->entreprise).'/DEFUNTS/'.strtoupper($nomDefunt).'/RAPPORTS/'; + $folderDestination = FileExportHelpers::GetDefuntsFolder( + $defunt->nom, + $defunt->nom_defunt, + $defaultConfig[0]->path.'/' + ); + $folderDestination .= 'RAPPORTS/'; try { $this->storage->newFolder($folderDestination); } catch(\OCP\Files\NotPermittedException $e) { } @@ -2083,9 +2088,9 @@ class PageController extends Controller { $pdf->SetXY(($col_width*2)+15, $pdf->GetY()-8); $pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell($col_width, 8, utf8_decode(html_entity_decode($defunt->drainage_etat)), 'LR', 'C'); $pdf->Line(15, $pdf->GetY(), $pdf->GetPageWidth()-15, $pdf->GetY()); - $pdf->SetY(-30); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $current_config[0]->legal_one))), '', 'C'); - $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $current_config[0]->legal_two))), '', 'C'); - $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $current_config[0]->telephone))), '', 'C'); + $pdf->SetY(-30); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $defaultConfig[0]->legal_one))), '', 'C'); + $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $defaultConfig[0]->legal_two))), '', 'C'); + $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $defaultConfig[0]->telephone))), '', 'C'); $pdf->AddPage(); @@ -2150,9 +2155,9 @@ class PageController extends Controller { $col_width = round(($pdf->GetPageWidth()-30)/2); foreach ($observations as $key => $obs) { if($pdf->getY()>=($pdf->GetPageHeight()-45)) { - $pdf->SetY(-30); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $current_config[0]->legal_one))), '', 'C'); - $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $current_config[0]->legal_two))), '', 'C'); - $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $current_config[0]->telephone))), '', 'C'); + $pdf->SetY(-30); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $defaultConfig[0]->legal_one))), '', 'C'); + $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $defaultConfig[0]->legal_two))), '', 'C'); + $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $defaultConfig[0]->telephone))), '', 'C'); $pdf->AddPage(); } $pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell($col_width, 8, utf8_decode(html_entity_decode($obs->designation)), 'LTRB', 'L'); @@ -2162,16 +2167,16 @@ class PageController extends Controller { $pdf->setY($pdf->GetY()+10); if($pdf->getY()>=($pdf->GetPageHeight()-45)) { - $pdf->SetY(-30); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $current_config[0]->legal_one))), '', 'C'); - $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $current_config[0]->legal_two))), '', 'C'); - $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $current_config[0]->telephone))), '', 'C'); + $pdf->SetY(-30); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $defaultConfig[0]->legal_one))), '', 'C'); + $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $defaultConfig[0]->legal_two))), '', 'C'); + $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $defaultConfig[0]->telephone))), '', 'C'); $pdf->AddPage(); } // signature $pdf->SetFont('ComicSans','',11); $pdf->setY($pdf->GetY()+10); - $pdf->Cell( $pdf->GetPageWidth()-30, 0, utf8_decode(html_entity_decode($current_config[0]->nom).' '.html_entity_decode($current_config[0]->prenom)), 0, 0, 'L'); + $pdf->Cell( $pdf->GetPageWidth()-30, 0, utf8_decode(html_entity_decode($defaultConfig[0]->nom).' '.html_entity_decode($defaultConfig[0]->prenom)), 0, 0, 'L'); $pdf->setY($pdf->GetY()+5); $signatureExist = $this->signatureImageExists('sign.png'); @@ -2182,9 +2187,9 @@ class PageController extends Controller { $pdf->setY($pdf->GetY()-5); $pdf->SetFont('ComicSans','',11); $pdf->Cell( $pdf->GetPageWidth()-80, 0, "Pour :", 0, 0, 'R'); - $pdf->SetY(-30); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $current_config[0]->legal_one))), '', 'C'); - $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $current_config[0]->legal_two))), '', 'C'); - $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $current_config[0]->telephone))), '', 'C'); + $pdf->SetY(-30); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $defaultConfig[0]->legal_one))), '', 'C'); + $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $defaultConfig[0]->legal_two))), '', 'C'); + $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, utf8_decode(html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $defaultConfig[0]->telephone))), '', 'C'); $pdf->AddPage(); $pdf->Image($this->src_path.(($defunt->sexe=='m'?'facehomme.jpg':'facefemme.jpg')), 0, 0, $pdf->GetPageWidth(), $pdf->GetPageHeight()); @@ -2253,8 +2258,13 @@ class PageController extends Controller { $formatter = new IntlDateFormatter('fr_FR', IntlDateFormatter::LONG, IntlDateFormatter::NONE); $today = $formatter->format(DateTime::createFromFormat('d-m-Y', $date_temp)); - $folderDestination = html_entity_decode($defaultConfig[0]->path).'/CLIENTS/'.strtoupper($defunt->entreprise).'/DEFUNTS/'.strtoupper($nomDefunt).'/RAPPORTS/'; - + // $folderDestination = html_entity_decode($defaultConfig[0]->path).'/CLIENTS/'.strtoupper($defunt->entreprise).'/DEFUNTS/'.strtoupper($nomDefunt).'/RAPPORTS/'; + $folderDestination = FileExportHelpers::GetDefuntsFolder( + $defunt->nom, + $defunt->nom_defunt, + $defaultConfig[0]->path.'/' + ); + $folderDestination .= 'RAPPORTS/'; try { $this->storage->newFolder($folderDestination); } catch(\OCP\Files\NotPermittedException $e) { } diff --git a/gestion/lib/Db/Bdd.php b/gestion/lib/Db/Bdd.php index f62607b..5774f97 100644 --- a/gestion/lib/Db/Bdd.php +++ b/gestion/lib/Db/Bdd.php @@ -535,12 +535,14 @@ class Bdd { $sql = "SELECT ".$this->tableprefix."facture.id," . $this->tableprefix . "facture.version," . $this->tableprefix . "facture.num, " .$this->tableprefix."facture.date, ".$this->tableprefix."devis.num as dnum, comment, date_paiement, type_paiement, id_devis, ".$this->tableprefix."client.nom, prenom, entreprise," .$this->tableprefix."devis.comment as dcomment,".$this->tableprefix."lieu.nom as lieu, ".$this->tableprefix."lieu.adresse as adresse_soin," - .$this->tableprefix."defunt.nom as nom_defunt + .$this->tableprefix."defunt.nom as nom_defunt, " + .$this->tableprefix."facture_payment_type.facture_payment_type_label as facture_payment_type_label FROM (".$this->tableprefix."facture LEFT JOIN ".$this->tableprefix."devis on ".$this->tableprefix."facture.id_devis = ".$this->tableprefix."devis.id LEFT JOIN ".$this->tableprefix."lieu on ".$this->tableprefix."devis.id_lieu = ".$this->tableprefix."lieu.id) LEFT JOIN ".$this->tableprefix."client on ".$this->tableprefix."devis.id_client = ".$this->tableprefix."client.id LEFT JOIN ".$this->tableprefix."defunt on ".$this->tableprefix."devis.id_defunt = ".$this->tableprefix."defunt.id + LEFT JOIN ".$this->tableprefix."facture_payment_type on ".$this->tableprefix."facture.fk_facture_payment_type_id = ".$this->tableprefix."facture_payment_type.id WHERE ".$this->tableprefix."facture.id = ?"; // return $this->execSQL($sql, array($numfacture, $idNextcloud)); return $this->execSQL($sql, array($numfacture)); diff --git a/gestion/lib/Service/Certificate/CertificateService.php b/gestion/lib/Service/Certificate/CertificateService.php index c95f89f..ae56785 100644 --- a/gestion/lib/Service/Certificate/CertificateService.php +++ b/gestion/lib/Service/Certificate/CertificateService.php @@ -155,7 +155,7 @@ class CertificateService { private function getCareCertificateFolder($devisOfDefunt){ $careCertificateFolder = 'CLIENTS/' - .mb_strtoupper($devisOfDefunt["client_entreprise"],'UTF-8') + .mb_strtoupper($devisOfDefunt["client_nom"],'UTF-8') .'/DEFUNTS/' .mb_strtoupper($devisOfDefunt["defunt_nom"],'UTF-8').'/' .'ATTESTATION/'; @@ -170,7 +170,7 @@ class CertificateService { private function getPacemakerCertificateFolder($devisOfDefunt){ $folder = 'CLIENTS/' - .mb_strtoupper($devisOfDefunt["client_entreprise"],'UTF-8') + .mb_strtoupper($devisOfDefunt["client_nom"],'UTF-8') .'/DEFUNTS/' .mb_strtoupper($devisOfDefunt["defunt_nom"],'UTF-8').'/' .'ATTESTATION/'; diff --git a/gestion/templates/content/factureshow.php b/gestion/templates/content/factureshow.php index 121ab5e..69a85a3 100644 --- a/gestion/templates/content/factureshow.php +++ b/gestion/templates/content/factureshow.php @@ -48,7 +48,7 @@