From 1d50a92f1deb5f67b08d7125d5e0818100ec01e4 Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Mon, 30 Sep 2013 18:57:43 +0800 Subject: [PATCH] IDEMPIERE-569 Ticket #1001758: Improve shipping configuration to support external services * Inactive 'Package' window record * Inactive 'Package' menu record * Fix NullPointerException when freight charges is not provided during create package process --- .../oracle/201309301851_IDEMPIERE-569.sql | 15 +++++++++++ .../postgresql/201309301851_IDEMPIERE-569.sql | 12 +++++++++ .../src/org/compiere/model/MPackage.java | 25 +++++++++++-------- 3 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 migration/i1.0c-release/oracle/201309301851_IDEMPIERE-569.sql create mode 100644 migration/i1.0c-release/postgresql/201309301851_IDEMPIERE-569.sql diff --git a/migration/i1.0c-release/oracle/201309301851_IDEMPIERE-569.sql b/migration/i1.0c-release/oracle/201309301851_IDEMPIERE-569.sql new file mode 100644 index 0000000000..dced747572 --- /dev/null +++ b/migration/i1.0c-release/oracle/201309301851_IDEMPIERE-569.sql @@ -0,0 +1,15 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Sep 30, 2013 6:48:37 PM SGT +-- IDEMPIERE-569 Ticket #1001758: Improve shipping configuration to support external services +UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2013-09-30 18:48:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=444 +; + +-- Sep 30, 2013 6:48:42 PM SGT +-- IDEMPIERE-569 Ticket #1001758: Improve shipping configuration to support external services +UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2013-09-30 18:48:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=319 +; + +SELECT register_migration_script('201309301851_IDEMPIERE-569.sql') FROM dual +; \ No newline at end of file diff --git a/migration/i1.0c-release/postgresql/201309301851_IDEMPIERE-569.sql b/migration/i1.0c-release/postgresql/201309301851_IDEMPIERE-569.sql new file mode 100644 index 0000000000..a7ef3ab7d3 --- /dev/null +++ b/migration/i1.0c-release/postgresql/201309301851_IDEMPIERE-569.sql @@ -0,0 +1,12 @@ +-- Sep 30, 2013 6:48:37 PM SGT +-- IDEMPIERE-569 Ticket #1001758: Improve shipping configuration to support external services +UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2013-09-30 18:48:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=444 +; + +-- Sep 30, 2013 6:48:42 PM SGT +-- IDEMPIERE-569 Ticket #1001758: Improve shipping configuration to support external services +UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2013-09-30 18:48:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=319 +; + +SELECT register_migration_script('201309301851_IDEMPIERE-569.sql') FROM dual +; \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/model/MPackage.java b/org.adempiere.base/src/org/compiere/model/MPackage.java index 2e769b9483..49b072d470 100644 --- a/org.adempiere.base/src/org/compiere/model/MPackage.java +++ b/org.adempiere.base/src/org/compiere/model/MPackage.java @@ -200,19 +200,22 @@ public class MPackage extends X_M_Package setIsSaturdayDelivery(shipper.isSaturdayDelivery()); setTrackingInfo(shipper.getTrackingURL()); - String shipperAccount = null; - String dutiesShipperAccount = null; - if (shipment.getFreightCharges().equals(MInOut.FREIGHTCHARGES_Prepaid) || shipment.getFreightCharges().equals(MInOut.FREIGHTCHARGES_PrepaidAndBill)) + if (shipment.getFreightCharges() != null) { - shipperAccount = ShippingUtil.getSenderShipperAccount(shipper.getM_Shipper_ID(), shipper.getAD_Org_ID()); - dutiesShipperAccount = ShippingUtil.getSenderDutiesShipperAccount(shipper.getM_Shipper_ID(), shipper.getAD_Org_ID()); + String shipperAccount = null; + String dutiesShipperAccount = null; + if (shipment.getFreightCharges().equals(MInOut.FREIGHTCHARGES_Prepaid) || shipment.getFreightCharges().equals(MInOut.FREIGHTCHARGES_PrepaidAndBill)) + { + shipperAccount = ShippingUtil.getSenderShipperAccount(shipper.getM_Shipper_ID(), shipper.getAD_Org_ID()); + dutiesShipperAccount = ShippingUtil.getSenderDutiesShipperAccount(shipper.getM_Shipper_ID(), shipper.getAD_Org_ID()); + } + else + shipperAccount = shipment.getShipperAccount(); + if (shipperAccount != null) + setShipperAccount(shipperAccount); + if (dutiesShipperAccount != null) + setDutiesShipperAccount(dutiesShipperAccount); } - else - shipperAccount = shipment.getShipperAccount(); - if (shipperAccount != null) - setShipperAccount(shipperAccount); - if (dutiesShipperAccount != null) - setDutiesShipperAccount(dutiesShipperAccount); } // MPackage protected boolean beforeSave(boolean newRecord)