Menu

#1069 Improvement import business partner

open
nobody
5
2014-08-23
2011-11-25
No

Add 2 new columns (Logo String, MBPBankAccount String) to the table I_BPartner
then improve MBPBankAccoutn.java
change this method
public MBPBankAccount (Properties ctx, MBPartner bp, MUser bpc, MLocation location, String Description)
with
public MBPBankAccount (Properties ctx, MBPartner bp, MUser bpc, MLocation location, String Description)
{
this(ctx, 0, bp.get_TrxName());
setIsACH (true);
setBPBankAcctUse("B");
//
setC_BPartner_ID(bp.getC_BPartner_ID());
//
if (bpc !=null)
{
setA_Name(bpc.getName());
setA_EMail(bpc.getEMail());
}
//
if ( location != null )
{
setA_Street(location.getAddress1());
setA_City(location.getCity());
setA_Zip(location.getPostal());
setA_State(location.getRegionName(true));
setA_Country(location.getCountryName());
}
if (Description != null)
{
set_ValueOfColumn("Description", Description );
}

} // MBP_BankAccount

then improve ImportBPartner.java adding this code

// OSG import Image_ID

if (impBP.get_Value("Logo") != null )
{
File file = new File(impBP.get_Value("Logo").toString());
if (file.exists())
{
MImage m_mImage = null;
m_mImage = MImage.get (Env.getCtx(), 0);
m_mImage.setName(impBP.get_Value("Logo").toString());
m_mImage.setImageURL(impBP.get_Value("Logo").toString());
AImage image = new AImage(impBP.get_Value("Logo").toString(),new FileInputStream(impBP.get_Value("Logo").toString()));
m_mImage.setBinaryData(image.getByteData());
m_mImage.save();
bp.setLogo_ID(m_mImage.get_ID());
bp.save();
}
else
{
impBP.setI_ErrorMsg("File does not exist in the specified path");
impBP.save();
}
}

// OSG import MBPBankAccount
if (impBP.get_Value("MBPBankAccount") != null )
{

MBPBankAccount ba = new MBPBankAccount(getCtx(), bp,null, null, impBP.get_Value("MBPBankAccount").toString());
ba.save();
}

kind regards
John Agudelo
www.osgroup.co

Discussion


Log in to post a comment.