diff options
Diffstat (limited to 'web')
-rwxr-xr-x | web/confirm.cgi | 10 | ||||
-rwxr-xr-x | web/questionnaire.cgi | 11 |
2 files changed, 12 insertions, 9 deletions
diff --git a/web/confirm.cgi b/web/confirm.cgi index 4a41721d4..dfb3bfa95 100755 --- a/web/confirm.cgi +++ b/web/confirm.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: confirm.cgi,v 1.15 2007-05-03 09:40:05 matthew Exp $ +# $Id: confirm.cgi,v 1.16 2007-05-09 11:01:44 matthew Exp $ use strict; require 5.8.0; @@ -47,9 +47,11 @@ sub main { my ($email) = dbh()->selectrow_array("select email from comment where id=?", {}, $id); my ($problem_id, $fixed, $reopen) = dbh()->selectrow_array("select problem_id,mark_fixed,mark_open from comment where id=?", {}, $id); if ($fixed) { - dbh()->do("update problem set state='fixed' where id=? and state='confirmed'", {}, $problem_id); + dbh()->do("update problem set state='fixed', laststatechange = ms_current_timestamp() + where id=? and state='confirmed'", {}, $problem_id); } elsif ($reopen) { - dbh()->do("update problem set state='confirmed' where id=? and state='fixed'", {}, $problem_id); + dbh()->do("update problem set state='confirmed', laststatechange = ms_current_timestamp() + where id=? and state='fixed'", {}, $problem_id); } my $salt = unpack('h*', random_bytes(8)); my $secret = scalar(dbh()->selectrow_array('select secret from secret')); @@ -66,7 +68,7 @@ EOF $out .= $q->p(sprintf(_('You could also <a href="%s">subscribe to the RSS feed</a> of updates by other local people on this problem, or %s if you wish to receive updates by email.'), "/rss/$problem_id", $signup)); $out .= '</form>'; } elsif ($type eq 'problem') { - dbh()->do("update problem set state='confirmed',confirmed=ms_current_timestamp() + dbh()->do("update problem set state='confirmed', confirmed=ms_current_timestamp(), laststatechange=ms_current_timestamp() where id=? and state='unconfirmed'", {}, $id); my ($email, $council) = dbh()->selectrow_array("select email, council from problem where id=?", {}, $id); my $salt = unpack('h*', random_bytes(8)); diff --git a/web/questionnaire.cgi b/web/questionnaire.cgi index b2ffca760..8f812948b 100755 --- a/web/questionnaire.cgi +++ b/web/questionnaire.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: questionnaire.cgi,v 1.3 2007-05-08 12:17:43 matthew Exp $ +# $Id: questionnaire.cgi,v 1.4 2007-05-09 11:01:44 matthew Exp $ use strict; require 5.8.0; @@ -66,7 +66,7 @@ sub check_stuff { my $problem = dbh()->selectrow_hashref( "select *, extract(epoch from confirmed) as time, extract(epoch from whensent-confirmed) as whensent - from problem where id=? and state in ('confirmed','fixed')", {}, $problem_id); + from problem where id=? and state in ('confirmed','fixed')", {}, $problem_id); throw Error::Simple("I'm afraid we couldn't locate your problem in the database.\n") unless $problem; return ($questionnaire, $prev_questionnaire, $problem); @@ -83,7 +83,7 @@ sub submit_questionnaire { ($questionnaire, $prev_questionnaire, $problem) = check_stuff($q); } catch Error::Simple with { my $e = shift; - $error = $e; + $error = $e; }; return $error if $error; @@ -101,7 +101,8 @@ sub submit_questionnaire { $new_state = 'confirmed' if $input{been_fixed} eq 'No' && $problem->{state} eq 'fixed'; # Record state change, if there was one - dbh()->do("update problem set state=? where id=?", {}, $new_state, $problem->{id}) + dbh()->do("update problem set state=?, laststatechange=ms_current_timestamp() + where id=?", {}, $new_state, $problem->{id}) if $new_state; # Record questionnaire response @@ -143,7 +144,7 @@ sub display_questionnaire { ($questionnaire, $prev_questionnaire, $problem) = check_stuff($q); } catch Error::Simple with { my $e = shift; - $error = $e; + $error = $e; }; return $error if $error; |