Buggy code:
public class MFTARecordWeight extends X_FTA_RecordWeight implements DocAction , DocOptions { private static final long serialVersionUID = - 5574275427824428940L ; public MFTARecordWeight ( Properties ctx , int FTA_RecordWeight_ID , String trxName ) { } public MFTARecordWeight ( Properties ctx , ResultSet rs , String trxName ) { } public String getDocumentInfo ( ) { } public File createPDF ( ) { } public File createPDF ( File file ) { } public boolean processIt ( String processAction ) { } private String m_processMsg = null ; private boolean m_justPrepared = false ; private MFTAQualityAnalysis m_QualityAnalysis = null ; private MFTAQualityAnalysis m_ChuteQualityAnalysis = null ; private final String EVENTTYPE_RECEIPT = "EW" ; private final String EVENTTYPE_SHIPMENT = "OW" ; private BigDecimal m_Valideight = null ; public boolean unlockIt ( ) { } public boolean invalidateIt ( ) { } public String prepareIt ( ) { } public boolean approveIt ( ) { } public boolean rejectIt ( ) { } public String completeIt ( ) { } private void validateEntryTicket ( ) { } private String validateShipmentGuide ( ) { int m_FTA_LoadOrder_ID = getFTA_LoadOrder_ID ( ) ; if ( m_FTA_LoadOrder_ID == 0 ) return null ; MFTALoadOrder m_FTA_LoadOrder = new MFTALoadOrder ( getCtx ( ) , m_FTA_LoadOrder_ID , get_TrxName ( ) ) ; MDocType m_DocType = MDocType . get ( getCtx ( ) , m_FTA_LoadOrder . getC_DocType_ID ( ) ) ; <START_BUG> if ( ( ! ( m_DocType . get_ValueAsBoolean ( "IsGenerateShipmentGuide" ) ) ) && ( ! ( MSysConfig . getBooleanValue ( "FTA_MANDATORY_SHIPMENT_GUIDE" , false , getAD_Client_ID ( ) ) ) ) ) <END_BUG> return null ; String sql = "SELECT<seq2seq4repair_space>mg.FTA_MobilizationGuide_ID" + ( ( ( ( ( "<seq2seq4repair_space>FROM<seq2seq4repair_space>FTA_RecordWeight<seq2seq4repair_space>rw" + "<seq2seq4repair_space>INNER<seq2seq4repair_space>JOIN<seq2seq4repair_space>FTA_MobilizationGuide<seq2seq4repair_space>mg<seq2seq4repair_space>ON<seq2seq4repair_space>(rw.FTA_LoadOrder_ID<seq2seq4repair_space>=<seq2seq4repair_space>mg.FTA_LoadOrder_ID)" ) + "<seq2seq4repair_space>WHERE" ) + "<seq2seq4repair_space>mg.DocStatus<seq2seq4repair_space>IN<seq2seq4repair_space>('CO','CL')" ) + "<seq2seq4repair_space>AND<seq2seq4repair_space>mg.IsSotrx<seq2seq4repair_space>=<seq2seq4repair_space>'Y'" ) + "<seq2seq4repair_space>AND<seq2seq4repair_space>rw.FTA_RecordWeight_ID=?" ) ; int shipmentGuide_ID = DB . getSQLValue ( get_TrxName ( ) , sql , get_ID ( ) ) ; if ( shipmentGuide_ID > 0 ) return null ; else return "@FTA_MobilizationGuide_ID@<seq2seq4repair_space>@NotFound@" ; } private String validateChuteQualityAnalysis ( ) { } private String calculatePayWeight ( ) { } public MFTAQualityAnalysis getQualityAnalysis ( ) { } public MFTAQualityAnalysis getCurrentChuteQA ( boolean reQuery ) { } private String validWeight ( ) { } private void setDefiniteDocumentNo ( ) { } public boolean voidIt ( ) { } public boolean closeIt ( ) { } public boolean reverseCorrectIt ( ) { } public boolean reverseAccrualIt ( ) { } public boolean reActivateIt ( ) { } private String validInOutReference ( ) { } private String validMGReference ( ) { } private String validQAReference ( ) { } private String reverseInOut ( ) { } private String reverseMovement ( ) { } public String getSummary ( ) { } public String getProcessMsg ( ) { } public int getDoc_User_ID ( ) { } public BigDecimal getApprovalAmt ( ) { } public int getC_Currency_ID ( ) { } public void addDescription ( String description ) { } public boolean isComplete ( ) { } @ Override public int customizeValidActions ( String docStatus , Object processing , String orderType , String isSOTrx , int AD_Table_ID , String [ ] docAction , String [ ] options , int index ) { } @ Override protected boolean beforeSave ( boolean newRecord ) { } private String createMovement ( ) { } private void completeMovement ( MMovement m_Current_Movement ) { } private String createInOut ( ) { } private String createShipments ( ) { } private void completeShipment ( MInOut m_Current_Shipment ) { } private String validETReference ( ) { } private BigDecimal getValidWeight ( boolean reload ) { } public Timestamp getDateForDocument ( ) { } @ Override public BigDecimal getPayWeight ( ) { } }

Fix:
if ( ( m_DocType . get_ValueAsBoolean ( "IsGenerateShipmentGuide" ) ) && ( ! ( MSysConfig . getBooleanValue ( "FTA_MANDATORY_SHIPMENT_GUIDE" , false , getAD_Client_ID ( ) ) ) ) )