[freeside-commits] branch FREESIDE_3_BRANCH updated. 3b747e41c8795c2fed2cbbe2993a6a445d7546a3

Ivan ivan at 420.am
Mon Apr 14 01:17:14 PDT 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  3b747e41c8795c2fed2cbbe2993a6a445d7546a3 (commit)
      from  ddcefead29544e7813f942e0eca062bf6433763e (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 3b747e41c8795c2fed2cbbe2993a6a445d7546a3
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Apr 14 01:17:13 2014 -0700

    installers (calendaring), RT#16584

diff --git a/rt/lib/RTx/Schedule.pm b/rt/lib/RTx/Schedule.pm
index c143277..167019d 100644
--- a/rt/lib/RTx/Schedule.pm
+++ b/rt/lib/RTx/Schedule.pm
@@ -99,7 +99,8 @@ sub UserDaySchedule {
             
 
             #XXX color code existing appointments by... city?  proximity?  etc.
-            my $col = '99ff99'; #green for now
+            #my $col = '99ff99'; #green for now
+            my $col = 'a097ed'; #any of green/red/yellow-like would be confusing as a placeholder color, so.. blue-ish/purple
 
             $_->Id => [ $starts, $due, $col, $_ ];
           }
diff --git a/rt/share/html/Elements/CalendarDaySchedule b/rt/share/html/Elements/CalendarDaySchedule
index a8cda65..5be5b06 100644
--- a/rt/share/html/Elements/CalendarDaySchedule
+++ b/rt/share/html/Elements/CalendarDaySchedule
@@ -32,7 +32,7 @@ $CurrentUser => undef
 %     my $s = int(($starts-$stime)/10);
 %     my $e = int(($due-$stime)/10)-1;
       <AREA
-         onmouseover = "overlib('<%$id%>: XX miles away<BR>more info', WRAP, BGCOLOR, '#000000', FGCOLOR, '#<%$col%>')"
+         onmouseover = "overlib('<%$id%>: <% FS::sched_avail::pretty_time($starts). '-'. FS::sched_avail::pretty_time($due) %><BR>XX miles away<BR>more info', WRAP, BGCOLOR, '#000000', FGCOLOR, '#<%$col%>')"
          onmouseout  = "nd(); return true;"
          shape       = "rect"
          coords      = "<%$s%>,0,<%$e%>,<%$height%>"
@@ -87,6 +87,7 @@ my $height = 12; #Schedule/UserBar
 <%init>
 
 use RTx::Schedule qw( UserDaySchedule );
+use FS::sched_avail; #just for pretty_time
 
 #my( $date, $time ) = split('T', $Date);
 my $date = $Date->strftime('%F');
diff --git a/rt/share/html/Elements/CalendarSlotSchedule b/rt/share/html/Elements/CalendarSlotSchedule
index 5b40040..55c45cd 100644
--- a/rt/share/html/Elements/CalendarSlotSchedule
+++ b/rt/share/html/Elements/CalendarSlotSchedule
@@ -7,6 +7,8 @@
   $timestep  => $default_timestep
   @username  => ()
   $LengthMin => $default_timestep
+  $custnum   => undef
+  $pkgnum    => undef
 </%ARGS>
 % foreach my $username ( @username ) {
 %
@@ -17,43 +19,80 @@
 %
 %   my $bgcolor = '666666;border-color:#555555';
 %   my $content = '';
-%   my $onmouse = 0;
+%   my $selectable = 0;
 %
 %   #white out available times
 %   foreach my $avail ( @{ $schedule{'avail'} } ) {
 %     my( $start, $end ) = @$avail;
 %     next if $start >= ($tod_row+$timestep) || $end <= $tod_row;
 %     $bgcolor = 'FFFFFF';
-%     $onmouse = 1
+%     $selectable = 1
 %       if $LengthMin <= $end - $tod_row  #the slot is long enough
 %       && ! grep { $_ > $tod_row && $LengthMin > $_ - $tod_row }
 %              map $_->[0], values %{ $schedule{'scheduled'} };
 %   }
 %
 %   #block out / show / color code existing appointments
+%   #my %line = ();
 %   foreach my $id ( keys %{ $schedule{'scheduled'} } ) {
 %
 %     my( $starts, $due, $col, $t ) = @{ $schedule{'scheduled'}->{$id} };
 %
-%     next if $starts >= ($tod_row+$timestep) || $due < $tod_row;
+%     next if $starts >= ($tod_row+$timestep) || $due <= $tod_row;
 %
 %     $bgcolor = $col;
-%     $onmouse = 0;
+%     $selectable = 0;
 %
 %     if ( $starts >= $tod_row ) { #first row
-%       $content .= ($content?', ':''). $id; #XXX more
+%       $content .= ($content?', ':''). $id.
+%                   ': '. FS::sched_avail::pretty_time($starts). '-'.
+%                         FS::sched_avail::pretty_time($due);
+%                   #'install for custname XX miles away'; #XXX placeholder/more
+%     #} else {
+%     #  $content .= ($content?', ':''). $id;
 %     }
 %   }
 
-    <td style="background:#<%$bgcolor%>" class="weekly"
+    <td style="background:#<%$bgcolor%>"
+        class="<% $selectable ? 'weeklyselectable' : 'weekly' %>"
 %#               <%   $is_today     ? 'today'
 %#                  : $is_yesterday ? 'yesterday'
 %#                  : $is_aweekago  ? 'aweekago'
 %#                  : ''
 %#               %>"
-%     if ( $onmouse ) {
-        onmouseover="boxon(this);"
-        onmouseout ="boxoff(this);"
+%     if ( $selectable ) {
+%
+%       #XXX for now, construct a ticket creation URL
+%       # eventually, do much the same, but say "appointment made", show time
+%       # and date, have # options to do things with it? etc.
+%       # then redir back to customer/appointment view i guess
+%
+%       #abstraction is leaking like a sieve... linking back to freeside cust
+%       # (XXX and eventually, package)
+%       my $cust_main = qsearchs('cust_main', { custnum=>$custnum } )
+%         or die "unknown custnum $custnum";
+%       my $Queue = $cust_main->agent->ticketing_queueid || 1; # || $default_queueid;#XXX really, pick pkg_category queue
+%       my $member = "freeside://freeside/cust_main/$custnum";
+%
+%warn       my $Starts = int($tod_row/60). ':'. sprintf('%02d',$tod_row%60). ':00';
+%warn       my $Due    = int(($tod_row+$LengthMin)/60). ':'.
+%                    sprintf('%02d',($tod_row+$LengthMin)%60). ':00';
+%
+%       my $url = $RT::WebPath. '/Ticket/Display.html?id=new'.
+%                 "&Queue=$Queue".
+%                 "&Owner=$username".
+%                 '&Starts='. $Date->strftime('%F').'%20'. $Starts.
+%                 '&Due='.    $Date->strftime('%F').'%20'. $Due.
+%                 '&new-MemberOf='. $member; #XXX uri_escape?
+%                 #'&Requestors='. #XXX Freeside customer requestor(s) (package?
+
+        onmouseover = "boxon(this);"
+        onmouseout  = "boxoff(this);"
+        title       = "<% 'Make appointment for '.
+                            FS::sched_avail::pretty_time($tod_row). '-'.
+                            FS::sched_avail::pretty_time($tod_row+$LengthMin)
+                      %>"
+        onclick     = "window.location.href = '<% $url %>'"
 %     }
     ><% $content %></td>
 % }
@@ -64,5 +103,10 @@ my $default_timestep = RT->Config->Get('CalendarWeeklySizeMin') || 30; #1/2h
 <%INIT>
 
 use RTx::Schedule qw( UserDaySchedule );
+use FS::sched_avail; #just for pretty_time
+
+#what happened?  alas.  for constructing the ticket creation links
+use FS::Record qw( qsearchs );
+use FS::cust_main;
 
 </%INIT>
diff --git a/rt/share/html/Search/Schedule.html b/rt/share/html/Search/Schedule.html
index 4bc5134..8290472 100644
--- a/rt/share/html/Search/Schedule.html
+++ b/rt/share/html/Search/Schedule.html
@@ -61,6 +61,9 @@
      Display     => 'Schedule',
      DisplayArgs => [ username  => $ARGS{username},
                       LengthMin => $LengthMin,
+                      #oops, more freeside abstraction-leaking
+                      custnum   => $ARGS{custnum},
+                      pkgnum    => $ARGS{pkgnum},
                     ],
 &>
 
@@ -77,7 +80,7 @@ my @files = ();
   push @files, map { "${_}contentmws" } qw( iframe ajax );
 #%}
 
-my $LengthMin = 180; #XXX $ARGS{LengthMin};, passed in
+( my $LengthMin = $ARGS{LengthMin} ) =~ /^\d+$/ or die 'non-numeric LengthMin';
 
 my $cells = int($LengthMin / $timestep);
 $cells++ if $LengthMin % $timestep;

-----------------------------------------------------------------------

Summary of changes:
 rt/lib/RTx/Schedule.pm                      |    3 +-
 rt/share/html/Elements/CalendarDaySchedule  |    3 +-
 rt/share/html/Elements/CalendarSlotSchedule |   62 +++++++++++++++++++++++----
 rt/share/html/Search/Schedule.html          |    5 ++-
 4 files changed, 61 insertions(+), 12 deletions(-)




More information about the freeside-commits mailing list