Skip to content

Commit

Permalink
V3.2.0 (#184)
Browse files Browse the repository at this point in the history
* Fix bug when journal entry amount is 0

A journal entry amount of "0" would always results in a transaction type of "Debit". Add the ability to indicate which journal entry is Debit and which is Credit when journaling an amount of "0".

* Allow unsetting email address in vendor

Allow clearing a previously-set email address in the Vendor.  Previously, once you set an email address, you could never remove an email address.

* Write the "start" XML attribute

Write the "start" XML attribute when paging through a list.

* Allow using record number when updating customer or vendor

Previously, the library only supported using the vendor ID or customer ID when updating a vendor or customer.  Allow additionally using the record number to update.

* Allow using ReadMore for reports

Listing stored report data requires using the ReadMore function. Add a report ID to the ReadMore function.

* Fix the unit tests

After augmenting VendorUpdate, CustomerUpdate, and ReadMore to allow record ID (for the former two) and report ID (for the latter), fix the corresponding unit tests.

* Update JournalEntryLineCreate.php

Fix bug in setting transaction amount

* Fix for issue 168

* added tax entries for bill

* updated referenced versions for travis and composer to 8.1

* added description to new methods

* updated set description for primaryEmailAddress

* bump version 3.1.0 to 4.0.0

* corrected version bump from 4.0.0 to 3.2.0

* updated supported versions of php

* remove .travis.yml

* updated doxygen related files

Co-authored-by: Ben Hardin <[email protected]>
  • Loading branch information
dylan-holt-sage and bch36 authored Jul 13, 2022
1 parent c1cb79c commit 4a767c3
Show file tree
Hide file tree
Showing 27 changed files with 617 additions and 176 deletions.
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
## System Requirements

* You must have an active Sage Intacct Web Services Developer license
* PHP >= 7.3
* PHP >= 7.4
* A recent version of cURL >= 7.19.4 compiled with OpenSSL and zlib
* [Composer](composer)

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"require": {
"php": ">=7.3",
"php": ">=7.4",
"ext-dom": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
Expand Down
339 changes: 207 additions & 132 deletions docs/doxygen.conf

Large diffs are not rendered by default.

35 changes: 25 additions & 10 deletions docs/layout.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<doxygenlayout version="1.0">
<!-- Generated by doxygen 1.9.1 -->
<!-- Generated by doxygen 1.9.4 -->
<!-- Navigation index tabs for HTML output -->
<navindex>
<tab type="mainpage" visible="no" title=""/>
Expand All @@ -10,32 +10,35 @@
<tab type="namespacelist" visible="no" title="" intro=""/>
<tab type="namespacemembers" visible="no" title="" intro=""/>
</tab>
<tab type="concepts" visible="no" title="">
</tab>
<tab type="interfaces" visible="yes" title="">
<tab type="interfacelist" visible="yes" title="" intro=""/>
<tab type="interfaceindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="interfacehierarchy" visible="yes" title="" intro=""/>
</tab>
<tab type="classindex" visible="yes" title="Index"/>
<tab type="classlist" visible="yes" title="Classes" intro=""/>
<tab type="classes" visible="no" title="">
<tab type="classlist" visible="yes" title="Classes" intro=""/>
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="classindex" visible="no" title=""/>
<tab type="hierarchy" visible="no" title="" intro=""/>
<tab type="classmembers" visible="no" title="" intro=""/>
</tab>
<tab type="structs" visible="yes" title="">
<tab type="structlist" visible="yes" title="" intro=""/>
<tab type="structindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="structs" visible="no" title="">
<tab type="structlist" visible="no" title="" intro=""/>
<tab type="structindex" visible="no" title=""/>
</tab>
<tab type="exceptions" visible="yes" title="">
<tab type="exceptionlist" visible="yes" title="" intro=""/>
<tab type="exceptionindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="exceptionhierarchy" visible="yes" title="" intro=""/>
<tab type="exceptions" visible="no" title="">
<tab type="exceptionlist" visible="no" title="" intro=""/>
<tab type="exceptionindex" visible="no" title=""/>
<tab type="exceptionhierarchy" visible="no" title="" intro=""/>
</tab>
<tab type="files" visible="no" title="">
<tab type="filelist" visible="no" title="" intro=""/>
<tab type="globals" visible="no" title="" intro=""/>
</tab>
<tab type="examples" visible="yes" title="" intro=""/>
<tab type="examples" visible="no" title="" intro=""/>
</navindex>

<!-- Layout definition for a class page -->
Expand Down Expand Up @@ -105,6 +108,7 @@
<constantgroups visible="yes" title=""/>
<interfaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<concepts visible="yes" title=""/>
<structs visible="yes" title=""/>
<exceptions visible="yes" title=""/>
<typedefs title=""/>
Expand All @@ -128,6 +132,15 @@
<authorsection visible="yes"/>
</namespace>

<!-- Layout definition for a concept page -->
<concept>
<briefdescription visible="yes"/>
<includes visible="$SHOW_HEADERFILE"/>
<definition visible="yes" title=""/>
<detaileddescription title=""/>
<authorsection visible="yes"/>
</concept>

<!-- Layout definition for a file page -->
<file>
<briefdescription visible="yes"/>
Expand All @@ -141,6 +154,7 @@
<structs visible="yes" title=""/>
<exceptions visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<concepts visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
Expand Down Expand Up @@ -174,6 +188,7 @@
<dirs visible="yes" title=""/>
<files visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<concepts visible="yes" title=""/>
<classes visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
Expand Down
2 changes: 1 addition & 1 deletion src/Intacct/AbstractClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function __construct(ClientConfig $config = null)
*
* @return Xml\OnlineResponse
*/
protected function executeOnlineRequest(array $functions, RequestConfig $requestConfig = null)
protected function executeOnlineRequest(array $functions, RequestConfig &$requestConfig = null)
{
if (!$requestConfig) {
$requestConfig = new RequestConfig();
Expand Down
23 changes: 23 additions & 0 deletions src/Intacct/Functions/AccountsPayable/AbstractBill.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ abstract class AbstractBill extends AbstractFunction
/** @var string */
protected $attachmentsId;

/** @var string */
protected $taxSolutionId;

/** @var AbstractBillLine[] */
protected $lines = [];

Expand Down Expand Up @@ -535,6 +538,26 @@ public function setAttachmentsId($attachmentsId)
$this->attachmentsId = $attachmentsId;
}

/**
* Get Tax Solution Id
*
* @return string
*/
public function getTaxSolutionId()
{
return $this->taxSolutionId;
}

/**
* Set Tax Solution Id
*
* @param string $taxSolutionId
*/
public function setTaxSolutionId(string $taxSolutionId)
{
$this->taxSolutionId = $taxSolutionId;
}

/**
* Get bill lines
*
Expand Down
19 changes: 19 additions & 0 deletions src/Intacct/Functions/AccountsPayable/AbstractBillLine.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ abstract class AbstractBillLine
/** @var string */
protected $warehouseId;

/** @var AbstractBillLineTaxEntries[] */
protected $taxEntry = [];

/**
* Get account label
*
Expand Down Expand Up @@ -546,5 +549,21 @@ public function setWarehouseId($warehouseId)
$this->warehouseId = $warehouseId;
}

/**
* @return AbstractBillLineTaxEntries[]
*/
public function getTaxEntry(): array
{
return $this->taxEntry;
}

/**
* @param AbstractBillLineTaxEntries[] $taxEntry
*/
public function setTaxEntry(array $taxEntry): void
{
$this->taxEntry = $taxEntry;
}

abstract public function writeXml(XMLWriter &$xml);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php

/**
* Copyright 2021 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "LICENSE" file accompanying this file. This file is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

namespace Intacct\Functions\AccountsPayable;

use Intacct\Functions\AbstractFunction;
use Intacct\Functions\Traits\CustomFieldsTrait;
use Intacct\Xml\XMLWriter;

abstract class AbstractBillLineTaxEntries extends \Intacct\Functions\AbstractFunction
{

use CustomFieldsTrait;

protected $taxId;
protected $taxValue;

/**
* Get Tax Id
*
* @return string
*/
public function getTaxId()
{
return $this->taxId;
}

/**
* Set Tax Id
*
* @param string $taxId
*/
public function setTaxId($taxId): void
{
$this->taxId = $taxId;
}

/**
* Get Tax Value
*
* @return float|string
*/
public function getTaxValue()
{
return $this->taxValue;
}

/**
* Set Tax Value
*
* @param float|string $taxValue
*/
public function setTaxValue($taxValue): void
{
$this->taxValue = $taxValue;
}

abstract public function writeXml(XMLWriter &$xml);
}
26 changes: 25 additions & 1 deletion src/Intacct/Functions/AccountsPayable/AbstractVendor.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ abstract class AbstractVendor extends AbstractFunction

use CustomFieldsTrait;

/** @var int */
protected $recordNo;

/** @var string */
protected $vendorId;

Expand Down Expand Up @@ -232,6 +235,26 @@ abstract class AbstractVendor extends AbstractFunction
/** @var array */
protected $restrictedDepartments = [];

/**
* Get record number
*
* @return int|string
*/
public function getRecordNo()
{
return $this->recordNo;
}

/**
* Set record number
*
* @param int|string $recordNo
*/
public function setRecordNo($recordNo)
{
$this->recordNo = $recordNo;
}

/**
* Get vendor ID
*
Expand Down Expand Up @@ -544,12 +567,13 @@ public function getPrimaryEmailAddress()

/**
* Set primary email address
* Also, allows for unsetting of previously set email
*
* @param string $primaryEmailAddress
*/
public function setPrimaryEmailAddress($primaryEmailAddress)
{
if (filter_var($primaryEmailAddress, FILTER_VALIDATE_EMAIL) === false) {
if (!empty($primaryEmailAddress) && filter_var($primaryEmailAddress, FILTER_VALIDATE_EMAIL) === false) {
throw new \InvalidArgumentException('Primary Email Address is not a valid email');
}
$this->primaryEmailAddress = $primaryEmailAddress;
Expand Down
1 change: 1 addition & 0 deletions src/Intacct/Functions/AccountsPayable/BillCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public function writeXml(XMLWriter &$xml)

$xml->writeElement('nogl', $this->isDoNotPostToGL());
$xml->writeElement('supdocid', $this->getAttachmentsId());
$xml->writeElement('taxsolutionid', $this->getTaxSolutionId());

$this->writeXmlExplicitCustomFields($xml);

Expand Down
9 changes: 9 additions & 0 deletions src/Intacct/Functions/AccountsPayable/BillLineCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ public function writeXml(XMLWriter &$xml)
$xml->writeElement('warehouseid', $this->getWarehouseId());
$xml->writeElement('billable', $this->isBillable());

// if there are tax entries, lets add them to our xml
if(!empty($this->getTaxEntry())) {
$xml->startElement('taxentries');
foreach ($this->getTaxEntry() as $taxentry) {
$taxentry->writeXml($xml);
}
$xml->endElement(); //taxentries
}

$xml->endElement(); //lineitem
}
}
37 changes: 37 additions & 0 deletions src/Intacct/Functions/AccountsPayable/BillLineTaxEntriesCreate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

/**
* Copyright 2021 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "LICENSE" file accompanying this file. This file is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

namespace Intacct\Functions\AccountsPayable;

use Intacct\Xml\XMLWriter;

/**
* Create a new accounts payable bill tax entries line record
*/
class BillLineTaxEntriesCreate extends AbstractBillLineTaxEntries
{

public function writeXml(XMLWriter &$xml)
{
$xml->startElement('taxentry');

$xml->writeElement('detailid', $this->getTaxId());
$xml->writeElement('trx_tax', $this->getTaxValue());

$xml->endElement();
}
}
Loading

0 comments on commit 4a767c3

Please sign in to comment.