[ChangePassword] Merge with pi
authorJonathan Bueno <jonathan.bueno@openbravo.com>
Wed, 17 Feb 2016 09:56:42 +0100
changeset 28808 efc711fa6288
parent 28807 9dda34ecf279 (current diff)
parent 28739 12dcb6800a9c (diff)
child 28809 060c7af3f4dd
[ChangePassword] Merge with pi
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/RemoveFilesEventHandler.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FileActionHandler.java
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-file.js
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/images/form/erase_icon.png
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/images/form/upload_icon.png
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/FileUIDefinition.java
src-db/database/model/tables/AD_FILE.xml
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_ELEMENT.xml
src-db/database/sourcedata/AD_FIELD.xml
src/org/openbravo/erpCommon/info/FileInfoBLOB.java
src/org/openbravo/erpCommon/utility/GetFile.java
--- a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DefaultDataSourceService.java	Wed Feb 17 09:52:43 2016 +0100
+++ b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DefaultDataSourceService.java	Wed Feb 17 09:56:42 2016 +0100
@@ -11,13 +11,14 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2010-2015 Openbravo SLU
+ * All portions are Copyright (C) 2010-2016 Openbravo SLU
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
  */
 package org.openbravo.service.datasource;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -252,10 +253,15 @@
       fieldQuery.setNamedParameter("tabId", tab.getId());
       fieldQuery.setNamedParameter("roleId", roleId);
       for (Field f : fieldQuery.list()) {
-        String key = KernelUtils.getProperty(f).getName();
+        Property property = KernelUtils.getProperty(f);
+        String key = property.getName();
         if (data.has(key)) {
           String newValue = getValue(data, key);
           String oldValue = getValue(oldData, key);
+          if (property.isPrimitive() && property.isNumericType()
+              && isSameNumericValue(newValue, oldValue)) {
+            continue;
+          }
           if (oldValue == null && newValue != null || oldValue != null
               && !oldValue.equals(newValue)) {
             throw new RuntimeException(KernelUtils.getInstance().getI18N(
@@ -284,6 +290,17 @@
       return val.toString();
   }
 
+  private static boolean isSameNumericValue(String str1, String str2) {
+    try {
+      BigDecimal bd1 = new BigDecimal(str1);
+      BigDecimal bd2 = new BigDecimal(str2);
+      return bd1.doubleValue() == bd2.doubleValue();
+    } catch (NumberFormatException nfex) {
+      log4j.error("Could not compare numeric values", nfex);
+    }
+    return false;
+  }
+
   public List<DataSourceProperty> getDataSourceProperties(Map<String, Object> parameters) {
     final Entity entity = getEntity();
     final List<DataSourceProperty> dsProperties;
Binary file src-db/database/lib/dbsourcemanager.jar has changed
--- a/src-db/database/model/functions/MRP_PURCHASEORDER.xml	Wed Feb 17 09:52:43 2016 +0100
+++ b/src-db/database/model/functions/MRP_PURCHASEORDER.xml	Wed Feb 17 09:56:42 2016 +0100
@@ -16,7 +16,7 @@
 * under the License.
 * The Original Code is Openbravo ERP.
 * The Initial Developer of the Original Code is Openbravo SLU
-* All portions are Copyright (C) 2001-2007 Openbravo SLU
+* All portions are Copyright (C) 2001-2016 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
@@ -53,6 +53,15 @@
   v_ProductName NVARCHAR2(90);
   v_IsAPRMinstalled NUMBER;
   v_DefaultPaymentRule VARCHAR2(60):=null;
+  v_PriceListVersion_ID M_PRICELIST_VERSION.M_PRICELIST_VERSION_ID%TYPE;
+  v_istaxincluded CHAR(1);
+  v_LineNetAmt NUMBER:=0;
+  v_gross_unit_price NUMBER:=0;
+  v_stdprecision NUMBER:=0;
+  v_priceprecision NUMBER:=0;
+  v_line_gross_amount NUMBER:=0;
+  v_gross_price_std NUMBER:=0;
+  v_gross_price_list NUMBER:=0;
 
   v_Count NUMBER;
 
@@ -191,14 +200,7 @@
                           AND plv.AD_Client_ID =v_Client_ID));
 
       IF (v_count > 0) THEN
-        SELECT PriceList, PriceStd,
-               M_Get_Offers_Price(v_DateDoc,Cur_workproposal.C_BPartner_ID,Cur_workproposal.M_Product_ID,PriceStd,Cur_workproposal.QTY, Cur_workproposal.PO_PRICELIST_ID),
-               PriceLimit
-          INTO v_PriceList, v_PriceStd, v_PriceActual, v_PriceLimit
-        FROM M_ProductPrice
-        WHERE M_Product_ID = Cur_workproposal.M_Product_ID
-          AND M_PRICELIST_VERSION_ID = (
-                SELECT min(plv.M_PriceList_Version_ID) as M_PriceList_Version_ID
+        SELECT min(plv.M_PriceList_Version_ID) INTO v_PriceListVersion_ID
                 FROM M_PriceList_Version plv
                 WHERE plv.M_PriceList_ID = Cur_workproposal.PO_PRICELIST_ID
                   AND plv.IsActive= 'Y'
@@ -210,7 +212,15 @@
                                     AND plv.IsActive= 'Y'
                                     AND pl.M_PriceList_ID = Cur_workproposal.PO_PRICELIST_ID
                                     AND plv.ValidFrom <= v_DateDoc
-                                    AND plv.AD_Client_ID =v_Client_ID));
+                                    AND plv.AD_Client_ID =v_Client_ID);
+
+        SELECT PriceList, PriceStd,
+               M_Get_Offers_Price(v_DateDoc,Cur_workproposal.C_BPartner_ID,Cur_workproposal.M_Product_ID,PriceStd,Cur_workproposal.QTY, Cur_workproposal.PO_PRICELIST_ID),
+               PriceLimit
+          INTO v_PriceList, v_PriceStd, v_PriceActual, v_PriceLimit
+        FROM M_ProductPrice
+        WHERE M_Product_ID = Cur_workproposal.M_Product_ID
+          AND M_PRICELIST_VERSION_ID = v_PriceListVersion_ID;
       ELSE
         SELECT NAME INTO v_ProductName
         FROM M_PRODUCT
@@ -220,8 +230,33 @@
         RAISE_APPLICATION_ERROR(-20000, v_Message);
       END IF;
 
+      SELECT istaxincluded INTO v_istaxincluded
+          FROM M_PRICELIST
+            WHERE M_PRICELIST_ID = (SELECT M_PRICELIST_ID
+              FROM M_PRICELIST_VERSION
+                WHERE M_PRICELIST_VERSION_ID = v_PriceListVersion_ID);
+
       v_TaxID := C_GetTax(Cur_workproposal.M_Product_ID, v_DateDoc, v_Org_ID, v_M_Warehouse_ID, v_BillTo_ID, v_BPartner_Location_ID, null, 'N');
+      v_LineNetAmt:= v_PriceActual*Cur_workproposal.QTY;
+      IF (v_istaxincluded = 'Y') THEN
+        SELECT PricePrecision, stdprecision
+            INTO v_priceprecision, v_stdprecision
+          FROM C_CURRENCY
+          WHERE C_CURRENCY_ID = Cur_workproposal.C_Currency_ID;
 
+        v_gross_unit_price:= v_PriceActual;
+        v_gross_price_std:= v_PriceStd;
+        v_gross_price_list:= v_PriceList;
+        v_line_gross_amount:= ROUND(v_gross_unit_price * Cur_workproposal.QTY, v_stdprecision);
+        v_PriceActual:= C_GET_NET_PRICE_FROM_GROSS(v_TaxID, v_PriceActual, 0, v_priceprecision, 1);
+        v_PriceStd:= C_GET_NET_PRICE_FROM_GROSS(v_TaxID, v_PriceStd, 0, v_priceprecision, 1);
+        v_PriceList:= C_GET_NET_PRICE_FROM_GROSS(v_TaxID, v_PriceList, 0, v_priceprecision, 1);
+        v_PriceLimit:= C_GET_NET_PRICE_FROM_GROSS(v_TaxID, v_PriceLimit, 0, v_priceprecision, 1);
+        v_LineNetAmt:= ROUND(v_PriceActual * Cur_workproposal.QTY, v_stdprecision);
+
+        UPDATE C_ORDER SET ISTAXINCLUDED='Y' WHERE C_ORDER_ID = v_COrder_ID;
+
+      END IF;
       v_ResultStr:='Insert order line';
 
       INSERT INTO C_OrderLine
@@ -232,7 +267,8 @@
          M_WAREHOUSE_ID, C_UOM_ID, QTYORDERED, C_CURRENCY_ID,
          PRICELIST, PRICEACTUAL, PRICELIMIT,
          PRICESTD, LINENETAMT, DISCOUNT,
-         C_TAX_ID)
+         C_TAX_ID, gross_unit_price, line_gross_amount,
+         grosspricestd, grosspricelist)
      VALUES
       (v_COrderLine_ID,v_Client_ID, v_Org_ID,'Y',
        now(), v_User_ID, now(), v_User_ID,
@@ -240,8 +276,9 @@
        Cur_workproposal.PLANNEDORDERDATE, Cur_workproposal.PLANNEDDATE, v_Description, Cur_workproposal.M_Product_ID,
        v_M_Warehouse_ID, Cur_workproposal.C_UOM_ID, Cur_workproposal.QTY, Cur_workproposal.C_Currency_ID,
        v_PriceList, v_PriceActual, v_PriceLimit,
-       v_PriceStd, v_PriceActual*Cur_workproposal.QTY,CASE v_PriceList WHEN 0 THEN 0 ELSE ROUND((((v_PriceList-v_PriceStd) / v_PriceList) * 100),2) END,
-       v_TaxID
+       v_PriceStd, v_LineNetAmt, CASE v_PriceList WHEN 0 THEN 0 ELSE ROUND((((v_PriceList-v_PriceStd) / v_PriceList) * 100),2) END,
+       v_TaxID, v_gross_unit_price, v_line_gross_amount,
+       v_gross_price_std, v_gross_price_list
       );
 
       UPDATE MRP_RUN_PURCHASELINE
