Allow to define a new date if current is postponed

Relates: #8092
This commit is contained in:
Daniel Siepmann 2021-03-16 12:10:07 +01:00
parent c65ae5023f
commit 10b4c34fe6
5 changed files with 48 additions and 1 deletions

View file

@ -25,6 +25,11 @@ class Date extends AbstractEntity
*/ */
protected $canceled = "no"; protected $canceled = "no";
/**
* @var Date
*/
protected $postponedDate;
/** /**
* @var \Wrm\Events\Domain\Model\Event * @var \Wrm\Events\Domain\Model\Event
*/ */
@ -121,4 +126,13 @@ class Date extends AbstractEntity
{ {
$this->canceled = $canceled; $this->canceled = $canceled;
} }
public function getPostponedDate(): ?Date
{
if ($this->getCanceled() === 'postponed') {
return $this->postponedDate;
}
return null;
}
} }

View file

@ -23,7 +23,7 @@ return [
'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_date.svg' 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_date.svg'
], ],
'types' => [ 'types' => [
'1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, start, end, canceled, event, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, start, end, canceled, postponed_date, event, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'],
], ],
'columns' => [ 'columns' => [
'sys_language_uid' => [ 'sys_language_uid' => [
@ -162,6 +162,24 @@ return [
], ],
], ],
], ],
'postponed_date' => [
'exclude' => true,
'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.postponed_date',
'displayCond' => 'FIELD:canceled:=:postponed',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'tx_events_domain_model_date',
'foreign_table_where' => ' AND {#tx_events_domain_model_date}.{#event} = ###REC_FIELD_event###',
'default' => '0',
'items' => [
'0' => [
'0' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.postponed_date.0',
'1' => '0',
],
],
],
],
'event' => array( 'event' => array(
'exclude' => 1, 'exclude' => 1,

View file

@ -31,6 +31,14 @@
<source>Postponed</source> <source>Postponed</source>
<target>Verschoben</target> <target>Verschoben</target>
</trans-unit> </trans-unit>
<trans-unit id="tx_events_domain_model_date.canceled.options.postponed_date">
<source>Postponed date</source>
<target>Verschoben auf folgendes Datum</target>
</trans-unit>
<trans-unit id="tx_events_domain_model_date.canceled.options.postponed_date.0">
<source>Not defined</source>
<target>Noch nicht definiert</target>
</trans-unit>
<trans-unit id="tx_events_domain_model_date.event"> <trans-unit id="tx_events_domain_model_date.event">
<source>Associated event</source> <source>Associated event</source>
<target>Verknüpfte Veranstaltungen</target> <target>Verknüpfte Veranstaltungen</target>

View file

@ -24,6 +24,12 @@
<trans-unit id="tx_events_domain_model_date.canceled.options.postponed"> <trans-unit id="tx_events_domain_model_date.canceled.options.postponed">
<source>Postponed</source> <source>Postponed</source>
</trans-unit> </trans-unit>
<trans-unit id="tx_events_domain_model_date.canceled.options.postponed_date">
<source>Postponed date</source>
</trans-unit>
<trans-unit id="tx_events_domain_model_date.canceled.options.postponed_date.0">
<source>Not defined</source>
</trans-unit>
<trans-unit id="tx_events_domain_model_date.event"> <trans-unit id="tx_events_domain_model_date.event">
<source>Associated event</source> <source>Associated event</source>
</trans-unit> </trans-unit>

View file

@ -91,5 +91,6 @@ CREATE TABLE tx_events_domain_model_region (
CREATE TABLE tx_events_domain_model_date ( CREATE TABLE tx_events_domain_model_date (
event int(11) unsigned DEFAULT '0' NOT NULL, event int(11) unsigned DEFAULT '0' NOT NULL,
postponed_date int(11) unsigned DEFAULT '0' NOT NULL,
); );