Skip to content

Commit

Permalink
Some modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Dambacher committed Jun 14, 2016
1 parent 176e747 commit 3e11eff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Entity/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ class Invoice extends CollmexObject
*/
protected $position_type;
/**
* @ORM\Column(type="integer")
* @ORM\Column(type="string")
*/
protected $product_id;
/**
Expand Down
26 changes: 7 additions & 19 deletions Entity/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,36 +267,24 @@ class Product extends CollmexObject
* @ORM\Column(type="string")
*/
protected $goods_number;
/**
* @ORM\Column(type="string")
*/
protected $extraInfo;



public function setField($key, $value)
{
$this->template[$key] = $value;

if ($key == 'remark') {
$this->parseRemark();
}
}


public function getExtraInfo()
{
return $this->extraInfo;
return $this->parseRemark();
}

public function parseRemark()
{
$remark = $this->getField('remark');

preg_match_all("/(\[)(.*?)(\])/", $remark, $aMatches);

$array = array();

foreach ($aMatches[2] as $match) {
$parameters = explode('=', $match);
$this->extraInfo[$parameters[0]] = $parameters[1];
$array[$parameters[0]] = $parameters[1];
}

return $array;
}
}
3 changes: 2 additions & 1 deletion Services/CollmexManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function getInvoice($invoiceNo = null, $customerNo = null, $from = null,

return $response->getObjects()[0];
}

public function getInvoices($customerNo = null, $from = null, $to = null, $onlyIssued = 0, $onlyModified = 0, $onlyCreatedWithThisAPI = 0, $companyId = 1)
{
$request = new Request([
Expand All @@ -208,6 +208,7 @@ public function getInvoices($customerNo = null, $from = null, $to = null, $onlyI
return $response->getObjects();
}




}

0 comments on commit 3e11eff

Please sign in to comment.