From 59867e99e8020b3b8ab1844c9e2e7de24d45e6cf Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Thu, 31 Mar 2016 18:08:37 -0500 Subject: [PATCH] RT#34237: installer scheduling [bug fixes for refactor] --- rt/share/html/Elements/CalendarSlotSchedule | 39 ++++++++++++++++------------- rt/share/html/Search/Schedule.html | 2 -- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/rt/share/html/Elements/CalendarSlotSchedule b/rt/share/html/Elements/CalendarSlotSchedule index c8d3bfaa6..b5c08d6ac 100644 --- a/rt/share/html/Elements/CalendarSlotSchedule +++ b/rt/share/html/Elements/CalendarSlotSchedule @@ -21,7 +21,7 @@ % % my $bgcolor = '#666666'; % my $border = '1px solid #555555'; -% my $content = ''; +% my $label = ''; % my $selectable = 0; # can we schedule a new appointment % my $ticketid = 0; % my $draggable_length = 0; @@ -42,13 +42,20 @@ % } % % #block out / show / color code existing appointments +% my $maxstarts = 0; % foreach my $id ( keys %{ $schedule{'scheduled'} } ) { % % my( $starts, $due, $col, $t ) = @{ $schedule{'scheduled'}->{$id} }; % -% # misleading loop--at most one id will pass this test +% # misleading loop--at most one id should pass this test % next if $starts >= ($tod_row+$timestep) || $due <= $tod_row; % +% # but, if for any reason a scheduling conflict occurs, +% # use the later starting one to minimize UI conflicts-- +% # not to imply that this scenario has been tested or should ever happen!!! +% next if $starts < $maxstarts; +% $maxstarts = $starts; +% % $ticketid = $id; % $bgcolor = '#'.$col; % $border = '1px solid #D7D7D7'; @@ -60,22 +67,18 @@ % $cells = int( ($due-$starts) / $timestep ); % $cells++ if ($due-$starts) % $timestep; % -% if ( $starts >= $tod_row ) { #first row -% -% #false laziness w/misc/xmlhttp-ticket-update.html & CalendarDaySchedule -% my %hash = $m->comp('/Ticket/Elements/Customers', Ticket => $t); -% my @cust_main = values( %{$hash{cust_main}} ); +% #false laziness w/misc/xmlhttp-ticket-update.html & CalendarDaySchedule +% my %hash = $m->comp('/Ticket/Elements/Customers', Ticket => $t); +% my @cust_main = values( %{$hash{cust_main}} ); % -% #false laziness w/xmlhttp-ticket-update.html -% $content .= FS::sched_avail::pretty_time($starts). '-'. -% FS::sched_avail::pretty_time($due). -% ': '. $cust_main[0]->_FreesideURILabel; -% #'install for custname XX miles away'; #XXX placeholder/more +% #false laziness w/xmlhttp-ticket-update.html +% $label .= FS::sched_avail::pretty_time($starts). '-'. +% FS::sched_avail::pretty_time($due). +% ': '. $cust_main[0]->_FreesideURILabel; +% #'install for custname XX miles away'; #XXX placeholder/more % -% } else { -% $offset = int( ($tod_row - $starts) / $timestep ); -% $offset++ if ($tod_row - $starts) % $timestep; -% } +% $offset = int( ($tod_row - $starts) / $timestep ); +% $offset++ if ($tod_row - $starts) % $timestep; % } % % my $td_id = 'td_'. $Date->epoch. '_'. $tod_row. '_'. $username; @@ -137,7 +140,7 @@ % } % % } - ><% $content |h %> + >