Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom Norwood 29 posts 60 karma points
    Jan 26, 2016 @ 16:31
    Tom Norwood
    0

    Bugs in Umbraco.Forms.Data.Storage.RecordStorage

    Hi!

    I've come across two bugs in the Umbraco.Forms.Data.Storage.RecordStorage. I'm running a nightly build: http://nightly.umbraco.org/UmbracoForms/nightlies/UmbracoForms.Files.4.2.0-WIP.Build.65.zip

    1. GetAllRecords does not honor includeFields

    If you set includeFields to false it will always return no items. I've decomiled the code to show you:

        public List<Record> GetAllRecords(Form form, bool includeFields = true)
        {
            string str = "SELECT * FROM UFrecords WHERE form = @FormId order by created DESC;";
            List<Record> list = new List<Record>();
            IRecordsReader reader = Helper.SqlHelper.ExecuteReader(str, new IParameter[] { Helper.SqlHelper.CreateParameter("@Formid", form.Id) });
            if (includeFields)
            {
                while (reader.Read())
                {
                    Record record = Record.CreateFromDataReader(reader);
                    record.RecordFields = this..GetAllRecordFields(record, form);
                    list.Add(record);
                }
            }
            reader.Dispose();
            return list;
        }
    
    1. GetRecordByUniqueId does not check against the form parameter

    Our umbraco database has records with the same unique Id which we differentiate by form Id. The GetRecordByUniqueId function does not use the formId in the SQL query and gets the error "Sequence contains more than one element". Decompiled code:

        public Record GetRecordByUniqueId(Guid UniqueId, Form form = null)
        {
            RecordStorage.  = new RecordStorage. {
                 = UniqueId
            };
            Sql sql = new Sql();
            PetaPocoSqlExtensions.Where<Record>(sql, x => x.UniqueId == .);
            Record record = this..get_Database().SingleOrDefault<Record>(sql);
            if (form == null)
            {
                form = record.GetForm();
            }
            record.RecordFields = this..GetAllRecordFields(record, form);
            return record;
        }
    

    I've raised this issue in - issues.umbraco: http://issues.umbraco.org/issue/CON-880 umbraco support:

    Also - Can you please give us an indication of when 4.2.0 will be released? The 4.1.4 release was in June 22 2015 and we have not heard anything about when 4.2.0 will be released. We have a number of issues we are waiting to be fixed.

Please Sign in or register to post replies

Write your reply to:

Draft