mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 23:16:03 +00:00
bug fix: tcpdf total page numbers for groups (#2632)
The total page number was not correct for groups. The page number for a non-group was used, which produced the wrong result.
This commit is contained in:
@@ -128,20 +128,7 @@ class Tcpdf extends TcpdfOriginal
|
||||
|
||||
$html = $this->headerHtml;
|
||||
|
||||
if ($this->useGroupNumbers) {
|
||||
$html = str_replace('{pageNumber}', '{{:png:}}', $html);
|
||||
$html = str_replace('{pageAbsoluteNumber}', '{{:pnp:}}', $html);
|
||||
} else {
|
||||
$html = str_replace('{pageNumber}', '{{:pnp:}}', $html);
|
||||
$html = str_replace('{pageAbsoluteNumber}', '{{:pnp:}}', $html);
|
||||
}
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
if ($this->isUnicodeFont()) {
|
||||
$html = str_replace('{totalPageNumber}', '{{:ptp:}}', $html);
|
||||
} else {
|
||||
$html = str_replace('{totalPageNumber}', '{:ptp:}', $html);
|
||||
}
|
||||
$html = $this->setPageNumbers($html);
|
||||
|
||||
$this->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, '', 0, false);
|
||||
}
|
||||
@@ -160,26 +147,43 @@ class Tcpdf extends TcpdfOriginal
|
||||
|
||||
$html = $this->footerHtml;
|
||||
|
||||
if ($this->useGroupNumbers) {
|
||||
$html = str_replace('{pageNumber}', '{{:png:}}', $html);
|
||||
$html = str_replace('{pageAbsoluteNumber}', '{{:pnp:}}', $html);
|
||||
} else {
|
||||
$html = str_replace('{pageNumber}', '{{:pnp:}}', $html);
|
||||
$html = str_replace('{pageAbsoluteNumber}', '{{:pnp:}}', $html);
|
||||
}
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
if ($this->isUnicodeFont()) {
|
||||
$html = str_replace('{totalPageNumber}', '{{:ptp:}}', $html);
|
||||
} else {
|
||||
$html = str_replace('{totalPageNumber}', '{:ptp:}', $html);
|
||||
}
|
||||
$html = $this->setPageNumbers($html);
|
||||
|
||||
$this->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, '', 0, false);
|
||||
|
||||
$this->SetAutoPageBreak($autoPageBreak, $breakMargin);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $html
|
||||
* @return string
|
||||
*/
|
||||
private function setPageNumbers($html): string {
|
||||
if ($this->useGroupNumbers) {
|
||||
$html = str_replace('{pageNumber}', '{{:png:}}', $html);
|
||||
$html = str_replace('{pageAbsoluteNumber}', '{{:pnp:}}', $html);
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
if ($this->isUnicodeFont()) {
|
||||
$html = str_replace('{totalPageNumber}', '{{:ptg:}}', $html);
|
||||
} else {
|
||||
$html = str_replace('{totalPageNumber}', '{:ptg:}', $html);
|
||||
}
|
||||
} else {
|
||||
$html = str_replace('{pageNumber}', '{{:pnp:}}', $html);
|
||||
$html = str_replace('{pageAbsoluteNumber}', '{{:pnp:}}', $html);
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
if ($this->isUnicodeFont()) {
|
||||
$html = str_replace('{totalPageNumber}', '{{:ptp:}}', $html);
|
||||
} else {
|
||||
$html = str_replace('{totalPageNumber}', '{:ptp:}', $html);
|
||||
}
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $dest
|
||||
|
||||
Reference in New Issue
Block a user