[TikiWiki-commits] [Git][tikiwiki/tiki][28.x] [FIX] tabular sync via odbc: observe default filter values, so records that...
"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <68c3efc716f59_2cde6e814379@gitlab-sidekiq-low-urgency-cpu-bound-v2-865b9c788c-hpj5r.mail> |
Victor Emanouilov pushed to branch 28.x at Tiki Wiki CMS Groupware / Tiki
Commits:
0ed5a445 by Victor Emanouilov at 2025-09-12T13:02:40+03:00
[FIX] tabular sync via odbc: observe default filter values, so records that are filtered out are not synced back to the source
- - - - -
2 changed files:
- lib/core/Tracker/Tabular/Manager.php
- lib/core/Tracker/Tabular/Writer/ODBCWriter.php
Changes:
=====================================
lib/core/Tracker/Tabular/Manager.php
=====================================
@@ -110,8 +110,9 @@ class Manager
try {
if ($tabular['odbc_config']) {
+ $source = new \Tracker\Tabular\Source\TrackerItemSource($schema, $args['object']);
$writer = new Writer\ODBCWriter($tabular['odbc_config']);
- $remote = $writer->sync($schema, $args['object'], $args['old_values_by_permname'], $args['values_by_permname'], $is_new);
+ $remote = $writer->sync($source, $args['object'], $args['old_values_by_permname'], $args['values_by_permname'], $is_new);
foreach ($remote as $field => $value) {
if (isset($args['values_by_permname'][$field])) {
$differs = $value !== $args['values_by_permname'][$field];
=====================================
lib/core/Tracker/Tabular/Writer/ODBCWriter.php
=====================================
@@ -53,11 +53,22 @@ class ODBCWriter
/**
* Called after trackeritem save event, this method updates remote data source with local changes
*/
- public function sync(\Tracker\Tabular\Schema $schema, int $item_id, array $old_values, array $new_values, &$is_new)
+ public function sync(\Tracker\Tabular\Source\TrackerItemSource $source, int $item_id, array $old_values, array $new_values, &$is_new)
{
+ $schema = $source->getSchema();
$schema->validate();
$columns = $schema->getColumns();
+ // check the sync against the tabular source as default filters might filter out this entry and we don't want to sync in that case
+ $at_least_one_entry = false;
+ foreach ($source->getEntries() as $entry) {
+ $at_least_one_entry = true;
+ break;
+ }
+ if (! $at_least_one_entry) {
+ return [];
+ }
+
// prepare the remote entry to replace - send only the following:
// - changed values
// - fields that do not store value in Tiki db like ItemsList (they might have changed as well)
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/0ed5a445323bd4e5d638ac3e8d394b0f831f7107
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/0ed5a445323bd4e5d638ac3e8d394b0f831f7107
You're receiving this email because of your account on gitlab.com.
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs