Package org.compiere.model

Examples of org.compiere.model.MUser


    //      Tools
    JMenu mTools = AEnv.getMenu("Tools");
    menuBar.add(mTools);
    AEnv.addMenuItem("Calculator", null, null, mTools, this);
    AEnv.addMenuItem("Calendar", null, null, mTools, this);
    MUser user = MUser.get(Env.getCtx());
    if (user.isAdministrator())
      AEnv.addMenuItem("Editor", null, null, mTools, this);
    AEnv.addMenuItem("Script", null, null, mTools, this);
    mTools.addSeparator();
    AEnv.addMenuItem("Preference", null, null, mTools, this);
   
View Full Code Here


   *   Send Mail
   */
  private void cmd_sendMail()
  {
    String to = "";
    MUser from = MUser.get(Env.getCtx(), Env.getAD_User_ID(Env.getCtx()));
    String subject = m_reportEngine.getName();
    String message = "";
    File attachment = null;
   
    try
View Full Code Here

    JMenu mTools = AEnv.getMenu("Tools");
    menuBar.add(mTools);
    aCalculator = addAction("Calculator",  mTools,   null,  false);
    aCalendar = addAction("Calendar",    mTools,   null,  false);
    aEditor =  addAction("Editor",      mTools,   null,  false);
    MUser user = MUser.get(Env.getCtx());
    if (user.isAdministrator())
      aScript = addAction("Script",          mTools,   null,  false);
    if ("Y".equals(Env.getContext(m_ctx, "#SysAdmin")))  //  set in DB.loginDB
      aWinSize = addAction("WinSize",     mTools,   null,  false);
    if (AEnv.isWorkflowProcess())
      aWorkflow = addAction("WorkFlow",  mTools,    null,  false);
View Full Code Here

        int AD_PrintFormat_ID = rs.getInt(4);
        int copies = rs.getInt(5);
        if (copies == 0)
          copies = 1;
        int AD_User_ID = rs.getInt(6);
        MUser to = new MUser (getCtx(), AD_User_ID, get_TrxName());
        String DocumentNo = rs.getString(7);
        C_BPartner_ID = rs.getInt(8);
        //
        String documentDir = client.getDocumentDir();
        if (documentDir == null || documentDir.length() == 0)
          documentDir = ".";
        //
        if (p_EMailPDF && (to.get_ID() == 0 || to.getEMail() == null || to.getEMail().length() == 0))
        {
          addLog (C_Invoice_ID, null, null, DocumentNo + " @RequestActionEMailNoTo@");
          errors++;
          continue;
        }
        if (AD_PrintFormat_ID == 0)
        {
          addLog (C_Invoice_ID, null, null, DocumentNo + " No Print Format");
          errors++;
          continue;
        }
        //  Get Format & Data
        if (AD_PrintFormat_ID != old_AD_PrintFormat_ID)
        {
          format = MPrintFormat.get (getCtx(), AD_PrintFormat_ID, false);
          old_AD_PrintFormat_ID = AD_PrintFormat_ID;
        }
        format.setLanguage(language);
        format.setTranslationLanguage(language);
        //  query
        MQuery query = new MQuery("C_Invoice_Header_v");
        query.addRestriction("C_Invoice_ID", MQuery.EQUAL, new Integer(C_Invoice_ID));

        //  Engine
        PrintInfo info = new PrintInfo(
          DocumentNo,
          X_C_Invoice.Table_ID,
          C_Invoice_ID,
          C_BPartner_ID);
        info.setCopies(copies);
        ReportEngine re = new ReportEngine(getCtx(), format, query, info);
        boolean printed = false;
        if (p_EMailPDF)
        {
          String subject = mText.getMailHeader() + " - " + DocumentNo;
          EMail email = client.createEMail(to.getEMail(), subject, null);
          if (!email.isValid())
          {
            addLog (C_Invoice_ID, null, null,
              DocumentNo + " @RequestActionEMailError@ Invalid EMail: " + to);
            errors++;
            continue;
          }
          mText.setUser(to);          //  Context
          mText.setBPartner(C_BPartner_ID)//  Context
          mText.setPO(new MInvoice(getCtx(), C_Invoice_ID, get_TrxName()));
          String message = mText.getMailText(true);
          if (mText.isHtml())
            email.setMessageHTML(subject, message);
          else
          {
            email.setSubject (subject);
            email.setMessageText (message);
          }
          //
          File invoice = null;
          if (!Ini.isClient())
            invoice = new File(MInvoice.getPDFFileName(documentDir, C_Invoice_ID));
          File attachment = re.getPDF(invoice);
          log.fine(to + " - " + attachment);
          email.addAttachment(attachment);
          //
          String msg = email.send();
          MUserMail um = new MUserMail(mText, getAD_User_ID(), email);
          um.save();
          if (msg.equals(EMail.SENT_OK))
          {
            addLog (C_Invoice_ID, null, null,
              DocumentNo + " @RequestActionEMailOK@ - " + to.getEMail());
            count++;
            printed = true;
          }
          else
          {
            addLog (C_Invoice_ID, null, null,
              DocumentNo + " @RequestActionEMailError@ " + msg
              + " - " + to.getEMail());
            errors++;
          }
        }
        else
        {
View Full Code Here

TOP

Related Classes of org.compiere.model.MUser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.