chg: Use a more suitable Sighting creation function as recommended, grab the Org ID from the user if present

pull/6938/head
Tom King 2021-02-11 16:31:51 +00:00
parent 07b79aee78
commit 626443af47
2 changed files with 3 additions and 3 deletions

View File

@ -4079,9 +4079,7 @@ class Attribute extends AppModel
}
if (isset($attribute['Sighting']) && !empty($attribute['Sighting'])) {
$this->Sighting = ClassRegistry::init('Sighting');
foreach ($attribute['Sighting'] as $s) {
$result = $this->Sighting->saveSightings($attribute['uuid'], false, $s['date_sighting'], $user, $s['type'], $s['source'], isset($s['uuid']) ? $s['uuid']: false);
}
$this->Sighting->captureSightings($attribute['Sighting'], $attribute['id'], $eventId, $user);
}
$fieldList = $this->editableFields;
if (empty($existingAttribute)) {

View File

@ -154,6 +154,8 @@ class Sighting extends AppModel
} else {
$orgId = $this->Organisation->captureOrg($sighting['Organisation'], $user);
}
} else if (isset($user['org_id'])) {
$orgId = $user['org_id'];
}
unset($sighting['id']);