attach found sightings to event item

pull/3518/head
jgo 2018-07-27 13:42:29 +02:00
parent 719bcb5a65
commit b321ef7a20
1 changed files with 14 additions and 0 deletions

View File

@ -2958,6 +2958,13 @@ class Event extends AppModel
}
}
}
// zeroq: check if sightings are attached and add to event
if (isset($data['Sighting']) && !empty($data['Sighting'])) {
$this->Sighting = ClassRegistry::init('Sighting');
foreach ($data['Sighting'] as $s) {
$result = $this->Sighting->saveSightings($s['attribute_uuid'], false, $s['date_sighting'], $user, $s['type'], $s['source']);
}
}
if ($fromXml) {
$created_id = $this->id;
}
@ -3119,6 +3126,13 @@ class Event extends AppModel
}
}
}
// zeroq: if sightings then attach to event
if (isset($data['Sighting']) && !empty($data['Sighting'])) {
$this->Sighting = ClassRegistry::init('Sighting');
foreach ($data['Sighting'] as $s) {
$result = $this->Sighting->saveSightings($s['attribute_uuid'], false, $s['date_sighting'], $user, $s['type'], $s['source']);
}
}
// if published -> do the actual publishing
if ((!empty($data['Event']['published']) && 1 == $data['Event']['published'])) {
// do the necessary actions to publish the event (email, upload,...)