From 21703cfc000ab514d2677f3ea0cdbff4359c89bc Mon Sep 17 00:00:00 2001 From: Nikolaus Krondraf Date: Tue, 30 Jun 2020 15:40:30 +0200 Subject: [PATCH] add functions to delete entries --- .../models/ressource/Zeitaufzeichnung_model.php | 10 ++++++++++ application/models/ressource/Zeitsperre_model.php | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/application/models/ressource/Zeitaufzeichnung_model.php b/application/models/ressource/Zeitaufzeichnung_model.php index f887a20a0..b44861d13 100644 --- a/application/models/ressource/Zeitaufzeichnung_model.php +++ b/application/models/ressource/Zeitaufzeichnung_model.php @@ -11,4 +11,14 @@ class Zeitaufzeichnung_model extends DB_Model $this->dbTable = 'campus.tbl_zeitaufzeichnung'; $this->pk = 'zeitaufzeichnung_id'; } + + public function deleteEntriesForCurrentDay() + { + $today = date('Y-m-d'); + $qry = "DELETE FROM " . $this->dbTable . " + WHERE start >= '" . $today . " 00:00:00' + AND start <= '" . $today . " 23:59:59';"; + + return $this->execQuery($qry); + } } diff --git a/application/models/ressource/Zeitsperre_model.php b/application/models/ressource/Zeitsperre_model.php index 07889e349..350a7be58 100644 --- a/application/models/ressource/Zeitsperre_model.php +++ b/application/models/ressource/Zeitsperre_model.php @@ -11,4 +11,13 @@ class Zeitsperre_model extends DB_Model $this->dbTable = 'campus.tbl_zeitsperre'; $this->pk = 'zeitsperre_id'; } + + public function deleteEntriesForCurrentDay() + { + $today = date('Y-m-d'); + $qry = "DELETE FROM " . $this->dbTable . " + WHERE vondatum = '" . $today . "';"; + + return $this->execQuery($qry); + } }