Skip to content

Commit

Permalink
Merge pull request #5 from sitn/orderid
Browse files Browse the repository at this point in the history
show order id
  • Loading branch information
maltaesousa authored Jun 16, 2021
2 parents 0a91f7f + bf9149f commit bb54bd5
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -986,24 +986,25 @@ private ConnectorImportResult addImportedProductsToResult(final String responseS
this.logger.debug("Processing order index {}.", i);
JSONObject orderNode = orderArray.getJSONObject(i);
final int orderId = orderNode.getInt("id");
String orderLabel = orderNode.getString("title");
String orderLabel = String.valueOf(orderId) + " - " + orderNode.getString("title");
String orderType = orderNode.getString("order_type");

JSONObject client = orderNode.getJSONObject("client");
String clientName = client.getString("first_name") + " " + client.getString("last_name");
String clientOrganism = client.getString("company_name");
int clientId = client.getInt("id");
String clientAddress = client.getString("street") + ", " + client.getString("postcode") + " " + client.getString("city");
String clientAddress = client.getString("street") + ", " + client.getString("postcode") + " " + client.getString("city")
+ ", " + ObjectUtils.firstNonNull(client.getString("email"), client.getString("phone"));

String tiersName = "";
String tiersAddress = "";
if (orderNode.isNull("invoice_contact") == false) {
JSONObject tiers = orderNode.getJSONObject("invoice_contact");
String tiersCompanyName = tiers.getString("company_name");
tiersCompanyName = (tiersCompanyName == null || tiersCompanyName.isEmpty()) ? "" : " (" + tiersCompanyName + ")";
tiersName = tiers.getString("first_name") + " " + tiers.getString("last_name")
+ tiersCompanyName + " " + ObjectUtils.firstNonNull(tiers.getString("email"), tiers.getString("phone"));
tiersAddress = tiers.getString("street") + ", " + tiers.getString("postcode") + " " + tiers.getString("city");
tiersName = tiers.getString("first_name") + " " + tiers.getString("last_name");
tiersAddress = tiers.getString("street") + ", " + tiers.getString("postcode") + " " + tiers.getString("city")
+ tiersCompanyName + " " + ObjectUtils.firstNonNull(tiers.getString("email"), tiers.getString("phone"));
}
String detailsUrl;

Expand Down Expand Up @@ -1097,7 +1098,7 @@ private String getFileNameForRequest(final IExportRequest request, final String
assert request.getOrderLabel() != null : "The label of the exported order cannot be null.";
assert request.getProductLabel() != null : "The label of the exported product cannot be null.";

final String baseFileName = String.format("%s_%s", request.getOrderLabel(), request.getProductLabel())
final String baseFileName = String.format("%s_%s", request.getOrderGuid(), request.getProductLabel())
.replaceAll("[\\s<>*\"/\\\\\\[\\]:;|=,]", "_");
this.logger.debug("The raw base file name is {}", baseFileName);
this.logger.debug("The bytes of the raw base file name is {}.", baseFileName.getBytes(StandardCharsets.UTF_8));
Expand Down

0 comments on commit bb54bd5

Please sign in to comment.