Skip to content

Commit

Permalink
fix(Tinebase/Update/18.3): make sure that notes are not touched befor…
Browse files Browse the repository at this point in the history
…e update script
  • Loading branch information
pschuele committed Feb 5, 2025
1 parent 022a966 commit f6ffc2e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
3 changes: 0 additions & 3 deletions tests/tine20/Addressbook/ControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,6 @@ public function testUseNotes()

$this->assertTrue($newcontact1->has('notes'));
$this->assertEquals($compStr, $newcontact1->notes[0]->note);

$this->expectException('Tinebase_Exception_NotFound');
$this->objects['contact']->notes[0]->note = 'note';
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tine20/Tinebase/Controller/Record/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ protected function _getRelatedData($record)
if ($record->has('attachments') && Tinebase_Core::isFilesystemAvailable()) {
Tinebase_FileSystem_RecordAttachments::getInstance()->getRecordAttachments($record);
}
if ($record->has('notes')) {
if ($record->has('notes') && $this->useNotes()) {
$record->notes = Tinebase_Notes::getInstance()->getNotesOfRecord($this->_modelName, $record->getId());
}
if (!empty($record::getConfiguration()->jsonExpander)) {
Expand Down Expand Up @@ -2473,7 +2473,7 @@ protected function _deleteRecord(Tinebase_Record_Interface $_record)
*/
protected function _deleteLinkedObjects(Tinebase_Record_Interface $_record)
{
if ($_record->has('notes')) {
if ($_record->has('notes') && $this->useNotes()) {
Tinebase_Notes::getInstance()->deleteNotesOfRecord($this->_modelName, $this->_getBackendType(), $_record->getId());
}

Expand Down
12 changes: 6 additions & 6 deletions tine20/Tinebase/Setup/Update/18.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ class Tinebase_Setup_Update_18 extends Setup_Update_Abstract
protected const RELEASE018_UPDATE002 = __CLASS__ . '::update002';
protected const RELEASE018_UPDATE003 = __CLASS__ . '::update003';


static protected $_allUpdates = [
self::PRIO_TINEBASE_BEFORE_EVERYTHING => [
self::RELEASE018_UPDATE003 => [
self::CLASS_CONST => self::class,
self::FUNCTION_CONST => 'update003',
],
],
self::PRIO_TINEBASE_STRUCTURE => [
self::RELEASE018_UPDATE001 => [
self::CLASS_CONST => self::class,
Expand All @@ -29,10 +34,6 @@ class Tinebase_Setup_Update_18 extends Setup_Update_Abstract
self::CLASS_CONST => self::class,
self::FUNCTION_CONST => 'update002',
],
self::RELEASE018_UPDATE003 => [
self::CLASS_CONST => self::class,
self::FUNCTION_CONST => 'update003',
],
],
self::PRIO_NORMAL_APP_UPDATE => [
self::RELEASE018_UPDATE000 => [
Expand Down Expand Up @@ -89,5 +90,4 @@ public function update003()

$this->addApplicationUpdate(Tinebase_Config::APP_NAME, '18.3', self::RELEASE018_UPDATE003);
}

}

0 comments on commit f6ffc2e

Please sign in to comment.