details: https://code.openbravo.com/erp/devel/main/rev/91af7013421e changeset: 25690:91af7013421e user: Atul Gaware <atul.gaware <at> openbravo.com> date: Tue Jan 20 14:57:35 2015 +0530 summary: Fixes Issue 28591:Reversing a payment is creating wrong invoice payment plan details
Problem is Schedule detail was being updated by payment amount now it is taken care to update using individual schedule detail amount while creating reverse payment schedule and payment schedule details. Modulescript to fix errorneous data consists of update invoice paid, outstanding amt, update payment schedule received and outstanding amount, update payment credit generated info if in case required. details: https://code.openbravo.com/erp/devel/main/rev/a088e7fae5e8 changeset: 25691:a088e7fae5e8 user: Atul Gaware <atul.gaware <at> openbravo.com> date: Wed Jan 21 13:29:26 2015 +0530 summary: Related to Issue 28591:Removed unwanted code from the modulescript to update payment plan and payment plan details details: https://code.openbravo.com/erp/devel/main/rev/7cf1a163acc1 changeset: 25692:7cf1a163acc1 user: Sandra Huguet <sandra.huguet <at> openbravo.com> date: Wed Jan 14 18:44:36 2015 +0100 summary: Fixed bug 28618 Added OB.Reservation.QuantityValidate to quantity field OB.Reservation.QuantityValidate is missing after after stock reservation refactor details: https://code.openbravo.com/erp/devel/main/rev/d5c6e81a234b changeset: 25693:d5c6e81a234b user: Naroa Iriarte <naroa.iriarte <at> openbravo.com> date: Mon Jan 19 14:42:57 2015 +0100 summary: Fixed issue 28623: Window's behaviour changes when creating a new record. When a window is opened using the "quick create new" widget, the same window in the recent views layout does not allow to create a new record (the green small button for creating a new record, which should be by the window name, disappears). The problem was in the "ob-utilities.js", inside the "{OB.Utilities.openView}" function, the logic for setting the "singleRecord" value (this is the Edit Only attribute) was wrong. If the value of the variable singleRecord of that function was undefined or null, as it was in the case of clicking the "quick create new" widget, that value was set to true and the window became an "edit only" window.That was why the small green "create new" icon disappeared from the recent views layout. For fixing this the condition has been removed, so we know that the value of the variable "singleRecord" is not going to be modified and it will be set correctly. details: https://code.openbravo.com/erp/devel/main/rev/373b808b426c changeset: 25694:373b808b426c user: Sandra Huguet <sandra.huguet <at> openbravo.com> date: Thu Jan 15 18:16:20 2015 +0100 summary: Fixed bug 28632 created colour status field in open/close period control created colour status field in open/close period control that was deleted by mistake in a project merge details: https://code.openbravo.com/erp/devel/main/rev/1d34a4e4bb53 changeset: 25695:1d34a4e4bb53 user: Unai Martirena <unai.martirena <at> openbravo.com> date: Fri Jan 16 12:56:53 2015 +0100 summary: Fixes bug 28643: Currency now is setted correctly in Transaction tab. Default value assigned to Currency column in transaction tab, that was not done during Transaction tab refactor project. details: https://code.openbravo.com/erp/devel/main/rev/9f0f61605bc5 changeset: 25696:9f0f61605bc5 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Thu Jan 22 11:14:24 2015 +0100 summary: fixed bug 28720: callouts incorrectly set big non integer numbers When a big non integer number was set by a callout, decimal separator was removed resulting in a different number, ie. 10200500.45 resulted in 1020050045.00. The problem was in the OB.Utilities.Number.ScientificToDecimal JavaScript function which wrongly assumed scientific exponent always added zeroes to coefficient, which is not true in this case where exponent determines where the decimal separator is inserted in the coefficient. details: https://code.openbravo.com/erp/devel/main/rev/b7df49952bd8 changeset: 25697:b7df49952bd8 user: David Baz Fayos <david.baz <at> openbravo.com> date: Mon Jan 26 13:13:50 2015 +0100 summary: Fixed issue 28766: Updated the list of recommended browsers: Mozilla Firefox 31 (latest ESR) Google Chrome: 40 Internet Explorer: 11 Apple Safari: 8 details: https://code.openbravo.com/erp/devel/main/rev/aed2a8dd8cc8 changeset: 25698:aed2a8dd8cc8 user: Aaron Calero <aaron.calero <at> openbravo.com> date: Fri Jan 23 12:21:36 2015 +0100 summary: Fixed issue 28722: Not possible to create invoiced receipts for customers created in WebPOS Modified the event handler used to set the BP currency to work not only on update events, but on save events too. Now when BPs are saved from the POS, the currency is automatically assigned to these business partners and they can be used to generate invoices. details: https://code.openbravo.com/erp/devel/main/rev/5cc656afb987 changeset: 25699:5cc656afb987 user: Sandra Huguet <sandra.huguet <at> openbravo.com> date: Tue Jan 27 13:16:28 2015 +0100 summary: Fixed bug 28755 It is impossible leaving credit when adding a payment in match statement Properly default value in actual payment field when add payment popup runs from match statement. Disabled "+" button and "magnifying glass" when line record is linked to a transaction. details: https://code.openbravo.com/erp/devel/main/rev/55fd6ab39a0e changeset: 25700:55fd6ab39a0e user: Unai Martirena <unai.martirena <at> openbravo.com> date: Wed Jan 28 17:37:00 2015 +0100 summary: Related to issue 28755: Fix copyright details: https://code.openbravo.com/erp/devel/main/rev/8362f1ef998a changeset: 25701:8362f1ef998a user: Sandra Huguet <sandra.huguet <at> openbravo.com> date: Tue Jan 27 17:19:36 2015 +0100 summary: Fixed bug 28780: Return to Vendor fails when unit price is zero or empty after refactoring, when Unit Price is empty in the pick&edit in SRMOPickEditLines.java class UnitPrice value comes as empty string, before refactoring this value was null. details: https://code.openbravo.com/erp/devel/main/rev/6f3cf69baf15 changeset: 25702:6f3cf69baf15 user: Sandra Huguet <sandra.huguet <at> openbravo.com> date: Thu Jan 29 17:22:12 2015 +0100 summary: Fixed bug 27570 updateBpPaymentLineInvoice is not correct for all scenarios details: https://code.openbravo.com/erp/devel/main/rev/431c13ee4c47 changeset: 25703:431c13ee4c47 user: Unai Martirena <unai.martirena <at> openbravo.com> date: Wed Jan 28 09:31:53 2015 +0100 summary: Fixes bug 28426: A product without sales price can be added to a commision Filter expression of Product Selector has been changed for Commission window, to not to filter by Sales flag, displaying in this way Purchase and Sales Products. diffstat: modules/org.openbravo.advpaymentmngt/build/classes/org/openbravo/advpaymentmngt/modulescript/Issue28591UpdatePSD.class | 0 modules/org.openbravo.advpaymentmngt/build/classes/org/openbravo/advpaymentmngt/modulescript/Issue28591UpdatePSDData.class | 0 modules/org.openbravo.advpaymentmngt/src-util/modulescript/src/org/openbravo/advpaymentmngt/modulescript/Issue28591UpdatePSD.java | 41 + modules/org.openbravo.advpaymentmngt/src-util/modulescript/src/org/openbravo/advpaymentmngt/modulescript/Issue28591UpdatePSD_data.xsql | 85 ++ modules/org.openbravo.advpaymentmngt/src-util/modulescript/src/src/org/openbravo/advpaymentmngt/modulescript/Issue28591UpdatePSDData.java | 292 ++++++++++ modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java | 6 +- modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js | 11 +- modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-matchStatement.js | 6 + modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-number.js | 15 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js | 13 +- src-db/database/sourcedata/AD_COLUMN.xml | 3 +- src-db/database/sourcedata/AD_FIELD.xml | 27 + src-db/database/sourcedata/OBUISEL_SELECTOR.xml | 2 +- src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateBpPaymentLineData.class | 0 src-util/modulescript/src/org/openbravo/modulescript/UpdateBpPaymentLine_data.xsql | 7 +- src/org/openbravo/common/actionhandler/SRMOPickEditLines.java | 4 +- src/org/openbravo/erpCommon/security/Login.html | 8 +- src/org/openbravo/event/BusinessPartnerEventHandler.java | 21 +- 18 files changed, 499 insertions(+), 42 deletions(-) diffs (truncated from 823 to 300 lines): diff -r 56eb6b2608eb -r 431c13ee4c47 modules/org.openbravo.advpaymentmngt/build/classes/org/openbravo/advpaymentmngt/modulescript/Issue28591UpdatePSD.class Binary file modules/org.openbravo.advpaymentmngt/build/classes/org/openbravo/advpaymentmngt/modulescript/Issue28591UpdatePSD.class has changed diff -r 56eb6b2608eb -r 431c13ee4c47 modules/org.openbravo.advpaymentmngt/build/classes/org/openbravo/advpaymentmngt/modulescript/Issue28591UpdatePSDData.class Binary file modules/org.openbravo.advpaymentmngt/build/classes/org/openbravo/advpaymentmngt/modulescript/Issue28591UpdatePSDData.class has changed diff -r 56eb6b2608eb -r 431c13ee4c47 modules/org.openbravo.advpaymentmngt/src-util/modulescript/src/org/openbravo/advpaymentmngt/modulescript/Issue28591UpdatePSD.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/org.openbravo.advpaymentmngt/src-util/modulescript/src/org/openbravo/advpaymentmngt/modulescript/Issue28591UpdatePSD.java Wed Jan 28 09:31:53 2015 +0100 @@ -0,0 +1,41 @@ +/* + ************************************************************************* + * The contents of this file are subject to the Openbravo Public License + * Version 1.0 (the "License"), being the Mozilla Public License + * Version 1.1 with a permitted attribution clause; you may not use this + * file except in compliance with the License. You may obtain a copy of + * the License at http://www.openbravo.com/legal/license.html + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * The Original Code is Openbravo ERP. + * The Initial Developer of the Original Code is Openbravo SLU + * All portions are Copyright (C) 2015 Openbravo SLU + * All Rights Reserved. + * Contributor(s): ______________________________________. + ************************************************************************* + */ +package org.openbravo.advpaymentmngt.modulescript; + +import org.openbravo.database.ConnectionProvider; +import org.openbravo.modulescript.ModuleScript; +import java.math.BigDecimal; + +public class Issue28591UpdatePSD extends ModuleScript { + public void execute() { + try { + ConnectionProvider cp = getConnectionProvider(); + boolean issue28591UpdatePSD = Issue28591UpdatePSDData.updateWrongPSD(cp); + if(!issue28591UpdatePSD) { + Issue28591UpdatePSDData[] data = Issue28591UpdatePSDData.selectPSD(cp); + for (Issue28591UpdatePSDData upsd : data) { + Issue28591UpdatePSDData.updatePSDAmount(cp, upsd.outstandingamt, upsd.finPaymentScheduledetailId); + } + Issue28591UpdatePSDData.createPreference(cp); + } + } catch (Exception e) { + handleError(e); + } + } +} \ No newline at end of file diff -r 56eb6b2608eb -r 431c13ee4c47 modules/org.openbravo.advpaymentmngt/src-util/modulescript/src/org/openbravo/advpaymentmngt/modulescript/Issue28591UpdatePSD_data.xsql --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/org.openbravo.advpaymentmngt/src-util/modulescript/src/org/openbravo/advpaymentmngt/modulescript/Issue28591UpdatePSD_data.xsql Wed Jan 28 09:31:53 2015 +0100 @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ************************************************************************* + * The contents of this file are subject to the Openbravo Public License + * Version 1.0 (the "License"), being the Mozilla Public License + * Version 1.1 with a permitted attribution clause; you may not use this + * file except in compliance with the License. You may obtain a copy of + * the License at http://www.openbravo.com/legal/license.html + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * The Original Code is Openbravo ERP. + * The Initial Developer of the Original Code is Openbravo SLU + * All portions are Copyright (C) 2015 Openbravo SLU + * All Rights Reserved. + * Contributor(s): ______________________________________. + ************************************************************************* +--> +<SqlClass name="Issue28591UpdatePSDData" package="org.openbravo.advpaymentmngt.modulescript"> + <SqlClassComment></SqlClassComment> + <SqlMethod name="select" type="preparedStatement" return="multiple"> + <SqlMethodComment></SqlMethodComment> + <Sql> + <![CDATA[ + SELECT '' as fin_payment_scheduledetail_id, '' as outstandingamt, '' as wrongamt, + '' as fin_payment_schedule_id, '' as c_invoice_id, '' as c_currency_id, '' as bp_currency_id, + '' as fin_payment_id, '' as fin_payment_detail_id, '' as isreceipt, '' as c_bpartner_id + FROM DUAL + ]]> + </Sql> + </SqlMethod> + <SqlMethod name="selectPSD" type="preparedStatement" return="multiple"> + <SqlMethodComment></SqlMethodComment> + <Sql> + <![CDATA[ + select ps.outstandingamt as outstandingamt, max(psd.fin_payment_scheduledetail_id) as fin_payment_scheduledetail_id + from fin_payment_scheduledetail psd + LEFT JOIN fin_payment_schedule ps ON ps.fin_payment_schedule_id = COALESCE(psd.fin_payment_schedule_invoice,psd.fin_payment_schedule_order) + where psd.fin_payment_detail_id is null and ps.outstandingamt > 0 + group by ps.outstandingamt, ps.fin_payment_schedule_id + having sum(psd.amount) <> ps.outstandingamt + ]]> + </Sql> + </SqlMethod> + <SqlMethod name="updatePSDAmount" type="preparedStatement" return="rowcount"> + <SqlMethodComment></SqlMethodComment> + <Sql> + <![CDATA[ + UPDATE FIN_PAYMENT_SCHEDULEDETAIL SET AMOUNT=TO_NUMBER(?), + updatedby='0', updated=now() + WHERE FIN_PAYMENT_SCHEDULEDETAIL_ID = ? + ]]> + </Sql> + <Parameter name="outStandingAmount"/> + <Parameter name="finPaymentScheduledetailId"/> + </SqlMethod> + <SqlMethod name="updateWrongPSD" type="preparedStatement" return="boolean"> + <SqlMethodComment></SqlMethodComment> + <Sql> + <![CDATA[ + SELECT count(*) as exist + FROM DUAL + WHERE EXISTS (SELECT 1 FROM ad_preference + WHERE attribute = 'Issue28591updateWrongPSD') + ]]> + </Sql> + </SqlMethod> + <SqlMethod name="createPreference" type="preparedStatement" return="rowcount"> + <SqlMethodComment></SqlMethodComment> + <Sql> + <![CDATA[ + INSERT INTO ad_preference ( + ad_preference_id, ad_client_id, ad_org_id, isactive, + createdby, created, updatedby, updated, + attribute + ) VALUES ( + get_uuid(), '0', '0', 'Y', + '0', NOW(), '0', NOW(), + 'Issue28591updateWrongPSD' + ) + ]]> + </Sql> + </SqlMethod> + </SqlClass> diff -r 56eb6b2608eb -r 431c13ee4c47 modules/org.openbravo.advpaymentmngt/src-util/modulescript/src/src/org/openbravo/advpaymentmngt/modulescript/Issue28591UpdatePSDData.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/org.openbravo.advpaymentmngt/src-util/modulescript/src/src/org/openbravo/advpaymentmngt/modulescript/Issue28591UpdatePSDData.java Wed Jan 28 09:31:53 2015 +0100 @@ -0,0 +1,292 @@ +//Sqlc generated V1.O00-1 +package org.openbravo.advpaymentmngt.modulescript; + +import java.sql.*; + +import org.apache.log4j.Logger; + +import javax.servlet.ServletException; + +import org.openbravo.data.FieldProvider; +import org.openbravo.database.ConnectionProvider; +import org.openbravo.data.UtilSql; +import java.util.*; + +class Issue28591UpdatePSDData implements FieldProvider { +static Logger log4j = Logger.getLogger(Issue28591UpdatePSDData.class); + private String InitRecordNumber="0"; + public String finPaymentScheduledetailId; + public String outstandingamt; + public String wrongamt; + public String finPaymentScheduleId; + public String cInvoiceId; + public String cCurrencyId; + public String bpCurrencyId; + public String finPaymentId; + public String finPaymentDetailId; + public String isreceipt; + public String cBpartnerId; + + public String getInitRecordNumber() { + return InitRecordNumber; + } + + public String getField(String fieldName) { + if (fieldName.equalsIgnoreCase("fin_payment_scheduledetail_id") || fieldName.equals("finPaymentScheduledetailId")) + return finPaymentScheduledetailId; + else if (fieldName.equalsIgnoreCase("outstandingamt")) + return outstandingamt; + else if (fieldName.equalsIgnoreCase("wrongamt")) + return wrongamt; + else if (fieldName.equalsIgnoreCase("fin_payment_schedule_id") || fieldName.equals("finPaymentScheduleId")) + return finPaymentScheduleId; + else if (fieldName.equalsIgnoreCase("c_invoice_id") || fieldName.equals("cInvoiceId")) + return cInvoiceId; + else if (fieldName.equalsIgnoreCase("c_currency_id") || fieldName.equals("cCurrencyId")) + return cCurrencyId; + else if (fieldName.equalsIgnoreCase("bp_currency_id") || fieldName.equals("bpCurrencyId")) + return bpCurrencyId; + else if (fieldName.equalsIgnoreCase("fin_payment_id") || fieldName.equals("finPaymentId")) + return finPaymentId; + else if (fieldName.equalsIgnoreCase("fin_payment_detail_id") || fieldName.equals("finPaymentDetailId")) + return finPaymentDetailId; + else if (fieldName.equalsIgnoreCase("isreceipt")) + return isreceipt; + else if (fieldName.equalsIgnoreCase("c_bpartner_id") || fieldName.equals("cBpartnerId")) + return cBpartnerId; + else { + log4j.debug("Field does not exist: " + fieldName); + return null; + } + } + + public static Issue28591UpdatePSDData[] select(ConnectionProvider connectionProvider) throws ServletException { + return select(connectionProvider, 0, 0); + } + + public static Issue28591UpdatePSDData[] select(ConnectionProvider connectionProvider, int firstRegister, int numberRegisters) throws ServletException { + String strSql = ""; + strSql = strSql + + " SELECT '' as fin_payment_scheduledetail_id, '' as outstandingamt, '' as wrongamt, " + + " '' as fin_payment_schedule_id, '' as c_invoice_id, '' as c_currency_id, '' as bp_currency_id," + + " '' as fin_payment_id, '' as fin_payment_detail_id, '' as isreceipt, '' as c_bpartner_id" + + " FROM DUAL"; + + ResultSet result; + Vector<java.lang.Object> vector = new Vector<java.lang.Object>(0); + PreparedStatement st = null; + + try { + st = connectionProvider.getPreparedStatement(strSql); + + result = st.executeQuery(); + long countRecord = 0; + long countRecordSkip = 1; + boolean continueResult = true; + while(countRecordSkip < firstRegister && continueResult) { + continueResult = result.next(); + countRecordSkip++; + } + while(continueResult && result.next()) { + countRecord++; + Issue28591UpdatePSDData objectIssue28591UpdatePSDData = new Issue28591UpdatePSDData(); + objectIssue28591UpdatePSDData.finPaymentScheduledetailId = UtilSql.getValue(result, "fin_payment_scheduledetail_id"); + objectIssue28591UpdatePSDData.outstandingamt = UtilSql.getValue(result, "outstandingamt"); + objectIssue28591UpdatePSDData.wrongamt = UtilSql.getValue(result, "wrongamt"); + objectIssue28591UpdatePSDData.finPaymentScheduleId = UtilSql.getValue(result, "fin_payment_schedule_id"); + objectIssue28591UpdatePSDData.cInvoiceId = UtilSql.getValue(result, "c_invoice_id"); + objectIssue28591UpdatePSDData.cCurrencyId = UtilSql.getValue(result, "c_currency_id"); + objectIssue28591UpdatePSDData.bpCurrencyId = UtilSql.getValue(result, "bp_currency_id"); + objectIssue28591UpdatePSDData.finPaymentId = UtilSql.getValue(result, "fin_payment_id"); + objectIssue28591UpdatePSDData.finPaymentDetailId = UtilSql.getValue(result, "fin_payment_detail_id"); + objectIssue28591UpdatePSDData.isreceipt = UtilSql.getValue(result, "isreceipt"); + objectIssue28591UpdatePSDData.cBpartnerId = UtilSql.getValue(result, "c_bpartner_id"); + objectIssue28591UpdatePSDData.InitRecordNumber = Integer.toString(firstRegister); + vector.addElement(objectIssue28591UpdatePSDData); + if (countRecord >= numberRegisters && numberRegisters != 0) { + continueResult = false; + } + } + result.close(); + } catch(SQLException e){ + log4j.error("SQL error in query: " + strSql + "Exception:"+ e); + throw new ServletException("@CODE=" + Integer.toString(e.getErrorCode()) + "@" + e.getMessage()); + } catch(Exception ex){ + log4j.error("Exception in query: " + strSql + "Exception:"+ ex); + throw new ServletException("@CODE=@" + ex.getMessage()); + } finally { + try { + connectionProvider.releasePreparedStatement(st); + } catch(Exception ignore){ + ignore.printStackTrace(); + } + } + Issue28591UpdatePSDData objectIssue28591UpdatePSDData[] = new Issue28591UpdatePSDData[vector.size()]; + vector.copyInto(objectIssue28591UpdatePSDData); + return(objectIssue28591UpdatePSDData); + } + + public static Issue28591UpdatePSDData[] selectPSD(ConnectionProvider connectionProvider) throws ServletException { + return selectPSD(connectionProvider, 0, 0); + } + + public static Issue28591UpdatePSDData[] selectPSD(ConnectionProvider connectionProvider, int firstRegister, int numberRegisters) throws ServletException { + String strSql = ""; + strSql = strSql + + " select ps.outstandingamt as outstandingamt, max(psd.fin_payment_scheduledetail_id) as fin_payment_scheduledetail_id" + + " from fin_payment_scheduledetail psd" + + " LEFT JOIN fin_payment_schedule ps ON ps.fin_payment_schedule_id = COALESCE(psd.fin_payment_schedule_invoice,psd.fin_payment_schedule_order)" + + " where psd.fin_payment_detail_id is null and ps.outstandingamt > 0" + + " group by ps.outstandingamt, ps.fin_payment_schedule_id" + + " having sum(psd.amount) <> ps.outstandingamt"; + + ResultSet result; + Vector<java.lang.Object> vector = new Vector<java.lang.Object>(0); + PreparedStatement st = null; + + try { + st = connectionProvider.getPreparedStatement(strSql); + + result = st.executeQuery(); + long countRecord = 0; + long countRecordSkip = 1; + boolean continueResult = true; + while(countRecordSkip < firstRegister && continueResult) { + continueResult = result.next(); + countRecordSkip++; + } ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
