2039f3e2d7d13ca2093a51f866b0800d5108ef64
[freeside.git] / rt / lib / RT / Ticket_Vendor.pm
1 package RT::Ticket;
2 use strict;
3
4 sub SetPriority {
5   # Special case: Pass a value starting with 'R' to set priority 
6   # relative to the current level.  Used for bulk updates, though 
7   # it can be used anywhere else too.
8   my $Ticket = shift;
9   my $value = shift;
10   if ( $value =~ /^R([+-]?\d+)$/ ) {
11     $value = $1 + ($Ticket->Priority || 0);
12   }
13   $Ticket->SUPER::SetPriority($value);
14 }
15
16 =head2 MissingRequiredFields {
17
18 Return all custom fields with the Required flag set for which this object
19 doesn't have any non-empty values.
20
21 =cut
22
23 sub MissingRequiredFields {
24     my $self = shift;
25     my $CustomFields = $self->CustomFields;
26     my @results;
27     while ( my $CF = $CustomFields->Next ) {
28         next if !$CF->Required;
29         if ( !length($self->FirstCustomFieldValue($CF->Id) || '') )  {
30             push @results, $CF;
31         }
32     }
33     return @results;
34 }
35
36 1;