fix ea pn repositories

This commit is contained in:
yuri
2019-01-09 14:46:01 +02:00
parent 62dcc1f55b
commit 8d13668595
2 changed files with 27 additions and 27 deletions
@@ -252,15 +252,15 @@ class PhoneNumber extends \Espo\Core\ORM\Repositories\RDB
$new = true;
$changed = false;
if ($hash->$key['primary']) {
if ($hash->{$key}['primary']) {
$primary = $key;
}
if (property_exists($hashPrevious, $key)) {
$new = false;
$changed = $hash->$key['type'] != $hashPrevious->$key['type'];
if ($hash->$key['primary']) {
if ($hash->$key['primary'] == $hashPrevious->$key['primary']) {
$changed = $hash->{$key}['type'] != $hashPrevious->$key['type'];
if ($hash->{$key}['primary']) {
if ($hash->{$key}['primary'] == $hashPrevious->$key['primary']) {
$primary = false;
}
}
@@ -301,7 +301,7 @@ class PhoneNumber extends \Espo\Core\ORM\Repositories\RDB
$skipSave = $this->checkChangeIsForbidden($phoneNumber, $entity);
if (!$skipSave) {
$phoneNumber->set([
'type' => $hash->$number['type'],
'type' => $hash->{$number}['type'],
]);
$this->save($phoneNumber);
} else {
@@ -319,15 +319,15 @@ class PhoneNumber extends \Espo\Core\ORM\Repositories\RDB
$phoneNumber->set([
'name' => $number,
'type' => $hash->$number['type'],
'type' => $hash->{$number}['type'],
]);
$this->save($phoneNumber);
} else {
$skipSave = $this->checkChangeIsForbidden($phoneNumber, $entity);
if (!$skipSave) {
if ($phoneNumber->get('type') != $hash->$number['type']) {
if ($phoneNumber->get('type') != $hash->{$number}['type']) {
$phoneNumber->set([
'type' => $hash->$number['type'],
'type' => $hash->{$number}['type'],
]);
$this->save($phoneNumber);
}