[TikiWiki-commits] [Git][tikiwiki/tiki][26.x] 2 commits: [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 | <68c3f0331c445_2cde60c629e@gitlab-sidekiq-low-urgency-cpu-bound-v2-865b9c788c-gww9v.mail> |
Victor Emanouilov pushed to branch 26.x at Tiki Wiki CMS Groupware / Tiki
Commits:
3134597f by Victor Emanouilov at 2025-09-12T13:03:01+03:00
[FIX] tabular sync via odbc: observe default filter values, so records that are filtered out are not synced back to the source
- - - - -
1fc54596 by Victor Emanouilov at 2025-09-12T13:04:26+03:00
[FIX] tracker tabularSync array cast
- - - - -
3 changed files:
- lib/core/Tracker/Tabular/Manager.php
- lib/core/Tracker/Tabular/Writer/ODBCWriter.php
- lib/trackers/trackerlib.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)
=====================================
lib/trackers/trackerlib.php
=====================================
@@ -6966,7 +6966,7 @@ class TrackerLib extends TikiLib
'logo' => $input->logo->text(),
'useFormClasses' => $input->useFormClasses->int() ? 'y' : 'n',
'formClasses' => $input->formClasses->text(),
- 'tabularSync' => implode(',', $input->tabularSync->asArray()),
+ 'tabularSync' => implode(',', $input->asArray('tabularSync')),
'tabularSyncModifiedField' => $input->tabularSyncModifiedField->int(),
'tabularSyncLastImport' => $input->tabularSyncLastImport->int(),
'tabularSyncLastImportSkipUpdate' => $input->tabularSyncLastImportSkipUpdate->int() ? 'y' : 'n',
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/compare/33821926b518ab0301ade271081822166ba28b62...1fc54596459d5ccd0c842d549de83f95a32cb345
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/compare/33821926b518ab0301ade271081822166ba28b62...1fc54596459d5ccd0c842d549de83f95a32cb345
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