Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0008502Openbravo ERP02. Master data managementpublic2009-04-08 12:302009-05-13 00:00
cheli 
shuehner 
normaltrivialalways
closedno change required 
20Debian Gnu Linux
2.40MP1 
 
Core
No
0008502: Code errors in SE_Order_BPartner.java file
I was trying to upgrade from 2.40mp1 to 2.40mp3 and I found some odd things, then I have checked the mp3 source file and I found this:

Line 81:

if (data!=null && data.length>0) {
      strDeliveryRule = data[0].deliveryrule.equals("")?strDeliveryRule0:data[0].deliveryrule;
      strUserRep = SEOrderBPartnerData.userIdSalesRep(this, data[0].salesrepId);
      strUserRep = strUserRep.equals("")?strUserRep0:strUserRep;
      strPaymentrule = (strIsSOTrx.equals("Y")?data[0].paymentrule: data[0].paymentrulepo);
      strPaymentrule = strPaymentrule.equals("")?strPaymentrule0:strPaymentrule;
      strPaymentterm = (strIsSOTrx.equals("Y")?data[0].cPaymenttermId: data[0].poPaymenttermId);
      strPaymentterm = strPaymentterm.equals("")?strPaymentterm0:strPaymentterm;
      strInvoiceRule = data[0].invoicerule.equals("")?strInvoiceRule0:data[0].invoicerule;
      strPriceList = (strIsSOTrx.equals("Y")?data[0].mPricelistId: data[0].poPricelistId);
      strPriceList = strPriceList.equals("")?strPriceList0:strPriceList;
    }

it makes no sense to make assignments twice for the same variable.
Leave only last assignment for each variable.
Clean-up, tictech
Issue History
2009-04-08 12:30cheliNew Issue
2009-04-08 12:30cheliAssigned To => rafaroda
2009-04-08 12:31cheliTag Attached: tictech
2009-04-08 12:42rafarodaTag Attached: Clean-up
2009-04-08 14:57cheliNote Added: 0015284
2009-04-22 18:43psarobeStatusnew => scheduled
2009-04-22 18:43psarobefix_in_branch => pi
2009-04-23 12:03rafarodaAssigned Torafaroda => shuehner
2009-05-12 10:12shuehnerNote Added: 0016286
2009-05-12 11:02shuehnerNote Added: 0016287
2009-05-12 11:02shuehnerStatusscheduled => feedback
2009-05-12 11:13cheliNote Added: 0016289
2009-05-12 11:46shuehnerRegression testing => No
2009-05-12 11:46shuehnerStatusfeedback => closed
2009-05-12 11:46shuehnerNote Added: 0016292
2009-05-12 11:46shuehnerResolutionopen => no change required
2009-05-13 00:00anonymoussf_bug_id0 => 2790912

Notes
(0015284)
cheli   
2009-04-08 14:57   
Ok you compare if the first assignment returns 0 length string.

strUserRep = SEOrderBPartnerData.userIdSalesRep(this, data[0].salesrepId);
strUserRep = strUserRep.equals("")?strUserRep0:strUserRep;
(0016286)
shuehner   
2009-05-12 10:12   
cheli: do you have any further info that there is a possible bug/problem?

As like you said the two lines together only select one of three values.

If not i would like to reject this as not an issue..
(0016287)
shuehner   
2009-05-12 11:02   
Reasking last notes' question via the feedback state:

do you have any further info that there is a possible bug/problem?

As like you said the two lines together only select one of three values.

If not i would like to reject this as not an issue..
(0016289)
cheli   
2009-05-12 11:13   
Hi Shuehner, perhaps the code is not as elegant as it could be but the answear is no, it has not got any bug/problem. You can reject this issue.

Thanks.
(0016292)
shuehner   
2009-05-12 11:46   
After discussion with reporter no change required as the code question does have a purpose and is not a programming mistake.