Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
fix(TB ModLog) improve sequence counting
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmhh committed May 4, 2021
1 parent a09d536 commit b1dda6b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tine20/Tinebase/Timemachine/ModificationLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ public function getModificationsBySeq($applicationId, Tinebase_Record_Interface
array('field' => 'application_id', 'operator' => 'equals', 'value' => $applicationId),
));
$paging = new Tinebase_Model_Pagination(array(
'sort' => 'seq'
'sort' => 'instance_seq'
));

return $this->_backend->search($filter, $paging);
Expand Down Expand Up @@ -1202,9 +1202,12 @@ public static function setRecordMetaData(Tinebase_Record_Interface $_newRecord,
*/
public static function increaseRecordSequence(Tinebase_Record_Interface $newRecord, Tinebase_Record_Interface $curRecord = NULL)
{
if (is_object($curRecord) && $curRecord->has('seq')) {
$newRecord->seq = (int) $curRecord->seq +1;

if ($newRecord->has('seq')) {
if (is_object($curRecord)) {
$newRecord->seq = (int) $curRecord->seq + 1;
} else {
$newRecord->seq = (int) $newRecord->seq + 1;
}
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ .
' Increasing seq of ' . get_class($newRecord) . ' with id ' . $newRecord->getId() .
' from ' . ($newRecord->seq - 1) . ' to ' . $newRecord->seq);
Expand Down

0 comments on commit b1dda6b

Please sign in to comment.