From 1e028a8a6563ce3d3d661c2eb49cb8aed2904c7a Mon Sep 17 00:00:00 2001 From: Freerk Minnema Date: Thu, 24 Dec 2020 13:07:04 +0100 Subject: [PATCH 1/2] getPurchaseOrdersV2 now has support for request.purchaseOrderNumber and request.extPurchaseOrderId --- Mplusqapiclient.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Mplusqapiclient.php b/Mplusqapiclient.php index e312eef..7c042b3 100755 --- a/Mplusqapiclient.php +++ b/Mplusqapiclient.php @@ -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; } @@ -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); } @@ -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'); @@ -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) { From e6bddff4da3e4917bd34d710d488111e2a9605f4 Mon Sep 17 00:00:00 2001 From: Freerk Minnema Date: Thu, 24 Dec 2020 13:07:27 +0100 Subject: [PATCH 2/2] version --- Mplusqapiclient.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mplusqapiclient.php b/Mplusqapiclient.php index 7c042b3..0ec4e3e 100755 --- a/Mplusqapiclient.php +++ b/Mplusqapiclient.php @@ -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;