Fix stampa con php8.1

This commit is contained in:
Pek5892 2024-04-12 10:17:30 +02:00
parent c8c5f59abf
commit ec940b82f2
2 changed files with 6 additions and 8 deletions

View File

@ -49,15 +49,9 @@ class ButtonManager implements ManagerInterface
protected function getInfo($options)
{
if ($options['type'] == 'print') {
$print = PrintTemplate::find((new PrintTemplate())->getByField('title', $options['id']));
if (empty($print)) {
$print = PrintTemplate::find($options['id']);
}
if (!empty($print)) {
$result = [
'link' => \Prints::getHref($print, $options['id_record'], $options['parameters']),
'link' => \Prints::getHref($options['id'], $options['id_record'], $options['parameters']),
'title' => tr('Stampa').' '.((strtoupper($print->getTranslation('title')) == $print->getTranslation('title')) ? $print->getTranslation('title') : lcfirst($print->getTranslation('title'))),
'icon' => $print->icon,
];

View File

@ -207,7 +207,11 @@ class Prints
*/
public static function getHref($print, $id_record, $get = '')
{
$infos = $print;
$infos = PrintTemplate::find((new PrintTemplate())->getByField('title', $print));
if (empty($infos)) {
$infos = PrintTemplate::find($print);
}
if (empty($infos)) {
return false;