--- a/src-db/database/model/functions/M_RESERVE_STOCK_MANUAL.xml	Wed Feb 17 09:52:43 2016 +0100
+++ b/src-db/database/model/functions/M_RESERVE_STOCK_MANUAL.xml	Wed Feb 17 09:56:42 2016 +0100
@@ -34,7 +34,7 @@
 * under the License.
 * The Original Code is Openbravo ERP.
 * The Initial Developer of the Original Code is Openbravo SLU
-* All portions are Copyright (C) 2012-2015 Openbravo SLU
+* All portions are Copyright (C) 2012-2016 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
@@ -125,7 +125,7 @@
 
   IF (v_aux_rs_id IS NOT NULL) THEN
     UPDATE m_reservation_stock
-    SET quantity = quantity + p_qty
+    SET quantity = CASE WHEN (quantity + p_qty) <= 0 THEN 0 ELSE quantity + p_qty END
     WHERE m_reservation_stock_id = v_aux_rs_id;
     p_reservation_stock_id := v_aux_rs_id;
     RETURN;
--- a/src-db/database/model/views/C_INVOICETAX_CASHVAT_V.xml	Wed Feb 17 09:52:43 2016 +0100
+++ b/src-db/database/model/views/C_INVOICETAX_CASHVAT_V.xml	Wed Feb 17 09:56:42 2016 +0100
@@ -1,4 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICETAX_CASHVAT_V">
-    <view name="C_INVOICETAX_CASHVAT_V"><![CDATA[SELECT itcv.c_invoicetax_cashvat_id AS c_invoicetax_cashvat_v_id, itcv.ad_client_id, itcv.ad_org_id, itcv.created, itcv.createdby, itcv.updated, itcv.updatedby, itcv.isactive, fp.paymentdate, itcv.percentage, itcv.taxamt, itcv.taxbaseamt, fpsd.iscanceled, fp.fin_payment_id, fpd.fin_payment_detail_id, fp.isreceipt, fp.c_bpartner_id, fp.fin_paymentmethod_id, fp.status, fp.amount, fp.c_currency_id, itcv.c_invoicetax_id, itcv.ismanualsettlement FROM c_invoicetax_cashvat itcv LEFT JOIN fin_payment_detail fpd ON fpd.fin_payment_detail_id = itcv.fin_payment_detail_id LEFT JOIN fin_payment fp ON fp.fin_payment_id = fpd.fin_payment_id LEFT JOIN fin_payment_scheduledetail fpsd ON fpd.fin_payment_detail_id = fpsd.fin_payment_detail_id]]></view>
+    <view name="C_INVOICETAX_CASHVAT_V"><![CDATA[SELECT itcv.c_invoicetax_cashvat_id AS c_invoicetax_cashvat_v_id, itcv.ad_client_id, itcv.ad_org_id, itcv.created, itcv.createdby, itcv.updated, itcv.updatedby, itcv.isactive, fp.paymentdate, itcv.percentage, itcv.taxamt, itcv.taxbaseamt, fpsd.iscanceled, fp.fin_payment_id, fpd.fin_payment_detail_id, fp.isreceipt, fp.c_bpartner_id, fp.fin_paymentmethod_id, fp.status, fp.amount, fp.c_currency_id, itcv.c_invoicetax_id, itcv.ismanualsettlement FROM c_invoicetax_cashvat itcv JOIN c_invoicetax it ON it.c_invoicetax_id = itcv.c_invoicetax_id JOIN fin_payment_detail fpd ON fpd.fin_payment_detail_id = itcv.fin_payment_detail_id JOIN fin_payment fp ON fp.fin_payment_id = fpd.fin_payment_id JOIN fin_payment_scheduledetail fpsd ON fpd.fin_payment_detail_id = fpsd.fin_payment_detail_id JOIN fin_payment_schedule fpsi ON fpsi.fin_payment_schedule_id = fpsd.fin_payment_schedule_invoice WHERE itcv.ismanualsettlement = 'N' AND fpsi.c_invoice_id = it.c_invoice_id UNION ALL SELECT itcv.c_invoicetax_cashvat_id AS c_invoicetax_cashvat_v_id, itcv.ad_client_id, itcv.ad_org_id, itcv.created, itcv.createdby, itcv.updated, itcv.updatedby, itcv.isactive, NULL AS paymentdate, itcv.percentage, itcv.taxamt, itcv.taxbaseamt, 'N' AS iscanceled, NULL AS fin_payment_id, NULL AS fin_payment_detail_id, NULL AS isreceipt, NULL AS c_bpartner_id, NULL AS fin_paymentmethod_id, NULL AS status, NULL AS amount, NULL AS c_currency_id, itcv.c_invoicetax_id, itcv.ismanualsettlement FROM c_invoicetax_cashvat itcv WHERE itcv.ismanualsettlement = 'Y']]></view>
   </database>
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Wed Feb 17 09:52:43 2016 +0100
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Wed Feb 17 09:56:42 2016 +0100
@@ -293328,6 +293328,7 @@
 <!--7891269C8418655DE040007F010155CE-->  <ISPARENT><![CDATA[N]]></ISPARENT>
 <!--7891269C8418655DE040007F010155CE-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
 <!--7891269C8418655DE040007F010155CE-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--7891269C8418655DE040007F010155CE-->  <READONLYLOGIC><![CDATA[@Processed@='Y']]></READONLYLOGIC>
 <!--7891269C8418655DE040007F010155CE-->  <ISIDENTIFIER><![CDATA[Y]]></ISIDENTIFIER>
 <!--7891269C8418655DE040007F010155CE-->  <SEQNO><![CDATA[110]]></SEQNO>
 <!--7891269C8418655DE040007F010155CE-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
