From 8f5d6c959175e4ff3ce2e319847584730a39edb5 Mon Sep 17 00:00:00 2001 From: Dipak Sarkar Date: Wed, 1 Nov 2023 17:36:01 +0530 Subject: [PATCH] Fix Purchase Order and Contact Bill & Sale Issue --- src/XeroPHP/Models/Accounting/Contact.php | 22 ++++++++-- .../Accounting/Organisation/PaymentTerm.php | 42 ++++++++++++++++--- .../Models/Accounting/PurchaseOrder.php | 15 ++++++- 3 files changed, 70 insertions(+), 9 deletions(-) diff --git a/src/XeroPHP/Models/Accounting/Contact.php b/src/XeroPHP/Models/Accounting/Contact.php index 4762e70d..3d95175b 100644 --- a/src/XeroPHP/Models/Accounting/Contact.php +++ b/src/XeroPHP/Models/Accounting/Contact.php @@ -187,7 +187,7 @@ class Contact extends Remote\Model /** * The default payment terms for the contact – see Payment Terms. * - * @property PaymentTerm[] PaymentTerms + * @property PaymentTerm PaymentTerms */ /** @@ -960,7 +960,7 @@ public function setTrackingCategoryOption($value) } /** - * @return PaymentTerm[]|Remote\Collection + * @return PaymentTerm|Remote\Collection */ public function getPaymentTerms() { @@ -978,7 +978,23 @@ public function addPaymentTerm(PaymentTerm $value) if (! isset($this->_data['PaymentTerms'])) { $this->_data['PaymentTerms'] = new Remote\Collection(); } - $this->_data['PaymentTerms'][] = $value; + $this->_data['PaymentTerms'] = $value; + + return $this; + } + + /** + * @param PaymentTerm $value + * + * @return Contact + */ + public function setPaymentTerm(PaymentTerm $value) + { + $this->propertyUpdated('PaymentTerms', $value); + if (! isset($this->_data['PaymentTerms'])) { + $this->_data['PaymentTerms'] = new Remote\Collection(); + } + $this->_data['PaymentTerms'] = $value; return $this; } diff --git a/src/XeroPHP/Models/Accounting/Organisation/PaymentTerm.php b/src/XeroPHP/Models/Accounting/Organisation/PaymentTerm.php index 1707f84a..ad055f61 100644 --- a/src/XeroPHP/Models/Accounting/Organisation/PaymentTerm.php +++ b/src/XeroPHP/Models/Accounting/Organisation/PaymentTerm.php @@ -9,13 +9,13 @@ class PaymentTerm extends Remote\Model /** * Default payment terms for bills (accounts payable) – see Payment Terms. * - * @property Bill[] Bills + * @property Bill Bills */ /** * Default payment terms for sales invoices(accounts receivable) – see Payment Terms. * - * @property Sale[] Sales + * @property Sale Sales */ const DAYSAFTERBILLDATE = 'DAYSAFTERBILLDATE'; @@ -42,7 +42,7 @@ public static function getResourceURI() */ public static function getRootNodeName() { - return 'PaymentTerm'; + return 'PaymentTerms'; } /** @@ -116,7 +116,23 @@ public function addBill(Bill $value) if (! isset($this->_data['Bills'])) { $this->_data['Bills'] = new Remote\Collection(); } - $this->_data['Bills'][] = $value; + $this->_data['Bills'] = $value; + + return $this; + } + + /** + * @param Bill $value + * + * @return PaymentTerm + */ + public function setBill(Bill $value) + { + $this->propertyUpdated('Bills', $value); + if (!isset($this->_data['Bills'])) { + $this->_data['Bills'] = new Remote\Collection(); + } + $this->_data['Bills'] = $value; return $this; } @@ -140,7 +156,23 @@ public function addSale(Sale $value) if (! isset($this->_data['Sales'])) { $this->_data['Sales'] = new Remote\Collection(); } - $this->_data['Sales'][] = $value; + $this->_data['Sales'] = $value; + + return $this; + } + + /** + * @param Sale $value + * + * @return PaymentTerm + */ + public function setSale(Sale $value) + { + $this->propertyUpdated('Sales', $value); + if (!isset($this->_data['Sales'])) { + $this->_data['Sales'] = new Remote\Collection(); + } + $this->_data['Sales'] = $value; return $this; } diff --git a/src/XeroPHP/Models/Accounting/PurchaseOrder.php b/src/XeroPHP/Models/Accounting/PurchaseOrder.php index aa3b39d7..1e1488da 100644 --- a/src/XeroPHP/Models/Accounting/PurchaseOrder.php +++ b/src/XeroPHP/Models/Accounting/PurchaseOrder.php @@ -245,7 +245,6 @@ public static function getProperties() 'PurchaseOrderNumber' => [false, self::PROPERTY_TYPE_STRING, null, false, false], 'Reference' => [false, self::PROPERTY_TYPE_STRING, null, false, false], 'BrandingThemeID' => [false, self::PROPERTY_TYPE_STRING, null, false, false], - 'CurrencyCode' => [false, self::PROPERTY_TYPE_STRING, null, false, false], 'Status' => [false, self::PROPERTY_TYPE_ENUM, null, false, false], 'SentToContact' => [false, self::PROPERTY_TYPE_BOOLEAN, null, false, false], 'DeliveryAddress' => [false, self::PROPERTY_TYPE_STRING, null, false, false], @@ -254,6 +253,7 @@ public static function getProperties() 'DeliveryInstructions' => [false, self::PROPERTY_TYPE_STRING, null, false, false], 'ExpectedArrivalDate' => [false, self::PROPERTY_TYPE_DATE, '\\DateTimeInterface', false, false], 'PurchaseOrderID' => [false, self::PROPERTY_TYPE_STRING, null, false, false], + 'CurrencyCode' => [false, self::PROPERTY_TYPE_STRING, null, false, false], 'CurrencyRate' => [false, self::PROPERTY_TYPE_FLOAT, null, false, false], 'SubTotal' => [false, self::PROPERTY_TYPE_FLOAT, null, false, false], 'TotalTax' => [false, self::PROPERTY_TYPE_FLOAT, null, false, false], @@ -637,6 +637,19 @@ public function getCurrencyRate() return $this->_data['CurrencyRate']; } + /** + * @param string $value + * + * @return PurchaseOrder + */ + public function setCurrencyRate($value) + { + $this->propertyUpdated('CurrencyRate', $value); + $this->_data['CurrencyRate'] = $value; + + return $this; + } + /** * @return float */