Path: blob/master/src/applications/calendar/xaction/PhabricatorCalendarEventRecurringTransaction.php
12256 views
<?php12final class PhabricatorCalendarEventRecurringTransaction3extends PhabricatorCalendarEventTransactionType {45const TRANSACTIONTYPE = 'calendar.recurring';67public function generateOldValue($object) {8return (int)$object->getIsRecurring();9}1011public function generateNewValue($object, $value) {12return (int)$value;13}1415public function isInheritedEdit() {16return false;17}1819public function shouldHide() {20// This event isn't interesting on its own, and is accompanied by an21// "alice set this event to repeat weekly." event in normal circumstances22// anyway.23return true;24}2526public function applyInternalEffects($object, $value) {27$object->setIsRecurring($value);28}2930public function validateTransactions($object, array $xactions) {31$errors = array();3233$old = $object->getIsRecurring();34foreach ($xactions as $xaction) {35if ($this->isNewObject()) {36continue;37}3839if ($xaction->getNewValue() == $old) {40continue;41}4243if ($xaction->getNewValue()) {44continue;45}4647$errors[] = $this->newInvalidError(48pht(49'An event can not be stopped from recurring once it has been '.50'made recurring. You can cancel the event.'),51$xaction);52}5354return $errors;55}5657}585960