Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0036747Openbravo ERP09. Financial managementpublic2017-08-30 10:412018-01-08 18:15
AtulOpenbravo 
AtulOpenbravo 
normalminoralways
closedfixed 
5
 
3.0PR18Q1 
dmiguelez
Core
No
0036747: Avoid query more than once in several classes
Query is executed more than once in several classes.

1. ReportReconciliation.java
2. AdvPaymentMngtDao.java
3. FIN_PaymentMonitorProcess
          
-
In ReportReconciliation.java,

if (obcTrans.list() != null && obcTrans.list().size() > 0) {
  @SuppressWarnings("rawtypes")
  List o = obcTrans.list();

needs to changed as

@SuppressWarnings("rawtypes")
List o = obcTrans.list();
if (!o.isEmpty()) {

in several places.
No tags attached.
related to design defect 0036898 new Triage Finance Performance issues when using DAL 
related to defect 0040964 closed nonofrancisco Cannot open Payment Execution form if there are more than 1000 payment methods 
Issue History
2017-08-30 10:41AtulOpenbravoNew Issue
2017-08-30 10:41AtulOpenbravoAssigned To => Triage Finance
2017-08-30 10:41AtulOpenbravoModules => Core
2017-08-30 10:41AtulOpenbravoTriggers an Emergency Pack => No
2017-09-05 11:49AtulOpenbravoSummaryAvoid query more than once in reports => Avoid query more than once in several classes
2017-09-05 11:49AtulOpenbravoDescription Updatedbug_revision_view_page.php?rev_id=15807#r15807
2017-09-14 13:32aferrazAssigned ToTriage Finance => AtulOpenbravo
2017-09-20 13:09aferrazRelationship addedrelated to 0036898
2017-09-21 10:45AtulOpenbravoStatusnew => scheduled
2017-10-06 08:29AtulOpenbravoDescription Updatedbug_revision_view_page.php?rev_id=16036#r16036
2017-10-06 08:36AtulOpenbravoNote Added: 0099781
2017-11-10 10:33dmiguelezNote Added: 0100416
2017-11-10 13:06dmiguelezNote Added: 0100425
2017-11-10 13:06dmiguelezNote Added: 0100426
2017-11-10 13:08hgbotCheckin
2017-11-10 13:08hgbotNote Added: 0100427
2017-11-10 13:08hgbotStatusscheduled => resolved
2017-11-10 13:08hgbotResolutionopen => fixed
2017-11-10 13:08hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/32bab2f8df54dcb0d5a15131757c2cd13d15e497 [^]
2017-11-10 13:08hgbotCheckin
2017-11-10 13:08hgbotNote Added: 0100428
2017-11-10 13:08hgbotCheckin
2017-11-10 13:08hgbotNote Added: 0100429
2017-11-10 13:08hgbotCheckin
2017-11-10 13:08hgbotNote Added: 0100430
2017-11-10 13:08hgbotCheckin
2017-11-10 13:08hgbotNote Added: 0100431
2017-11-10 13:08hgbotCheckin
2017-11-10 13:08hgbotNote Added: 0100432
2017-11-10 13:08hgbotCheckin
2017-11-10 13:08hgbotNote Added: 0100433
2017-11-10 13:09hgbotCheckin
2017-11-10 13:09hgbotNote Added: 0100435
2017-11-10 13:09hgbotCheckin
2017-11-10 13:09hgbotNote Added: 0100436
2017-11-10 13:09hgbotCheckin
2017-11-10 13:09hgbotNote Added: 0100437
2017-11-10 13:11dmiguelezReview Assigned To => dmiguelez
2017-11-10 13:11dmiguelezNote Added: 0100439
2017-11-10 13:11dmiguelezStatusresolved => closed
2018-01-03 12:38hudsonbotCheckin
2018-01-03 12:38hudsonbotNote Added: 0101401
2018-01-03 12:38hudsonbotCheckin
2018-01-03 12:38hudsonbotNote Added: 0101402
2018-01-03 12:38hudsonbotCheckin
2018-01-03 12:38hudsonbotNote Added: 0101403
2018-01-03 12:38hudsonbotCheckin
2018-01-03 12:38hudsonbotNote Added: 0101404
2018-01-03 12:38hudsonbotCheckin
2018-01-03 12:38hudsonbotNote Added: 0101405
2018-01-03 12:38hudsonbotCheckin
2018-01-03 12:38hudsonbotNote Added: 0101406
2018-01-03 12:38hudsonbotCheckin
2018-01-03 12:38hudsonbotNote Added: 0101407
2018-01-03 12:38hudsonbotCheckin
2018-01-03 12:38hudsonbotNote Added: 0101408
2018-01-03 12:38hudsonbotCheckin
2018-01-03 12:38hudsonbotNote Added: 0101409
2018-01-03 12:38hudsonbotCheckin
2018-01-03 12:38hudsonbotNote Added: 0101410
2018-01-08 18:15dmiguelezFixed in Version => 3.0PR18Q1
2019-05-28 17:20ngarciaRelationship addedrelated to 0040964

Notes
(0099781)
AtulOpenbravo   
2017-10-06 08:36   
Test Plan
- In log4j.lcf set log4j.logger.org.hibernate.SQL=debug
- Compile and start the application
- Login as F&B International Group Admin
- Navigate to Financial Account - Bank Account 1
- From reconciliation tab, select any recent record and click on Reconciliation Details or Reconciliation Summary button.
- Realize that in the logs, queries from the method getUnreconciledBankStatmentLinesTotal, getOutstandingPaymentAndDepositTotal, getTransactionsTotalAfterReconciliationEndDate are executed only once.
(0100416)
dmiguelez   
2017-11-10 10:33   
Test Plan.

Run ant test for Inventory Status and Costing and check that it is completed successfully:

ant run.test -Dtest=org.openbravo.test.inventoryStatus.InventoryStatusTest
ant run.test -Dtest=org.openbravo.test.costing.TestCosting
(0100425)
dmiguelez   
2017-11-10 13:06   
Functional Steps for the Test Plan.

If the configuration is set as the first test plan, the queries executed can be checked.


Test Plan 1:

Log in as F&B Group Admin

Go to Financial Account and select record Bank - Account 1
Move to Reconciliations Tab
Select any record and click on Reconciliation Summary button
The Report should be shown correctly


Test Plan 2:

Log in as F&B Group Admin

Move to Financial Account and select record Bank - Account 1
Move to Payment method and select Wire Transfer
Modify Execution Type to automatic, set Execution Process to Simple Execution Process and check the Deferred flag

Go to Sales Invoice Window and create a new record for:
* Organization: F&B US
* Business Partner: Healthy Food Supermarkets
Create a new line wiht:
* Product: Ale Beer
* Invoiced Quantity: 10
Complete the document

Go to Payment In Window and create a new record:
* Organization: F&B US
* Received From: Healthy Food Supermarkets
* Amount: 10
* Payment Method: Wire Transfer
* Deposit To: Bank - Account 1
Click on Add details and select the previously created Invoice. Click on done.
Check that the Payment has status: Awaiting Execution

Go to Paymetn Execution Window and select
* Organization: F&B US
* Financial Account: Bank - Account 1
* Payment Method: Wire Transfer
Click on search and select the previously created Payment.
Click on Process and Execute.

Move to Payment In Window and check that the previous Payment has status Deposited Not Cleared


Test Plan 3:

Log in as F&B Group Admin

Go to Process Request Window
Create a new record with:
* Organization: *
* Process: Payment Monitor
* Timing: Run immediately
Click on Reschedule Process
Move to Process Monitor Tab and check that is has been completed successfully and that the log states that some Invoices has been updated.


Test Plan 4:

Log in as F&B Group Admin

- Navigate to Financial Account and select Bank Account 1
- Set Matching Algorithm as Blank.
- Add Transaction with Transaction Type = BP Withdrawal, GL Item = Salaries, Withdrawal amount = 1000.
- Set Transaction Date = Accounting Date = 31-10-2017
- Process and Post above transaction.
- Go to Financial Account tab and click on Reconcile Button
- Log the query in method getLastReconciliation
- Keep Statement Date as 10-10-2017, Ending Balance = Starting Balance + 1000.
- Remove the flag Hide Transaction After Statement Date and select the above created financial account transaction.
- Click on Reconcile button


Test Plan 5:

Log in as F&B Group Admin

- Navigate to Warehouse and Storage Bin and select España Región Norte warehouse
- Navigate to Storage Bin Tab and select bin RN-0-0-0
- Change the Active flag = No


Test Plan 6:

Log in as System Administrator
- Navigate to Reference Window and select "OBPSLicenseEdition"
- Navigate to List Reference Tab and select "Community Edition"
- Navigate to Translation Tab and add record for English Language as "Trl Community Edition"
- Refresh the url in the browser
- Navigate to Translation created for List Reference "Community Edition" and delete it.
- Refresh the url in the browser
(0100426)
dmiguelez   
2017-11-10 13:06   
Document with more information regarding Test Plan:
https://docs.google.com/spreadsheets/d/16NWYzNUKeArlOKyW0BsDuc6H49h7bJnNZaSTtt0-ME8/edit#gid=1567073233 [^]
(0100427)
hgbot   
2017-11-10 13:08   
Repository: erp/devel/pi
Changeset: 32bab2f8df54dcb0d5a15131757c2cd13d15e497
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Fri Oct 06 11:41:37 2017 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/32bab2f8df54dcb0d5a15131757c2cd13d15e497 [^]

Fixes Issue 36747:Avoid query more than once in several classes

** In ReportReconciliation.java, method getUnreconciledBankStatmentLinesTotal,
getOutstandingPaymentAndDepositTotal, getTransactionsTotalAfterReconciliationEndDate
executes query only once by avoiding calls to list method multiple times

** Use IsEmpty method instead of size() > 0 to check if the list is not empty

---
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_reports/ReportReconciliation.java
---
(0100428)
hgbot   
2017-11-10 13:08   
Repository: erp/devel/pi
Changeset: 9cf1f8c7de280894eb268e310a732b3e61cd128d
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Tue Oct 10 13:49:09 2017 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/9cf1f8c7de280894eb268e310a732b3e61cd128d [^]

Related to Issue 36747:Avoid query more than once in AdvPaymentMngtDao.java

** Use IsEmpty() for list instead if size() > 0
** Use count() to get the size of list instead of size()
** Instead of get(0) for any list, use setMaxResults(1) and uniqueResult()
   for OBCriteria

---
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java
---
(0100429)
hgbot   
2017-11-10 13:08   
Repository: erp/devel/pi
Changeset: 59128cd57e895176643ba01f08b47b7133ec1641
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Tue Oct 10 13:51:31 2017 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/59128cd57e895176643ba01f08b47b7133ec1641 [^]

Related to Issue 36747:Avoid query more than once in FIN_PaymentMonitorProcess.java

** Instead of get(0) for any list, use setMaxResults(1) and uniqueResult()
   for OBCriteria
** Use StringUtils to compare module id
** Update copyright year information

---
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentMonitorProcess.java
---
(0100430)
hgbot   
2017-11-10 13:08   
Repository: erp/devel/pi
Changeset: 75b558d706129a37276e9d96065b3369ad7c7414
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Wed Oct 11 14:47:07 2017 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/75b558d706129a37276e9d96065b3369ad7c7414 [^]

Related to Issue 36747:Avoid query more than once in InventoryStatusTest.java

** Use count() instead of list().size()

---
M src-test/src/org/openbravo/test/inventoryStatus/InventoryStatusTest.java
---
(0100431)
hgbot   
2017-11-10 13:08   
Repository: erp/devel/pi
Changeset: 14205180042a449006b69f2800b7e6bdda2fab3a
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Wed Oct 11 14:38:14 2017 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/14205180042a449006b69f2800b7e6bdda2fab3a [^]

Related to Issue 36747:Avoid query more than once in InventoryStatusUtils.java

** Avoid list().size() and use count()

---
M src/org/openbravo/erpCommon/utility/InventoryStatusUtils.java
---
(0100432)
hgbot   
2017-11-10 13:08   
Repository: erp/devel/pi
Changeset: ee94fdf7171ed3f341988c915563c0342885f106
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Wed Oct 11 01:23:38 2017 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/ee94fdf7171ed3f341988c915563c0342885f106 [^]

Related to Issue 36747:Avoid query more than once in SE_Locator_Activate.java

** Use setMaxResult(1) and uniqueResult() in storageIsNotEmpty method
   just one fetch a single record and decide whether the storage bin
   is empty or not instead of fetching all the record and checking
   with size() > 0

---
M src/org/openbravo/erpCommon/ad_callouts/SE_Locator_Activate.java
---
(0100433)
hgbot   
2017-11-10 13:08   
Repository: erp/devel/pi
Changeset: 44e45c93cd4055b6f16a2c8ed697078a214675e3
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Wed Oct 11 14:42:38 2017 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/44e45c93cd4055b6f16a2c8ed697078a214675e3 [^]

Related to Issue 36747:Avoid query more than once in TestCosting.java

** Avoid mutliple call to list() method in assertDocumentPost
** Use setMaxResult(1) and uniqueResult()
   in OBCriteria instead of get(0) from the list.
** Use count() instead of list().size()

---
M src-test/src/org/openbravo/test/costing/TestCosting.java
---
(0100435)
hgbot   
2017-11-10 13:09   
Repository: erp/devel/pi
Changeset: 218bc353d82badbfa5f95bfd61036c082946a17a
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Thu Nov 09 17:58:26 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/218bc353d82badbfa5f95bfd61036c082946a17a [^]

Related to Issue 36747:Avoid query more than once in TransactionsDao.java

** Avoid multiple call to list() and list().size() in getAccTrxData method
** Use uniqueResult() instead of get(0) to get Last FIN_Reconciliation
** Use count() instead of size() in getPendingToMatchCount method
** Avoid multiple calls to list() and use setMaxResult(1) and uniqueResult()
   in getPeriod method instead of get(0)

---
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/TransactionsDao.java
---
(0100436)
hgbot   
2017-11-10 13:09   
Repository: erp/devel/pi
Changeset: fd6282f181824fd492750e8b1fecdb09751eb155
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Wed Oct 11 01:56:44 2017 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/fd6282f181824fd492750e8b1fecdb09751eb155 [^]

Related to Issue 36747:Avoid query more than once in Utility.java

** Avoid mutliple call to list() method and use setMaxResult(1) and uniqueResult()
   in OBCriteria instead of get(0) from the list.

---
M src/org/openbravo/erpCommon/utility/Utility.java
---
(0100437)
hgbot   
2017-11-10 13:09   
Repository: erp/devel/pi
Changeset: 929418684af7b27099feb8132abe8f325a9f5446
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Fri Nov 10 10:24:55 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/929418684af7b27099feb8132abe8f325a9f5446 [^]

Related to Issue 36747. Code review changes

* Added comments to code
* Moved some code to a different line
* Added uniqueResults condition to missing clause in SE_Locator_Activate

---
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentMonitorProcess.java
M src/org/openbravo/erpCommon/ad_callouts/SE_Invoice_BPartner.java
M src/org/openbravo/erpCommon/ad_callouts/SE_Locator_Activate.java
---
(0100439)
dmiguelez   
2017-11-10 13:11   
Code Review + Testing Ok
(0101401)
hudsonbot   
2018-01-03 12:38   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/c81e0d3cbab5 [^]
Maturity status: Test
(0101402)
hudsonbot   
2018-01-03 12:38   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/c81e0d3cbab5 [^]
Maturity status: Test
(0101403)
hudsonbot   
2018-01-03 12:38   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/c81e0d3cbab5 [^]
Maturity status: Test
(0101404)
hudsonbot   
2018-01-03 12:38   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/c81e0d3cbab5 [^]
Maturity status: Test
(0101405)
hudsonbot   
2018-01-03 12:38   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/c81e0d3cbab5 [^]
Maturity status: Test
(0101406)
hudsonbot   
2018-01-03 12:38   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/c81e0d3cbab5 [^]
Maturity status: Test
(0101407)
hudsonbot   
2018-01-03 12:38   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/c81e0d3cbab5 [^]
Maturity status: Test
(0101408)
hudsonbot   
2018-01-03 12:38   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/c81e0d3cbab5 [^]
Maturity status: Test
(0101409)
hudsonbot   
2018-01-03 12:38   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/c81e0d3cbab5 [^]
Maturity status: Test
(0101410)
hudsonbot   
2018-01-03 12:38   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/c81e0d3cbab5 [^]
Maturity status: Test