diff --git a/src/AbraFlexi/Company.php b/src/AbraFlexi/Company.php index 02e25ba..4511cc1 100644 --- a/src/AbraFlexi/Company.php +++ b/src/AbraFlexi/Company.php @@ -166,9 +166,13 @@ public function saveBackupTo($filename) $headersBackup = $this->defaultHttpHeaders; $this->defaultHttpHeaders['Accept'] = '*/*'; $this->defaultHttpHeaders['Content-Type'] = 'application/x-winstrom-backup'; - $this->performRequest('backup', 'GET'); + $responseCode = $this->doCurlRequest( + $this->evidenceUrlWithSuffix('backup'), + 'GET', + 'winstrom-backup' + ); $this->defaultHttpHeaders = $headersBackup; - if ($this->lastResponseCode == 200) { + if ($responseCode == 200) { if (file_put_contents($filename, $this->lastCurlResponse)) { $result = true; } diff --git a/src/AbraFlexi/email.php b/src/AbraFlexi/email.php index e110446..4e0e369 100644 --- a/src/AbraFlexi/email.php +++ b/src/AbraFlexi/email.php @@ -34,8 +34,8 @@ * * @author Vítězslav Dvořák */ -trait email { - +trait email +{ /** * Get recipient for documnet. * @@ -46,7 +46,8 @@ trait email { * * @return string */ - public function getEmail() { + public function getEmail() + { if (empty($this->getDataValue('kontaktEmail'))) { $addresser = new Adresar($this->getDataValue('firma'), array_merge(['detail' => 'custom:email'], $this->getConnectionOptions())); if (empty($addresser->getDataValue('email'))) { @@ -74,7 +75,8 @@ public function getEmail() { * * @return string column divided list of email addresses */ - public function getRecipients(string $purpose = '') { + public function getRecipients(string $purpose = '') + { $recipients = []; if (empty($this->getDataValue('kontaktEmail')) === false) { $recipients[] = $this->getDataValue('kontaktEmail'); @@ -103,8 +105,9 @@ public function getRecipients(string $purpose = '') { * * @return string Contact role Fak|Obj|Nab|Ppt|Skl|Pok or '' */ - public static function docTypeToPurpose($document) { - $purposeRaw = substr(str_replace('AbraFlexi\\', '', str_replace('Poptavka', 'Pptavka', get_class($document) ) ), 0, 3); + public static function docTypeToPurpose($document) + { + $purposeRaw = substr(str_replace('AbraFlexi\\', '', str_replace('Poptavka', 'Pptavka', get_class($document))), 0, 3); return array_search($purposeRaw, ['Fak', 'Obj', 'Nab', 'Ppt', 'Skl', 'Pok']) === false ? '' : $purposeRaw; } }