X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT%2FTicket_Vendor.pm;h=9fa24a2a887a058279325dc7fe58c2689d581c74;hb=86b5edc2d448cb9c8e90b76b77b21b09d69d8527;hp=604a84aa22c8c8a84c08398d93141f82b65e017c;hpb=f2a797b9cc0e9a6053399356e9e8cae22e553c9c;p=freeside.git diff --git a/rt/lib/RT/Ticket_Vendor.pm b/rt/lib/RT/Ticket_Vendor.pm index 604a84aa2..9fa24a2a8 100644 --- a/rt/lib/RT/Ticket_Vendor.pm +++ b/rt/lib/RT/Ticket_Vendor.pm @@ -13,4 +13,53 @@ sub SetPriority { $Ticket->SUPER::SetPriority($value); } +=head2 MissingRequiredFields { + +Return all custom fields with the Required flag set for which this object +doesn't have any non-empty values. + +=cut + +sub MissingRequiredFields { + my $self = shift; + my $CustomFields = $self->CustomFields; + my @results; + while ( my $CF = $CustomFields->Next ) { + next if !$CF->Required; + if ( !length($self->FirstCustomFieldValue($CF->Id) || '') ) { + push @results, $CF; + } + } + return @results; +} + +# Declare the 'WillResolve' field +sub _VendorAccessible { + { + WillResolve => + {read => 1, write => 1, sql_type => 11, length => 0, is_blob => 0, is_numeric => 0, type => 'datetime', default => ''}, + }, +}; + +sub WillResolveObj { + my $self = shift; + + my $time = new RT::Date( $self->CurrentUser ); + + if ( my $willresolve = $self->WillResolve ) { + $time->Set( Format => 'sql', Value => $willresolve ); + } + else { + $time->Set( Format => 'unix', Value => -1 ); + } + + return $time; +} + +sub WillResolveAsString { + my $self = shift; + return $self->WillResolveObj->AsString(); +} + + 1;