Possbile **Bug**: _globalOrder doesn't have a sort order

7 posts by 3 authors in: Forums > CMS Builder
Last Post: September 6   (RSS)

By kitsguru - September 5 - edited: September 5

CMSB 3.71: I am trying to add a record to a category menu table created in an earlier version of CMSB, even as far back as 2.x. I get an error " _globalOrder does not have a default value"

In the ini file, it has:

  'globalOrder' => array(
    'order' => 6,
    'label' => '_globalOrder',
    'type' => 'none',
    'customColumnType' => 'int(10) unsigned NOT NULL',
    'isSystemField' => '1',
    'name' => 'globalOrder',
    '_tableName' => 'sys_modules',
  ),

Creating a new category menu with CMSB 3.71 it has:

  'globalOrder' => array(
    'order' => '6',
    'label' => '_globalOrder',
    'type' => 'none',
    'customColumnType' => 'int(10) unsigned',
    'isSystemField' => '1',
  ),

It looks like all the system fields are similarly defined. NOT NULL is not used in CMSB 3.71. I think it worked in 3.65. I have 3 or 4 tables that are category menus. How do I fix this?

Jeff Shields

By kitsguru - September 5 - edited: September 5

Hi Tim,

Both the database and schema were defined as NOT NULL for the system fields. These are system fields by default for Category Menu type so I am nt editing these fields directly.

I was simply adding a new record after updating to CMSB 3.71 when I got the errI edited the schema in the database editor and removed Not Null from the necessary fields, which also updated the database. I was then able to add the record. 

I  don't know when the change occurred but I will dig deeper when I have sometime over the next few days.

Jeff Shields

I did some digging. In CMSB 3.64, the system fields are defined as Not Null.

  'globalOrder' => array(
    'order' => '6',
    'label' => '_globalOrder',
    'type' => 'none',
    'customColumnType' => 'int(10) unsigned NOT NULL',
    'isSystemField' => '1',
  ),
  'siblingOrder' => array(
    'order' => '7',
    'label' => '_siblingOrder',
    'type' => 'none',
    'customColumnType' => 'int(10) unsigned NOT NULL',
    'isSystemField' => '1',
  ),
  'lineage' => array(
    'order' => '8',
    'label' => '_lineage',
    'type' => 'none',
    'customColumnType' => 'varchar(255) NOT NULL',
    'isSystemField' => '1',
  ),
  'depth' => array(
    'order' => '9',
    'label' => '_depth',
    'type' => 'none',
    'customColumnType' => 'int(10) unsigned NOT NULL',
    'isSystemField' => '1',
  ),
  'parentNum' => array(
    'order' => '10',
    'label' => 'Parent Category',
    'type' => 'parentCategory',
    'customColumnType' => 'int(10) unsigned NOT NULL',
    'isSystemField' => '1',
  ),
  'breadcrumb' => array(
    'order' => '11',
    'label' => 'Breadcrumb',
    'type' => 'none',
    'customColumnType' => 'varchar(255) NOT NULL',
    'isSystemField' => '1',
  ),

It was changed in 3.65, and the NOT NULL was removed. It continued to work until 3.71. New category-type tables created after 3.64 would not experience the issue.

Jeff Shields

By Dave - September 6 - edited: Yesterday at 3:47pm

Hi Jeff, 

Yes, that's a bug, thanks for bringing that to our attention.  We'll add a patch for this to an upcoming release, but in the meantime here's a workaround: 

  • Go to: Database Editor > Your Category Menu
  • Change the MySQL Column Type on these fields to the new value below:
    • Change globalOrder to custom column type int unsigned
    • Change depth to custom column type int unsigned
    • Change lineage to varchar(255)
    • Change breadcrumb to varchar(255)

It's because the old category schemas aren't getting updated to the column types used by the new code.

Let me know if that works for you.

Dave Edis - Senior Developer
interactivetools.com

Thanks Dave,

had already figured that out.

Jeff Shields

Nice, I'm not surprised but still good to have the fix there for anyone else who runs into the issue. 

Thanks for reporting this one! 

Dave Edis - Senior Developer
interactivetools.com