Merge branch 'hotfixes/hotfixes-certificate-folder' into staging

This commit is contained in:
Tiavina 2025-02-05 17:39:17 +03:00
commit a24b9e613c
4 changed files with 33 additions and 21 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

@ -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));

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

View File

@ -48,7 +48,7 @@
<hr/>
<div class="col col-xl mb-3 text-center">
<span>Date de facture : <b><?php echo (new DateTime($_['facture'][0]->date_paiement))->format('d-m-Y');?></b>, </span><span><?php p($l->t('Date of service'));?> : <b><?php echo (new DateTime($_['facture'][0]->date))->format('d-m-Y');?></b></span><br/>
<span id="devisid" data-id=<?php echo $_['facture'][0]->id_devis;?>>Defunt associé : <b><?php echo $_['facture'][0]->nom_defunt;?></b>, </span><span><?php p($l->t('Means of payment'));?> : <b><?php echo $_['facture'][0]->type_paiement;?></b></span><br/>
<span id="devisid" data-id=<?php echo $_['facture'][0]->id_devis;?>>Defunt associé : <b><?php echo $_['facture'][0]->nom_defunt;?></b>, </span><span><?php p($l->t('Means of payment'));?> : <b><?php echo $_['facture'][0]->facture_payment_type_label ?? "Aucun";?></b></span><br/>
<span>Lieu : <b><?php echo $_['facture'][0]->lieu;?> (<?php echo $_['facture'][0]->adresse_soin;?>)</b>
</div>
<hr/>