1 14 package org.compiere.process; 15 16 17 import java.math.*; 18 19 import org.compiere.model.*; 20 21 27 public class CopyFromJournal extends SvrProcess 28 { 29 private int m_GL_JournalBatch_ID = 0; 30 31 34 protected void prepare() 35 { 36 ProcessInfoParameter[] para = getParameter(); 37 for (int i = 0; i < para.length; i++) 38 { 39 String name = para[i].getParameterName(); 40 if (para[i].getParameter() == null) 41 ; 42 else if (name.equals("GL_JournalBatch_ID")) 43 m_GL_JournalBatch_ID = ((BigDecimal)para[i].getParameter()).intValue(); 44 else 45 log.error("prepare - Unknown Parameter: " + name); 46 } 47 } 49 54 protected String doIt() throws Exception 55 { 56 int To_GL_JournalBatch_ID = getRecord_ID(); 57 log.info("doIt - From GL_JournalBatch_ID=" + m_GL_JournalBatch_ID + " to " + To_GL_JournalBatch_ID); 58 if (To_GL_JournalBatch_ID == 0) 59 throw new IllegalArgumentException ("Target GL_JournalBatch_ID == 0"); 60 if (m_GL_JournalBatch_ID == 0) 61 throw new IllegalArgumentException ("Source GL_JournalBatch_ID == 0"); 62 MJournalBatch from = new MJournalBatch (getCtx(), m_GL_JournalBatch_ID); 63 MJournalBatch to = new MJournalBatch (getCtx(), To_GL_JournalBatch_ID); 64 int no = to.copyDetailsFrom (from); 66 return "@Copied@=" + no; 68 } 70 } | Popular Tags |