Issue updating events within the core Concrete Calendar

Permalink 0 0 Browser Info Environment
By default, calendar events have three attributes, one of which is a page selector (cID). I found that if that is set and you try to edit an event and clear that link, the changes don't save. No errors, it just keeps the link as it was.
The fix I applied that seems to fix the issue was in Concrete/Controllers/Dialog/Event/edit.php, I changed at line 149, this ...
if (!$eventVersion->getPageID() && $calendar->enableMoreDetails() == 'A') {
     $eventVersion->setPageID($calendar->getEventPageAssociatedID());
     $eventVersion->setRelatedPageRelationType('A');
 }

To this ...
if (!$eventVersion->getPageID() && $calendar->enableMoreDetails() == 'A') {
     $eventVersion->setPageID($calendar->getEventPageAssociatedID());
     $eventVersion->setRelatedPageRelationType('A');
 } else {
     $eventVersion->setPageID(null);
}

That way if no cID (or PageID) is provided, it saves as null instead of saving whatever it once was.


Status: New
KorkolaDesign replied on at Permalink Reply
KorkolaDesign
There was an issue with this fix. It brakes when saving (not publishing) a new event. I changed the code to what you see below:
if (!$eventVersion->getPageID() && $calendar->enableMoreDetails() == 'A') {
     $eventVersion->setPageID($calendar->getEventPageAssociatedID());
     $eventVersion->setRelatedPageRelationType('A');
 } else {
     $eventVersion->setPageID(0);
}

concrete5 Environment Information

# concrete5 Version
Core Version - 8.3.1
Version Installed - 8.3.1
Database Version - 20171218000000

# concrete5 Packages
Advanced Google Maps (1.2.20), Image Gallery (0.7), Korkola Design Theme (0.3.1), Workshop Attribute (0.1.9)

# concrete5 Overrides
None

# concrete5 Cache Settings
Block Cache - On
Overrides Cache - On
Full Page Caching - On - If blocks on the particular page allow it.
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache

# Server API
litespeed

# PHP Version
5.6.33

# PHP Extensions
apc, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imagick, imap, ionCube Loader, json, libxml, litespeed, mbstring, mcrypt, mhash, mysql, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_sqlite, pgsql, Phar, posix, readline, Reflection, session, shmop, SimpleXML, soap, sockets, SPL, sqlite3, standard, suhosin, tidy, timezonedb, tokenizer, uploadprogress, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend Guard Loader, Zend OPcache, zip, zlib

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - -1
max_input_vars - 1000
memory_limit - 128M
post_max_size - 32M
sql.safe_mode - Off
upload_max_filesize - 128M
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
pgsql.max_links - Unlimited
pgsql.max_persistent - Unlimited
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
suhosin.cookie.max_array_depth - 50
suhosin.cookie.max_array_index_length - 64
suhosin.cookie.max_name_length - 64
suhosin.cookie.max_totalname_length - 256
suhosin.cookie.max_value_length - 10000
suhosin.cookie.max_vars - 100
suhosin.executor.include.max_traversal - 0
suhosin.executor.max_depth - 750
suhosin.get.max_array_depth - 50
suhosin.get.max_array_index_length - 64
suhosin.get.max_name_length - 64
suhosin.get.max_totalname_length - 256
suhosin.get.max_value_length - 512
suhosin.get.max_vars - 100
suhosin.log.phpscript.is_safe - Off
suhosin.memory_limit - 0
suhosin.post.max_array_depth - 50
suhosin.post.max_array_index_length - 64
suhosin.post.max_name_length - 64
suhosin.post.max_totalname_length - 256
suhosin.post.max_value_length - 1000000
suhosin.post.max_vars - 1000
suhosin.request.max_array_depth - 50
suhosin.request.max_array_index_length - 64
suhosin.request.max_totalname_length - 256
suhosin.request.max_value_length - 1000000
suhosin.request.max_varname_length - 64
suhosin.request.max_vars - 1000
suhosin.session.max_id_length - 128
suhosin.upload.max_newlines - 100
suhosin.upload.max_uploads - 25
opcache.max_accelerated_files - 2000
opcache.max_file_size - 0
opcache.max_wasted_percentage - 5
zend_optimizerplus.max_accelerated_files - 2000
zend_optimizerplus.max_file_size - 0
zend_optimizerplus.max_wasted_percentage - 5

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36