From 5d6a450011603fbfe3d6c47259980abc4bd2523a Mon Sep 17 00:00:00 2001 From: sp Date: Thu, 9 Jun 2022 00:34:21 +1000 Subject: [PATCH] bugfix for xero refresh token when things goes wrong, email is sent to patrick for manual operation. --- .idea/vcs.xml | 1 + Storage.php | 4 +++- XeroOauth2Timesheet.php | 5 ++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..7c57d90 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/Storage.php b/Storage.php index 4c196b0..1b2947e 100644 --- a/Storage.php +++ b/Storage.php @@ -88,7 +88,9 @@ class StorageClass $this->write_json(); } - + public function tokenExpiresHumanRedable(){ + return $this->oauth2['expires_human']; + } private function getExpiresHuman($time_stamp) { $expire = date("Y-m-d H:i:s", $time_stamp); $utc_date = \DateTime::createFromFormat( diff --git a/XeroOauth2Timesheet.php b/XeroOauth2Timesheet.php index ee9fd1d..770a404 100644 --- a/XeroOauth2Timesheet.php +++ b/XeroOauth2Timesheet.php @@ -67,7 +67,7 @@ class XeroOauth2Timesheet $ts->setStatus(\XeroAPI\XeroPHP\Models\PayrollAu\TimesheetStatus::DRAFT); } //adding lines - $tsLines = []; + $tsLines=[]; foreach ($rateshours as $rateId => $hours) { $ts_line = new \XeroAPI\XeroPHP\Models\PayrollAu\TimesheetLine; @@ -148,7 +148,6 @@ class XeroOauth2Timesheet } } $this->apiPayrollAu->createTimesheet($this->oauth2->getTenantId(),$to_save); - return; } public function approve_all(){ @@ -193,4 +192,4 @@ class XeroOauth2Timesheet $line->setNumberOfUnits($unit); return $line; } -} \ No newline at end of file +}