diff --git a/src/mServer/Adressbook.php b/src/mServer/Adressbook.php index fb4314d..9eecebb 100644 --- a/src/mServer/Adressbook.php +++ b/src/mServer/Adressbook.php @@ -30,23 +30,19 @@ class Adressbook extends Client /** * Request XML helper. */ - public \Riesenia\Pohoda\Addressbook $requestXml = null; + public ?\Riesenia\Pohoda\Addressbook $requestXml = null; /** * AddressBook records name column. */ - public string $nameColumn = 'address:company'; - - /** - * AddressBook records name column. - */ - public string $nameColumn = 'address:company'; + public ?string $nameColumn = 'address:company'; /** * Create Agenda document using given data. * * @param array $data */ + #[\Override] public function create($data): void { $this->requestXml = $this->pohoda->createAddressbook($data); diff --git a/src/mServer/Bank.php b/src/mServer/Bank.php index 398f3ea..84eaa02 100644 --- a/src/mServer/Bank.php +++ b/src/mServer/Bank.php @@ -42,6 +42,7 @@ class Bank extends Client * * @param array $data */ + #[\Override] public function create($data): void { $this->requestXml = $this->pohoda->createBank($data); @@ -62,13 +63,14 @@ public function takeData($data) \Ease\Functions::divDataArray($data, $summaryData, 'homeCurrency'); \Ease\Functions::divDataArray($data, $summaryData, 'foreignCurrency'); $taken = parent::takeData($data); - - return $taken + $this->addSummary($summaryData); + $this->addSummary($summaryData); + return $taken; } /** * {@inheritDoc} */ + #[\Override] public function setObjectName($forceName = '') { return parent::setObjectName($forceName ?: $this->getDataValue('account').'@'.$this->getObjectName()); diff --git a/src/mServer/Client.php b/src/mServer/Client.php index a9886ac..9783a88 100644 --- a/src/mServer/Client.php +++ b/src/mServer/Client.php @@ -213,7 +213,7 @@ public function reset(): void { $this->dataReset(); $this->pohoda = new Pohoda($this->ico); - $this->pohoda->setApplicationName(Functions::cfg('APP_NAME', 'PHPmPohoda')); + $this->pohoda->setApplicationName(\Ease\Shared::cfg('APP_NAME', 'PHPmPohoda')); $this->xmlCache = sys_get_temp_dir().'/phpmPohoda_'.Functions::randomString().'.xml'; $this->pohoda->open($this->xmlCache, microtime(), 'generated by PHPmPohoda'); @@ -543,12 +543,10 @@ public function takeData($data) /** * Create Agenda document using given data. - * - * @param array $data */ - public function create($data) + public function create(string $data) { - $this->requestXml = $this->pohoda->create($data); + $this->requestXml = $this->pohoda->create($this->agenda, $data); return empty($this->requestXml) ? 0 : 1; } @@ -557,8 +555,6 @@ public function create($data) * Insert prepared record to Pohoda. * * @param array $data extra data - * - * @return int */ public function addToPohoda($data = []) { diff --git a/src/mServer/Invoice.php b/src/mServer/Invoice.php index 527a457..6b0f97b 100644 --- a/src/mServer/Invoice.php +++ b/src/mServer/Invoice.php @@ -30,7 +30,7 @@ class Invoice extends Client /** * Request XML helper. */ - public \Riesenia\Pohoda\Invoice $requestXml = null; + public ?\Riesenia\Pohoda\Invoice $requestXml = null; /* public function getElementMap($extra = []) { @@ -76,6 +76,7 @@ static function xmlDeserialize(\Sabre\Xml\Reader $reader) { * * @param array $data */ + #[\Override] public function create($data): void { if (\array_key_exists('invoiceSummary', $data)) { diff --git a/tests/update-address.php b/tests/update-address.php index 87a15ea..290264a 100644 --- a/tests/update-address.php +++ b/tests/update-address.php @@ -87,4 +87,4 @@ ]; $addresser = new Adressbook($addressBookRecord, \Ease\Shared::instanced()->loadConfig(__DIR__.'/.env')); -$addresser->updateInPohoda(null, ['extId' => ['exSystemName' => \Ease\Functions::cfg('APP_NAME'), 'ids' => (string) $extID]]); +$addresser->updateInPohoda(null, ['extId' => ['exSystemName' => \Ease\Shared::cfg('APP_NAME'), 'ids' => (string) $extID]]);