Assegnazione url corretto alla singola circolare

This commit is contained in:
2025-08-26 16:59:53 +02:00
parent 2f251bbfb0
commit 16ac92a59e
9 changed files with 200 additions and 8 deletions

View File

@ -21,7 +21,7 @@ use \Joomla\CMS\Helper\TagsHelper;
use \Joomla\CMS\Filter\OutputFilter;
use \Joomla\CMS\Event\Model;
use Joomla\CMS\Event\AbstractEvent;
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Application\ApplicationHelper;
/**
@ -127,6 +127,14 @@ class CircolareModel extends AdminModel
$data = $this->item;
}
if ((is_array($data) && empty($data['id'])) || (is_object($data) && empty($data->id))) {
if (is_array($data)) {
$data['catid'] = (int)($data['catid'] ?? 0) ?: 11;
} else {
$data->catid = (int)($data->catid ?? 0) ?: 11;
}
}
return $data;
}

View File

@ -198,7 +198,7 @@ class CircolareTable extends Table implements VersionableTableInterface, Taggabl
$this->ordering = self::getNextOrder();
}
// Ordering per nuovi record
// Ordering per nuovi record
if (property_exists($this, 'ordering') && (int) $this->id === 0) {
$this->ordering = self::getNextOrder();
}
@ -235,6 +235,11 @@ class CircolareTable extends Table implements VersionableTableInterface, Taggabl
}
// Default categoria (nuovi record o catid non impostato)
$this->catid = (int)($this->catid ?? 0) ?: 11;
return parent::check();
}
@ -313,5 +318,4 @@ class CircolareTable extends Table implements VersionableTableInterface, Taggabl
$this->_db->setQuery($q);
return ((int) $this->_db->loadResult()) > 0;
}
}