Skip to content

Commit 30b8d82

Browse files
committed
Resolved #188
1 parent b96f386 commit 30b8d82

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

src/DTO/General/UserManagement/GetUsers/OutOfOffice.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@ public static function fromJson(array $data): self
1212
{
1313
if ($startDateTime = Arr::get($data, 'StartDateTime')) {
1414
$startDateTime = Str::of($startDateTime)->after('(')->before(')');
15-
// Extract milliseconds part (ignore optional timezone offset like +0000)
1615
$milliseconds = (int) (string) $startDateTime;
1716
$startDateTime = Carbon::createFromTimestampMs($milliseconds, 'UTC');
1817
}
1918

2019
if ($endDateTime = Arr::get($data, 'EndDateTime')) {
2120
$endDateTime = Str::of($endDateTime)->after('(')->before(')');
22-
// Extract milliseconds part (ignore optional timezone offset like +0000)
2321
$milliseconds = (int) (string) $endDateTime;
2422
$endDateTime = Carbon::createFromTimestampMs($milliseconds, 'UTC');
2523
}

src/Requests/Documents/ModifyDocuments/TransferDocument.php

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
namespace CodebarAg\DocuWare\Requests\Documents\ModifyDocuments;
44

5+
use CodebarAg\DocuWare\DTO\Documents\DocumentIndex\PrepareDTO;
56
use CodebarAg\DocuWare\Responses\Documents\ModifyDocuments\TransferDocumentResponse;
7+
use Illuminate\Support\Collection;
68
use Saloon\Contracts\Body\HasBody;
79
use Saloon\Enums\Method;
810
use Saloon\Http\Request;
@@ -18,9 +20,12 @@ class TransferDocument extends Request implements HasBody
1820
public function __construct(
1921
protected readonly string $fileCabinetId,
2022
protected readonly string $destinationFileCabinetId,
21-
protected readonly string $storeDialogId,
2223
protected readonly string $documentId,
23-
protected readonly array $fields = [],
24+
protected readonly ?string $storeDialogId = null,
25+
protected readonly ?Collection $fields = null,
26+
protected readonly bool $keepSource = false,
27+
protected readonly bool $fillIntellix = false,
28+
protected readonly bool $useDefaultDialog = false,
2429
) {}
2530

2631
public function resolveEndpoint(): string
@@ -39,18 +44,30 @@ protected function defaultHeaders(): array
3944

4045
protected function defaultBody(): array
4146
{
42-
return [
47+
$body = [
4348
'SourceFileCabinetId' => $this->fileCabinetId,
4449
'Documents' => [
4550
[
4651
'Id' => $this->documentId,
47-
'Fields' => $this->fields,
4852
],
4953
],
50-
'KeepSource' => false,
51-
'FillIntellix' => false,
52-
'UseDefaultDialog' => false,
54+
'KeepSource' => $this->keepSource,
55+
'FillIntellix' => $this->fillIntellix,
56+
'UseDefaultDialog' => $this->useDefaultDialog,
5357
];
58+
59+
// Add storeDialogId if provided
60+
if ($this->storeDialogId) {
61+
$body['StoreDialogId'] = $this->storeDialogId;
62+
}
63+
64+
// Add fields if provided
65+
if ($this->fields) {
66+
$fieldData = PrepareDTO::makeField($this->fields);
67+
$body['Documents'][0]['Fields'] = $fieldData['Field'];
68+
}
69+
70+
return $body;
5471
}
5572

5673
public function createDtoFromResponse(Response $response): bool

0 commit comments

Comments
 (0)