fix: Invalid uuid used in the objectreferences add form

pull/2517/head
iglocska 2017-09-27 15:12:45 +02:00
parent 63e934824c
commit 36f6c9685d
4 changed files with 8 additions and 7 deletions

View File

@ -46,7 +46,7 @@ class AppController extends Controller {
public $helpers = array('Utility');
private $__queryVersion = '19';
private $__queryVersion = '20';
public $pyMispVersion = '2.4.80';
public $phpmin = '5.6.5';
public $phprec = '7.0.16';

View File

@ -53,7 +53,7 @@ class ObjectReferencesController extends AppController {
}
$referenced_type = 1;
$target_object = $this->ObjectReference->Object->find('first', array(
'conditions' => array('Object.uuid' => $this->request->data['ObjectReference']['object_uuid']),
'conditions' => array('Object.uuid' => $this->request->data['ObjectReference']['referenced_uuid']),
'recursive' => -1,
'fields' => array('Object.id', 'Object.uuid', 'Object.event_id')
));
@ -64,8 +64,9 @@ class ObjectReferencesController extends AppController {
throw new NotFoundException('Invalid target. Target has to be within the same event.');
}
} else {
debug($this->request->data);
$target_attribute = $this->ObjectReference->Object->Attribute->find('first', array(
'conditions' => array('Attribute.uuid' => $this->request->data['ObjectReference']['uuid']),
'conditions' => array('Attribute.uuid' => $this->request->data['ObjectReference']['referenced_uuid']),
'recursive' => -1,
'fields' => array('Attribute.id', 'Attribute.uuid', 'Attribute.event_id')
));

View File

@ -38,7 +38,7 @@
<div class="row-fluid">
<div class="span6">
<?php
echo $this->Form->input('uuid', array(
echo $this->Form->input('referenced_uuid', array(
'label' => 'Target UUID',
'div' => false,
'style' => 'width:320px;'

View File

@ -3146,8 +3146,8 @@ function objectReferenceInput() {
var types = ["Attribute", "Object"];
for (var type in types) {
for (var k in targetEvent[types[type]]) {
if (targetEvent[types[type]][k]['uuid'] == $('#ObjectReferenceUuid').val()) {
$('#targetSelect').val($('#ObjectReferenceUuid').val());
if (targetEvent[types[type]][k]['uuid'] == $('#ObjectReferenceReferencedUuid').val()) {
$('#targetSelect').val($('#ObjectReferenceReferencedUuid').val());
changeObjectReferenceSelectOption();
}
}
@ -3167,7 +3167,7 @@ function objectReferenceCheckForCustomRelationship() {
function changeObjectReferenceSelectOption() {
var object = $('#targetSelect option:selected');
var uuid = $(object).val();
$('#ObjectReferenceUuid').val(uuid);
$('#ObjectReferenceReferencedUuid').val(uuid);
var type = $(object).data('type');
if (type == "Attribute") {
$('#targetData').html("");