Skip to content

make accountNo optional#25

Open
lukas-staab wants to merge 1 commit into
ameax:mainfrom
lukas-staab:patch-optional-account-name
Open

make accountNo optional#25
lukas-staab wants to merge 1 commit into
ameax:mainfrom
lukas-staab:patch-optional-account-name

Conversation

@lukas-staab

@lukas-staab lukas-staab commented Jun 2, 2026

Copy link
Copy Markdown

Summary

This PR makes the $accountNo parameter nullable with a default value on both DatevAccountLedgerData::addAccountsReceivableLedger() and addAccountsPayableLedger():

  • public function addAccountsReceivableLedger(float $amount, string $accountNo, ...)
  • public function addAccountsReceivableLedger(float $amount, ?string $accountNo = null, ...)

Motivation

accountNo (the Gegenkonto / contra account) is optional in the DATEV schema this library implements. In xsds/Belegverwaltung_online_ledger_import_v060.xsd:

<xsd:element name="accountNo" type="de:p10039" minOccurs="0" maxOccurs="1">
  <xsd:documentation>Das Element accountNo enthält die Kontonummer des Gegenkontos.</xsd:documentation>
</xsd:element>

minOccurs="0" means the contra account may be omitted — DATEV resolves it later via automatic account assignment (Kontierung) rather than requiring it at import time. This is a common real-world case: the exporting system records the
amount and booking text but deliberately leaves the contra account to be determined in DATEV (e.g. by Steuerberater)

Currently the required string $accountNo forces callers to pass a value the schema treats as optional, which throws ArgumentCountError for an otherwise valid ledger entry. Every other optional field in these methods already follows
the ?type $x = null convention, so this aligns the two required-looking parameters with both the XSD and the rest of the signature.

Changes

  • $accountNo changed from string $accountNo to ?string $accountNo = null in addAccountsReceivableLedger() and addAccountsPayableLedger().

Backward compatibility

Fully backward compatible — existing callers that pass accountNo are unaffected; only the "omit it" case becomes possible. The value is already stored as-is into the ledger array and emitted (or skipped) accordingly, matching the
XSD's minOccurs="0".

@lukas-staab

lukas-staab commented Jun 8, 2026

Copy link
Copy Markdown
Author

Hey @ms-aranes any plans to merge this PR soon? Right now this is the blocking feature why i cannot use your libary, and i would like to use and ship it :) If you have any questions or suggestions please let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant