package contacts / "name per packages", RT#22185
[freeside.git] / FS / FS / contact_Mixin.pm
diff --git a/FS/FS/contact_Mixin.pm b/FS/FS/contact_Mixin.pm
new file mode 100644 (file)
index 0000000..33cd350
--- /dev/null
@@ -0,0 +1,19 @@
+package FS::contact_Mixin;
+
+use strict;
+use FS::Record qw( qsearchs );
+use FS::contact;
+
+=item contact
+
+Returns the contact object, if any (see L<FS::contact>).
+
+=cut
+
+sub contact {
+  my $self = shift;
+  return '' unless $self->contactnum;
+  qsearchs( 'contact', { 'contactnum' => $self->contactnum } );
+}
+
+1;