[Bps-public-commit] rtx-calendar branch multiple-days-events updated. 1.05-34-gca30566
BPS Git Server
git at git.bestpractical.com
Wed Sep 27 00:49:04 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, multiple-days-events has been updated
via ca30566f724ced7bb9f372c9b021994356fd5ef2 (commit)
via a26546458ad1c6a7f4e33ec98a9a883b294e1aa9 (commit)
from 3000ff4ecedf3356efae1e5d09fd4c074da7c0f0 (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 ca30566f724ced7bb9f372c9b021994356fd5ef2
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date: Tue Sep 26 21:38:59 2023 -0300
Fix filter on status bad behavior when changing months
When users changed the month on the calendar with the filter on status
enabled, and on the next month they changed the status filter, the filter
pre selecting the statuses from the args on the URI, and not and not
from the posted form.
diff --git a/html/Elements/Calendar b/html/Elements/Calendar
index b2bafe8..b87cd78 100644
--- a/html/Elements/Calendar
+++ b/html/Elements/Calendar
@@ -205,7 +205,16 @@ my $NewQuery = $DECODED_ARGS->{NewQuery};
my $BaseQuery = $DECODED_ARGS->{BaseQuery};
my $FilterOnStatusClear = $DECODED_ARGS->{FilterOnStatusClear};
my @FilterOnStatus;
-if ( $DECODED_ARGS->{FilterOnStatus} ) {
+if ( $DECODED_ARGS->{NewFilterOnStatus} ) {
+ if ( ref $DECODED_ARGS->{NewFilterOnStatus} eq 'ARRAY' ) {
+ @FilterOnStatus = @{$DECODED_ARGS->{NewFilterOnStatus}};
+ }
+ else {
+ push @FilterOnStatus, $DECODED_ARGS->{NewFilterOnStatus};
+ }
+}
+# This comes from the month changing form and link
+elsif ( $DECODED_ARGS->{FilterOnStatus} ) {
if ( ref $DECODED_ARGS->{FilterOnStatus} eq 'ARRAY' ) {
@FilterOnStatus = @{$DECODED_ARGS->{FilterOnStatus}};
}
diff --git a/html/Elements/CalendarSidebar b/html/Elements/CalendarSidebar
index 34ceaf0..b1f96ce 100644
--- a/html/Elements/CalendarSidebar
+++ b/html/Elements/CalendarSidebar
@@ -12,7 +12,7 @@
<form id="FilterOnStatusForm"
method="post">
- <select name="FilterOnStatus" id="FilterOnStatus"
+ <select name="NewFilterOnStatus" id="NewFilterOnStatus"
class="selectpicker filteronstatus mt-3 mb-3" multiple="multiple" size="6">
% for my $Status (sort {loc($a) cmp loc($b)} @{RT->Config->Get('CalendarFilterStatuses')}) {
<option value="<% $Status %>"
commit a26546458ad1c6a7f4e33ec98a9a883b294e1aa9
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date: Tue Sep 26 21:21:31 2023 -0300
Fix filter on status to not replace the default query
Filter on Status was replacing the default query of the Calendar
element, causing the calendar to show wrong events when selecting a
status that was not part of the default query.
diff --git a/html/Elements/Calendar b/html/Elements/Calendar
index 0042415..b2bafe8 100644
--- a/html/Elements/Calendar
+++ b/html/Elements/Calendar
@@ -249,12 +249,6 @@ my $set = DateTime::Set->from_recurrence(
next => sub { $_[0]->truncate( to => 'day' )->add( days => 1 ) }
);
-if (@FilterOnStatus) {
- my $StatusClause = join " OR ", map { "Status = '$_'" } @FilterOnStatus;
- $Query .= " AND " if $Query;
- $Query .= "($StatusClause)";
-}
-
# Default Query and Format
my $TempFormat = "__Starts__ __Due__";
my $TempQuery = "( Status = 'new' OR Status = 'open' OR Status = 'stalled')
@@ -310,6 +304,12 @@ my %DateTypes = map { $_ => 1 } @Dates;
$TempQuery .= RTx::Calendar::DatesClauses(\@Dates, $date->strftime("%F"), $end->strftime("%F"));
+if (@FilterOnStatus) {
+ my $StatusClause = join " OR ", map { "Status = '$_'" } @FilterOnStatus;
+ $TempQuery .= " AND " if $TempQuery;
+ $TempQuery .= "($StatusClause)";
+}
+
$m->callback( CallbackName => 'BeforeFindTickets', ARGSRef => \%ARGS, QueryRef => \$TempQuery, FormatRef => \$TempFormat );
my ($Tickets, $TicketsSpanningDays) = RTx::Calendar::FindTickets($session{'CurrentUser'}, $TempQuery, \@Dates, $date->strftime("%F"), $end->strftime("%F"));
-----------------------------------------------------------------------
Summary of changes:
html/Elements/Calendar | 23 ++++++++++++++++-------
html/Elements/CalendarSidebar | 2 +-
2 files changed, 17 insertions(+), 8 deletions(-)
hooks/post-receive
--
rtx-calendar
More information about the Bps-public-commit
mailing list