예제 #1
0
        /**
         *  Create Project from Lead
         *	@return error message
         */
        public String CreateProject(int C_ProjectType_ID)
        {
            if (GetC_Project_ID() != 0)
            {
                return("@AlreadyExists@: @C_Project_ID@ (ID=" + GetC_Project_ID() + ")");
            }
            if (GetC_BPartner_ID() == 0)
            {
                String retValue = CreateBP();
                if (retValue != null)
                {
                    return(retValue);
                }
            }
            _project = new MProject(GetCtx(), 0, Get_TrxName());
            _project.SetAD_Org_ID(GetAD_Org_ID());
            _project.SetProjectLineLevel(MProject.PROJECTLINELEVEL_Project);
            _project.SetName(GetName());
            _project.SetDescription(GetDescription());
            _project.SetNote(GetHelp());
            //
            _project.SetC_BPartner_ID(GetC_BPartner_ID());
            _project.SetC_BPartner_Location_ID(GetC_BPartner_Location_ID());
            _project.SetAD_User_ID(GetAD_User_ID());
            _project.SetC_BPartnerSR_ID(GetC_BPartnerSR_ID());
            _project.SetC_Campaign_ID(GetC_Campaign_ID());

            _project.SetC_ProjectType_ID(C_ProjectType_ID);
            _project.SetSalesRep_ID(GetSalesRep_ID());
            _project.SetC_SalesRegion_ID(GetC_SalesRegion_ID());
            if (!_project.Save())
            {
                return("@SaveError@");
            }
            //
            if (GetRequest() != null)
            {
                _request.SetC_Project_ID(_project.GetC_Project_ID());
                _request.Save();
            }
            //
            SetC_Project_ID(_project.GetC_Project_ID());
            return(null);
        }
예제 #2
0
        /**
         *  Create Request from Lead
         *  @param R_RequestType_ID request type
         *	@return error message
         */
        private String CreateRequest(int R_RequestType_ID)
        {
            if (GetR_Request_ID() != 0)
            {
                return("@AlreadyExists@: @R_Request_ID@ (ID=" + GetR_Request_ID() + ")");
            }
            if (GetC_BPartner_ID() == 0)
            {
                String retValue = CreateBP();
                if (retValue != null)
                {
                    return(retValue);
                }
            }
            _request = new MRequest(GetCtx(), 0, Get_TrxName());
            _request.SetAD_Org_ID(GetAD_Org_ID());
            String summary = GetName();

            if (summary == null)
            {
                summary = GetHelp();
            }
            if (summary == null)
            {
                summary = GetSummary();
            }
            if (summary == null)
            {
                summary = GetDescription();
            }
            _request.SetSummary(summary);
            //
            _request.SetR_RequestType_ID(R_RequestType_ID);
            if (IsR_Status_IDValid(GetR_Status_ID()))
            {
                _request.SetR_Status_ID(GetR_Status_ID());
            }
            else
            {
                _request.SetR_Status_ID();
            }
            //
            _request.SetC_Lead_ID(GetC_Lead_ID());
            //
            _request.SetC_BPartner_ID(GetC_BPartner_ID());
            _request.SetAD_User_ID(GetAD_User_ID());
            _request.SetC_Project_ID(GetC_Project_ID());
            _request.SetC_Campaign_ID(GetC_Campaign_ID());
            _request.SetR_Source_ID(GetR_Source_ID());
            _request.SetC_BPartnerSR_ID(GetC_BPartnerSR_ID());
            _request.SetC_SalesRegion_ID(GetC_SalesRegion_ID());

            _request.SetSalesRep_ID(GetSalesRep_ID());
            if (!_request.Save())
            {
                return("@SaveError@");
            }
            //
            SetR_Request_ID(_request.GetR_Request_ID());
            return(null);
        }