@@ -306892,6 +306893,7 @@
 <!--828EE0AE801C5FA1E040007F010067C7-->  <ISPARENT><![CDATA[N]]></ISPARENT>
 <!--828EE0AE801C5FA1E040007F010067C7-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
 <!--828EE0AE801C5FA1E040007F010067C7-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--828EE0AE801C5FA1E040007F010067C7-->  <READONLYLOGIC><![CDATA[@Processed@='Y']]></READONLYLOGIC>
 <!--828EE0AE801C5FA1E040007F010067C7-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
 <!--828EE0AE801C5FA1E040007F010067C7-->  <SEQNO><![CDATA[260]]></SEQNO>
 <!--828EE0AE801C5FA1E040007F010067C7-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
--- a/src-db/database/sourcedata/AD_VAL_RULE.xml	Wed Feb 17 09:52:43 2016 +0100
+++ b/src-db/database/sourcedata/AD_VAL_RULE.xml	Wed Feb 17 09:56:42 2016 +0100
@@ -1719,7 +1719,7 @@
 <!--71188F0005494DA08311B4FFB2C5A993-->  <NAME><![CDATA[AD_Org child orgs any table]]></NAME>
 <!--71188F0005494DA08311B4FFB2C5A993-->  <DESCRIPTION><![CDATA[Filters the rows to show only those in that belong to child organizations of the organization of the record.]]></DESCRIPTION>
 <!--71188F0005494DA08311B4FFB2C5A993-->  <TYPE><![CDATA[S]]></TYPE>
