Skip to content

Commit

Permalink
Code is string on relation not an id
Browse files Browse the repository at this point in the history
  • Loading branch information
petericebear committed Jul 16, 2020
1 parent bbf97e4 commit f3dc4c0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ private function getORel(EboekhoudenRelation $relation): array
return [
'ID' => $id,
'AddDatum' => ($relation->getAddDate() ?? new DateTime())->format('Y-m-d'),
'Code' => (string) $relation->getCode(),
'Code' => $relation->getCode(),
'Bedrijf' => $relation->getCompany(),
'Contactpersoon' => $relation->getContact(),
'Geslacht' => $relation->getGender(),
Expand Down
2 changes: 1 addition & 1 deletion src/Models/EboekhoudenInvoiceLine.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class EboekhoudenInvoiceLine implements Arrayable
use ProtectedFieldsToArrayTrait;

protected float $amount = 0;
protected string $unit = 'piece';
protected string $unit = 'stuk';
protected string $code = '';
protected string $description = '';
protected float $price = 0;
Expand Down
16 changes: 6 additions & 10 deletions src/Models/EboekhoudenRelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class EboekhoudenRelation implements Arrayable
protected ?int $id = null;
protected string $relation_type = 'B';
protected ?DateTime $add_date = null;
protected int $code = 0;
protected string $code = '';
protected string $company = '';
protected string $contact = '';
protected string $gender = '';
Expand Down Expand Up @@ -49,7 +49,7 @@ public function __construct(array $item = null)
$this
->setId($item['ID'])
->setAddDate(new DateTime($item['AddDatum']))
->setCode((int)$item['Code'])
->setCode($item['Code'])
->setCompany($item['Bedrijf'])
->setContact($item['Contactpersoon'])
->setGender($item['Geslacht'])
Expand Down Expand Up @@ -136,23 +136,19 @@ public function setAddDate(?\DateTime $add_date): EboekhoudenRelation
}

/**
* @return int
* @return string
*/
public function getCode(): int
public function getCode(): string
{
return $this->code;
}

/**
* @param int $code
* @param string $code
* @return EboekhoudenRelation
* @throws EboekhoudenException
*/
public function setCode(int $code): EboekhoudenRelation
public function setCode(string $code): EboekhoudenRelation
{
if ($code < 0) {
throw new EboekhoudenException("Code must be a positive integer.");
}
$this->code = $code;

return $this;
Expand Down

0 comments on commit f3dc4c0

Please sign in to comment.