Skip to content

Commit

Permalink
Merge branch 'feature/purchaseOrdersV2' into 'master'
Browse files Browse the repository at this point in the history
getPurchaseOrdersV2 now has support for request.purchaseOrderNumber and request.extPurchaseOrderId

See merge request mpluskassa/mplus-api-client-deprecated!49
  • Loading branch information
freerk-mpluskassa committed Dec 24, 2020
2 parents abe4825 + e6bddff commit d3e261c
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Mplusqapiclient.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class MplusQAPIclient
{
const CLIENT_VERSION = '1.32.0';
const CLIENT_VERSION = '1.33.0';
const WSDL_TTL = 300;

var $MIN_API_VERSION_MAJOR = 0;
Expand Down Expand Up @@ -2834,10 +2834,10 @@ public function getPurchaseOrders($syncMarker, $fromOrderDate, $throughOrderDate

//----------------------------------------------------------------------------

public function getPurchaseOrdersV2($syncMarker, $fromOrderDate, $throughOrderDate, $fromDeliveryDate=null, $throughDeliveryDate=null, $branchNumbers=null, $employeeNumbers=null, $relationNumbers=null, $articleNumbers=null, $articleTurnoverGroups=null, $articlePluNumbers=null, $articleBarcodes=null, $syncMarkerLimit=null, $attempts=0)
public function getPurchaseOrdersV2($syncMarker, $fromOrderDate, $throughOrderDate, $fromDeliveryDate=null, $throughDeliveryDate=null, $branchNumbers=null, $employeeNumbers=null, $relationNumbers=null, $articleNumbers=null, $articleTurnoverGroups=null, $articlePluNumbers=null, $articleBarcodes=null, $syncMarkerLimit=null, $purchaseOrderNumber=null, $extPurchaseOrderId=null, $attempts=0)
{
try {
$result = $this->client->getPurchaseOrdersV2($this->parser->convertGetPurchaseOrdersRequest($syncMarker, $fromOrderDate, $throughOrderDate, $fromDeliveryDate, $throughDeliveryDate, $branchNumbers, $employeeNumbers, $relationNumbers, $articleNumbers, $articleTurnoverGroups, $articlePluNumbers, $articleBarcodes, $syncMarkerLimit));
$result = $this->client->getPurchaseOrdersV2($this->parser->convertGetPurchaseOrdersRequest($syncMarker, $fromOrderDate, $throughOrderDate, $fromDeliveryDate, $throughDeliveryDate, $branchNumbers, $employeeNumbers, $relationNumbers, $articleNumbers, $articleTurnoverGroups, $articlePluNumbers, $articleBarcodes, $syncMarkerLimit, $purchaseOrderNumber, $extPurchaseOrderId));
if($this->returnRawResult) {
return $result;
}
Expand All @@ -2846,7 +2846,7 @@ public function getPurchaseOrdersV2($syncMarker, $fromOrderDate, $throughOrderDa
$msg = $e->getMessage();
if (false !== stripos($msg, 'Could not connect to host') and $attempts < 3) {
sleep(1);
return $this->getPurchaseOrdersV2($syncMarker, $fromFinancialDate, $throughFinancialDate, $fromDeliveryDate, $throughDeliveryDate, $branchNumbers, $employeeNumbers, $relationNumbers, $articleNumbers, $articleTurnoverGroups, $articlePluNumbers, $articleBarcodes, $syncMarkerLimit, $attempts+1);
return $this->getPurchaseOrdersV2($syncMarker, $fromOrderDate, $throughOrderDate, $fromDeliveryDate, $throughDeliveryDate, $branchNumbers, $employeeNumbers, $relationNumbers, $articleNumbers, $articleTurnoverGroups, $articlePluNumbers, $articleBarcodes, $syncMarkerLimit, $purchaseOrderNumber, $extPurchaseOrderId, $attempts+1);
} else {
throw new MplusQAPIException('SoapFault occurred: '.$msg, 0, $e);
}
Expand Down Expand Up @@ -7888,7 +7888,7 @@ public function convertGetPackingSlipsByOrderRequest($orderId)

//----------------------------------------------------------------------------

public function convertGetPurchaseOrdersRequest($syncMarker, $fromOrderDate, $throughOrderDate, $fromDeliveryDate, $throughDeliveryDate, $branchNumbers, $employeeNumbers, $relationNumbers, $articleNumbers, $articleTurnoverGroups, $articlePluNumbers, $articleBarcodes, $syncMarkerLimit)
public function convertGetPurchaseOrdersRequest($syncMarker, $fromOrderDate, $throughOrderDate, $fromDeliveryDate, $throughDeliveryDate, $branchNumbers, $employeeNumbers, $relationNumbers, $articleNumbers, $articleTurnoverGroups, $articlePluNumbers, $articleBarcodes, $syncMarkerLimit, $purchaseOrderNumber=null, $extPurchaseOrderId=null)
{
$fromOrderDate = is_null($fromOrderDate)?null:$this->convertMplusDate($fromOrderDate, 'fromOrderDate');
$throughOrderDate = is_null($throughOrderDate)?null:$this->convertMplusDate($throughOrderDate, 'throughOrderDate');
Expand Down Expand Up @@ -7917,6 +7917,12 @@ public function convertGetPurchaseOrdersRequest($syncMarker, $fromOrderDate, $th
}

$array = array();
if (!is_null($purchaseOrderNumber) and !empty($purchaseOrderNumber)) {
$array['purchaseOrderNumber'] = $this->convertYearNumber($purchaseOrderNumber);
}
elseif (!is_null($extPurchaseOrderId) and !empty($extPurchaseOrderId)) {
$array['extPurchaseOrderId'] = $extPurchaseOrderId;
}
if ( ! is_null($syncMarker)) {
$array['syncMarker'] = (int)$syncMarker;
if ( ! is_null($syncMarkerLimit) and $syncMarkerLimit > 0) {
Expand Down

0 comments on commit d3e261c

Please sign in to comment.