Skip to content

Commit 5edb591

Browse files
authored
Update pdf_soleil.modules.php
1 parent 83ed28c commit 5edb591

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -508,17 +508,30 @@ protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $
508508
}
509509
}
510510

511-
$pdf->SetXY(20, 230);
512-
$pdf->MultiCell(80, 5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"), 0, 'L', false);
511+
// EN: Keep the signature box and related labels on the same page by positioning them dynamically.
512+
$signature_block_height = 30;
513+
$page_break_trigger = $pdf->getPageHeight() - $pdf->getBreakMargin();
514+
$signature_top = $tab_top + $tab_height - $signature_block_height - 5;
515+
$signature_top = min($signature_top, $page_break_trigger - $signature_block_height);
516+
$signature_top = max($signature_top, $tab_top + 5);
513517

514-
$pdf->SetXY(20, 235);
518+
$previous_autopagebreak = $pdf->getAutoPageBreak();
519+
$previous_breakmargin = $pdf->getBreakMargin();
520+
$pdf->SetAutoPageBreak(false, 0);
521+
522+
$pdf->SetXY(20, $signature_top);
523+
$pdf->MultiCell(80, 5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"), 0, 'L', 0);
524+
525+
$pdf->SetXY(20, $signature_top + 5);
515526
$pdf->MultiCell(80, 25, $employee_name, 1, 'L');
516527

517-
$pdf->SetXY(110, 230);
518-
$pdf->MultiCell(80, 5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"), 0, 'L', false);
528+
$pdf->SetXY(110, $signature_top);
529+
$pdf->MultiCell(80, 5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"), 0, 'L', 0);
519530

520-
$pdf->SetXY(110, 235);
531+
$pdf->SetXY(110, $signature_top + 5);
521532
$pdf->MultiCell(80, 25, '', 1);
533+
534+
$pdf->SetAutoPageBreak($previous_autopagebreak, $previous_breakmargin);
522535
}
523536
}
524537

0 commit comments

Comments
 (0)