From c642110dfbe6f4a5367026be4885a5290f38e273 Mon Sep 17 00:00:00 2001 From: pumpkinball <91833653+pumpkinball@users.noreply.github.com> Date: Wed, 15 Feb 2023 15:39:04 +0000 Subject: [PATCH] GetFilesAssocCount added GetFullyPaidDate for Invoice added --- authorization.php | 2 +- example.php | 37 +++++++++++++++++++++++++++++++++---- get.php | 21 ++++++++++++++++++++- xero-sdk-ui/xero.js | 4 +++- 4 files changed, 57 insertions(+), 7 deletions(-) diff --git a/authorization.php b/authorization.php index 62e4dc6..da02c72 100755 --- a/authorization.php +++ b/authorization.php @@ -23,7 +23,7 @@ $options = [ - 'scope' => ['openid email profile offline_access assets projects accounting.settings accounting.transactions accounting.contacts accounting.journals.read accounting.reports.read accounting.attachments'] + 'scope' => ['openid email profile offline_access assets projects accounting.settings accounting.transactions accounting.contacts accounting.journals.read accounting.reports.read accounting.attachments files files.read'] // finance.accountingactivity.read finance.bankstatementsplus.read finance.cashvalidation.read finance.statements.read ]; diff --git a/example.php b/example.php index 71406f9..d9cbbdd 100755 --- a/example.php +++ b/example.php @@ -319,6 +319,13 @@ public function getAccountAttachmentById($xeroTenantId,$apiInstance,$returnObj=f } } + public function getAssociationsCount($xeroTenantId, $filesApi) + { + $objects = "0c0f2162-7f7e-4816-a5f7-1e24a6299d3c,0bdc1542-6987-42f8-97a3-eb453f5314b7"; + $result = $filesApi->getAssociationsCount($xeroTenantId,$objects); + echo '
'; print_r($result); echo '
'; + } + public function getAccounts($xeroTenantId,$apiInstance,$returnObj=false) { $str = ''; @@ -665,14 +672,18 @@ public function getContacts($xeroTenantId,$apiInstance,$returnObj=false) //[Contacts:Read] // read all contacts $result = $apiInstance->getContacts($xeroTenantId); - // filter by contacts by status $where = 'ContactStatus=="ACTIVE"'; -$result2 = $apiInstance->getContacts($xeroTenantId, null, $where); +$order = "Name ASC"; +$page = 0; +$includeArchived = true; +$summaryOnly = true; +$searchTerm = ""; +$result2 = $apiInstance->getContacts($xeroTenantId, null, $where, $order,null,$page,$includeArchived,$summaryOnly,$searchTerm); //[/Contacts:Read] - $str = $str . "Get Contacts Total: " . count($result->getContacts()) . "
"; - $str = $str . "Get ACTIVE Contacts Total: " . count($result2->getContacts()) . "
"; + $str = $str . "Get Contacts Total: " . count($result->getContacts()) . "
"; + $str = $str . "Get ACTIVE Contacts Total: " . count($result2->getContacts()) . "
"; if($returnObj) { return $result2; @@ -2041,6 +2052,24 @@ public function getPayment($xeroTenantId,$apiInstance,$returnObj=false) } } + public function getPaymentFullyPaidDate($xeroTenantId,$apiInstance,$returnObj=false) + { + $str = ''; + +//[PaymentsFullyPaidDate:Read] +//$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice; +$invoiceId = '1300d9d0-cf54-4b1b-9a75-8b338a8ca7df'; +$invoice = $apiInstance->getInvoice($xeroTenantId,$invoiceId); +//$invoice->setInvoiceID($invoiceId); +var_dump( $invoice->getInvoices()[0]->getFullyPaidOnDateAsDate()); +$result = $invoice->getInvoices()[0]->getFullyPaidOnDateAsDate(); + $str = print_r($result,true) . "
"; +//[/PaymentsFullyPaidDate:Read] + +return $str; + + } + public function createPayment($xeroTenantId,$apiInstance,$returnObj=false) { $str = ''; diff --git a/get.php b/get.php index 8442d4a..a5b9d07 100755 --- a/get.php +++ b/get.php @@ -75,6 +75,11 @@ $config ); + $filesApi = new XeroAPI\XeroPHP\Api\FilesApi( + new GuzzleHttp\Client(), + $config + ); + if (isset($_POST["endpoint"]) ) { $endpoint = htmlspecialchars($_POST["endpoint"]); } else { @@ -278,7 +283,7 @@ function get_string_between($string, $start, $end){ echo $ex->createContacts($xeroTenantId,$accountingApi); break; case "Read": - echo $ex->getContact($xeroTenantId,$accountingApi); + echo $ex->getContacts($xeroTenantId,$accountingApi); break; case "UpdateOrCreate": echo $ex->updateOrCreateContacts($xeroTenantId,$accountingApi); @@ -416,6 +421,9 @@ function get_string_between($string, $start, $end){ case "Void": echo $ex->voidInvoice($xeroTenantId,$accountingApi); break; + case "FullPaidDate": + echo $ex->getPaymentFullyPaidDate($xeroTenantId,$accountingApi); + break; default: echo $action . " action not supported in API"; } @@ -960,6 +968,17 @@ function get_string_between($string, $start, $end){ } break; + case "FilesAssocCount": + switch($action) + { + case "Read": + echo $ex->getAssociationsCount($xeroTenantId,$filesApi); + break; + default: + echo $action . " action not supported in API"; + } + break; + case "FinancialStatementBalanceSheet": switch($action) { diff --git a/xero-sdk-ui/xero.js b/xero-sdk-ui/xero.js index 7e0b261..23beed5 100755 --- a/xero-sdk-ui/xero.js +++ b/xero-sdk-ui/xero.js @@ -34,7 +34,7 @@ var endpoint = [ {name: "Currencies",action:[{name: "Create"},{name: "Read"}]}, {name: "Employees",action:[{name: "Create"},{name: "CreateMulti"},{name: "Read"},{name: "Update"}]}, {name: "ExpenseClaims",action:[{name: "Create"},{name: "Read"},{name: "Update"}]}, - {name: "Invoices",action:[{name: "Create"},{name: "UpdateOrCreate"},{name: "ReadPdf"},{name: "Read"},{name: "Update"},{name: "Delete"},{name: "Void"}]}, + {name: "Invoices",action:[{name: "Create"},{name: "UpdateOrCreate"},{name: "ReadPdf"},{name: "Read"},{name: "Update"},{name: "Delete"},{name: "Void"},{name: "FullPaidDate"}]}, {name: "InvoiceReminders",action:[{name: "Read"}]}, {name: "Items",action:[{name: "Create"},{name: "CreateMulti"},{name: "Read"},{name: "Update"},{name: "Delete"}]}, {name: "Journals",action:[{name: "Read all"}, {name: "Read one by number"}]}, @@ -55,6 +55,8 @@ var endpoint = [ {name: "TrackingCategories",action:[{name: "Create"},{name: "Read"},{name: "Update"},{name: "Delete"},{name: "Archive"}]}, {name: "TrackingOptions",action:[{name: "Create"},{name: "Update"},{name: "Delete"}]}, {name: "Users",action:[{name: "Read"}]}, + {name: "---FILES---",action:[{name: ""}]}, + {name: "FilesAssocCount",action:[{name: "Read"}]}, {name: "---FIXED ASSETS---",action:[{name: ""}]}, {name: "Asset",action:[{name: "Read"},{name: "Create"},{name: "Update"}]}, {name: "Assets",action:[{name: "Read"}]},