-<!--71188F0005494DA08311B4FFB2C5A993-->  <CODE><![CDATA[AD_ISORGINCLUDED(@AD_ORG_ID@, ad_org_id, ad_client_id)<>-1]]></CODE>
+<!--71188F0005494DA08311B4FFB2C5A993-->  <CODE><![CDATA[AD_ISORGINCLUDED(ad_org_id, @AD_ORG_ID@, ad_client_id)<>-1]]></CODE>
 <!--71188F0005494DA08311B4FFB2C5A993-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--71188F0005494DA08311B4FFB2C5A993--></AD_VAL_RULE>
 
--- a/src-test/src/org/openbravo/test/costing/TestCosting.java	Wed Feb 17 09:52:43 2016 +0100
+++ b/src-test/src/org/openbravo/test/costing/TestCosting.java	Wed Feb 17 09:56:42 2016 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2014-2015 Openbravo SLU 
+ * All portions are Copyright (C) 2014-2016 Openbravo SLU
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
--- a/src/org/openbravo/erpCommon/ad_forms/DocMatchInv.java	Wed Feb 17 09:52:43 2016 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocMatchInv.java	Wed Feb 17 09:56:42 2016 +0100
@@ -11,7 +11,7 @@
  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
  * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
  * Contributor(s): Openbravo SLU
- * Contributions are Copyright (C) 2001-2015 Openbravo S.L.U.
+ * Contributions are Copyright (C) 2001-2016 Openbravo S.L.U.
  ******************************************************************************
  */
 package org.openbravo.erpCommon.ad_forms;