fixes bug 87 - on import of existing event: event info changed, tagged

private. Also fixes events tagged private when added using REST api.
pull/61/head
Christophe Vandeplas 2012-10-19 13:28:32 +02:00
parent e20cbf3303
commit 311a09e2b0
2 changed files with 7 additions and 6 deletions

View File

@ -266,10 +266,6 @@ class EventsController extends AppController {
// LATER do this with $this->validator()->remove('event_id');
unset($this->Event->Attribute->validate['event_id']);
unset($this->Event->Attribute->validate['value']['unique']); // otherwise gives bugs because event_id is not set
// thing a 'pull from server' sets ServersController.php:176
// Event.info is appended from the publishing side, given the need to have Server.url
$data['Event']['private'] = true;
}
if (isset($data['Event']['uuid'])) { // TODO here we should start RESTful dialog

View File

@ -176,8 +176,13 @@ class ServersController extends AppController {
$this->Server->data);
if (null != $event) {
// we have an Event array
$event['Event']['private'] = true;
$event['Event']['info'] .= "\n Imported from " . $this->Server->data['Server']['url'];
// check if the event already exist (using the uuid)
$existingEventCount = $this->Event->find('count', array('conditions' => array('Event.uuid' => $event['Event']['uuid'])));
if ($existingEventCount == 0) {
// add data for newly imported events
$event['Event']['private'] = true;
$event['Event']['info'] .= "\n Imported from " . $this->Server->data['Server']['url'];
}
$eventsController = new EventsController();
try {
$result = $eventsController->_add($event, $this->Auth, $fromXml = true, $this->Server->data['Server']['organization']);