Merge branch 'develop-tolotsoa' into production-hfc

This commit is contained in:
Tolotsoa 2025-09-09 11:11:15 +03:00
commit 49ecf4b1ed
31 changed files with 398 additions and 152 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2724,9 +2724,14 @@ class PageController extends Controller
$pdf->Cell($pdf->GetPageWidth() - 30, 0, utf8_decode(html_entity_decode($defaultConfig[0]->nom).' '.html_entity_decode($defaultConfig[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); $pdf->setY($pdf->GetY() + 5);
$signatureExist = $this->signatureImageExists('sign.jpg');
if($signatureExist) {
$pdf->Image($this->defaultImagePath."sign.jpg", 13, $pdf->GetY() + 8, 55, 25);
}
$signatureExist = $this->signatureImageExists('sign.png'); $signatureExist = $this->signatureImageExists('sign.png');
if($signatureExist) { if($signatureExist) {
$pdf->Image($this->defaultImagePath."sign.png", 13, $pdf->GetY(), 40, 15); $pdf->Image($this->defaultImagePath."sign.png", 13, $pdf->GetY() + 40, 40, 15);
} }
$pdf->setY($pdf->GetY() - 5); $pdf->setY($pdf->GetY() - 5);
@ -2932,9 +2937,14 @@ class PageController extends Controller
$pdf->Cell($pdf->GetPageWidth() - 30, 0, utf8_decode(html_entity_decode($defaultConfig[0]->nom).' '.html_entity_decode($defaultConfig[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); $pdf->setY($pdf->GetY() + 5);
$signatureExist = $this->signatureImageExists('sign.jpg');
if($signatureExist) {
$pdf->Image($this->defaultImagePath."sign.jpg", 10, $pdf->GetY() + 5, 55, 25);
}
$signatureExist = $this->signatureImageExists('sign.png'); $signatureExist = $this->signatureImageExists('sign.png');
if ($signatureExist) { if ($signatureExist) {
$pdf->Image($this->defaultImagePath."sign.png", 10, $pdf->GetY(), 40, 15); $pdf->Image($this->defaultImagePath."sign.png", 10, $pdf->GetY() + 35, 40, 15);
} }
$pdf->setY($pdf->GetY() - 5); $pdf->setY($pdf->GetY() - 5);

View File

@ -44,7 +44,7 @@ class Bdd
"quantite", "date_paiement", "type_paiement", "id_devis", "reference", "description", "prix_unitaire", "legal_two", "path", "tva_default", "coefficient_ik", "quantite", "date_paiement", "type_paiement", "id_devis", "reference", "description", "prix_unitaire", "legal_two", "path", "tva_default", "coefficient_ik",
"mentions_default", "version", "mentions", "comment", "status_paiement", "devise", "auto_invoice_number", "changelog", "format", "comment", "user_id", "mentions_default", "version", "mentions", "comment", "status_paiement", "devise", "auto_invoice_number", "changelog", "format", "comment", "user_id",
"facture_prefixe", "arrivee", "depart", "latitude", "longitude", "id_lieu", "rang", "mois", "annee", "id_trajet", "commentaire","source", "facture_prefixe", "arrivee", "depart", "latitude", "longitude", "id_lieu", "rang", "mois", "annee", "id_trajet", "commentaire","source",
"date_habilitation", "sexe", "observations_generales", "ref_pacemaker", "id_defunt", "article_id", "corpulence", "date_habilitation", "sexe", "observations_generales", "ref_pacemaker", "id_defunt", "article_id", "corpulence", "lieu_deces",
"date_naissance", "heure_debut", "heure_fin", "rigidite", "lividite", "observations_corps", "acces", "acces_recherche", "acces_etat", "date_naissance", "heure_debut", "heure_fin", "rigidite", "lividite", "observations_corps", "acces", "acces_recherche", "acces_etat",
"injection", "injection_diffusion", "injection_qte", "preinjection", "preinjection_qte", "coinjection", "coinjection_qte", "injection", "injection_diffusion", "injection_qte", "preinjection", "preinjection_qte", "coinjection", "coinjection_qte",
"drainage", "drainage_qte", "drainage_etat", "ponction", "ponction_qte", "cavite", "cavite_qte", "desinfection", "lavage", "drainage", "drainage_qte", "drainage_etat", "ponction", "ponction_qte", "cavite", "cavite_qte", "desinfection", "lavage",
@ -740,7 +740,7 @@ class Bdd
public function getDefunts($idNextcloud, $isUserThanatoOnly = false) public function getDefunts($idNextcloud, $isUserThanatoOnly = false)
{ {
$sql = "SELECT ".$this->tableprefix."defunt.id, ".$this->tableprefix."defunt.nom, ".$this->tableprefix."defunt.date_naissance, ".$this->tableprefix."defunt.ref_pacemaker, ".$this->tableprefix."defunt.sexe, " $sql = "SELECT ".$this->tableprefix."defunt.id, ".$this->tableprefix."defunt.nom, ".$this->tableprefix."defunt.date_naissance, ".$this->tableprefix."defunt.ref_pacemaker, ".$this->tableprefix."defunt.sexe, ".$this->tableprefix."defunt.lieu_deces as lieu_deces, "
.$this->tableprefix."client.nom as nom_client, ".$this->tableprefix."client.id as id_client, " .$this->tableprefix."client.nom as nom_client, ".$this->tableprefix."client.id as id_client, "
.$this->tableprefix."devis.num as numero_devis, ".$this->tableprefix."devis.id as id_devis, ".$this->tableprefix."devis.user_id as user_id, " .$this->tableprefix."devis.num as numero_devis, ".$this->tableprefix."devis.id as id_devis, ".$this->tableprefix."devis.user_id as user_id, "
.$this->tableprefix."devis.date as devis_date, " .$this->tableprefix."devis.date as devis_date, "
@ -783,7 +783,7 @@ class Bdd
public function getUnusedDefunts($idNextcloud) public function getUnusedDefunts($idNextcloud)
{ {
$sql = "SELECT ".$this->tableprefix."defunt.id, ".$this->tableprefix."defunt.nom, ".$this->tableprefix."defunt.date_naissance, ".$this->tableprefix."defunt.ref_pacemaker, ".$this->tableprefix."defunt.sexe," $sql = "SELECT ".$this->tableprefix."defunt.id, ".$this->tableprefix."defunt.nom, ".$this->tableprefix."defunt.date_naissance, ".$this->tableprefix."defunt.ref_pacemaker, ".$this->tableprefix."defunt.sexe, ".$this->tableprefix."defunt.lieu_deces,"
.$this->tableprefix."devis.user_id as user_id .$this->tableprefix."devis.user_id as user_id
FROM ".$this->tableprefix."defunt FROM ".$this->tableprefix."defunt
LEFT JOIN ".$this->tableprefix."devis ON ".$this->tableprefix."devis.id_defunt = ".$this->tableprefix."defunt.id LEFT JOIN ".$this->tableprefix."devis ON ".$this->tableprefix."devis.id_defunt = ".$this->tableprefix."defunt.id
@ -822,6 +822,7 @@ class Bdd
.$this->tableprefix."defunt.heure_debut," .$this->tableprefix."defunt.heure_debut,"
.$this->tableprefix."defunt.heure_fin," .$this->tableprefix."defunt.heure_fin,"
.$this->tableprefix."defunt.corpulence," .$this->tableprefix."defunt.corpulence,"
.$this->tableprefix."defunt.lieu_deces,"
.$this->tableprefix."defunt.rigidite," .$this->tableprefix."defunt.rigidite,"
.$this->tableprefix."defunt.lividite," .$this->tableprefix."defunt.lividite,"
.$this->tableprefix."defunt.observations_corps," .$this->tableprefix."defunt.observations_corps,"
@ -4076,6 +4077,7 @@ class Bdd
lieu.adresse as lieu_adresse, lieu.adresse as lieu_adresse,
defunt.nom as defunt_nom, defunt.nom as defunt_nom,
defunt.sexe as defunt_sexe, defunt.sexe as defunt_sexe,
defunt.lieu_deces as lieu_deces,
defunt.ref_pacemaker as defunt_reference_pacemaker, defunt.ref_pacemaker as defunt_reference_pacemaker,
defunt.product_brand as defunt_product_brand, defunt.product_brand as defunt_product_brand,
defunt.product_reference as defunt_product_reference, defunt.product_reference as defunt_product_reference,
@ -4112,6 +4114,7 @@ class Bdd
$sql = "SELECT $sql = "SELECT
defunt.id as id, defunt.id as id,
defunt.nom as defunt_nom, defunt.nom as defunt_nom,
defunt.lieu_deces as lieu_deces,
devis.id as devis_id devis.id as devis_id
FROM ".$this->tableprefix."defunt as defunt FROM ".$this->tableprefix."defunt as defunt
LEFT JOIN ".$this->tableprefix."devis as devis on defunt.id = devis.id_defunt LEFT JOIN ".$this->tableprefix."devis as devis on defunt.id = devis.id_defunt

View File

@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace OCA\Gestion\Migration;
use Closure;
use OCP\IDBConnection;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
/**
* Auto-generated migration step: Ajout du champ lieu_deces à la table defunt
*/
class Version8Date20250904141530 extends SimpleMigrationStep
{
private IDbConnection $db;
public function __construct(IDbConnection $db)
{
$this->db = $db;
}
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
*/
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void
{
}
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options)
{
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
$tableprefix = "gestion_";
/** DEFUNT - Ajout du champ lieu_deces **/
if ($schema->hasTable($tableprefix.'defunt')) {
$table = $schema->getTable($tableprefix.'defunt');
if (!$table->hasColumn('lieu_deces')) {
$table->addColumn('lieu_deces', 'string', [
'length' => 255,
'notnull' => false,
'default' => null
]);
}
}
return $schema;
}
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
*/
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void
{
}
}

View File

@ -27,29 +27,28 @@ declare(strict_types=1);
namespace OCA\Gestion\Service\Certificate\PdfHandler; namespace OCA\Gestion\Service\Certificate\PdfHandler;
use DateTime; use DateTime;
use \FPDF; use FPDF;
use OCA\Gestion\Helpers\DateHelpers; use OCA\Gestion\Helpers\DateHelpers;
use OCA\Gestion\Helpers\FileExportHelpers; use OCA\Gestion\Helpers\FileExportHelpers;
use OCA\Gestion\Helpers\PriceHelpers; use OCA\Gestion\Helpers\PriceHelpers;
class CareCertificatePdfHandler extends FPDF { class CareCertificatePdfHandler extends FPDF
{
private $devisOfDefunt = []; private $devisOfDefunt = [];
private $logo = null; private $logo = null;
private $signatureImageExist = false; private $signatureImageExist = false;
private $tamponImageExist = false; private $tamponImageExist = false;
private $imagePath = "/var/www/html/data/admin/files/.gestion/"; private $imagePath = "/var/www/html/data/admin/files/.gestion/";
function Header() public function Header()
{ {
if($this->logo != "nothing") { if($this->logo != "nothing") {
$this->Image($this->imagePath."logo.png", 4, 2, 40, 45); $this->Image($this->imagePath."logo.png", 4, 2, 40, 45);
} } else {
else{
$this->Cell(55, 30, ''); $this->Cell(55, 30, '');
} }
} }
function Footer() public function Footer()
{ {
$this->SetY(-18); $this->SetY(-18);
$this->SetFont('Arial', '', 10); $this->SetFont('Arial', '', 10);
@ -57,14 +56,16 @@ class CareCertificatePdfHandler extends FPDF {
$this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->adresse)), 0, 'C'); $this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->adresse)), 0, 'C');
} }
public function SetCareCertificateData(array $devisOfDefunt,$logo = null,$signatureImageExist = false , $tamponImageExist = false){ public function SetCareCertificateData(array $devisOfDefunt, $logo = null, $signatureImageExist = false, $tamponImageExist = false)
{
$this->devisOfDefunt = $devisOfDefunt; $this->devisOfDefunt = $devisOfDefunt;
$this->logo = $logo; $this->logo = $logo;
$this->signatureImageExist = $signatureImageExist; $this->signatureImageExist = $signatureImageExist;
$this->tamponImageExist = $tamponImageExist; $this->tamponImageExist = $tamponImageExist;
} }
public function SetCareCertificate(){ public function SetCareCertificate()
{
$this->AddPage(); $this->AddPage();
$this->SetMargins(left:20, top:0, right:20); $this->SetMargins(left:20, top:0, right:20);
$this->SetCareCertificateTitle(); $this->SetCareCertificateTitle();
@ -72,7 +73,8 @@ class CareCertificatePdfHandler extends FPDF {
$this->SetSigning(); $this->SetSigning();
} }
private function SetSigning(){ private function SetSigning()
{
$this->SetXY(140, $this->GetY() + 15); $this->SetXY(140, $this->GetY() + 15);
$this->Cell(0, 10, 'Cachet et signature'); $this->Cell(0, 10, 'Cachet et signature');
@ -85,7 +87,8 @@ class CareCertificatePdfHandler extends FPDF {
} }
} }
private function SetCareCertificateContent(){ private function SetCareCertificateContent()
{
$this->SetFont('Arial', '', 14); $this->SetFont('Arial', '', 14);
$this->MultiCell(0, 7, FileExportHelpers::FormatTextForExport('La Société '. $this->devisOfDefunt['configuration']->entreprise. ' habilitée sous le numéro ' . $this->devisOfDefunt['thanato_reference'] . ', certifie par la présente que : ')); $this->MultiCell(0, 7, FileExportHelpers::FormatTextForExport('La Société '. $this->devisOfDefunt['configuration']->entreprise. ' habilitée sous le numéro ' . $this->devisOfDefunt['thanato_reference'] . ', certifie par la présente que : '));
$this->SetFont('Arial', 'B', 14); $this->SetFont('Arial', 'B', 14);
@ -97,6 +100,8 @@ class CareCertificatePdfHandler extends FPDF {
$this->SetFont('Arial', '', 14); $this->SetFont('Arial', '', 14);
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Date du décès") . ' : ' . $this->devisOfDefunt['defunt_date'], 0, 1); $this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Date du décès") . ' : ' . $this->devisOfDefunt['defunt_date'], 0, 1);
$this->SetFont('Arial', '', 14); $this->SetFont('Arial', '', 14);
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Lieu du décès") . ' : ' . $this->devisOfDefunt['lieu_deces'], 0, 1);
$this->SetFont('Arial', '', 14);
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Qui reposait à l'adresse suivante") . ' : ', 0, 1); $this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Qui reposait à l'adresse suivante") . ' : ', 0, 1);
$this->SetFont('Arial', 'B', 14); $this->SetFont('Arial', 'B', 14);
$this->MultiCell(0, 6, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['location_of_devis'])); $this->MultiCell(0, 6, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['location_of_devis']));
@ -106,19 +111,20 @@ class CareCertificatePdfHandler extends FPDF {
$this->SetFont('Arial', '', 14); $this->SetFont('Arial', '', 14);
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("La présente attestation est établie pour faire valoir ce que de droit."), 0, 5); $this->Cell(0, 12, FileExportHelpers::FormatTextForExport("La présente attestation est établie pour faire valoir ce que de droit."), 0, 5);
$this->Ln(5); $this->Ln(5);
$this->MultiAlignCell(120,7,FileExportHelpers::FormatTextForExport('Fait à '). FileExportHelpers::FormatTextForExport($this->devisOfDefunt['location_of_devis']),0); // $this->MultiAlignCell(120,7,FileExportHelpers::FormatTextForExport('Fait à '). FileExportHelpers::FormatTextForExport($this->devisOfDefunt['location_of_devis']),0);
$this->SetX(140); // $this->SetX(140);
$this->Cell(0,7,'le '. $this->devisOfDefunt['devis_date']->format('d/m/Y'),0); $this->Cell(0, 7, 'Fait le '. $this->devisOfDefunt['devis_date']->format('d/m/Y'), 0);
} }
private function SetCareCertificateTitle(){ private function SetCareCertificateTitle()
{
$this->SetY(60); $this->SetY(60);
$this->SetFont('Arial', 'B', 20); $this->SetFont('Arial', 'B', 20);
$this->Cell(0, 10, 'ATTESTATION DE SOINS DE CONSERVATION', 0, 1, 'C'); $this->Cell(0, 10, 'ATTESTATION DE SOINS DE CONSERVATION', 0, 1, 'C');
$this->Ln(20); $this->Ln(20);
} }
function MultiAlignCell($w,$h,$text,$border=0,$ln=0,$align='L',$fill=false) public function MultiAlignCell($w, $h, $text, $border = 0, $ln = 0, $align = 'L', $fill = false)
{ {
// Store reset values for (x,y) positions // Store reset values for (x,y) positions
$x = $this->GetX() + $w; $x = $this->GetX() + $w;
@ -128,35 +134,35 @@ class CareCertificatePdfHandler extends FPDF {
$this->MultiCell($w, $h, $text, $border, $align, $fill); $this->MultiCell($w, $h, $text, $border, $align, $fill);
// Reset the line position to the right, like in Cell // Reset the line position to the right, like in Cell
if( $ln==0 ) if($ln == 0) {
{
$this->SetXY($x, $y); $this->SetXY($x, $y);
} }
} }
function NbLines($w, $txt) public function NbLines($w, $txt)
{ {
// Compute the number of lines a MultiCell of width w will take // Compute the number of lines a MultiCell of width w will take
if(!isset($this->CurrentFont)) if(!isset($this->CurrentFont)) {
$this->Error('No font has been set'); $this->Error('No font has been set');
}
$cw = $this->CurrentFont['cw']; $cw = $this->CurrentFont['cw'];
if($w==0) if($w == 0) {
$w = $this->w - $this->rMargin - $this->x; $w = $this->w - $this->rMargin - $this->x;
}
$wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize; $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
$s = str_replace("\r", '', (string)$txt); $s = str_replace("\r", '', (string)$txt);
$nb = strlen($s); $nb = strlen($s);
if($nb>0 && $s[$nb-1]=="\n") if($nb > 0 && $s[$nb - 1] == "\n") {
$nb--; $nb--;
}
$sep = -1; $sep = -1;
$i = 0; $i = 0;
$j = 0; $j = 0;
$l = 0; $l = 0;
$nl = 1; $nl = 1;
while($i<$nb) while($i < $nb) {
{
$c = $s[$i]; $c = $s[$i];
if($c=="\n") if($c == "\n") {
{
$i++; $i++;
$sep = -1; $sep = -1;
$j = $i; $j = $i;
@ -164,26 +170,26 @@ class CareCertificatePdfHandler extends FPDF {
$nl++; $nl++;
continue; continue;
} }
if($c==' ') if($c == ' ') {
$sep = $i; $sep = $i;
}
$l += $cw[$c]; $l += $cw[$c];
if($l>$wmax) if($l > $wmax) {
{ if($sep == -1) {
if($sep==-1) if($i == $j) {
{
if($i==$j)
$i++; $i++;
} }
else } else {
$i = $sep + 1; $i = $sep + 1;
}
$sep = -1; $sep = -1;
$j = $i; $j = $i;
$l = 0; $l = 0;
$nl++; $nl++;
} } else {
else
$i++; $i++;
} }
}
return $nl; return $nl;
} }
} }

View File

@ -27,20 +27,20 @@ declare(strict_types=1);
namespace OCA\Gestion\Service\Certificate\PdfHandler; namespace OCA\Gestion\Service\Certificate\PdfHandler;
use DateTime; use DateTime;
use \FPDF; use FPDF;
use OCA\Gestion\Helpers\DateHelpers; use OCA\Gestion\Helpers\DateHelpers;
use OCA\Gestion\Helpers\FileExportHelpers; use OCA\Gestion\Helpers\FileExportHelpers;
use OCA\Gestion\Helpers\PriceHelpers; use OCA\Gestion\Helpers\PriceHelpers;
class PacemakerCertificatePdfHandler extends FPDF class PacemakerCertificatePdfHandler extends FPDF
{ {
private $devisOfDefunt = []; private $devisOfDefunt = [];
private $logo = null; private $logo = null;
private $signatureImageExist = false; private $signatureImageExist = false;
private $imagePath = "/var/www/html/data/admin/files/.gestion/"; private $imagePath = "/var/www/html/data/admin/files/.gestion/";
private $tamponImageExist = false; private $tamponImageExist = false;
function Header()
public function Header()
{ {
if ($this->logo != "nothing") { if ($this->logo != "nothing") {
$this->Image($this->imagePath."logo.png", 4, 2, 40, 45); $this->Image($this->imagePath."logo.png", 4, 2, 40, 45);
@ -48,8 +48,10 @@ class PacemakerCertificatePdfHandler extends FPDF
$this->Cell(55, 30, ''); $this->Cell(55, 30, '');
} }
} }
function Footer()
public function Footer()
{ {
// Augmenter l'espace pour le footer pour éviter les chevauchements
$this->SetY(-18); $this->SetY(-18);
$this->SetFont('Arial', '', 10); $this->SetFont('Arial', '', 10);
$this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->legal_one)), 0, 'C'); $this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->legal_one)), 0, 'C');
@ -75,17 +77,27 @@ class PacemakerCertificatePdfHandler extends FPDF
private function SetSigning() private function SetSigning()
{ {
$this->SetXY(140, $this->GetY() + 10); // Ajouter plus d'espace avant la signature et le tampon
// $this->Cell(0, 10, 'Cachet et signatures'); $this->Ln(5); // Ajouter de l'espace vertical
// Calculer la position Y pour éviter le chevauchement avec le footer
$maxY = $this->GetPageHeight() - 65;
$currentY = $this->GetY();
// Si on est trop bas, ne pas dépasser la limite
if ($currentY > $maxY) {
$currentY = $maxY;
}
// Positionner le tampon
if($this->tamponImageExist) { if($this->tamponImageExist) {
$this->Image($this->imagePath."sign.jpg", 120, $this->GetY() + 8, 80, 30); $this->Image($this->imagePath."sign.jpg", 120, $currentY, 80, 25); // Réduire la hauteur de 30 à 25
} }
// Positionner la signature sous le tampon
if ($this->signatureImageExist) { if ($this->signatureImageExist) {
$this->Image($this->imagePath."sign.png", 140, $this->GetY() + 38, 40, 16); $this->Image($this->imagePath."sign.png", 140, $currentY + 28, 40, 16); // Ajuster la position Y
} }
} }
private function SetPacemakerCertificateContent() private function SetPacemakerCertificateContent()
@ -101,6 +113,8 @@ class PacemakerCertificatePdfHandler extends FPDF
$this->SetFont('Arial', '', 14); $this->SetFont('Arial', '', 14);
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Date du décès") . ' : ' . $this->devisOfDefunt['defunt_date'], 0, 1); $this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Date du décès") . ' : ' . $this->devisOfDefunt['defunt_date'], 0, 1);
$this->SetFont('Arial', '', 14); $this->SetFont('Arial', '', 14);
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Lieu du décès") . ' : ' . $this->devisOfDefunt['lieu_deces'], 0, 1);
$this->SetFont('Arial', '', 14);
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Qui reposait à l'adresse suivante") . ' : ', 0, 1); $this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Qui reposait à l'adresse suivante") . ' : ', 0, 1);
$this->SetFont('Arial', 'B', 14); $this->SetFont('Arial', 'B', 14);
@ -123,24 +137,26 @@ class PacemakerCertificatePdfHandler extends FPDF
0, 0,
1 1
); );
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("La présente attestation est établie pour faire valoir ce que de droit."), 0, 5); $this->Cell(0, 12, FileExportHelpers::FormatTextForExport("La présente attestation est établie pour faire valoir ce que de droit."), 0, 1);
$this->Ln(5); $this->Ln(5);
$this->MultiAlignCell(120, 7, FileExportHelpers::FormatTextForExport('Fait à ') . FileExportHelpers::FormatTextForExport($this->devisOfDefunt['location_of_devis']), 0); // Positionner "Fait le" de manière relative plutôt qu'absolue
$this->SetX(140); $this->SetX(140);
$this->Cell(0, 7, 'le ' . $this->devisOfDefunt['devis_date']->format('d/m/Y'), 0); $this->Cell(0, 7, 'Fait le ' . $this->devisOfDefunt['devis_date']->format('d/m/Y'), 0);
} }
private function SetPacemakerCertificateTitle() private function SetPacemakerCertificateTitle()
{ {
$this->SetY(y: 50); $this->SetY(y: 50);
$this->SetFont('Arial', 'B', 20); $this->SetFont('Arial', 'B', 15);
$this->Cell(0, 10, 'ATTESTATION DE RETRAIT DE LA', 0, 1, 'C'); $this->Cell(0, 10, 'ATTESTATION DE RECUPERATION DE', 0, 1, 'C');
$this->Cell(0, 10, 'PROTHESE FONCTIONNANT A PILE', 0, 1, 'C'); $this->Cell(0, 10, 'PROTHESE FONCTIONNANT AU MOYEN D\'UNE PILE', 0, 1, 'C');
$this->Ln(20); $this->SetFont('Arial', 'B', 12);
$this->Cell(0, 10, '(dernier alinea de l\'article R.2213-15 du code des collectivites territoriales)', 0, 1, 'C');
$this->Ln(10);
} }
function MultiAlignCell($w, $h, $text, $border = 0, $ln = 0, $align = 'L', $fill = false) public function MultiAlignCell($w, $h, $text, $border = 0, $ln = 0, $align = 'L', $fill = false)
{ {
// Store reset values for (x,y) positions // Store reset values for (x,y) positions
$x = $this->GetX() + $w; $x = $this->GetX() + $w;
@ -155,19 +171,22 @@ class PacemakerCertificatePdfHandler extends FPDF
} }
} }
function NbLines($w, $txt) public function NbLines($w, $txt)
{ {
// Compute the number of lines a MultiCell of width w will take // Compute the number of lines a MultiCell of width w will take
if (!isset($this->CurrentFont)) if (!isset($this->CurrentFont)) {
$this->Error('No font has been set'); $this->Error('No font has been set');
}
$cw = $this->CurrentFont['cw']; $cw = $this->CurrentFont['cw'];
if ($w == 0) if ($w == 0) {
$w = $this->w - $this->rMargin - $this->x; $w = $this->w - $this->rMargin - $this->x;
}
$wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize; $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
$s = str_replace("\r", '', (string) $txt); $s = str_replace("\r", '', (string) $txt);
$nb = strlen($s); $nb = strlen($s);
if ($nb > 0 && $s[$nb - 1] == "\n") if ($nb > 0 && $s[$nb - 1] == "\n") {
$nb--; $nb--;
}
$sep = -1; $sep = -1;
$i = 0; $i = 0;
$j = 0; $j = 0;
@ -183,22 +202,26 @@ class PacemakerCertificatePdfHandler extends FPDF
$nl++; $nl++;
continue; continue;
} }
if ($c == ' ') if ($c == ' ') {
$sep = $i; $sep = $i;
}
$l += $cw[$c]; $l += $cw[$c];
if ($l > $wmax) { if ($l > $wmax) {
if ($sep == -1) { if ($sep == -1) {
if ($i == $j) if ($i == $j) {
$i++; $i++;
} else }
} else {
$i = $sep + 1; $i = $sep + 1;
}
$sep = -1; $sep = -1;
$j = $i; $j = $i;
$l = 0; $l = 0;
$nl++; $nl++;
} else } else {
$i++; $i++;
} }
}
return $nl; return $nl;
} }
} }

