certificate folder should be in the same folder of the defunt

This commit is contained in:
Tiavina 2025-02-05 16:26:50 +03:00
parent 6a4030d1e6
commit 83f8c7c0eb
2 changed files with 29 additions and 19 deletions

View File

@ -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) { }

View File

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