Skip to content

Commit 33f0480

Browse files
committed
unbreak locked project tags by using the correct query for each db backend
1 parent 4deb8f0 commit 33f0480

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

appinfo/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Mit dem integrierten Dashboard lässt sich anhand eines Kuchen-/Donut-Diagramms
3535

3636
Diese App wird aktuell noch weiterentwickelt, also: Augen offen halten für neue Features! Und falls Dir irgendwelche Verbesserungsvorschläge, Probleme oder neue Features einfallen, schau mal auf unserem [GitHub Projekt](https://github.com/mtierltd/timetracker) vorbei, vielleicht wird Dein Thema bereits diskutiert! Und falls nicht, starte gerne eine neue Diskussion, wir freuen uns auf Dein Feedback!
3737
</description>
38-
<version>0.0.64</version>
38+
<version>0.0.65</version>
3939
<licence>agpl</licence>
4040
<author mail="[email protected]" >MTier Ltd.</author>
4141
<namespace>TimeTracker</namespace>

lib/Db/TagMapper.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
class TagMapper extends Mapper {
1010

1111
public function __construct(IDBConnection $db) {
12+
$this->dbengine = 'MYSQL';
13+
if (strpos(get_class($db->getDatabasePlatform()),'PostgreSQL') !== FALSE){
14+
$this->dbengine = 'POSTGRES';
15+
} else if (strpos(get_class($db->getDatabasePlatform()),'Sqlite') !== FALSE){
16+
$this->dbengine = 'SQLITE';
17+
}
1218
parent::__construct($db, 'timetracker_tag');
1319
}
1420

@@ -61,9 +67,11 @@ public function allowedTags($id, $tag_ids){
6167
if (empty($t))
6268
continue;
6369
if ($this->dbengine == 'MYSQL'){
64-
$sql = 'insert into `*PREFIX*timetracker_lpa_tags` (project_id, tag_id, created_at) values(?,?,UNIX_TIMESTAMP(now())) ';
65-
} else {
66-
$sql = 'insert into `*PREFIX*timetracker_lpa_tags` (project_id, tag_id, created_at) values(?,?,extract(epoch from now())) ';
70+
$sql = "insert into `*PREFIX*timetracker_lpa_tags` (project_id, tag_id, created_at) values(?,?,UNIX_TIMESTAMP(now()))";
71+
} else if ($this->dbengine == 'POSTGRES'){
72+
$sql = "insert into `*PREFIX*timetracker_lpa_tags` (project_id, tag_id, created_at) values(?,?,extract(epoch from now()))";
73+
} else if ($this->dbengine == 'SQLITE'){
74+
$sql = "insert into `*PREFIX*timetracker_lpa_tags` (project_id, tag_id, created_at) values(?,?,strftime('%s', 'now'))";
6775
}
6876
$this->execute($sql, [$id, $t]);
6977
}

0 commit comments

Comments
 (0)