Skip to content

Commit e9514e5

Browse files
committed
Updates version, improves relation handling, adds example
Bumps server version references across modules for consistency. Enhances relation value processing to better distinguish between associative and indexed arrays, supporting more robust data mapping. Adds a sample script for reading address data to demonstrate usage.
1 parent 8af33ef commit e9514e5

File tree

8 files changed

+60
-28
lines changed

8 files changed

+60
-28
lines changed

Examples/ReadAddress.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/php -f
2+
<?php
3+
4+
declare(strict_types=1);
5+
6+
/**
7+
* This file is part of the SpojeNet\AbraFlexi package.
8+
*
9+
* (c) 2019-2024 SpojeNet s.r.o. <http://spoje.net/>
10+
* (c) 2025 SpojeNetIT s.r.o. <http://spojenet.cz/>
11+
*
12+
* For the full copyright and license information, please view the LICENSE
13+
* file that was distributed with this source code.
14+
*/
15+
16+
namespace Example\AbraFlexi;
17+
18+
include_once './config.php';
19+
20+
include_once '../vendor/autoload.php';
21+
22+
$adr = new \AbraFlexi\Adresar(666);
23+
24+
print_r($adr->getData());

Examples/config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
* file that was distributed with this source code.
1313
*/
1414

15-
require_once '../test/bootstrap.php';
15+
require_once '../tests/bootstrap.php';

src/AbraFlexi/Actions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Actions
2424
/**
2525
* Source AbraFlexi server version.
2626
*/
27-
public static string $version = '2025.8.2';
27+
public static string $version = '2025.8.4';
2828

2929
/**
3030
* Evidence adresar (Adresy firem) Actions.

src/AbraFlexi/EvidenceList.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class EvidenceList extends RO
3838
/**
3939
* Source FlexiBee server version.
4040
*/
41-
public static string $version = '2025.8.2';
41+
public static string $version = '2025.8.4';
4242

4343
/**
4444
* Evidences Path/Name listing.
@@ -790,7 +790,7 @@ class EvidenceList extends RO
790790
'prikaz-k-inkasu-polozka' => [
791791
'evidenceName' => 'Položka inkasa',
792792
'evidencePath' => 'prikaz-k-inkasu-polozka',
793-
'importStatus' => 'DISALLOWED',
793+
'importStatus' => 'NOT_DIRECT',
794794
'formCode' => 'elInkasoPol',
795795
'evidenceType' => 'PRIKAZ_K_INKASU_POLOZKA',
796796
'beanKey' => 'cz.winstrom.vo.eban.PolozkaPrikazu$$BAN',
@@ -801,7 +801,7 @@ class EvidenceList extends RO
801801
'prikaz-k-uhrade-polozka' => [
802802
'evidenceName' => 'Položka příkazu k úhradě',
803803
'evidencePath' => 'prikaz-k-uhrade-polozka',
804-
'importStatus' => 'DISALLOWED',
804+
'importStatus' => 'NOT_DIRECT',
805805
'formCode' => 'elPrikazPol',
806806
'evidenceType' => 'PRIKAZ_K_UHRADE_POLOZKA',
807807
'beanKey' => 'cz.winstrom.vo.eban.PolozkaPrikazu$$BAN',

src/AbraFlexi/Formats.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Formats
2424
/**
2525
* Source FlexiBee server version.
2626
*/
27-
public static string $version = '2025.8.2';
27+
public static string $version = '2025.8.4';
2828

2929
/**
3030
* Availble Formats.

src/AbraFlexi/RO.php

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,28 +1084,36 @@ public function fixRecordTypes(array $record, $evidence = null)
10841084
break;
10851085
case 'relation':
10861086
if (\is_array($record[$column])) {
1087-
$value = $record[$column][0];
1088-
1089-
if (\is_array($value)) {
1090-
$valueFields = array_keys($value);
1091-
$subject = next($valueFields);
1092-
$record[$column] = new Relation(
1093-
\is_array($value) ? (\array_key_exists('kod', $value) ? $value['kod'] : $value['id']) : $value,
1094-
\array_key_exists('fkEvidencePath', $columnInfo) && null !== $columnInfo['fkEvidencePath'] ? $columnInfo['fkEvidencePath'] : $column,
1095-
\array_key_exists($subject.'@ref', $value) ? $record[$subject.'@ref'] : $value['id'],
1096-
\array_key_exists($subject.'@showAs', $value) ? $value[$subject.'@showAs'] : null,
1097-
);
1098-
1099-
foreach ($value as $a => $b) {
1100-
$record[$column][$a] = $b;
1087+
if (\Ease\Functions::isAssoc($record[$column])) {
1088+
$value = $record[$column][0];
1089+
1090+
if (\is_array($value)) {
1091+
$valueFields = array_keys($value);
1092+
$subject = next($valueFields);
1093+
$record[$column] = new Relation(
1094+
\is_array($value) ? (\array_key_exists('kod', $value) ? $value['kod'] : $value['id']) : $value,
1095+
\array_key_exists('fkEvidencePath', $columnInfo) && null !== $columnInfo['fkEvidencePath'] ? $columnInfo['fkEvidencePath'] : $column,
1096+
\array_key_exists($subject.'@ref', $value) ? $record[$subject.'@ref'] : $value['id'],
1097+
\array_key_exists($subject.'@showAs', $value) ? $value[$subject.'@showAs'] : null,
1098+
);
1099+
1100+
foreach ($value as $a => $b) {
1101+
$record[$column][$a] = $b;
1102+
}
1103+
} else {
1104+
$record[$column] = new Relation(
1105+
$value,
1106+
$column,
1107+
str_replace('ext:', '', $value),
1108+
$value,
1109+
);
11011110
}
11021111
} else {
1103-
$record[$column] = new Relation(
1104-
$value,
1105-
$column,
1106-
str_replace('ext:', '', $value),
1107-
$value,
1108-
);
1112+
foreach ($record[$column] as $relPos => $rawRelation) {
1113+
[,$ext,$extId] = explode(':', $rawRelation);
1114+
$record[$column][$ext] = new Relation($extId, $column, $ext, $rawRelation);
1115+
unset($record[$column][$relPos]);
1116+
}
11091117
}
11101118
} else {
11111119
$record[$column] = new Relation(

src/AbraFlexi/Relations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Relations
2424
/**
2525
* Source FlexiBee server version.
2626
*/
27-
public static string $version = '2025.8.2';
27+
public static string $version = '2025.8.4';
2828

2929
/**
3030
* Evidence adresar (Adresy firem) Relations.

static/EvidenceFullList.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)