Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend all testing #3

Merged
merged 2 commits into from
May 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use PhpTwinfield\Fields\BehaviourField;
use PhpTwinfield\Fields\CodeField;
use PhpTwinfield\Fields\InUseField;
use PhpTwinfield\Fields\Level1234\DimensionTypeField;
use PhpTwinfield\Fields\Level1234\DimensionType\TypeField;
use PhpTwinfield\Fields\NameField;
use PhpTwinfield\Fields\OfficeField;
use PhpTwinfield\Fields\ShortNameField;
Expand All @@ -23,21 +23,21 @@ class Activity extends BaseObject
{
use BehaviourField;
use CodeField;
use DimensionTypeField;
use InUseField;
use NameField;
use OfficeField;
use ShortNameField;
use StatusField;
use TouchedField;
use TypeField;
use UIDField;
use VatCodeField;

private $projects;

public function __construct()
{
$this->setTypeFromCode('ACT');
$this->setTypeFromString('ACT');
$this->setProjects(new ActivityProjects);
}

Expand Down
2 changes: 1 addition & 1 deletion src/ApiConnectors/BaseApiConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,4 @@ public function mapListAll(string $className, $data, array $objectListAllTags):

return $objects;
}
}
}
2 changes: 1 addition & 1 deletion src/ApiConnectors/InvoiceApiConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function listAll(
$invoiceListAllTags = array(
0 => 'setInvoiceNumber',
1 => 'setInvoiceAmountFromFloat',
2 => 'setCustomerFromCode',
2 => 'setCustomerFromString',
3 => 'setCustomerName',
4 => 'setDebitCreditFromString',
);
Expand Down
2 changes: 1 addition & 1 deletion src/ApiConnectors/OfficeApiConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function listAll(
$officeListAllTags = array(
0 => 'setCode',
1 => 'setName',
2 => 'setCountryCode',
2 => 'setCountryCodeFromString',
3 => 'setVatPeriod',
4 => 'setVatFirstQuarterStartsIn',
);
Expand Down
8 changes: 4 additions & 4 deletions src/Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
use PhpTwinfield\Fields\Invoice\Article\AllowChangeUnitsPriceField;
use PhpTwinfield\Fields\Invoice\Article\AllowChangeVatCodeField;
use PhpTwinfield\Fields\Invoice\Article\AllowDecimalQuantityField;
use PhpTwinfield\Fields\Invoice\Article\ArticlePercentageField;
use PhpTwinfield\Fields\Invoice\Article\ArticleTypeField;
use PhpTwinfield\Fields\Invoice\Article\PercentageField;
use PhpTwinfield\Fields\Invoice\Article\TypeField;
use PhpTwinfield\Fields\Invoice\Article\UnitNamePluralField;
use PhpTwinfield\Fields\Invoice\Article\UnitNameSingularField;
use PhpTwinfield\Fields\Invoice\PerformanceTypeField;
Expand All @@ -30,14 +30,14 @@ class Article extends BaseObject
use AllowChangeVatCodeField;
use AllowDecimalQuantityField;
use AllowDiscountOrPremiumField;
use ArticlePercentageField;
use ArticleTypeField;
use CodeField;
use NameField;
use OfficeField;
use PercentageField;
use PerformanceTypeField;
use ShortNameField;
use StatusField;
use TypeField;
use UnitNamePluralField;
use UnitNameSingularField;
use VatCodeField;
Expand Down
8 changes: 4 additions & 4 deletions src/ArticleLine.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use PhpTwinfield\Fields\FreeText3Field;
use PhpTwinfield\Fields\IDField;
use PhpTwinfield\Fields\InUseField;
use PhpTwinfield\Fields\Invoice\Article\ArticleLineFreeText1Field;
use PhpTwinfield\Fields\Invoice\Article\ArticleLineFreeText2Field;
use PhpTwinfield\Fields\Invoice\Article\FreeText1Field;
use PhpTwinfield\Fields\Invoice\Article\FreeText2Field;
use PhpTwinfield\Fields\Invoice\Article\SubCodeField;
use PhpTwinfield\Fields\Invoice\UnitsField;
use PhpTwinfield\Fields\Invoice\UnitsPriceExclField;
Expand All @@ -21,8 +21,8 @@
*/
class ArticleLine extends BaseObject
{
use ArticleLineFreeText1Field;
use ArticleLineFreeText2Field;
use FreeText1Field;
use FreeText2Field;
use FreeText3Field;
use IDField;
use InUseField;
Expand Down
6 changes: 3 additions & 3 deletions src/CostCenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use PhpTwinfield\Fields\BehaviourField;
use PhpTwinfield\Fields\CodeField;
use PhpTwinfield\Fields\InUseField;
use PhpTwinfield\Fields\Level1234\DimensionTypeField;
use PhpTwinfield\Fields\Level1234\DimensionType\TypeField;
use PhpTwinfield\Fields\NameField;
use PhpTwinfield\Fields\OfficeField;
use PhpTwinfield\Fields\ShortNameField;
Expand All @@ -22,17 +22,17 @@ class CostCenter extends BaseObject
{
use BehaviourField;
use CodeField;
use DimensionTypeField;
use InUseField;
use NameField;
use OfficeField;
use ShortNameField;
use StatusField;
use TouchedField;
use TypeField;
use UIDField;

public function __construct()
{
$this->setTypeFromCode('KPL');
$this->setTypeFromString('KPL');
}
}
18 changes: 9 additions & 9 deletions src/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
use PhpTwinfield\Fields\BehaviourField;
use PhpTwinfield\Fields\CodeField;
use PhpTwinfield\Fields\InUseField;
use PhpTwinfield\Fields\Level1234\BeginPeriodField;
use PhpTwinfield\Fields\Level1234\BeginYearField;
use PhpTwinfield\Fields\Level1234\DimensionGroupField;
use PhpTwinfield\Fields\Level1234\DimensionTypeField;
use PhpTwinfield\Fields\Level1234\DimensionGroup\GroupField;
use PhpTwinfield\Fields\Level1234\DimensionType\TypeField;
use PhpTwinfield\Fields\Level1234\EndPeriodField;
use PhpTwinfield\Fields\Level1234\EndYearField;
use PhpTwinfield\Fields\Level1234\GeneralLedgerBeginPeriodField;
use PhpTwinfield\Fields\Level1234\GeneralLedgerEndPeriodField;
use PhpTwinfield\Fields\Level1234\Level2\Customer\DiscountArticleField;
use PhpTwinfield\Fields\Level1234\Level2\Customer\DiscountArticleIDField;
use PhpTwinfield\Fields\Level1234\Level2\PaymentConditionDiscountDaysField;
Expand All @@ -31,16 +31,15 @@
*/
class Customer extends BaseObject
{
use BeginPeriodField;
use BeginYearField;
use BehaviourField;
use CodeField;
use DimensionGroupField;
use DimensionTypeField;
use DiscountArticleField;
use DiscountArticleIDField;
use EndPeriodField;
use EndYearField;
use GeneralLedgerBeginPeriodField;
use GeneralLedgerEndPeriodField;
use GroupField;
use InUseField;
use NameField;
use OfficeField;
Expand All @@ -51,6 +50,7 @@ class Customer extends BaseObject
use ShortNameField;
use StatusField;
use TouchedField;
use TypeField;
use UIDField;
use WebsiteField;

Expand All @@ -66,7 +66,7 @@ public function __construct()
$this->setBeginYear(0);
$this->setEndPeriod(0);
$this->setEndYear(0);
$this->setTypeFromCode('DEB');
$this->setTypeFromString('DEB');

$this->setCreditManagement(new CustomerCreditManagement);
$this->setFinancials(new CustomerFinancials);
Expand Down
4 changes: 2 additions & 2 deletions src/CustomerAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace PhpTwinfield;

use PhpTwinfield\Fields\IDField;
use PhpTwinfield\Fields\Level1234\Level2\AddressTypeField;
use PhpTwinfield\Fields\Level1234\Level2\CityField;
use PhpTwinfield\Fields\Level1234\Level2\CountryField;
use PhpTwinfield\Fields\Level1234\Level2\DefaultField;
Expand All @@ -17,6 +16,7 @@
use PhpTwinfield\Fields\Level1234\Level2\PostcodeField;
use PhpTwinfield\Fields\Level1234\Level2\TelefaxField;
use PhpTwinfield\Fields\Level1234\Level2\TelephoneField;
use PhpTwinfield\Fields\Level1234\Level2\TypeField;
use PhpTwinfield\Fields\NameField;

/**
Expand All @@ -25,7 +25,6 @@
*/
class CustomerAddress extends BaseObject
{
use AddressTypeField;
use CityField;
use CountryField;
use DefaultField;
Expand All @@ -41,4 +40,5 @@ class CustomerAddress extends BaseObject
use PostcodeField;
use TelefaxField;
use TelephoneField;
use TypeField;
}
4 changes: 2 additions & 2 deletions src/CustomerChildValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use PhpTwinfield\Fields\ElementValueField;
use PhpTwinfield\Fields\Level1234\LevelField;
use PhpTwinfield\Fields\Level1234\GeneralLedgerTypeField;
use PhpTwinfield\Fields\Level1234\TypeField;

/**
* @see https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/Customers
Expand All @@ -14,5 +14,5 @@ class CustomerChildValidation extends BaseObject
{
use ElementValueField;
use LevelField;
use GeneralLedgerTypeField;
use TypeField;
}
4 changes: 2 additions & 2 deletions src/CustomerCollectMandate.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace PhpTwinfield;

use PhpTwinfield\Fields\Level1234\Level2\Customer\CollectMandateIDField;
use PhpTwinfield\Fields\Level1234\Level2\Customer\FirstRunDateField;
use PhpTwinfield\Fields\Level1234\Level2\Customer\IDField;
use PhpTwinfield\Fields\Level1234\Level2\Customer\SignatureDateField;

/**
Expand All @@ -12,7 +12,7 @@
*/
class CustomerCollectMandate extends BaseObject
{
use CollectMandateIDField;
use FirstRunDateField;
use IDField;
use SignatureDateField;
}
4 changes: 2 additions & 2 deletions src/CustomerCreditManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use PhpTwinfield\Fields\Level1234\Level2\Customer\BlockedLockedField;
use PhpTwinfield\Fields\Level1234\Level2\Customer\BlockedModifiedField;
use PhpTwinfield\Fields\Level1234\Level2\Customer\CommentField;
use PhpTwinfield\Fields\Level1234\Level2\Customer\CustomerFreeText1Field;
use PhpTwinfield\Fields\Level1234\Level2\Customer\FreeText1Field;
use PhpTwinfield\Fields\Level1234\Level2\Customer\ReminderEmailField;
use PhpTwinfield\Fields\Level1234\Level2\Customer\ResponsibleUserField;
use PhpTwinfield\Fields\Level1234\Level2\Customer\SendReminderField;
Expand All @@ -25,7 +25,7 @@ class CustomerCreditManagement extends BaseObject
use BlockedLockedField;
use BlockedModifiedField;
use CommentField;
use CustomerFreeText1Field;
use FreeText1Field;
use FreeText2Field;
use FreeText3Field;
use ReminderEmailField;
Expand Down
8 changes: 4 additions & 4 deletions src/DimensionGroupDimension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

namespace PhpTwinfield;

use PhpTwinfield\Fields\Level1234\DimensionGroup\DimensionCodeField;
use PhpTwinfield\Fields\Level1234\DimensionTypeField;
use PhpTwinfield\Fields\Level1234\DimensionGroup\CodeField;
use PhpTwinfield\Fields\Level1234\DimensionType\TypeField;

/**
* @see https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/DimensionGroups
* @todo Add documentation and typehints to all properties.
*/
class DimensionGroupDimension extends BaseObject
{
use DimensionCodeField;
use DimensionTypeField;
use CodeField;
use TypeField;
}
8 changes: 4 additions & 4 deletions src/DimensionTypeLevels.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

namespace PhpTwinfield;

use PhpTwinfield\Fields\Level1234\DimensionType\DimensionTypeFinancialsField;
use PhpTwinfield\Fields\Level1234\DimensionType\DimensionTypeTimeField;
use PhpTwinfield\Fields\Level1234\DimensionType\FinancialsField;
use PhpTwinfield\Fields\Level1234\DimensionType\TimeField;

/**
* @see https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/DimensionTypes
* @todo Add documentation and typehints to all properties.
*/
class DimensionTypeLevels extends BaseObject
{
use DimensionTypeFinancialsField;
use DimensionTypeTimeField;
use FinancialsField;
use TimeField;
}
10 changes: 5 additions & 5 deletions src/DomDocuments/ActivitiesDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,21 @@ public function addActivity(Activity $activity)

$activityElement->appendChild($this->createNodeWithTextContent('code', $activity->getCode()));
$activityElement->appendChild($this->createNodeWithTextContent('name', $activity->getName()));
$activityElement->appendChild($this->createNodeWithTextContent('office', $activity->getOfficeToCode()));
$activityElement->appendChild($this->createNodeWithTextContent('office', $activity->getOfficeToString()));
$activityElement->appendChild($this->createNodeWithTextContent('shortname', $activity->getShortName()));
$activityElement->appendChild($this->createNodeWithTextContent('type', $activity->getTypeToCode()));
$activityElement->appendChild($this->createNodeWithTextContent('type', $activity->getTypeToString()));

$financialsElement = $this->createElement('financials');
$activityElement->appendChild($financialsElement);

$financialsElement->appendChild($this->createNodeWithTextContent('vatcode', $activity->getVatCodeToCode()));
$financialsElement->appendChild($this->createNodeWithTextContent('vatcode', $activity->getVatCodeToString()));

$projects = $activity->getProjects();

$projectsElement = $this->createElement('projects');
$activityElement->appendChild($projectsElement);

$inheritArray = array('authoriser' => 'getAuthoriserToCode', 'billable' => 'getBillableToString', 'customer' => 'getCustomerToCode', 'rate' => 'getRateToCode');
$inheritArray = array('authoriser' => 'getAuthoriserToString', 'billable' => 'getBillableToString', 'customer' => 'getCustomerToString', 'rate' => 'getRateToString');

foreach ($inheritArray as $inheritVar => $method) {
$methodLocked = "get" . ucfirst($inheritVar) . "Locked";
Expand Down Expand Up @@ -98,7 +98,7 @@ public function addActivity(Activity $activity)
$quantitiesElement->appendChild($quantityElement);

$quantityElement->appendChild($this->createNodeWithTextContent('label', $quantity->getLabel()));
$quantityElement->appendChild($this->createNodeWithTextContent('rate', $quantity->getRateToCode()));
$quantityElement->appendChild($this->createNodeWithTextContent('rate', $quantity->getRateToString()));
$quantityElement->appendChild($this->createNodeWithTextContent('billable', $quantity->getBillableToString(), $quantity, array('locked' => 'getBillableLockedToString')));
$quantityElement->appendChild($this->createNodeWithTextContent('mandatory', $quantity->getMandatoryToString()));
}
Expand Down
8 changes: 4 additions & 4 deletions src/DomDocuments/ArticlesDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ public function addArticle(Article $article)
$headerElement->appendChild($this->createNodeWithTextContent('allowdecimalquantity', $article->getAllowDecimalQuantityToString()));
$headerElement->appendChild($this->createNodeWithTextContent('allowdiscountorpremium', $article->getAllowDiscountOrPremiumToString()));
$headerElement->appendChild($this->createNodeWithTextContent('code', $article->getCode()));
$headerElement->appendChild($this->createNodeWithTextContent('office', $article->getOfficeToCode()));
$headerElement->appendChild($this->createNodeWithTextContent('office', $article->getOfficeToString()));
$headerElement->appendChild($this->createNodeWithTextContent('name', $article->getName()));
$headerElement->appendChild($this->createNodeWithTextContent('percentage', $article->getPercentageToString()));
$headerElement->appendChild($this->createNodeWithTextContent('performancetype', $article->getPerformanceType()));
$headerElement->appendChild($this->createNodeWithTextContent('shortname', $article->getShortName()));
$headerElement->appendChild($this->createNodeWithTextContent('type', $article->getType()));
$headerElement->appendChild($this->createNodeWithTextContent('unitnameplural', $article->getUnitNamePlural()));
$headerElement->appendChild($this->createNodeWithTextContent('unitnamesingular', $article->getUnitNameSingular()));
$headerElement->appendChild($this->createNodeWithTextContent('vatcode', $article->getVatCodeToCode()));
$headerElement->appendChild($this->createNodeWithTextContent('vatcode', $article->getVatCodeToString()));

//Clear VAT code in case of a discount/premium article with percentage set to true to prevent errors
if ($article->getType() != "normal" && $article->getPercentage() == true) {
Expand Down Expand Up @@ -92,8 +92,8 @@ public function addArticle(Article $article)
$lineElement->setAttribute('status', $status);
}

$lineElement->appendChild($this->createNodeWithTextContent('freetext1', $line->getFreeText1ToCode()));
$lineElement->appendChild($this->createNodeWithTextContent('freetext2', $line->getFreeText2ToCode()));
$lineElement->appendChild($this->createNodeWithTextContent('freetext1', $line->getFreeText1ToString()));
$lineElement->appendChild($this->createNodeWithTextContent('freetext2', $line->getFreeText2ToString()));
$lineElement->appendChild($this->createNodeWithTextContent('freetext3', $line->getFreeText3()));
$lineElement->appendChild($this->createNodeWithTextContent('name', $line->getName()));
$lineElement->appendChild($this->createNodeWithTextContent('shortname', $line->getShortName()));
Expand Down
Loading