Openbravo Issue Tracking System - Openbravo ERP |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0040523 | Openbravo ERP | Z. Others | public | 2019-04-04 13:38 | 2019-05-21 15:16 |
|
Reporter | alostale | |
Assigned To | nonofrancisco | |
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | closed | Resolution | fixed | |
Platform | | OS | 5 | OS Version | |
Product Version | | |
Target Version | | Fixed in Version | 3.0PR19Q3 | |
Merge Request Status | |
Review Assigned To | vmromanos |
OBNetwork customer | |
Web browser | |
Modules | Core |
Support ticket | |
Regression level | |
Regression date | |
Regression introduced in release | |
Regression introduced by commit | |
Triggers an Emergency Pack | No |
|
Summary | 0040523: use bind-parameters in FactLine |
Description | FactLine.getDescription method is generating a sql setting parameters by String concatenation, replace tokens by bind parameters.
|
Steps To Reproduce | - |
Proposed Solution | If query can be executed in Dal transaction can be done as:
strSql = strSql.replaceAll("@RecordId@", ":recordId").replaceAll("@Line@", ":lineId");
description.append(OBDal.getInstance().getSession()
.createNativeQuery(strSql)
.setParameter("lineId", localStrLine)
.setParameter("recordId", strRecord_ID)
.uniqueResult());
|
Additional Information | |
Tags | No tags attached. |
Relationships | depends on | backport | 0040699 | 3.0PR19Q2 | closed | nonofrancisco | use bind-parameters in FactLine | depends on | backport | 0040700 | 3.0PR19Q1.1 | closed | nonofrancisco | use bind-parameters in FactLine | depends on | backport | 0040701 | 3.0PR18Q4.4 | closed | nonofrancisco | use bind-parameters in FactLine | blocks | design defect | 0038136 | | acknowledged | Triage Platform Base | Tracking issue: Find & Fix queries not using bind-params but embedding values into query string | causes | defect | 0041848 | | closed | markmm82 | Cannot post a document if it has a customized SQL description that returns more than one record |
|
Attached Files | |
|
Issue History |
Date Modified | Username | Field | Change |
2019-04-04 13:38 | alostale | New Issue | |
2019-04-04 13:38 | alostale | Assigned To | => Triage Finance |
2019-04-04 13:38 | alostale | Modules | => Core |
2019-04-04 13:38 | alostale | Triggers an Emergency Pack | => No |
2019-04-04 13:38 | alostale | Relationship added | blocks 0040522 |
2019-04-05 10:09 | vmromanos | Status | new => scheduled |
2019-04-05 10:09 | vmromanos | Assigned To | Triage Finance => nonofrancisco |
2019-04-05 10:19 | vmromanos | Note Added: 0110995 | |
2019-04-05 10:19 | vmromanos | Note Edited: 0110995 | bug_revision_view_page.php?bugnote_id=0110995#r18593 |
2019-04-09 14:04 | caristu | Proposed Solution updated | |
2019-04-09 20:56 | shuehner | Relationship added | blocks 0038136 |
2019-04-09 20:57 | shuehner | Relationship deleted | blocks 0040522 |
2019-04-26 08:02 | vmromanos | Status | scheduled => acknowledged |
2019-04-26 15:11 | nonofrancisco | Status | acknowledged => scheduled |
2019-04-29 13:33 | nonofrancisco | Status | scheduled => acknowledged |
2019-04-29 13:34 | nonofrancisco | Status | acknowledged => scheduled |
2019-05-02 15:11 | nonofrancisco | Note Added: 0111436 | |
2019-05-02 16:09 | vmromanos | Note Added: 0111438 | |
2019-05-02 16:10 | vmromanos | File Added: before.png | |
2019-05-02 16:10 | vmromanos | File Added: after.png | |
2019-05-02 16:28 | vmromanos | Note Edited: 0111438 | bug_revision_view_page.php?bugnote_id=0111438#r18699 |
2019-05-02 16:28 | vmromanos | File Deleted: before.png | |
2019-05-02 16:28 | vmromanos | File Deleted: after.png | |
2019-05-03 09:55 | vmromanos | Note Edited: 0111438 | bug_revision_view_page.php?bugnote_id=0111438#r18702 |
2019-05-03 10:13 | hgbot | Checkin | |
2019-05-03 10:13 | hgbot | Note Added: 0111460 | |
2019-05-03 10:13 | hgbot | Status | scheduled => resolved |
2019-05-03 10:13 | hgbot | Resolution | open => fixed |
2019-05-03 10:13 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/devel/pi/rev/54f5cc848bee48edf56131bff6b0265e17a75a99 [^] |
2019-05-03 10:13 | hgbot | Checkin | |
2019-05-03 10:13 | hgbot | Note Added: 0111461 | |
2019-05-03 12:02 | vmromanos | Review Assigned To | => vmromanos |
2019-05-03 12:02 | vmromanos | Note Added: 0111472 | |
2019-05-03 12:02 | vmromanos | Status | resolved => closed |
2019-05-03 12:02 | vmromanos | Fixed in Version | => 3.0PR19Q3 |
2019-05-21 15:16 | hudsonbot | Checkin | |
2019-05-21 15:16 | hudsonbot | Note Added: 0112006 | |
2019-05-21 15:16 | hudsonbot | Checkin | |
2019-05-21 15:16 | hudsonbot | Note Added: 0112007 | |
2019-09-18 15:03 | ngarcia | Relationship added | causes 0041848 |
Notes |
|
|
Backport to previous releases
|
|
|
|
Test Plan
As System Administrator
Open Widows Tabs and Field window
Filter by "General Ledger Configuration"
Select Active Tables tab
Set Displayed = true for field "SQL Description"
Rebuild the system
As F&B Group Admin mode
Select General Ledger "F&B International Group US/A/US Dollar"
Move to Active Table tab
Select "Invoice" table
Write this query in SQL Description field
"select o.name from c_invoice i inner join ad_org o on i.ad_org_id = o.ad_org_id and i.c_invoice_id = @RecordId@ and i.c_invoice_id <> @Line@"
Create a Sales Invoice
Complete the document
Post the document
Verify the operation completes successfully |
|
|
(0111438)
|
vmromanos
|
2019-05-02 16:09
(edited on: 2019-05-03 09:55) |
|
Extended test plan:
As System Administrator
Open Widows Tabs and Field window
Filter by "General Ledger Configuration"
Select Active Tables tab
Set Displayed = true for field "SQL Description"
Rebuild the system
As F&B Group Admin mode
Select General Ledger "F&B España, S.A. US/A/Euro"
Move to Active Table tab
Select "Invoice" table
Write this query in SQL Description field:
select 'RecordId: ' || @RecordId@ || ', Line: ' || @Line@ from dual
Create a Sales Invoice for España Norte
Complete the document
Post the document
Verify the operation completes successfully
Inside the Journal Entries Report for "F&B España, S.A. US/A/Euro", press the Detail link.
Verify the description field looks like (the IDs might change):
43000 Clientes (euros) a corto plazo 185.13 RecordId: 3232199ED4824EE3A07BCC1E580ABFE7, Line: 5B172283D5474E7384BE6FA4EE1B521B
47700 Hacienda Pública IVA repercutido 32.13 RecordId: 3232199ED4824EE3A07BCC1E580ABFE7, Line: NULL
70000 Ventas de mercaderías 153.00 RecordId: 3232199ED4824EE3A07BCC1E580ABFE7, Line: 92488D61F72E4E288C8382FA5E537DEE
As F&B Group Admin mode
Select General Ledger "F&B España, S.A. US/A/Euro"
Move to Active Table tab
Select "Invoice" table
Write this query in SQL Description field:
select @Line@ from dual
(Note there is no @RecordId@ this time).
Create a Sales Invoice for España Norte
Complete the document
Post the document.
Verify the description field looks like (the IDs might change):
43000 Clientes (euros) a corto plazo 185.13 5B172283D5474E7384BE6FA4EE1B521B
47700 Hacienda Pública IVA repercutido 32.13
70000 Ventas de mercaderías 153.00 92488D61F72E4E288C8382FA5E537DEE
|
|
|
(0111460)
|
hgbot
|
2019-05-03 10:13
|
|
Repository: erp/devel/pi
Changeset: 54f5cc848bee48edf56131bff6b0265e17a75a99
Author: Nono Carballo <nonofce <at> gmail.com>
Date: Thu May 02 12:00:38 2019 -0400
URL: http://code.openbravo.com/erp/devel/pi/rev/54f5cc848bee48edf56131bff6b0265e17a75a99 [^]
Fixes issue 40523: Uses bind parameters in query
Instead of using string concatenation to form the query, bind parameters are
used.
---
M src/org/openbravo/erpCommon/ad_forms/FactLine.java
---
|
|
|
(0111461)
|
hgbot
|
2019-05-03 10:13
|
|
Repository: erp/devel/pi
Changeset: a09be04c90d76eada9ca5765d798ab75194cacae
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Fri May 03 09:54:13 2019 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/a09be04c90d76eada9ca5765d798ab75194cacae [^]
Related to issue 40523: code review improvements
Centralize localStrLine definition in just one line, when it's used.
Change parameter names to make more difficult to have conflicts with user defined params.
Remove 'if' for corner case. This creates a very small change in this scenario:
select 'RecordId: ' || @RecordId@ || ', Line: ' || @Line@ from dual
When Line is null then:
Before: NULL
After: RecordId: 3232199ED4824EE3A07BCC1E580ABFE7, Line: NULL
---
M src/org/openbravo/erpCommon/ad_forms/FactLine.java
---
|
|
|
|
|
|
|
|
|
|
|