summaryrefslogtreecommitdiff
path: root/rt
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-01-26 20:31:37 -0800
committerIvan Kohler <ivan@freeside.biz>2015-01-26 20:31:37 -0800
commit9c7f208cc849ea4019447884288bf2c04d43dfc6 (patch)
tree90bbb78cdbc8434afd10d9d95850c734585175f0 /rt
parent349bfb3f80c3af6be2b6c2af9e9d2e7a71b1ffe6 (diff)
fix handling of no installer and one installer cases, RT#16584
Diffstat (limited to 'rt')
-rw-r--r--rt/share/html/Search/Schedule.html15
1 files changed, 13 insertions, 2 deletions
diff --git a/rt/share/html/Search/Schedule.html b/rt/share/html/Search/Schedule.html
index 8290472e7..34ba142bd 100644
--- a/rt/share/html/Search/Schedule.html
+++ b/rt/share/html/Search/Schedule.html
@@ -55,11 +55,11 @@
Query => "( Status = 'new' OR Status = 'open' OR Status = 'stalled')
AND ( Type = 'reminder' OR 'Type' = 'ticket' )",
#XXX and we have the magic custom field
- slots => scalar( @{ $ARGS{username} } ),
+ slots => scalar(@usernames),
Embed => 'Schedule.html',
DimPast => 1,
Display => 'Schedule',
- DisplayArgs => [ username => $ARGS{username},
+ DisplayArgs => [ username => \@usernames,
LengthMin => $LengthMin,
#oops, more freeside abstraction-leaking
custnum => $ARGS{custnum},
@@ -80,6 +80,17 @@ my @files = ();
push @files, map { "${_}contentmws" } qw( iframe ajax );
#%}
+my @usernames = ();
+if ( ref($ARGS{username}) ) {
+ @usernames = @{ $ARGS{username} };
+} elsif ( $ARGS{username} ) {
+ @usernames = ( $ARGS{username} );
+} else {
+ #XXX shouldn't even get offered the link in the first place rather than perl
+ # barf, but this is better than erroring out later or empty @username
+ die "Can't schedule an appointment - no employees are configured as installers";
+}
+
( my $LengthMin = $ARGS{LengthMin} ) =~ /^\d+$/ or die 'non-numeric LengthMin';
my $cells = int($LengthMin / $timestep);