Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 24 additions & 14 deletions htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -508,32 +508,42 @@
}
}

// EN: Keep the signature box and related labels on the same page by positioning them dynamically.
$signature_block_height = 30;
$page_break_trigger = $pdf->getPageHeight() - $pdf->getBreakMargin();
$signature_top = $tab_top + $tab_height - $signature_block_height - 5;
$signature_top = min($signature_top, $page_break_trigger - $signature_block_height);
$signature_top = max($signature_top, $tab_top + 5);
// EN: Keep the signature boxes aligned inside the rectangle while preventing overflow.
$signature_block_height = 30;
$tab_bottom = $tab_top + $tab_height;
$page_break_trigger = $pdf->getPageHeight() - $pdf->getBreakMargin();
$content_bottom = max($nexY, $tab_top + 6);
$signature_top = $tab_bottom - $signature_block_height - 6;
$signature_top = max($signature_top, $content_bottom + 2);
$signature_top = min($signature_top, $tab_bottom - $signature_block_height - 1);
$signature_top = min($signature_top, $page_break_trigger - $signature_block_height);

$available_signature_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
$signature_spacing = 5;
$signature_box_width = ($available_signature_width - $signature_spacing) / 2;
$signature_left_x = $this->marge_gauche;
$signature_right_x = $signature_left_x + $signature_box_width + $signature_spacing;

$previous_autopagebreak = $pdf->getAutoPageBreak();
$previous_breakmargin = $pdf->getBreakMargin();
$pdf->SetAutoPageBreak(false, 0);

$pdf->SetXY(20, $signature_top);
$pdf->MultiCell(80, 5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"), 0, 'L', 0);
$pdf->SetXY($signature_left_x, $signature_top);
$pdf->MultiCell($signature_box_width, 5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"), 0, 'L', 0);

Check failure on line 532 in htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php

View workflow job for this annotation

GitHub Actions / phan / Run phan

PhanTypeMismatchArgument Argument 6 ($fill) is 0 of type 0 but \TCPDF::MultiCell() takes bool|false defined at htdocs/includes/tecnickcom/tcpdf/tcpdf.php:5871

$pdf->SetXY(20, $signature_top + 5);
$pdf->MultiCell(80, 25, $employee_name, 1, 'L');
$pdf->SetXY($signature_left_x, $signature_top + 5);
$pdf->MultiCell($signature_box_width, 25, $employee_name, 1, 'L');

$pdf->SetXY(110, $signature_top);
$pdf->MultiCell(80, 5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"), 0, 'L', 0);
$pdf->SetXY($signature_right_x, $signature_top);
$pdf->MultiCell($signature_box_width, 5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"), 0, 'L', 0);

Check failure on line 538 in htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php

View workflow job for this annotation

GitHub Actions / phan / Run phan

PhanTypeMismatchArgument Argument 6 ($fill) is 0 of type 0 but \TCPDF::MultiCell() takes bool|false defined at htdocs/includes/tecnickcom/tcpdf/tcpdf.php:5871

$pdf->SetXY(110, $signature_top + 5);
$pdf->MultiCell(80, 25, '', 1);
$pdf->SetXY($signature_right_x, $signature_top + 5);
$pdf->MultiCell($signature_box_width, 25, '', 1);

$pdf->SetAutoPageBreak($previous_autopagebreak, $previous_breakmargin);
}

}

Check failure on line 546 in htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Function closing brace must go on the next line following the body; found 1 blank lines before brace

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
Expand Down
Loading