[Rt-commit] rt branch, 5.0/custom-date-ranges-config-in-web-ui, updated. rt-4.4.4-729-g18dd00fa7c
Michel Rodriguez
michel at bestpractical.com
Tue Apr 21 10:17:48 EDT 2020
The branch, 5.0/custom-date-ranges-config-in-web-ui has been updated
via 18dd00fa7c23e2d69a3c3a095d3f1aad79ae3974 (commit)
from 85a3435142e3b0216f32f6309e0a1767dc85e432 (commit)
Summary of changes:
lib/RT/Config.pm | 7 +++++++
1 file changed, 7 insertions(+)
- Log -----------------------------------------------------------------
commit 18dd00fa7c23e2d69a3c3a095d3f1aad79ae3974
Author: michel <michel at bestpractical.com>
Date: Thu Apr 16 17:50:52 2020 +0200
Add initial check on custom date ranges.
Check each cdr defined in the config files against cdr's defined in
the config DB or in user preferences.
If a cdr is defined twice, warn and keep the DB/user definition.
At this point the cdr cannot be deleted from the UI.
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index c4b6b3fc0d..e9b107c75d 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -1203,9 +1203,16 @@ our %META;
return;
}
+ my $all_cdr = $config->AllCustomDateRanges( 2 ); # 2 means that _all_ definitions are loaded
+
for my $class (keys %$ranges) {
if (ref($ranges->{$class}) eq 'HASH') {
for my $name (keys %{ $ranges->{$class} }) {
+ my $existing_def = $all_cdr->{$class}{$name};
+ if( $existing_def && $existing_def ne 'config files' ) {
+ RT->Logger->warning("Custom Date Range $name (for $class) defined both in config files and in $existing_def");
+ next;
+ }
my $spec = $ranges->{$class}{$name};
if (!ref($spec) || ref($spec) eq 'HASH') {
# this will produce error messages if parsing fails
-----------------------------------------------------------------------
More information about the rt-commit
mailing list