This is an automated email from the ASF dual-hosted git repository. nmalin pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push: new 7ac2ac642b Improved: Add function to OrderReadHelper (OFBIZ-13187) 7ac2ac642b is described below commit 7ac2ac642bcf5921c80f2bf71320d48c9938766e Author: Nicolas Malin <nicolas.ma...@nereide.fr> AuthorDate: Fri Nov 29 10:17:51 2024 +0100 Improved: Add function to OrderReadHelper (OFBIZ-13187) Add five new functions on OrderReadHelper as accessor to : * externalId -> getExternalId() * order priority -> getPriority() * order item attributes -> getOrderItemAttributes() * and two on order notes (internal and/or public) -> getOrderHeaderNotes() and getOrderHeaderNotes(boolean internalNote) --- .../apache/ofbiz/order/order/OrderReadHelper.java | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReadHelper.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReadHelper.java index 8549ec0fc9..27d66e4613 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReadHelper.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReadHelper.java @@ -228,6 +228,22 @@ public class OrderReadHelper { return orderHeader.getString("orderName"); } + /** + * Gets externalId. + * @return the external id + */ + public String getExternalId() { + return orderHeader.getString("externalId"); + } + + /** + * Gets order priority + * @return the priority + */ + public String getPriority() { + return orderHeader.getString("priority"); + } + /** * Gets adjustments. * @return the adjustments @@ -399,6 +415,51 @@ public class OrderReadHelper { } } + /** + * Return notes links to this order + * @param internalNote + * @return order notes + */ + public List<GenericValue> getOrderHeaderNotes(boolean internalNote) { + try { + return EntityQuery.use(orderHeader.getDelegator()).from("OrderHeaderNote") + .where("orderId", getOrderId(), + "internalNote", internalNote ? "Y" : "N") + .queryList(); + } catch (GenericEntityException e) { + Debug.logError(e, MODULE); + } + return null; + } + + /** + * Return public notes links to this order + * @return order public notes + */ + public List<GenericValue> getOrderHeaderNotes() { + return getOrderHeaderNotes(false); + } + + /** + * Retrieve order item attributes link to this order, first on this cache object else + * call delegator to load the cache from OrderItemAttribute entity + * + * @return Order item attributes link to this order + */ + public List<GenericValue> getOrderItemAttributes() { + if (orderHeader != null && orderItemAttributes == null) { + try { + orderItemAttributes = EntityQuery.use(orderHeader.getDelegator()) + .from("OrderItemAttribute") + .where("orderId", getOrderId()) + .queryList(); + } catch (GenericEntityException e) { + Debug.logError(e, MODULE); + } + } + return orderItemAttributes; + } + /** * Return the number of days from termDays of first FIN_PAYMENT_TERM * @return number of days from termDays of first FIN_PAYMENT_TERM