[freeside-commits] freeside/rt/lib/RT CustomField.pm, 1.4, 1.5 CustomField_Vendor.pm, 1.1, 1.2 Ticket_Vendor.pm, 1.1, 1.2
Mark Wells
mark at wavetail.420.am
Tue May 31 16:30:15 PDT 2011
Update of /home/cvs/cvsroot/freeside/rt/lib/RT
In directory wavetail.420.am:/tmp/cvs-serv19783/lib/RT
Modified Files:
CustomField.pm Ticket_Vendor.pm
Added Files:
CustomField_Vendor.pm
Log Message:
improve mandatory fields, #9260
Index: CustomField.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/CustomField.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -d -r1.4 -r1.5
--- CustomField.pm 18 Apr 2011 23:49:54 -0000 1.4
+++ CustomField.pm 31 May 2011 23:30:12 -0000 1.5
@@ -122,7 +122,6 @@
Disabled => '0',
LinkToValue => '',
IncludeContentForValue => '',
- Required => '0',
@_);
$self->SUPER::Create(
@@ -382,9 +381,6 @@
{read => 1, auto => 1, sql_type => 11, length => 0, is_blob => 0, is_numeric => 0, type => 'datetime', default => ''},
Disabled =>
{read => 1, write => 1, sql_type => 5, length => 6, is_blob => 0, is_numeric => 1, type => 'smallint(6)', default => '0'},
- Required =>
- {read => 1, write => 1, sql_type => 5, length => 6, is_blob => 0, is_numeric => 1, type => 'smallint(6)', default => '0'},
-
}
};
--- NEW FILE: CustomField_Vendor.pm ---
package RT::CustomField;
use strict;
no warnings 'redefine';
sub _VendorAccessible {
{
Required =>
{read => 1, write => 1, sql_type => 5, length => 6, is_blob => 0, is_numeric => 1, type => 'smallint(6)', default => '0'},
},
};
1;
Index: Ticket_Vendor.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Ticket_Vendor.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- Ticket_Vendor.pm 16 May 2011 23:28:19 -0000 1.1
+++ Ticket_Vendor.pm 31 May 2011 23:30:13 -0000 1.2
@@ -13,4 +13,24 @@
$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;
+}
+
1;
More information about the freeside-commits
mailing list