aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result/User.pm
diff options
context:
space:
mode:
authorDave Whiteland <dave@mysociety.org>2012-05-29 15:57:41 +0100
committerDave Whiteland <dave@mysociety.org>2012-05-29 15:57:41 +0100
commit67da8efc720d2d0bd22bd9fe8655b7e983b35bb4 (patch)
tree38b8570647124df06c637d4b923f6010211ef328 /perllib/FixMyStreet/DB/Result/User.pm
parent40b3a51d33caefa8f5fb97ce9be18ef936c7e260 (diff)
parent131ff6e9bf3626d6a8fff6ae54669d250148a63a (diff)
Merge remote branch 'origin/master' into fmb-read-only
Conflicts: bin/send-reports perllib/FixMyStreet/Cobrand/Default.pm perllib/FixMyStreet/Cobrand/FixMyStreet.pm templates/web/fixmystreet/alert/index.html templates/web/fixmystreet/around/display_location.html web/cobrands/fixmystreet/_layout.scss web/js/map-OpenLayers.js
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/User.pm')
-rw-r--r--perllib/FixMyStreet/DB/Result/User.pm30
1 files changed, 28 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm
index e13d88b88..7f43d1a52 100644
--- a/perllib/FixMyStreet/DB/Result/User.pm
+++ b/perllib/FixMyStreet/DB/Result/User.pm
@@ -30,6 +30,8 @@ __PACKAGE__->add_columns(
{ data_type => "integer", is_nullable => 1 },
"flagged",
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
+ "title",
+ { data_type => "text", is_nullable => 1 },
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->add_unique_constraint("users_email_key", ["email"]);
@@ -46,6 +48,12 @@ __PACKAGE__->has_many(
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->has_many(
+ "open311confs",
+ "FixMyStreet::DB::Result::Open311conf",
+ { "foreign.comment_user_id" => "self.id" },
+ { cascade_copy => 0, cascade_delete => 0 },
+);
+__PACKAGE__->has_many(
"problems",
"FixMyStreet::DB::Result::Problem",
{ "foreign.user_id" => "self.id" },
@@ -53,8 +61,8 @@ __PACKAGE__->has_many(
);
-# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tM1LUGrqDeQnF4BDgnYXGQ
+# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-05-01 16:20:29
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LKi8u5IYnHW1+Mez64nvGg
__PACKAGE__->add_columns(
"password" => {
@@ -172,4 +180,22 @@ sub belongs_to_council {
return 0;
}
+=head2 split_name
+
+ $name = $user->split_name;
+ printf( 'Welcome %s %s', $name->{first}, $name->{last} );
+
+Returns a hashref with first and last keys with first name(s) and last name.
+NB: the spliting algorithm is extremely basic.
+
+=cut
+
+sub split_name {
+ my $self = shift;
+
+ my ($first, $last) = $self->name =~ /^(\S*)(?: (.*))?$/;
+
+ return { first => $first || '', last => $last || '' };
+}
+
1;