Skip to content
Snippets Groups Projects
Commit 2d2951ec authored by Moritz Strohm's avatar Moritz Strohm
Browse files

fixed problems regarding moving single dates and displaying the amount of repetitions, fixes #4724

Closes #4724

Merge request studip/studip!3617
parent b710bd4d
No related branches found
No related tags found
No related merge requests found
...@@ -655,7 +655,7 @@ class Calendar_DateController extends AuthenticatedController ...@@ -655,7 +655,7 @@ class Calendar_DateController extends AuthenticatedController
throw new InvalidArgumentException(); throw new InvalidArgumentException();
} }
if ($this->date->repetition_type) { if ($this->date->repetition_type !== 'SINGLE') {
PageLayout::setTitle(_('Verschieben eines Termins aus einer Terminserie')); PageLayout::setTitle(_('Verschieben eines Termins aus einer Terminserie'));
//Show the dialog to decide what shall be done with the repetition. //Show the dialog to decide what shall be done with the repetition.
if (Request::submitted('move')) { if (Request::submitted('move')) {
......
...@@ -477,9 +477,10 @@ class CalendarDate extends SimpleORMap implements PrivacyObject ...@@ -477,9 +477,10 @@ class CalendarDate extends SimpleORMap implements PrivacyObject
if ($this->interval == '1') { if ($this->interval == '1') {
//Each day //Each day
if ($this->number_of_dates > 1) { if ($this->number_of_dates > 1) {
$number_of_exceptions = CalendarDateException::countByCalendar_date_id($this->id);
$repetition_string = sprintf( $repetition_string = sprintf(
_('Täglich (%u Termine)'), _('Täglich (%u Termine)'),
$this->number_of_dates $this->number_of_dates - $number_of_exceptions
); );
} elseif ($this->repetition_end < CalendarDate::NEVER_ENDING) { } elseif ($this->repetition_end < CalendarDate::NEVER_ENDING) {
$repetition_string = sprintf( $repetition_string = sprintf(
...@@ -492,10 +493,11 @@ class CalendarDate extends SimpleORMap implements PrivacyObject ...@@ -492,10 +493,11 @@ class CalendarDate extends SimpleORMap implements PrivacyObject
} else { } else {
//Every %u day //Every %u day
if ($this->number_of_dates > 1) { if ($this->number_of_dates > 1) {
$number_of_exceptions = CalendarDateException::countByCalendar_date_id($this->id);
$repetition_string = sprintf( $repetition_string = sprintf(
_('Jeden %1$u. Tag (%2$u Termine)'), _('Jeden %1$u. Tag (%2$u Termine)'),
$this->interval, $this->interval,
$this->number_of_dates $this->number_of_dates - $number_of_exceptions
); );
} elseif ($this->repetition_end < self::NEVER_ENDING) { } elseif ($this->repetition_end < self::NEVER_ENDING) {
$repetition_string = sprintf( $repetition_string = sprintf(
...@@ -535,10 +537,11 @@ class CalendarDate extends SimpleORMap implements PrivacyObject ...@@ -535,10 +537,11 @@ class CalendarDate extends SimpleORMap implements PrivacyObject
if ($this->interval == '1') { if ($this->interval == '1') {
//Each week //Each week
if ($this->number_of_dates > 1) { if ($this->number_of_dates > 1) {
$number_of_exceptions = CalendarDateException::countByCalendar_date_id($this->id);
$repetition_string = sprintf( $repetition_string = sprintf(
ngettext('Einmal am folgenden %s', 'Jeden %1$s (%2$u Termine)', $this->number_of_dates - 1), ngettext('Einmal am folgenden %s', 'Jeden %1$s (%2$u Termine)', $this->number_of_dates - 1),
$weekday_string, $weekday_string,
$this->number_of_dates $this->number_of_dates - $number_of_exceptions
); );
} elseif ($this->repetition_end < self::NEVER_ENDING) { } elseif ($this->repetition_end < self::NEVER_ENDING) {
$repetition_string = sprintf( $repetition_string = sprintf(
...@@ -555,11 +558,12 @@ class CalendarDate extends SimpleORMap implements PrivacyObject ...@@ -555,11 +558,12 @@ class CalendarDate extends SimpleORMap implements PrivacyObject
} else { } else {
//Every %u week //Every %u week
if ($this->number_of_dates > 1) { if ($this->number_of_dates > 1) {
$number_of_exceptions = CalendarDateException::countByCalendar_date_id($this->id);
$repetition_string = sprintf( $repetition_string = sprintf(
_('Jeden %1$u. %2$s (%3$u Termine)'), _('Jeden %1$u. %2$s (%3$u Termine)'),
$this->interval, $this->interval,
$weekday_string, $weekday_string,
$this->number_of_dates $this->number_of_dates - $number_of_exceptions
); );
} elseif ($this->repetition_end < self::NEVER_ENDING) { } elseif ($this->repetition_end < self::NEVER_ENDING) {
$repetition_string = sprintf( $repetition_string = sprintf(
...@@ -637,11 +641,12 @@ class CalendarDate extends SimpleORMap implements PrivacyObject ...@@ -637,11 +641,12 @@ class CalendarDate extends SimpleORMap implements PrivacyObject
//in a specific month. //in a specific month.
if ($this->offset < 0) { if ($this->offset < 0) {
if ($this->number_of_dates > 1) { if ($this->number_of_dates > 1) {
$number_of_exceptions = CalendarDateException::countByCalendar_date_id($this->id);
$repetition_string = sprintf( $repetition_string = sprintf(
_('Jedes Jahr im %1$s am letzten %2$s (%3$u Termine)'), _('Jedes Jahr im %1$s am letzten %2$s (%3$u Termine)'),
getMonthName($this->month, false), getMonthName($this->month, false),
getWeekday($this->days, false), getWeekday($this->days, false),
$this->number_of_dates $this->number_of_dates - $number_of_exceptions
); );
} elseif ($this->repetition_end < self::NEVER_ENDING) { } elseif ($this->repetition_end < self::NEVER_ENDING) {
$repetition_string = sprintf( $repetition_string = sprintf(
...@@ -659,12 +664,13 @@ class CalendarDate extends SimpleORMap implements PrivacyObject ...@@ -659,12 +664,13 @@ class CalendarDate extends SimpleORMap implements PrivacyObject
} }
} else { } else {
if ($this->number_of_dates > 1) { if ($this->number_of_dates > 1) {
$number_of_exceptions = CalendarDateException::countByCalendar_date_id($this->id);
$repetition_string = sprintf( $repetition_string = sprintf(
_('Jedes Jahr im %1$s am %2$u. %3$s (%4$u Termine'), _('Jedes Jahr im %1$s am %2$u. %3$s (%4$u Termine'),
getMonthName($this->month, false), getMonthName($this->month, false),
$this->offset, $this->offset,
getWeekday($this->days, false), getWeekday($this->days, false),
$this->number_of_dates $this->number_of_dates - $number_of_exceptions
); );
} elseif ($this->repetition_end < self::NEVER_ENDING) { } elseif ($this->repetition_end < self::NEVER_ENDING) {
$repetition_string = sprintf( $repetition_string = sprintf(
...@@ -686,11 +692,12 @@ class CalendarDate extends SimpleORMap implements PrivacyObject ...@@ -686,11 +692,12 @@ class CalendarDate extends SimpleORMap implements PrivacyObject
} else { } else {
//Repetition on one specific day of month. //Repetition on one specific day of month.
if ($this->number_of_dates > 1) { if ($this->number_of_dates > 1) {
$number_of_exceptions = CalendarDateException::countByCalendar_date_id($this->id);
$repetition_string = sprintf( $repetition_string = sprintf(
_('Jedes Jahr am %1$u. %2$s (%3$u Termine)'), _('Jedes Jahr am %1$u. %2$s (%3$u Termine)'),
$this->offset, $this->offset,
getMonthName($this->month, false), getMonthName($this->month, false),
$this->number_of_dates $this->number_of_dates - $number_of_exceptions
); );
} elseif ($this->repetition_end < self::NEVER_ENDING) { } elseif ($this->repetition_end < self::NEVER_ENDING) {
$repetition_string = sprintf( $repetition_string = sprintf(
...@@ -714,12 +721,13 @@ class CalendarDate extends SimpleORMap implements PrivacyObject ...@@ -714,12 +721,13 @@ class CalendarDate extends SimpleORMap implements PrivacyObject
//in a specific month. //in a specific month.
if ($this->offset < 0) { if ($this->offset < 0) {
if ($this->number_of_dates > 1) { if ($this->number_of_dates > 1) {
$number_of_exceptions = CalendarDateException::countByCalendar_date_id($this->id);
$repetition_string = sprintf( $repetition_string = sprintf(
_('Jedes %1$u. Jahr im %2$s am letzten %3$s (%4$u Termine)'), _('Jedes %1$u. Jahr im %2$s am letzten %3$s (%4$u Termine)'),
$this->interval, $this->interval,
getMonthName($this->month, false), getMonthName($this->month, false),
getWeekday($this->days, false), getWeekday($this->days, false),
$this->number_of_dates $this->number_of_dates - $number_of_exceptions
); );
} elseif ($this->repetition_end < self::NEVER_ENDING) { } elseif ($this->repetition_end < self::NEVER_ENDING) {
$repetition_string = sprintf( $repetition_string = sprintf(
...@@ -739,13 +747,14 @@ class CalendarDate extends SimpleORMap implements PrivacyObject ...@@ -739,13 +747,14 @@ class CalendarDate extends SimpleORMap implements PrivacyObject
} }
} else { } else {
if ($this->number_of_dates > 1) { if ($this->number_of_dates > 1) {
$number_of_exceptions = CalendarDateException::countByCalendar_date_id($this->id);
$repetition_string = sprintf( $repetition_string = sprintf(
_('Jedes %1$u. Jahr im %2$s am %3$u. %4$s (%5$u Termine)'), _('Jedes %1$u. Jahr im %2$s am %3$u. %4$s (%5$u Termine)'),
$this->interval, $this->interval,
getMonthName($this->month, false), getMonthName($this->month, false),
$this->offset, $this->offset,
getWeekday($this->days, false), getWeekday($this->days, false),
$this->number_of_dates $this->number_of_dates - $number_of_exceptions
); );
} elseif ($this->repetition_end < self::NEVER_ENDING) { } elseif ($this->repetition_end < self::NEVER_ENDING) {
$repetition_string = sprintf( $repetition_string = sprintf(
...@@ -769,12 +778,13 @@ class CalendarDate extends SimpleORMap implements PrivacyObject ...@@ -769,12 +778,13 @@ class CalendarDate extends SimpleORMap implements PrivacyObject
} else { } else {
//Repetition on one specific day of month. //Repetition on one specific day of month.
if ($this->number_of_dates > 1) { if ($this->number_of_dates > 1) {
$number_of_exceptions = CalendarDateException::countByCalendar_date_id($this->id);
$repetition_string = sprintf( $repetition_string = sprintf(
_('Jedes %1$u. Jahr am %2$u. %3$s (%4$u Termine)'), _('Jedes %1$u. Jahr am %2$u. %3$s (%4$u Termine)'),
$this->interval, $this->interval,
$this->offset, $this->offset,
getMonthName($this->month, false), getMonthName($this->month, false),
$this->number_of_dates $this->number_of_dates - $number_of_exceptions
); );
} elseif ($this->repetition_end < self::NEVER_ENDING) { } elseif ($this->repetition_end < self::NEVER_ENDING) {
$repetition_string = sprintf( $repetition_string = sprintf(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment