aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result/Problem.pm
diff options
context:
space:
mode:
authorEdmund von der Burg <evdb@mysociety.org>2011-04-01 15:53:21 +0100
committerEdmund von der Burg <evdb@mysociety.org>2011-04-01 15:53:21 +0100
commit22b4d5c4d19f882e07f45d083a64ae3fa4e2dc69 (patch)
tree64dc65056df7deec75c2db618ad474090b16a5ec /perllib/FixMyStreet/DB/Result/Problem.pm
parent00f183081599bfbb0b68724d058658123639fb84 (diff)
Move logic into problem
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Problem.pm')
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm23
1 files changed, 23 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 5873a9b7f..bafad4ec0 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -164,4 +164,27 @@ sub is_from_abuser {
|| undef;
}
+=head2 confirm
+
+ $bool = $problem->confirm( );
+ $problem->update;
+
+
+Set the state to 'confirmed' and put current time into 'confirmed' field. This
+is a no-op if the report is already confirmed.
+
+NOTE - does not update storage - call update or insert to do that.
+
+=cut
+
+sub confirm {
+ my $self = shift;
+
+ return if $self->state eq 'confirmed';
+
+ $self->state('confirmed');
+ $self->confirmed( \'ms_current_timestamp()' );
+ return 1;
+}
+
1;