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/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/';