From b2267691b8a71a38bfaa76a74f00594eb2e7f85f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20Sch=C3=BCle?=
Date: Thu, 27 Feb 2025 14:31:29 +0100
Subject: [PATCH] tweak(Tinebase+Timetracker/DemoData): improve demo data
creation
- detect created TAs in Timetracker
- only output imported csv data if it was created successfully
---
tine20/Timetracker/Setup/DemoData.php | 7 ++++---
tine20/Tinebase/Frontend/Cli/Abstract.php | 3 +--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tine20/Timetracker/Setup/DemoData.php b/tine20/Timetracker/Setup/DemoData.php
index 4c8ac2b842a..7a9d3633189 100644
--- a/tine20/Timetracker/Setup/DemoData.php
+++ b/tine20/Timetracker/Setup/DemoData.php
@@ -149,10 +149,11 @@ public static function hasBeenRun()
$c = Timetracker_Controller_Timeaccount::getInstance();
$f = new Timetracker_Model_TimeaccountFilter(array(
- array('field' => 'description', 'operator' => 'equals', 'value' => 'Created By Tine 2.0 DemoData'),
+ array('field' => 'description', 'operator' => 'contains', 'value' => 'tine DEMO DATA'),
), 'AND');
+ $count = $c->search($f)->count();
- return ($c->search($f)->count() > 9) ? true : false;
+ return ($count > 9);
}
/**
@@ -244,7 +245,7 @@ protected function _createSharedTimeaccounts()
'status' => 'billed',
'cleared_at' => $this->_clearedDate,
'budget' => NULL,
- 'description' => 'Created By Tine 2.0 DEMO DATA'
+ 'description' => 'Created By tine DEMO DATA'
));
if (($costcenter->name == 'Marketing') || ($costcenter->name == $developmentString)) {
diff --git a/tine20/Tinebase/Frontend/Cli/Abstract.php b/tine20/Tinebase/Frontend/Cli/Abstract.php
index 38940f3bdf4..0308c031bf4 100644
--- a/tine20/Tinebase/Frontend/Cli/Abstract.php
+++ b/tine20/Tinebase/Frontend/Cli/Abstract.php
@@ -370,9 +370,8 @@ protected function _createImportDemoData()
] : [];
$importer = new Tinebase_Setup_DemoData_Import($model, $options);
try {
- echo 'Importing Demo Data for ' . $model . "\n";
$importer->importDemodata();
- echo 'Csv Demo Data was created successfully' . "\n";
+ echo 'Imported CSV Demo Data for ' . $model . "\n";
} catch (Tinebase_Exception_NotFound $tenf) {
// model has no import files
}