Assegnazione url corretto alla singola circolare
This commit is contained in:
@ -18,6 +18,14 @@
|
||||
type="text"
|
||||
label="JFIELD_ALIAS_LABEL"
|
||||
description="JFIELD_ALIAS_DESC" />
|
||||
<field
|
||||
name="catid"
|
||||
type="category"
|
||||
extension="com_content"
|
||||
label="JCATEGORY"
|
||||
required="true"
|
||||
default="11"
|
||||
/>
|
||||
<field name="description" filter="safehtml" type="textarea" label="COM_CIRCOLARI_FORM_LBL_CIRCOLARE_DESCRIPTION" description="COM_CIRCOLARI_FORM_DESC_CIRCOLARE_DESCRIPTION" hint="COM_CIRCOLARI_FORM_LBL_CIRCOLARE_DESCRIPTION"/>
|
||||
<field name="attachment" type="media"
|
||||
label="COM_CIRCOLARI_FIELD_ATTACHMENT_LABEL"
|
||||
|
||||
9
administrator/sql/updates/1.1.3.sql
Normal file
9
administrator/sql/updates/1.1.3.sql
Normal file
@ -0,0 +1,9 @@
|
||||
ALTER TABLE `#__circolari`
|
||||
ADD COLUMN `catid` INT(10) UNSIGNED NOT NULL DEFAULT 0 AFTER `modified_by`,
|
||||
ADD INDEX `idx_catid` (`catid`);
|
||||
|
||||
ALTER TABLE `#__circolari`
|
||||
ALTER `catid` SET DEFAULT 11;
|
||||
|
||||
-- opzionale, porta a 11 i record con catid 0/null
|
||||
UPDATE `#__circolari` SET `catid` = 11 WHERE `catid` IS NULL OR `catid` = 0;
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ HTMLHelper::_('bootstrap.tooltip');
|
||||
<legend><?php echo Text::_('COM_CIRCOLARI_FIELDSET_CIRCOLARI'); ?></legend>
|
||||
<?php echo $this->form->renderField('title'); ?>
|
||||
<?php echo $this->form->renderField('alias'); ?>
|
||||
<?php echo $this->form->renderField('catid'); ?>
|
||||
<?php echo $this->form->renderField('description'); ?>
|
||||
<?php echo $this->form->renderField('attachment'); ?>
|
||||
<?php echo $this->form->renderField('image'); ?>
|
||||
|
||||
Reference in New Issue
Block a user