[Rt-commit] rt branch, 4.4/custom-field-disable-enable-msg, created. rt-4.2.11-150-gb07841a
Dustin Graves
dustin at bestpractical.com
Thu Aug 13 15:45:33 EDT 2015
The branch, 4.4/custom-field-disable-enable-msg has been created
at b07841adca7124f3fe00317a80ba300cf8877be3 (commit)
- Log -----------------------------------------------------------------
commit b07841adca7124f3fe00317a80ba300cf8877be3
Author: Dustin Graves <dustin at bestpractical.com>
Date: Thu Aug 13 19:42:34 2015 +0000
Change Custom Field disable/enable message to be friendlier
e.g. CustomField Foo: Disabled changed from (no value) to "1" ==>
CustomField Foo: Disabled
CustomField Foo: Disabled changed from "1" to "0" ==>
CustomField Foo: Enabled
Fixes: I#31141
diff --git a/lib/RT/CustomField.pm b/lib/RT/CustomField.pm
index 39b90b9..2b0b2ea 100644
--- a/lib/RT/CustomField.pm
+++ b/lib/RT/CustomField.pm
@@ -1084,6 +1084,27 @@ Takes a boolean.
=cut
+sub SetDisabled {
+ my $self = shift;
+ my $val = shift;
+
+ $RT::Handle->BeginTransaction();
+
+ my ($status, $msg) = $self->SUPER::SetDisabled($val);
+
+ unless ($status) {
+ $RT::Handle->Rollback();
+ return ($status, $msg);
+ }
+
+ $RT::Handle->Commit();
+
+ if ( $val == 1 ) {
+ return (1, $self->loc("Disabled"));
+ } else {
+ return (1, $self->loc("Enabled"));
+ }
+}
=head2 SetTypeComposite
-----------------------------------------------------------------------
More information about the rt-commit
mailing list