]> wagnertech.de Git - kivitendo-erp.git/blobdiff - SL/DB/Project.pm
Mandantenkonfiguration: experimentelle Features einzeln an-/abschaltbar machen
[kivitendo-erp.git] / SL / DB / Project.pm
index 3f3e88ddbcb434c8328bd97cb4c0d87d71a95d87..df5fe09ec2e24d17cce4f335ac8f48db135e8500 100644 (file)
@@ -48,6 +48,12 @@ sub is_projectnumber_unique {
   return !SL::DB::Manager::Project->get_first(where => \@filter);
 }
 
   return !SL::DB::Manager::Project->get_first(where => \@filter);
 }
 
+sub displayable_name {
+  my ($self) = @_;
+
+  return join ' ', grep $_, $self->projectnumber, $self->description;
+}
+
 sub full_description {
   my ($self, %params) = @_;
 
 sub full_description {
   my ($self, %params) = @_;
 
@@ -60,6 +66,14 @@ sub full_description {
   } elsif ($params{style} =~ m/description/) {
     $description = $self->description;
 
   } elsif ($params{style} =~ m/description/) {
     $description = $self->description;
 
+  } elsif (($params{style} =~ m/full/) && $self->customer) {
+    $description = $self->projectnumber;
+    if ($self->description && do { my $desc = quotemeta $self->description; $self->projectnumber !~ m/$desc/ }) {
+      $description .= ' ' . $self->description;
+    }
+
+    $description = $self->customer->name . " (${description})";
+
   } else {
     $description = $self->projectnumber;
     if ($self->description && do { my $desc = quotemeta $self->description; $self->projectnumber !~ m/$desc/ }) {
   } else {
     $description = $self->projectnumber;
     if ($self->description && do { my $desc = quotemeta $self->description; $self->projectnumber !~ m/$desc/ }) {
@@ -105,6 +119,11 @@ Returns trueish if the project number is not used for any other
 project in the database. Also returns trueish if no project number has
 been set yet.
 
 project in the database. Also returns trueish if no project number has
 been set yet.
 
+=item C<displayable_name>
+
+Returns a human-readable description of the project, consisting of projectnumber
+and description.
+
 =item C<full_description %params>
 
 Returns a full description for the project which can consist of the
 =item C<full_description %params>
 
 Returns a full description for the project which can consist of the
@@ -128,6 +147,16 @@ Returns only the project's number.
 
 Returns only the project's description.
 
 
 Returns only the project's description.
 
+=item C<full>
+
+Returns the customer name followed by the project number and project
+description in parenthesis (e.g. "Evil Corp (12345 World
+domination)"). If the project's description is already part of the
+project's number then it will not be appended.
+
+If this project isn't linked to a customer then the style C<both> is
+used instead.
+
 =back
 
 =back
 =back
 
 =back