pixiCanChangeAddress
Returns 1 if the address of an order may still be changed because no invoice lines exist for its order lines, otherwise 0.
Checks whether the address of an order can still be changed. The check is based only on whether the order has already been invoiced, completely or partially.
- If both
OrderNrandOrderNrExternalareNULL, the function returns0right away. - Otherwise it identifies the order lines (
Orderlines) of the order:- by
OrderNrif onlyOrderNris given, or - by
OrderNrExternalif onlyOrderNrExternalis given.
- by
- It counts the invoice lines (
InvLines) that reference one of these order lines throughOrderlineRef. - It returns
0if at least one invoice line exists (the order is invoiced at least partially). It returns1if no invoice line exists, which means the address may be changed.
Notes
- Pass only one of the two parameters. If both are given, neither filter condition applies. No order lines are found, and the function returns
1(change allowed), even if the order is invoiced. - A non-existent order number also returns
1, because no invoice lines are found. The function does not check whether the order exists. - Both tables are read with
NOLOCK, so the result can reflect uncommitted data. - The function only checks for invoice lines. Other states, such as shipped or cancelled orders, are not considered.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
OrderNr
|
int | NULL |
Internal Pixi order number. Used only if Example: |
OrderNrExternal
|
varchar(50) string |
NULL |
External order number, for example the shop order number. Used only if Example: |
Result set 1 · Always
Scalar return value of the function.
| Column | Type | Description |
|---|---|---|
Result
|
int |
|
Response example
<SqlRowSet1>
<row>
<Result>1</Result>
</row>
</SqlRowSet1>
POST https://apigateway.descartes.com/tms/pixi/
Content-Type: text/xml; charset=utf-8
Authorization: Basic BASE64(USERNAME:PASSWORD)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiCanChangeAddress>
<!-- <OrderNr>123456</OrderNr> -->
<!-- <OrderNrExternal>SHOP-100234</OrderNrExternal> -->
</ns1:pixiCanChangeAddress>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
curl -X POST 'https://apigateway.descartes.com/tms/pixi/' \
--user 'USERNAME:PASSWORD' \
--header 'Content-Type: text/xml; charset=utf-8' \
--data-binary @- <<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiCanChangeAddress>
<!-- <OrderNr>123456</OrderNr> -->
<!-- <OrderNrExternal>SHOP-100234</OrderNrExternal> -->
</ns1:pixiCanChangeAddress>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XML
<?php
$soapClient = new SoapClient(null, [
'login' => 'USERNAME',
'password' => 'PASSWORD',
'location' => 'https://apigateway.descartes.com/tms/pixi/',
'uri' => 'https://apigateway.descartes.com/tms/pixi/',
]);
$arguments = [
// 'OrderNr' => '123456',
// 'OrderNrExternal' => 'SHOP-100234',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiCanChangeAddress', $soapArguments);
- SQL object:
- dbo.pipiCanChangeAddress