From 981b2b2e6227552dbef67343cc163d2ba10c93ec Mon Sep 17 00:00:00 2001 From: Michael Calcinai Date: Tue, 27 Oct 2015 10:30:36 +1300 Subject: [PATCH] Added LinkedTransactions --- generator/generate | 7 +- .../Models/Accounting/LinkedTransaction.php | 331 +++++++++++++++++- 2 files changed, 332 insertions(+), 6 deletions(-) diff --git a/generator/generate b/generator/generate index a6c5a6ca..32effb7e 100755 --- a/generator/generate +++ b/generator/generate @@ -45,6 +45,7 @@ $scrape_apis = array( 'invoices', 'items', 'journals', + 'linked-transactions', 'manual-journals', 'organisation', 'overpayments', @@ -417,7 +418,7 @@ foreach($scrape_apis as $scrape_api) { } $property = null; - foreach(preg_split('/>\s*or\s*\s*or\s*<|\s&\s)/', $column_name) as $column_name){ //make it into another param $column_name = str_replace(' ', '', $column_name); $tmp_ro = $read_only; @@ -444,7 +445,7 @@ foreach($scrape_apis as $scrape_api) { } // Do some processing once we are at the last node. - if($node->getNode(0)->nodeValue === $last->getNode(0)->nodeValue) { + if($node->getNode(0)->nodeValue === $last->getNode(0)->nodeValue && $primary_model instanceof ParsedObjectInterface) { $models = array($primary_model); if($primary_model->getName() !== $current_model->getName()) {$models[] = $current_model;} foreach($models as $model) { @@ -485,7 +486,7 @@ foreach($apis as $api){ foreach($api->getModels() as $model){ $model_class = sprintf('\\XeroPHP\\Models\\%s', $model->getClassName(true)); - if(class_exists($model_class)){ + if(class_exists($model_class) && method_exists($model_class, 'getProperties')){ $property_position = 0; /** @var XeroPHP\Remote\ObjectInterface $model_class */ foreach($model_class::getProperties() as $name => $property_meta){ diff --git a/src/XeroPHP/Models/Accounting/LinkedTransaction.php b/src/XeroPHP/Models/Accounting/LinkedTransaction.php index 9446bd60..934e93c9 100644 --- a/src/XeroPHP/Models/Accounting/LinkedTransaction.php +++ b/src/XeroPHP/Models/Accounting/LinkedTransaction.php @@ -1,8 +1,73 @@ array (false, self::PROPERTY_TYPE_STRING, null, false, false), + 'SourceLineItemID' => array (true, self::PROPERTY_TYPE_STRING, null, false, false), + 'ContactID' => array (false, self::PROPERTY_TYPE_STRING, null, false, false), + 'TargetTransactionID' => array (false, self::PROPERTY_TYPE_STRING, null, false, false), + 'TargetLineItemID' => array (false, self::PROPERTY_TYPE_STRING, null, false, false), + 'LinkedTransactionID' => array (false, self::PROPERTY_TYPE_STRING, null, false, false), + 'Status' => array (false, self::PROPERTY_TYPE_STRING, null, false, false), + 'Type' => array (false, self::PROPERTY_TYPE_ENUM, null, false, false), + 'UpdatedDateUTC' => array (false, self::PROPERTY_TYPE_TIMESTAMP, '\\DateTime', false, false) + ); + } + + public static function isPageable() + { + return false; + } + + /** + * @return string + */ + public function getSourceTransactionID() + { + return $this->_data['SourceTransactionID']; + } + + /** + * @param string $value + * @return LinkedTransaction + */ + public function setSourceTransactionID($value) + { + $this->propertyUpdated('SourceTransactionID', $value); + $this->_data['SourceTransactionID'] = $value; + return $this; + } + + /** + * @return string + */ + public function getSourceLineItemID() + { + return $this->_data['SourceLineItemID']; + } + + /** + * @param string $value + * @return LinkedTransaction + */ + public function setSourceLineItemID($value) + { + $this->propertyUpdated('SourceLineItemID', $value); + $this->_data['SourceLineItemID'] = $value; + return $this; + } + + /** + * @return string + */ + public function getContactID() + { + return $this->_data['ContactID']; + } + + /** + * @param string $value + * @return LinkedTransaction + */ + public function setContactID($value) + { + $this->propertyUpdated('ContactID', $value); + $this->_data['ContactID'] = $value; + return $this; + } + + /** + * @return string + */ + public function getTargetTransactionID() + { + return $this->_data['TargetTransactionID']; + } + + /** + * @param string $value + * @return LinkedTransaction + */ + public function setTargetTransactionID($value) + { + $this->propertyUpdated('TargetTransactionID', $value); + $this->_data['TargetTransactionID'] = $value; + return $this; + } + + /** + * @return string + */ + public function getTargetLineItemID() + { + return $this->_data['TargetLineItemID']; + } + + /** + * @param string $value + * @return LinkedTransaction + */ + public function setTargetLineItemID($value) + { + $this->propertyUpdated('TargetLineItemID', $value); + $this->_data['TargetLineItemID'] = $value; + return $this; + } + + /** + * @return string + */ + public function getLinkedTransactionID() + { + return $this->_data['LinkedTransactionID']; + } + + /** + * @param string $value + * @return LinkedTransaction + */ + public function setLinkedTransactionID($value) + { + $this->propertyUpdated('LinkedTransactionID', $value); + $this->_data['LinkedTransactionID'] = $value; + return $this; + } + + /** + * @return string + */ + public function getStatus() + { + return $this->_data['Status']; + } + + /** + * @param string $value + * @return LinkedTransaction + */ + public function setStatus($value) + { + $this->propertyUpdated('Status', $value); + $this->_data['Status'] = $value; + return $this; + } + + /** + * @return string + */ + public function getType() + { + return $this->_data['Type']; + } + + /** + * @param string $value + * @return LinkedTransaction + */ + public function setType($value) + { + $this->propertyUpdated('Type', $value); + $this->_data['Type'] = $value; + return $this; + } + + /** + * @return \DateTime + */ + public function getUpdatedDateUTC() + { + return $this->_data['UpdatedDateUTC']; + } + + /** + * @param \DateTime $value + * @return LinkedTransaction + */ + public function setUpdatedDateUTC(\DateTime $value) + { + $this->propertyUpdated('UpdatedDateUTC', $value); + $this->_data['UpdatedDateUTC'] = $value; + return $this; + } + + +}