View File

@ -43,7 +43,7 @@ class MailerService {
$cordialement = "<p> Cordialement,</p>"; $cordialement = "<p> Cordialement,</p>";
$userName = "<p> {$userName} </p>" ; $userName = "<p> {$userName} </p>" ;
$signatureImage = $this->getSignatureHtmlEmailContent(); $signatureImage = $this->getSignatureHtmlEmailContent();
return $wish . $cordialement .$userName . $signatureImage ; return $wish.$cordialement.$signatureImage ;
} }
private function getSignatureHtmlEmailContent (){ private function getSignatureHtmlEmailContent (){

View File

@ -21,6 +21,7 @@ export class Defunt {
this.pompe = ((myresp.nom_client == null) ? '-' : myresp.nom_client); this.pompe = ((myresp.nom_client == null) ? '-' : myresp.nom_client);
this.lieu = ((myresp.lieu == null) ? '-' : myresp.lieu); this.lieu = ((myresp.lieu == null) ? '-' : myresp.lieu);
this.numero_devis = ((myresp.user_id == null) ? '-' : myresp.user_id); this.numero_devis = ((myresp.user_id == null) ? '-' : myresp.user_id);
this.lieu_deces = ((myresp.lieu_deces == null) ? '-' : myresp.lieu_deces);
this.baseUrl = generateUrl(`/apps/gestion/defunt/${this.id}/show`); this.baseUrl = generateUrl(`/apps/gestion/defunt/${this.id}/show`);
this.productCoverDescription = Defunt.getDefuntProductCoverDescriptionFromApiResponse(myresp); this.productCoverDescription = Defunt.getDefuntProductCoverDescriptionFromApiResponse(myresp);
} }

View File

@ -4,8 +4,12 @@ for ($i = 1; $i <= 10; $i++) {
$quantiteOptions[] = $i / 10; $quantiteOptions[] = $i / 10;
} }
for ($i = 1; $i <= 15; $i++) { for ($i = 1; $i <= 15; $i++) {
if ($i > 1) $quantiteOptions[] = $i; if ($i > 1) {
if ($i < 15) $quantiteOptions[] = $i + 0.5; $quantiteOptions[] = $i;
}
if ($i < 15) {
$quantiteOptions[] = $i + 0.5;
}
} }
$coverProducts = $_['coverProducts']; $coverProducts = $_['coverProducts'];
?> ?>
@ -71,13 +75,24 @@ $coverProducts = $_['coverProducts'];
<input class="gestion-input w-100" type="date" value="<?php echo $_['defunt'][0]->date_naissance ?>" data-table="defunt" data-column="date_naissance" data-id="<?php echo $_['defunt'][0]->id ?>" /> <input class="gestion-input w-100" type="date" value="<?php echo $_['defunt'][0]->date_naissance ?>" data-table="defunt" data-column="date_naissance" data-id="<?php echo $_['defunt'][0]->id ?>" />
</div> </div>
</div> </div>
<!-- Lieu décès -->
<div class="d-flex flex-row align-items-center col-12" style="margin-bottom: 8px">
<div class="col-3">Lieu de décès</div>
<div class="col-9">
<input class="gestion-input w-100" type="text" value="<?php echo $_['defunt'][0]->lieu_deces ?>" data-table="defunt" data-column="lieu_deces" data-id="<?php echo $_['defunt'][0]->id ?>" />
</div>
</div>
<!-- Sexe --> <!-- Sexe -->
<!-- <div class="d-flex flex-row align-items-center col-12" style="margin-bottom: 8px"> <!-- <div class="d-flex flex-row align-items-center col-12" style="margin-bottom: 8px">
<div class="col-3">Sexe</div> <div class="col-3">Sexe</div>
<div class="col-9"> <div class="col-9">
<select class="gestion-select w-100" data-table="defunt" data-column="sexe" data-id="<?php echo $_['defunt'][0]->id ?>"> <select class="gestion-select w-100" data-table="defunt" data-column="sexe" data-id="<?php echo $_['defunt'][0]->id ?>">
<option value="m" <?php if (strcmp($_['defunt'][0]->sexe, 'm') == 0) echo 'selected' ?>>Masculin</option> <option value="m" <?php if (strcmp($_['defunt'][0]->sexe, 'm') == 0) {
<option value="f" <?php if (strcmp($_['defunt'][0]->sexe, 'f') == 0) echo 'selected' ?>>Féminin</option> echo 'selected';
} ?>>Masculin</option>
<option value="f" <?php if (strcmp($_['defunt'][0]->sexe, 'f') == 0) {
echo 'selected';
} ?>>Féminin</option>
</select> </select>
</div> </div>
</div> --> </div> -->
@ -202,8 +217,12 @@ $coverProducts = $_['coverProducts'];
<div class="col-9"> <div class="col-9">
<select class="gestion-select w-100" data-table="defunt" data-column="acces_etat" data-id="<?php echo $_['defunt'][0]->id ?>"> <select class="gestion-select w-100" data-table="defunt" data-column="acces_etat" data-id="<?php echo $_['defunt'][0]->id ?>">
<option>Selectionner un état</option> <option>Selectionner un état</option>
<option value="mauvais" <?php if (strcmp($_['defunt'][0]->acces_etat, 'mauvais') == 0) echo 'selected' ?>>Mauvais</option> <option value="mauvais" <?php if (strcmp($_['defunt'][0]->acces_etat, 'mauvais') == 0) {
<option value="bon" <?php if (strcmp($_['defunt'][0]->acces_etat, 'bon') == 0) echo 'selected' ?>>Bon</option> echo 'selected';
} ?>>Mauvais</option>
<option value="bon" <?php if (strcmp($_['defunt'][0]->acces_etat, 'bon') == 0) {
echo 'selected';
} ?>>Bon</option>
</select> </select>
</div> </div>
</div> </div>
@ -225,7 +244,9 @@ $coverProducts = $_['coverProducts'];
<div class="col-9"> <div class="col-9">
<select class="gestion-select w-100" data-table="defunt" data-column="preinjection_qte" data-id="<?php echo $_['defunt'][0]->id ?>"> <select class="gestion-select w-100" data-table="defunt" data-column="preinjection_qte" data-id="<?php echo $_['defunt'][0]->id ?>">
<?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?> <?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?>
<option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->preinjection_qte == $quantiteOptions[$i]) echo 'selected' ?>><?php echo $quantiteOptions[$i] ?></option> <option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->preinjection_qte == $quantiteOptions[$i]) {
echo 'selected';
} ?>><?php echo $quantiteOptions[$i] ?></option>
<?php } ?> <?php } ?>
</select> </select>
</div> </div>
@ -248,8 +269,12 @@ $coverProducts = $_['coverProducts'];
<div class="col-9"> <div class="col-9">
<select class="gestion-select w-100" data-table="defunt" data-column="injection_diffusion" data-id="<?php echo $_['defunt'][0]->id ?>"> <select class="gestion-select w-100" data-table="defunt" data-column="injection_diffusion" data-id="<?php echo $_['defunt'][0]->id ?>">
<option>Selectionner un état</option> <option>Selectionner un état</option>
<option value="mauvaise" <?php if (strcmp($_['defunt'][0]->injection_diffusion, 'mauvaise') == 0) echo 'selected' ?>>Mauvaise</option> <option value="mauvaise" <?php if (strcmp($_['defunt'][0]->injection_diffusion, 'mauvaise') == 0) {
<option value="bonne" <?php if (strcmp($_['defunt'][0]->injection_diffusion, 'bonne') == 0) echo 'selected' ?>>Bonne</option> echo 'selected';
} ?>>Mauvaise</option>
<option value="bonne" <?php if (strcmp($_['defunt'][0]->injection_diffusion, 'bonne') == 0) {
echo 'selected';
} ?>>Bonne</option>
</select> </select>
</div> </div>
</div> </div>
@ -259,7 +284,9 @@ $coverProducts = $_['coverProducts'];
<div class="col-9"> <div class="col-9">
<select class="gestion-select w-100" data-table="defunt" data-column="injection_qte" data-id="<?php echo $_['defunt'][0]->id ?>"> <select class="gestion-select w-100" data-table="defunt" data-column="injection_qte" data-id="<?php echo $_['defunt'][0]->id ?>">
<?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?> <?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?>
<option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->injection_qte == $quantiteOptions[$i]) echo 'selected' ?>><?php echo $quantiteOptions[$i] ?></option> <option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->injection_qte == $quantiteOptions[$i]) {
echo 'selected';
} ?>><?php echo $quantiteOptions[$i] ?></option>
<?php } ?> <?php } ?>
</select> </select>
</div> </div>
@ -282,7 +309,9 @@ $coverProducts = $_['coverProducts'];
<div class="col-9"> <div class="col-9">
<select class="gestion-select w-100" data-table="defunt" data-column="coinjection_qte" data-id="<?php echo $_['defunt'][0]->id ?>"> <select class="gestion-select w-100" data-table="defunt" data-column="coinjection_qte" data-id="<?php echo $_['defunt'][0]->id ?>">
<?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?> <?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?>
<option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->coinjection_qte == $quantiteOptions[$i]) echo 'selected' ?>><?php echo $quantiteOptions[$i] ?></option> <option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->coinjection_qte == $quantiteOptions[$i]) {
echo 'selected';
} ?>><?php echo $quantiteOptions[$i] ?></option>
<?php } ?> <?php } ?>
</select> </select>
</div> </div>
@ -305,8 +334,12 @@ $coverProducts = $_['coverProducts'];
<div class="col-9"> <div class="col-9">
<select class="gestion-select w-100" data-table="defunt" data-column="drainage_etat" data-id="<?php echo $_['defunt'][0]->id ?>"> <select class="gestion-select w-100" data-table="defunt" data-column="drainage_etat" data-id="<?php echo $_['defunt'][0]->id ?>">
<option>Selectionner un état</option> <option>Selectionner un état</option>
<option value="mauvaise" <?php if (strcmp($_['defunt'][0]->drainage_etat, 'mauvaise') == 0) echo 'selected' ?>>Mauvaise</option> <option value="mauvaise" <?php if (strcmp($_['defunt'][0]->drainage_etat, 'mauvaise') == 0) {
<option value="bonne" <?php if (strcmp($_['defunt'][0]->drainage_etat, 'bonne') == 0) echo 'selected' ?>>Bonne</option> echo 'selected';
} ?>>Mauvaise</option>
<option value="bonne" <?php if (strcmp($_['defunt'][0]->drainage_etat, 'bonne') == 0) {
echo 'selected';
} ?>>Bonne</option>
</select> </select>
</div> </div>
</div> </div>
@ -316,7 +349,9 @@ $coverProducts = $_['coverProducts'];
<div class="col-9"> <div class="col-9">
<select class="gestion-select w-100" data-table="defunt" data-column="drainage_qte" data-id="<?php echo $_['defunt'][0]->id ?>"> <select class="gestion-select w-100" data-table="defunt" data-column="drainage_qte" data-id="<?php echo $_['defunt'][0]->id ?>">
<?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?> <?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?>
<option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->drainage_qte == $quantiteOptions[$i]) echo 'selected' ?>><?php echo $quantiteOptions[$i] ?></option> <option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->drainage_qte == $quantiteOptions[$i]) {
echo 'selected';
} ?>><?php echo $quantiteOptions[$i] ?></option>
<?php } ?> <?php } ?>
</select> </select>
</div> </div>
@ -339,7 +374,9 @@ $coverProducts = $_['coverProducts'];
<div class="col-9"> <div class="col-9">
<select class="gestion-select w-100" data-table="defunt" data-column="ponction_qte" data-id="<?php echo $_['defunt'][0]->id ?>"> <select class="gestion-select w-100" data-table="defunt" data-column="ponction_qte" data-id="<?php echo $_['defunt'][0]->id ?>">
<?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?> <?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?>
<option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->ponction_qte == $quantiteOptions[$i]) echo 'selected' ?>><?php echo $quantiteOptions[$i] ?></option> <option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->ponction_qte == $quantiteOptions[$i]) {
echo 'selected';
} ?>><?php echo $quantiteOptions[$i] ?></option>
<?php } ?> <?php } ?>
</select> </select>
</div> </div>
@ -362,7 +399,9 @@ $coverProducts = $_['coverProducts'];
<div class="col-9"> <div class="col-9">
<select class="gestion-select w-100" data-table="defunt" data-column="cavite_qte" data-id="<?php echo $_['defunt'][0]->id ?>"> <select class="gestion-select w-100" data-table="defunt" data-column="cavite_qte" data-id="<?php echo $_['defunt'][0]->id ?>">
<?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?> <?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?>
<option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->cavite_qte == $quantiteOptions[$i]) echo 'selected' ?>><?php echo $quantiteOptions[$i] ?></option> <option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->cavite_qte == $quantiteOptions[$i]) {
echo 'selected';
} ?>><?php echo $quantiteOptions[$i] ?></option>
<?php } ?> <?php } ?>
</select> </select>
</div> </div>
@ -417,7 +456,9 @@ $coverProducts = $_['coverProducts'];
<div class="d-flex flex-row col-12 align-items-center" style="margin-bottom: 8px"> <div class="d-flex flex-row col-12 align-items-center" style="margin-bottom: 8px">
<div class="col-3">Rasage</div> <div class="col-3">Rasage</div>
<div class="d-flex col-9 justify-content-start align-items-start"> <div class="d-flex col-9 justify-content-start align-items-start">
<input class="gestion-checkbox" type="checkbox" <?php if ($_['defunt'][0]->rasage == 1) echo 'checked' ?> data-table="defunt" data-column="rasage" data-id="<?php echo $_['defunt'][0]->id ?>" /> <input class="gestion-checkbox" type="checkbox" <?php if ($_['defunt'][0]->rasage == 1) {
echo 'checked';
} ?> data-table="defunt" data-column="rasage" data-id="<?php echo $_['defunt'][0]->id ?>" />
</div> </div>
</div> </div>
</div> </div>