From: Marek M. <mar...@us...> - 2004-11-15 08:48:34
|
Update of /cvsroot/compiere/extend/src/com/compiere/PharmaNord In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4528/src/com/compiere/PharmaNord Modified Files: Tag: pbs_payment getIFMJournal.java Log Message: extracted function common to web interface Index: getIFMJournal.java =================================================================== RCS file: /cvsroot/compiere/extend/src/com/compiere/PharmaNord/Attic/getIFMJournal.java,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** getIFMJournal.java 28 Oct 2004 12:58:31 -0000 1.1.2.2 --- getIFMJournal.java 15 Nov 2004 08:48:24 -0000 1.1.2.3 *************** *** 57,62 **** return ""; } ! private String editJournal(Properties ctx, int WindowNo) { //Journals are filename=J_<IFM_Contact_ID> int accesFolderId = -1; //Env.getContext(Env.getCtx(), WindowNo, "IFM_Permissiongroup_ID"); --- 57,90 ---- return ""; } + private String editJournal(Properties ctx,int WindowNo){ + //invoke Staroffice + int[] client = new int[1]; + int org[] = new int[1]; + String journalFile; + try { + journalFile = getJournalFile(ctx,getRecord_ID(),client,org); + }catch (Exception ex) { + System.err.println(ex); + Log.trace(Log.l3_Util, "Process.edit journal"); + return ex.getMessage(); + } + try { + Runtime runtime = Runtime.getRuntime(); + runtime.exec("/usr/bin/swriter " + journalFile); // Unix env. + } + catch (Exception IOEx) { + System.err.println(IOEx); + Log.trace(Log.l3_Util, "Process.edit journal"); + return "Diddent find the file with the journal"; + } + int userID = this.getAD_User_ID(); + String description = Env.getContext(ctx, WindowNo, "Description"); + IFM_Accces.journalEntry(getRecord_ID(), + client[0], org[0], + userID, "Journal viewed or changed:" + description); + return ""; ! } ! public static String getJournalFile(Properties ctx,int recordId,int[] clientRet,int[] orgRet) throws IOException{ //Journals are filename=J_<IFM_Contact_ID> int accesFolderId = -1; //Env.getContext(Env.getCtx(), WindowNo, "IFM_Permissiongroup_ID"); *************** *** 73,77 **** try { PreparedStatement pstmt = DB.prepareStatement(folderSQL); ! pstmt.setString(1, getRecord_ID() + ""); ResultSet rs = pstmt.executeQuery(); if (rs.next()) { --- 101,105 ---- try { PreparedStatement pstmt = DB.prepareStatement(folderSQL); ! pstmt.setInt(1, recordId); ResultSet rs = pstmt.executeQuery(); if (rs.next()) { *************** *** 85,88 **** --- 113,118 ---- fileName +=contact; + clientRet[0]=client; + orgRet[0]=org; rs.close(); *************** *** 91,95 **** catch (SQLException e) { Log.error("Edit journal ERROR in SQL", e); ! return "Error reading basic data from Oracle"; } //end retriving --- 121,125 ---- catch (SQLException e) { Log.error("Edit journal ERROR in SQL", e); ! throw new IOException("Error reading basic data from Oracle"); } //end retriving *************** *** 103,107 **** client, "Journal", ! this.getRecord_ID(), contact); //Check wether or not journal is present --- 133,137 ---- client, "Journal", ! recordId, contact); //Check wether or not journal is present *************** *** 124,147 **** System.err.println(IOEx); Log.trace(Log.l3_Util, "Process.edit journal"); ! return "Problemer med oprettelse af journalen"; } } ! ! //invoke Staroffice ! try { ! Runtime runtime = Runtime.getRuntime(); ! runtime.exec("/usr/bin/swriter " + journalDir + fileName + ".sxw "); // Unix env. ! } ! catch (Exception IOEx) { ! System.err.println(IOEx); ! Log.trace(Log.l3_Util, "Process.edit journal"); ! return "Diddent find the file with the journal"; ! } ! int userID = this.getAD_User_ID(); ! String description = Env.getContext(ctx, WindowNo, "Description"); ! IFM_Accces.journalEntry(contact, ! client, org, ! userID, "Journal viewed or changed:" + description); ! return ""; } //editLetter --- 154,162 ---- System.err.println(IOEx); Log.trace(Log.l3_Util, "Process.edit journal"); ! throw new IOException("Problemer med oprettelse af journalen"); } + } ! return file.getCanonicalPath(); } //editLetter |