Skip to content

Commit

Permalink
v2.3.0 (#160)
Browse files Browse the repository at this point in the history
* Add Batch Key support to ArPaymentCreate and testing against 7.4 to Travis

* Add TaskId to GLENTRY, Fix GlobalConsolidation processOffline

* Rollback adding 7.4 support.

* Add Decline AP Payements Request

* Add showprivate to Query

* Fix IsNegate for InArrayInteger and InArrayString #150

* Add approve and decline for PurchasingTransactions #144

* Incorporate code review comments

* Bump version number 2.3.0
  • Loading branch information
intacctcoleenho authored Sep 29, 2020
1 parent 9d6a9cb commit b8188d3
Show file tree
Hide file tree
Showing 23 changed files with 459 additions and 36 deletions.
50 changes: 50 additions & 0 deletions src/Intacct/Functions/AccountsPayable/ApPaymentRequestDecline.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

/**
* Copyright 2020 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;
use InvalidArgumentException;

/*
* Decline an existing AP payment request record
*/
class ApPaymentRequestDecline extends AbstractApPaymentRequest
{
/**
* Write the function block XML
*
* @param XMLWriter $xml
* @throw InvalidArgumentException
*/
public function writeXml(XMLWriter &$xml)
{
$xml->startElement('function');
$xml->writeAttribute('controlid', $this->getControlId());

$xml->startElement('decline_appaymentrequest');

if (!$this->getRecordNo()) {
throw new InvalidArgumentException('Record No is required for decline');
}
$xml->writeAttribute('key', $this->getRecordNo());

$xml->endElement(); //decline_appaymentrequest

$xml->endElement(); //function
}
}
23 changes: 23 additions & 0 deletions src/Intacct/Functions/AccountsReceivable/AbstractArPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ abstract class AbstractArPayment extends AbstractFunction
/** @var string */
protected $paymentMethod;

/** @var string|int */
protected $summaryRecordNo;

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

Expand Down Expand Up @@ -156,6 +159,26 @@ public function setPaymentMethod($paymentMethod)
$this->paymentMethod = $paymentMethod;
}

/**
* Get Summary Record No (Batch Key)
*
* @return int|string
*/
public function getSummaryRecordNo()
{
return $this->summaryRecordNo;
}

/**
* Set Summary Record No (Batch Key)
*
* @param string|int $summaryRecordNo
*/
public function setSummaryRecordNo($summaryRecordNo)
{
$this->summaryRecordNo = $summaryRecordNo;
}

/**
* Get bank account ID
*
Expand Down
24 changes: 0 additions & 24 deletions src/Intacct/Functions/AccountsReceivable/ArPaymentApply.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,6 @@
*/
class ArPaymentApply extends AbstractArPayment
{

/** @var string|int */
protected $summaryRecordNo;

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

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

/**
*
* @param XMLWriter $xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function writeXml(XMLWriter &$xml)
}
$xml->writeElement('customerid', $this->getCustomerId(), true);
$xml->writeElement('paymentamount', $this->getTransactionPaymentAmount(), true);
$xml->writeElement('batchkey', $this->getSummaryRecordNo());
$xml->writeElement('translatedamount', $this->getBasePaymentAmount());

if ($this->getUndepositedFundsGlAccountNo()) {
Expand Down
45 changes: 43 additions & 2 deletions src/Intacct/Functions/Common/NewQuery/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ class Query extends AbstractFunction implements QueryFunctionInterface
/** @var bool */
private $caseInsensitive;

/** @var bool */
private $showPrivate;

/** @var int */
private $pageSize;

Expand Down Expand Up @@ -239,6 +242,33 @@ public function caseInsensitive(bool $caseInsensitive): QueryFunctionInterface
return $this;
}

/**
* @return bool|null
*/
public function isShowPrivate() //: ?bool
{
return $this->showPrivate;
}

/**
* @param bool $showPrivate
*/
public function setShowPrivate(bool $showPrivate)
{
$this->showPrivate = $showPrivate;
}

/**
* @param bool $showPrivate
* @return QueryFunctionInterface
*/
public function showPrivate(bool $showPrivate): QueryFunctionInterface
{
$this->setShowPrivate($showPrivate);

return $this;
}

/**
* @return int|null
*/
Expand Down Expand Up @@ -303,6 +333,11 @@ public function offset(int $offset): QueryFunctionInterface
return $this;
}

private function hasOptions()
{
return $this->isShowPrivate() || $this->isCaseInsensitive();
}

