[Bps-public-commit] rtx-calendar branch allow-custom-field-based-events updated. 1.05-9-g43140bd
BPS Git Server
git at git.bestpractical.com
Wed Aug 23 20:20:12 UTC 2023
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rtx-calendar".
The branch, allow-custom-field-based-events has been updated
via 43140bd7ab6cd151d3ab5ec8b96b43d29f03136b (commit)
via b5488423f7aa9591613b08a07836f126357d9da5 (commit)
from 8299ab50c7e1647b587bd3f554f7a4120ca15188 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 43140bd7ab6cd151d3ab5ec8b96b43d29f03136b
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date: Wed Aug 23 17:14:10 2023 -0300
Add Date Custom Field support to the calendar
Only Date Time custom fields were supported in the calendar. This patch
adds support for Date custom fields.
Also, change the way we check for the Custom Field type, allowing loading
all Date and Date Time custom fields even if they are not in the Format
attribute.
diff --git a/html/Search/Calendar.html b/html/Search/Calendar.html
index 2f7a599..b037886 100644
--- a/html/Search/Calendar.html
+++ b/html/Search/Calendar.html
@@ -261,17 +261,6 @@ my $title = loc("Calendar");
my @DateTypes = qw/Created Starts Started Due LastUpdated Resolved/;
-# push Date Time CFs to DateTypes
-my $CFs = RT::CustomFields->new($session{'CurrentUser'});
-$CFs->Limit(
- FIELD => 'Type',
- VALUE => 'DateTime',
-);
-
-while ( my $CF = $CFs->Next ) {
- push @DateTypes, 'CustomField.{' . $CF->Name . '}';
-}
-
my $rtdate = RT::Date->new($session{'CurrentUser'});
my $weekstart = 'Sunday'; #RT::SiteConfig? user pref?
@@ -329,12 +318,22 @@ $TempQuery = $Query if $Query;
$TempFormat = $Format if $Format;
# we search all date types in Format string
-my @Dates = grep {
- my $LintField=${_};
- $LintField=~s/(\{|\})/\\$1/;
- $TempFormat =~ m/__$LintField(Relative)?__/
-} @DateTypes;
+my @CoreDates = grep { $TempFormat =~ m/__${_}(Relative)?__/ } @DateTypes;
+my @CustomFields = ( $TempFormat =~ /__(CustomField\.\{.*\})__/g );
+my @DateCustomFields;
+
+for my $CustomField (@CustomFields) {
+ my $LintCustomField = $CustomField;
+ $LintCustomField =~ s/CustomField\.\{(.*)\}/$1/;
+ my $CustomFieldObj = RT::CustomField->new( RT->SystemUser );
+ $CustomFieldObj->LoadByName( Name => $LintCustomField );
+ push @DateCustomFields, $CustomField
+ if $CustomFieldObj->id
+ && ( $CustomFieldObj->Type eq 'Date'
+ || $CustomFieldObj->Type eq 'DateTime' );
+}
+my @Dates = (@CoreDates, @DateCustomFields);
@Dates = map { $_ =~ s/^CustomField\.(.*)$/CF.$1/; $_ } @Dates;
# used to display or not a date in Element/CalendarEvent
commit b5488423f7aa9591613b08a07836f126357d9da5
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date: Wed Aug 23 16:15:26 2023 -0300
Remove general icon from non match events
If custom icon is not set to a Custom Field based event, then we will
not show a standard icon for that.
diff --git a/lib/RTx/Calendar.pm b/lib/RTx/Calendar.pm
index 5ebd0f9..e0b9390 100644
--- a/lib/RTx/Calendar.pm
+++ b/lib/RTx/Calendar.pm
@@ -202,8 +202,6 @@ sub GetEventIcon {
and RTx::Calendar::LocalDate($Object->LastUpdatedObj->Unix) eq $CurrentDate) {
$EventIcon = '<img src="' . $RT::WebImagesURL . '/updated.png" />';
- } else {
- $EventIcon = '<img src="' . $RT::WebImagesURL . '/reminder.png" />';
}
return $EventIcon;
}
-----------------------------------------------------------------------
Summary of changes:
html/Search/Calendar.html | 31 +++++++++++++++----------------
lib/RTx/Calendar.pm | 2 --
2 files changed, 15 insertions(+), 18 deletions(-)
hooks/post-receive
--
rtx-calendar
More information about the Bps-public-commit
mailing list