From 0a9ca576892e12cd9f672ad16c3b64dd5115b36d Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Fri, 25 Aug 2017 14:59:01 +0100 Subject: [PATCH] Added user type attribute --- lib/Pear/LocalLoop/Schema/Result/User.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/Pear/LocalLoop/Schema/Result/User.pm b/lib/Pear/LocalLoop/Schema/Result/User.pm index 151075d..75a1dde 100644 --- a/lib/Pear/LocalLoop/Schema/Result/User.pm +++ b/lib/Pear/LocalLoop/Schema/Result/User.pm @@ -149,8 +149,17 @@ sub name { } elsif ( defined $self->organisation_id ) { return $self->organisation->name; } else { - return undef; + return; } } +sub type { + my $self = shift; + + if ( defined $self->customer_id ) { + return "customer"; + } + return "organisation"; +} + 1;