/**
* @param XMLWriter $xml
* @throws InvalidArgumentException
Expand Down Expand Up @@ -353,9 +388,15 @@ public function writeXML(XMLWriter &$xml)
$xml->endElement(); // orderby
}

if ($this->isCaseInsensitive()) {
if ($this->hasOptions()) {
$xml->startElement('options');
$xml->writeElement('caseinsensitive', $this->isCaseInsensitive(), false);

if ($this->isCaseInsensitive()) {
$xml->writeElement('caseinsensitive', $this->isCaseInsensitive(), false);
}
if ($this->isShowPrivate()) {
$xml->writeElement('showprivate', $this->isShowPrivate(), false);
}
$xml->endElement();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ class InArrayInteger extends AbstractArrayInteger
public function __toString(): string
{
$clause = '';
$notClause = '';
if ($this->isNegate() === true) {
$clause = 'NOT ';
$notClause = ' NOT';
}
$pieces = [];
foreach ($this->getValue() as $value) {
$pieces[] = $value;
}
$clause .= $this->getField() . " IN (" . implode(',', $pieces) . ")";
$clause = $this->getField() . $notClause . " IN (" . implode(',', $pieces) . ")";

return $clause;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ class InArrayString extends AbstractArrayString
public function __toString(): string
{
$clause = '';
$notClause = '';
if ($this->isNegate() === true) {
$clause = 'NOT ';
$notClause = ' NOT';
}
$pieces = [];
foreach ($this->getValue() as $value) {
$pieces[] = "'" . addcslashes($value, "'") . "'";
}
$clause .= $this->getField() . " IN (" . implode(',', $pieces) . ")";
$clause = $this->getField() . $notClause . " IN (" . implode(',', $pieces) . ")";

return $clause;
}
Expand Down
19 changes: 19 additions & 0 deletions src/Intacct/Functions/GeneralLedger/AbstractGlEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ abstract class AbstractGlEntry
/** @var string */
protected $projectId;

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

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

Expand Down Expand Up @@ -166,6 +169,22 @@ public function setProjectId($projectId)
$this->projectId = $projectId;
}

/**
* @return string
*/
public function getTaskId()
{
return $this->taskId;
}

/**
* @param string $taskId
*/
public function setTaskId($taskId)
{
$this->taskId = $taskId;
}

/**
* @return string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function writeXml(XMLWriter &$xml)
$xml->writeElement('LOCATION', $this->getLocationId());
$xml->writeElement('DEPARTMENT', $this->getDepartmentId());
$xml->writeElement('PROJECTID', $this->getProjectId());
$xml->writeElement('TASKID', $this->getTaskId());
$xml->writeElement('CUSTOMERID', $this->getCustomerId());
$xml->writeElement('VENDORID', $this->getVendorId());
$xml->writeElement('EMPLOYEEID', $this->getEmployeeId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ public function writeXml(XMLWriter &$xml)
}
$xml->writeElement('reportingperiodname', $this->getReportingPeriodName(), true);

$xml->writeElement('offline', $this->isProcessOffline());
if ($this->processOffline === true) {
$xml->writeElement('offline', 'T');
} elseif ($this->processOffline === false) {
$xml->writeElement('offline', 'F');
}

$xml->writeElement('updatesucceedingperiods', $this->isUpdateSucceedingPeriods());
$xml->writeElement('changesonly', $this->isChangesOnly());
$xml->writeElement('email', $this->getNotificationEmail());
Expand Down
19 changes: 19 additions & 0 deletions src/Intacct/Functions/Purchasing/AbstractPurchasingTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ abstract class AbstractPurchasingTransaction extends AbstractFunction
/** @var AbstractPurchasingTransactionLine[] */
protected $lines = [];

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

/**
* @return string
*/
Expand Down Expand Up @@ -566,4 +569,20 @@ public function setLines($lines)
{
$this->lines = $lines;
}

/**
* @return string
*/
public function getComment()
{
return $this->comment;
}

/**
* @param $comment
*/
public function setComment($comment)
{
$this->comment = $comment;
}
}
48 changes: 48 additions & 0 deletions src/Intacct/Functions/Purchasing/PurchasingTransactionApprove.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

/**
* Copyright 2020 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\Purchasing;

use Intacct\Xml\XMLWriter;

class PurchasingTransactionApprove extends AbstractPurchasingTransaction
{
/**
* Write the function block XML
*
* @param XMLWriter $xml
*/
public function writeXml(XMLWriter &$xml)
{
$xml->startElement('function');
$xml->writeAttribute('controlid', $this->getControlId());

$xml->startElement('approve');

$xml->startElement('PODOCUMENT');

$xml->writeElement('DOCID', $this->getExternalId(), false);

$xml->writeElement('COMMENT', $this->getComment());

$xml->endElement(); //PODOCUMENT

$xml->endElement(); //approve

$xml->endElement(); //function
}
}
Loading

0 comments on commit b8188d3

Please sign in to comment.