pixiSupplierOrderLineUpdate
Updates the supplier price, estimated delivery date and comment of one supplier order line.
Updates a single supplier order line identified by SupplierOrderLineId. The actual update is delegated to the internal procedure pixi.SupplierOrderLineUpdate, which is called with ReturnUpdatedIds = 1.
Steps:
- Opens a transaction, or sets a savepoint if the caller already has an open transaction.
- Resolves the user: if
UserIdis given it is used directly; otherwise the user is looked up byUserNameviainf.UserGetByName. If that user name does not exist, the userpixiAdministrationis used instead. - Normalises the input values:
SupplierPrice: a value that equals an empty string is converted toNULL.EstimatedDeliveryDate: the time part is removed, only the date is passed on.Comment: an empty string is converted toNULL.
- Calls
pixi.SupplierOrderLineUpdatewith the user, the line ID and the three values. - Commits the transaction it opened itself.
If any error occurs, the transaction or savepoint is rolled back and a single row with ReturnCode = ERROR and the SQL error message is returned.
Notes
- The internal procedure
pixi.SupplierOrderLineUpdateis not attached. Which tables it changes, howNULLvalues are handled (e.g. whetherNULLmeans "leave unchanged") and the exact columns of the success result set (requested viaReturnUpdatedIds = 1) cannot be derived from this code. - Pitfall:
SupplierPriceis amoneyvalue compared with an empty string; SQL Server converts the empty string to0. A price of0is therefore turned intoNULLand cannot be set explicitly. - Likewise an empty
CommentbecomesNULL, so it may not be possible to clear a comment with an empty string. EstimatedDeliveryDateis truncated to the date; any time part is discarded.AppNameis required but not used by the code.UserNameis required but only evaluated whenUserIdis not supplied.- Uses a named transaction or savepoint, so the call can safely run inside an outer transaction; on error only its own work is rolled back (unless the transaction is uncommittable).
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
AppName
Required
|
varchar(255) string |
– |
Name of the calling application. Required, but not used by the code. Example: |
UserId
|
int | NULL |
ID of the Pixi user performing the change. If omitted, the user is resolved from Example: |
UserName
Required
|
varchar(50) string |
– |
Pixi user name. Used only if Example: |
SupplierOrderLineId
Required
|
int | – |
ID of the supplier order line to update. Example: |
SupplierPrice
|
money decimal |
NULL |
New supplier (purchase) price of the line. A value of Example: |
EstimatedDeliveryDate
|
datetime dateTime |
NULL |
New estimated delivery date. The time part is removed. Example: |
Comment
|
nvarchar(2000) string |
NULL |
New comment for the line. An empty string is converted to Example: |
Result set 1 · On success (returned by the internal procedure pixi.SupplierOrderLineUpdate with ReturnUpdatedIds = 1)
Result of the internal update procedure, presumably the IDs of the updated records. Its columns are not visible in the attached code.
Result set 2 · On error
Status row with the error message after rollback.
| Column | Type | Description |
|---|---|---|
ReturnCode
|
varchar(5) string |
Always |
ErrorMessage
Nullable |
nvarchar(4000) string |
SQL error message of the error that occurred. |
Response example
<SqlRowSet1>
<row>
<ReturnCode>ERROR</ReturnCode>
<ErrorMessage>Supplier order line 45871 not found.</ErrorMessage>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| ERROR | {ERROR_MESSAGE()} | Any error raised while resolving the user or inside `pixi.SupplierOrderLineUpdate` (e.g. an invalid supplier order line ID or a violated business rule). The message is the original SQL error text; check the line ID and values before retrying. |
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:pixiSupplierOrderLineUpdate>
<AppName>MyShopConnector</AppName>
<!-- <UserId>12</UserId> -->
<UserName>jdoe</UserName>
<SupplierOrderLineId>45871</SupplierOrderLineId>
<!-- <SupplierPrice>12.50</SupplierPrice> -->
<!-- <EstimatedDeliveryDate>2024-07-15T00:00:00</EstimatedDeliveryDate> -->
<!-- <Comment>Supplier confirmed delivery for week 29</Comment> -->
</ns1:pixiSupplierOrderLineUpdate>
</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:pixiSupplierOrderLineUpdate>
<AppName>MyShopConnector</AppName>
<!-- <UserId>12</UserId> -->
<UserName>jdoe</UserName>
<SupplierOrderLineId>45871</SupplierOrderLineId>
<!-- <SupplierPrice>12.50</SupplierPrice> -->
<!-- <EstimatedDeliveryDate>2024-07-15T00:00:00</EstimatedDeliveryDate> -->
<!-- <Comment>Supplier confirmed delivery for week 29</Comment> -->
</ns1:pixiSupplierOrderLineUpdate>
</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 = [
'AppName' => 'MyShopConnector',
// 'UserId' => '12',
'UserName' => 'jdoe',
'SupplierOrderLineId' => '45871',
// 'SupplierPrice' => '12.50',
// 'EstimatedDeliveryDate' => '2024-07-15T00:00:00',
// 'Comment' => 'Supplier confirmed delivery for week 29',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiSupplierOrderLineUpdate', $soapArguments);
- SQL object:
- dbo.pipiSupplierOrderLineUpdate