Skip to content

Commit 0ae6705

Browse files
authored
Merge pull request #803 from boxwise/identical-deleted-modified-in-dailyroutine
Use identical modified-deleted timestamps in dailyroutine
2 parents 805a24c + d163de0 commit 0ae6705

2 files changed

Lines changed: 2 additions & 11 deletions

File tree

cron/dailyroutine.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@
5151
$row['diff'] = $date2->diff($date1)->format('%a');
5252

5353
if ($row['diff'] > $row['treshold']) {
54-
db_query('UPDATE people SET deleted = :now WHERE id = :id', ['id' => $row['id'], 'now' => $now]);
54+
db_query('UPDATE people SET deleted = :now, modified = :now, modified_by = :user WHERE id = :id', ['user' => $_SESSION['user']['id'], 'id' => $row['id'], 'now' => $now]);
5555
simpleSaveChangeHistory('people', $row['id'], 'Record deleted by daily routine', $now);
56-
db_touch('people', $row['id']);
5756
}
5857
}
5958
}
@@ -64,9 +63,8 @@
6463
FROM people AS p1, people AS p2
6564
WHERE p2.parent_id = p1.id AND p1.deleted AND (NOT p2.deleted OR p2.deleted IS NULL)');
6665
while ($row = db_fetch($result)) {
67-
db_query('UPDATE people SET deleted = :now WHERE id = :id', ['id' => $row['id'], 'now' => $now]);
66+
db_query('UPDATE people SET deleted = :now, modified = :now, modified_by = :user WHERE id = :id', ['user' => $_SESSION['user']['id'], 'id' => $row['id'], 'now' => $now]);
6867
simpleSaveChangeHistory('people', $row['id'], 'Record deleted by daily routine because head of family/beneficiary was deleted', $now);
69-
db_touch('people', $row['id']);
7068
}
7169

7270
// this notifies us when a new installation of the Drop App is made

library/lib/database.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,6 @@ function db_tableexists($table, $dbid = false)
248248
return in_array($table, $tables);
249249
}
250250

251-
function db_touch($table, $id)
252-
{
253-
if (db_fieldexists($table, 'modified')) {
254-
db_query('UPDATE '.$table.' SET modified = NOW(), modified_by = :user WHERE id = :id', ['user' => $_SESSION['user']['id'], 'id' => $id]);
255-
}
256-
}
257-
258251
function db_simulate($query, $array = [], $dbid = false)
259252
{
260253
global $defaultdbid;

0 commit comments

Comments
 (0)