Пример #1
0
        }       //	setSatndardHeaderFooter

        public static MPrintFormat Copy(Ctx ctx, int from_AD_PrintFormat_ID,
                                        int to_AD_PrintFormat_ID, int to_Client_ID)
        {
            //_ctx = ctx;
            if (from_AD_PrintFormat_ID == 0)
            {
                throw new ArgumentException("From_AD_PrintFormat_ID is 0");
            }
            //
            MPrintFormat from = new MPrintFormat(ctx, from_AD_PrintFormat_ID, null);
            MPrintFormat to   = new MPrintFormat(ctx, to_AD_PrintFormat_ID, null);              //	could be 0

            MPrintFormat.CopyValues(from, to);
            //	New
            if (to_AD_PrintFormat_ID == 0)
            {
                if (to_Client_ID < 0)
                {
                    to_Client_ID = ctx.GetAD_Client_ID();
                }
                to.SetClientOrg(to_Client_ID, 0);
            }
            //	Set Name - Remove TEMPLATE - add copy

            to.SetName(Utility.Util.Replace(to.GetName(), "TEMPLATE", to_Client_ID.ToString()));
            to.SetName(to.GetName()
                       + " " + Msg.GetMsg(Env.GetContext(), "Copy", true)
                       + " " + to.HashCode());  //	unique name
            //
            to.Save();

            //	Copy Items
            to.SetItems(CopyItems(from, to));
            return(to);
        }       //	copyToClient