Skip to content

Commit

Permalink
Update archived to be timestamp, not boolean.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Somerville committed Apr 7, 2011
1 parent 3947a19 commit 24f64bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion db/schema.sql
Expand Up @@ -125,7 +125,7 @@ create table petition (
'finished' -- deadline passed
)
),
archived boolean not null default false,
archived timestamp,

-- the _categories fields are bitmasks of possible reasons in
-- petition.php; the constraints here must be kept up to date
Expand Down
12 changes: 6 additions & 6 deletions phplib/admin-pet.php
Expand Up @@ -438,9 +438,9 @@ function list_all_petitions() {
elseif ($status == 'rejected')
$status_query = "(status = 'rejected' or status = 'rejectedonce')";
elseif ($status == 'finished' && cobrand_admin_archive_option())
$status_query = "(status = 'finished' and not archived)";
$status_query = "(status = 'finished' and archived is null)";
elseif ($status == 'archived')
$status_query = "(status = 'finished' and archived)";
$status_query = "(status = 'finished' and archived is not null)";

$status_query .= cobrand_admin_site_restriction();

Expand Down Expand Up @@ -633,8 +633,8 @@ function show_one_petition($petition) {

print '<h2>Petition &lsquo;<a href="' . $petition_obj->url_main()
. '">' . $pdata['ref'] . '</a>&rsquo;';
if (cobrand_admin_archive_option() && $pdata['archived'] == 't') {
print ' &ndash; ARCHIVED';
if (cobrand_admin_archive_option() && $pdata['archived']) {
print ' &ndash; Archived';
}
print "</h2>";

Expand All @@ -658,7 +658,7 @@ function show_one_petition($petition) {
}
if ($pdata['status'] == 'live')
print ' <input type="submit" name="redraft" value="Undo approval">';
elseif (cobrand_admin_archive_option() && $pdata['archived'] == 'f')
elseif (cobrand_admin_archive_option() && !$pdata['archived'])
print ' <input type="submit" name="archive" value="Archive petition">';
print ' <input type="submit" name="remove" value="Remove petition">';
print '</form>';
Expand Down Expand Up @@ -1300,7 +1300,7 @@ function archive($petition_id) {
}

$p->log_event("Admin archived petition");
db_query("UPDATE petition SET archived='t', lastupdate=ms_current_timestamp()
db_query("UPDATE petition SET archived=ms_current_timestamp(), lastupdate=ms_current_timestamp()
where id=?", $p->id());
db_commit();
print '<p><em>That petition has been archived.</em></p>';
Expand Down

0 comments on commit 24f64bf

Please sign in to comment.