Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions cron/dailyroutine.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@
$row['diff'] = $date2->diff($date1)->format('%a');

if ($row['diff'] > $row['treshold']) {
db_query('UPDATE people SET deleted = NOW() WHERE id = :id', ['id' => $row['id']]);
db_query('UPDATE people SET deleted = NOW(), modified = NOW(), modified_by = :user WHERE id = :id', ['user' => $_SESSION['user']['id'], 'id' => $row['id']]);
Comment thread
HaGuesto marked this conversation as resolved.
Outdated
simpleSaveChangeHistory('people', $row['id'], 'Record deleted by daily routine');
db_touch('people', $row['id']);
}
}
}
Expand All @@ -61,9 +60,8 @@
FROM people AS p1, people AS p2
WHERE p2.parent_id = p1.id AND p1.deleted AND (NOT p2.deleted OR p2.deleted IS NULL)');
while ($row = db_fetch($result)) {
db_query('UPDATE people SET deleted = NOW() WHERE id = :id', ['id' => $row['id']]);
db_query('UPDATE people SET deleted = NOW(), modified = NOW(), modified_by = :user WHERE id = :id', ['user' => $_SESSION['user']['id'], 'id' => $row['id']]);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pylipp could we change it that the now timestamp matches the now timestamp in the history message?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simpleSaveChangeHistory('people', $row['id'], 'Record deleted by daily routine because head of family/beneficiary was deleted');
db_touch('people', $row['id']);
}

// this notifies us when a new installation of the Drop App is made
Expand Down
7 changes: 0 additions & 7 deletions library/lib/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,6 @@ function db_tableexists($table, $dbid = false)
return in_array($table, $tables);
}

function db_touch($table, $id)
{
if (db_fieldexists($table, 'modified')) {
db_query('UPDATE '.$table.' SET modified = NOW(), modified_by = :user WHERE id = :id', ['user' => $_SESSION['user']['id'], 'id' => $id]);
}
}

function db_simulate($query, $array = [], $dbid = false)
{
global $defaultdbid;
Expand Down