CMS Made Simple Core


[#12498] Page Copy in ContentManager enforces Default Values (overwriting actual values)

Created By: Ludger Merkens (lume)
Date Submitted: Wed Nov 24 06:10:46 -0500 2021

Assigned To:
Version: None
CMSMS Version: 2.2.15
Severity: Minor
Resolution: None
State: Open
Page Copy in ContentManager enforces Default Values (overwriting actual values)
Detailed Description:
Scenario is as follows:

you have a page template, which has a content_block with an explicit
default_value. You create a page, change this default_value and save the page.
You then copy this page and voila the copy of the page looses this change and
the default_value is in the page. I first stumbled upon this behaviour with ECB2
Checkbox fields, where I had lots of default_value=0 fields, to have sane
checkbox fields.


{content_module module="ECB2" field="checkbox" block="SitemapExclude"
assign="sitemapexclude" label="Seite und evtl. Unterseiten nicht in sitemap.xml
aufnehmen" tab='SEO' default_value=0}

I almost blamed ECB2 for badly handling the copy situation. But after a closer
look into the copy process the culprit seems to be:

 line 82 $to_obj->SetDefaultContent(0) from action.admin_copycontent.php.

The fix might be as simple, as removing this line. But I still ponder, what the
reason for this Initialization initially was.

best regards - any ideas?

Ludger Merkens


Date: 2021-11-25 23:09
Posted By: tom (tomphantoo)

->SetDefaultContent(0) (or actually, ->SetDefaultContent(false)) in
ContentManager-module action.admin_copycontent.php etc merely ensures that the
newly cloned content-object is not considered to be part of the (site) default
page (if indeed the cloned page is capable of being the default).

Are you able to post here a report on what is actually stored in the database
after you save a page including a changed default value?

There might be a cache-related problem.

Date: 2021-11-26 04:57
Posted By: Ludger Merkens (lume)

I'll try to do some more specific testing. I checked with CMSMS 2.2.12 running
on php 7.3 - there the problem doesn't occur. The problematic platform is 2.2.15
running on php 7.4. (both use apache with php-fpm)

I'm doing some more setup work now - to get a minimal scenario.


Updated: 2021-11-25 23:09
resolution_id: => 5