Skip to content

Commit c448364

Browse files
committed
Fixes ExtID parsing for relation records
Improves handling of external IDs in relation data by correcting array access and parsing logic. Ensures reliable creation of relation objects when processing records with ExtIDs, reducing errors in ID extraction and assignment.
1 parent c454be2 commit c448364

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

debian/changelog

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
php-spojenet-abraflexi (3.6.4) UNRELEASED; urgency=medium
1+
php-spojenet-abraflexi (3.6.5) UNRELEASED; urgency=medium
2+
3+
* ExtID parsing fix
4+
5+
-- vitex <info@vitexsoftware.cz> Thu, 20 Nov 2025 00:15:49 +0100
6+
7+
php-spojenet-abraflexi (3.6.4) experimental; urgency=medium
28

39
* fixRecordTypes now can handle relation without code
410

5-
-- vitex <info@vitexsoftware.cz> Tue, 21 Oct 2025 14:58:59 +0200
11+
-- vitex <info@vitexsoftware.cz> Thu, 20 Nov 2025 00:15:31 +0100
612

713
php-spojenet-abraflexi (3.6.3) experimental; urgency=medium
814

src/AbraFlexi/RO.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,8 +1111,8 @@ public function fixRecordTypes(array $record, $evidence = null)
11111111
case 'relation':
11121112
if (\is_array($record[$column])) {
11131113
$value = $record[$column][0];
1114-
if (\Ease\Functions::isAssoc($record[$column])) {
11151114

1115+
if (\Ease\Functions::isAssoc($record[$column])) {
11161116
if (\is_array($value)) {
11171117
$valueFields = array_keys($value);
11181118
$subject = next($valueFields);
@@ -1135,17 +1135,12 @@ public function fixRecordTypes(array $record, $evidence = null)
11351135
);
11361136
}
11371137
} else { // ExtIDs
1138-
if(count($record[$column]) == 1) {
1139-
$record[$column] = new Relation(
1140-
\array_key_exists('kod', $value) ? $value['kod'] : $value['id'],
1141-
$record[$column][0]['typDoklK'],
1142-
$record[$column][0]['id'],
1143-
$record[$column][0]['typDoklK@showAs']
1144-
);
1138+
if (\count($record[$column]) === 1) {
1139+
$record[$column] = new Relation(\array_key_exists('kod', $value[0]) ? $value[0]['kod'] : $value[0]['id'], $value[0]['typDoklK'], $value[0]['id'], $value[0]['typDoklK@showAs']);
11451140
} else {
11461141
foreach ($record[$column] as $relPos => $rawRelation) {
11471142
[,$ext,$extId] = explode(':', $rawRelation);
1148-
$record[$column][$ext] = new Relation($rawRelation, $ext, $extId, $column.' '.$ext.':'.$extId );
1143+
$record[$column][$ext] = new Relation($rawRelation, $ext, $extId, $column.' '.$ext.':'.$extId);
11491144
unset($record[$column][$relPos]);
11501145
}
11511146
}
@@ -2113,7 +2108,8 @@ public function getPrevRecordID($conditions = [])
21132108
public function getExternalID($want = null)
21142109
{
21152110
$ids = (array) $this->getExternalIDs();
2116-
return array_key_exists($want, $ids) ? $ids[$want] : current($ids);
2111+
2112+
return \array_key_exists($want, $ids) ? $ids[$want] : current($ids);
21172113
}
21182114

21192115
/**

0 commit comments

Comments
 (0)