Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0025030Openbravo ERPA. Platformpublic2013-10-26 00:452013-10-26 00:45
chelipf 
AugustoMauch 
normalminoralways
newopen 
30Debian Wheezy
3.0MP28.2 
 
Mozilla Firefox
Core
No
0025030: getTableName method of ErrorTexParser class assumes the primary key column is linked to an element like tablenname + _ID
What happens if I want to reuse the same element for two primary keys? for example
purchase_authorization (primary key purchase authorization_id) and sales_authorization(primary key sales_authorization_id)

tables. Your assumption forces to create two elements, one for each primary key.

 

protected String getTableName(String tableName) {
    try {
      String pkColumnName = tableName + "_ID";
      return ErrorTextParserData.selectColumnName(conn, language, pkColumnName);
    } catch (ServletException e) {
      log4j.error(
          "Error while trying to name for table via ad_element for tablename: " + tableName, e);
    }
    return tableName;
  }

selectColumnName method (
select coalesce(ad_element_trl.name, ad_element.name) as column_name
            from ad_element left join ad_element_trl on ad_element.ad_element_id = ad_element_trl.ad_element_id and ad_element_trl.ad_language = ?
          where upper(ad_element.columnname) = upper(?)";
create a new table and set the element of the primary key to an element which columnname is different from the column name. Set for example a unique constraint. The error message will get a null value as table name.
get the element linked to primary key column of the table, something like this:

selectColumnName method (
select coalesce(ad_element_trl.name, ad_element.name) as column_name
from ad_table t inner join ad_column c on t.ad_table_id = c.ad_table_id and c.ad_reference_id = '13' --ID Reference
left join ad_element e on c.ad_element_id = e.ad_element_id
left join ad_element_trl on ad_element.ad_element_id = ad_element_trl.ad_element_id and ad_element_trl.ad_language = ?
          where t.name = ?;
)
No tags attached.
Issue History
2013-10-26 00:45chelipfNew Issue
2013-10-26 00:45chelipfAssigned To => AugustoMauch
2013-10-26 00:45chelipfWeb browser => Mozilla Firefox
2013-10-26 00:45chelipfModules => Core
2013-10-26 00:45chelipfTriggers an Emergency Pack => No

There are no notes attached to this issue.