Index: install/upgrades.sql =================================================================== --- install/upgrades.sql (revision 13635) +++ install/upgrades.sql (working copy) @@ -1892,3 +1892,6 @@ DELETE FROM Permissions WHERE Permission LIKE 'in-portal:configuration_email%'; DELETE FROM Permissions WHERE Permission LIKE 'in-portal:user_email%'; DELETE FROM Phrase WHERE Phrase IN ('la_fld_FromToUser', 'la_col_FromToUser'); + +# ===== v 5.1.0-B2 ===== +UPDATE Events SET Headers = NULL WHERE Headers = ''; \ No newline at end of file Index: kernel/db/cat_dbitem.php =================================================================== --- kernel/db/cat_dbitem.php (revision 13557) +++ kernel/db/cat_dbitem.php (working copy) @@ -107,10 +107,14 @@ function Update($id=null, $system_update=false) { $this->VirtualFields['ResourceId'] = Array(); - $this->SetDBField('Modified', adodb_mktime() ); - $this->UpdateFormattersSubFields(array('Modified')); - $this->SetDBField('ModifiedById', $this->Application->RecallVar('user_id')); + if ($this->GetChangedFields()) { + $now = adodb_mktime(); + $this->SetDBField('Modified_date', $now); + $this->SetDBField('Modified_time', $now); + $this->SetDBField('ModifiedById', $this->Application->RecallVar('user_id')); + } + if ($this->useFilenames) { $this->checkFilename(); $this->generateFilename(); Index: units/categories/categories_event_handler.php =================================================================== --- units/categories/categories_event_handler.php (revision 13581) +++ units/categories/categories_event_handler.php (working copy) @@ -1304,7 +1304,9 @@ $object =& $event->getObject(); /* @var $object kDBItem */ - $object->SetDBField('ModifiedById', $this->Application->RecallVar('user_id')); + if ($object->GetChangedFields()) { + $object->SetDBField('ModifiedById', $this->Application->RecallVar('user_id')); + } $this->_beforeItemChange($event); } @@ -1556,8 +1558,10 @@ $now = adodb_mktime(); - $object->SetDBField('Modified_date', $now); - $object->SetDBField('Modified_time', $now); + if ($object->GetChangedFields()) { + $object->SetDBField('Modified_date', $now); + $object->SetDBField('Modified_time', $now); + } $object->setRequired('PageCacheKey', $object->GetDBField('OverridePageCacheKey')); $object->SetDBField('Template', $this->_stripTemplateExtension( $object->GetDBField('Template') )); Index: units/helpers/email_message_helper.php =================================================================== --- units/helpers/email_message_helper.php (revision 13557) +++ units/helpers/email_message_helper.php (working copy) @@ -28,7 +28,7 @@ } } - $ret['Headers'] = implode("\n", $headers); + $ret['Headers'] = $headers ? implode("\n", $headers) : null; // it's null field $lines = array_slice($lines, $line_id + 1); Index: units/modules/modules_event_handler.php =================================================================== --- units/modules/modules_event_handler.php (revision 13581) +++ units/modules/modules_event_handler.php (working copy) @@ -84,13 +84,13 @@ } $object->Load($id); - $object->SetDBField($status_field, $event->Name == 'OnMassApprove' ? 1 : 0); + $updated = $object->Update(); - if ($object->Update()) { + if ($updated) { $sql = 'UPDATE ' . TABLE_PREFIX . 'ImportScripts - SET Status = ' . ($event->Name == 'OnMassApprove' ? STATUS_ACTIVE : STATUS_DISABLED) . ' - WHERE Module = "' . $object->GetDBField('Name') . '"'; + SET Status = ' . ($event->Name == 'OnMassApprove' ? STATUS_ACTIVE : STATUS_DISABLED) . ' + WHERE Module = "' . $object->GetDBField('Name') . '"'; $this->Conn->Query($sql); $event->status = erSUCCESS;