[Cancel and Replace] Modified hook to add new parameter
authorUnai Martirena <unai.martirena@openbravo.com>
Thu, 26 May 2016 12:36:22 +0200
changeset 29643 91083519cb27
parent 29642 55a1c4875c47
child 29644 78fc1e193a52
[Cancel and Replace] Modified hook to add new parameter
src/org/openbravo/erpCommon/businessUtility/CancelAndReplaceOrderHook.java
src/org/openbravo/erpCommon/businessUtility/CancelAndReplaceOrderHookCaller.java
src/org/openbravo/erpCommon/businessUtility/CancelAndReplaceUtils.java
--- a/src/org/openbravo/erpCommon/businessUtility/CancelAndReplaceOrderHook.java	Mon May 23 13:58:02 2016 +0200
+++ b/src/org/openbravo/erpCommon/businessUtility/CancelAndReplaceOrderHook.java	Thu May 26 12:36:22 2016 +0200
@@ -13,6 +13,6 @@
 
 public abstract class CancelAndReplaceOrderHook {
 
-  public abstract void exec(Boolean triggersDisabled, Order oldOrder, Order newOrder)
-      throws Exception;
+  public abstract void exec(Boolean replaceOrder, Boolean triggersDisabled, Order oldOrder,
+      Order newOrder) throws Exception;
 }
--- a/src/org/openbravo/erpCommon/businessUtility/CancelAndReplaceOrderHookCaller.java	Mon May 23 13:58:02 2016 +0200
+++ b/src/org/openbravo/erpCommon/businessUtility/CancelAndReplaceOrderHookCaller.java	Thu May 26 12:36:22 2016 +0200
@@ -21,17 +21,17 @@
   @Any
   private Instance<CancelAndReplaceOrderHook> cancelAndReplaceOrderHookProcesses;
 
-  public void executeHook(boolean triggersDisabled, Order oldOrder, Order newOrder)
-      throws Exception {
-    executeHooks(triggersDisabled, oldOrder, newOrder);
+  public void executeHook(boolean replaceOrder, boolean triggersDisabled, Order oldOrder,
+      Order newOrder) throws Exception {
+    executeHooks(replaceOrder, triggersDisabled, oldOrder, newOrder);
   }
 
-  protected void executeHooks(boolean triggersDisabled, Order oldOrder, Order newOrder)
-      throws Exception {
+  protected void executeHooks(boolean replaceOrder, boolean triggersDisabled, Order oldOrder,
+      Order newOrder) throws Exception {
     for (Iterator<CancelAndReplaceOrderHook> processIterator = cancelAndReplaceOrderHookProcesses
         .iterator(); processIterator.hasNext();) {
       CancelAndReplaceOrderHook process = processIterator.next();
-      process.exec(triggersDisabled, oldOrder, newOrder);
+      process.exec(replaceOrder, triggersDisabled, oldOrder, newOrder);
     }
   }
 }
--- a/src/org/openbravo/erpCommon/businessUtility/CancelAndReplaceUtils.java	Mon May 23 13:58:02 2016 +0200
+++ b/src/org/openbravo/erpCommon/businessUtility/CancelAndReplaceUtils.java	Thu May 26 12:36:22 2016 +0200
@@ -331,7 +331,7 @@
 
      //Calling Cancelandreplaceorderhook
      WeldUtils.getInstanceFromStaticBeanManager(CancelAndReplaceOrderHookCaller.class)
-          .executeHook(triggersDisabled, oldOrder, newOrder);
+          .executeHook(replaceOrder, triggersDisabled, oldOrder, newOrder);
 
     } catch (Exception e1) {
       try {