diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2016-02-19 02:52:01 -0600 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2016-02-19 02:52:01 -0600 |
commit | dd72ad399c69875b14703e9086f8cedb88acb518 (patch) | |
tree | 8da035ae74cd995cfd4529be71b811ca937c28f2 /httemplate/misc | |
parent | bc977024d700876278824d2556c8d6201ad71334 (diff) | |
parent | efb3f4ff4890d19c2877600cf3a27ad77a45ee70 (diff) |
Merge branch 'FREESIDE_3_BRANCH_34237' into FREESIDE_3_BRANCH
Diffstat (limited to 'httemplate/misc')
-rw-r--r-- | httemplate/misc/schedule-appointment.html | 3 | ||||
-rw-r--r-- | httemplate/misc/xmlhttp-ticket-update.html | 67 |
2 files changed, 69 insertions, 1 deletions
diff --git a/httemplate/misc/schedule-appointment.html b/httemplate/misc/schedule-appointment.html index 45a8a5bab..69b9f422b 100644 --- a/httemplate/misc/schedule-appointment.html +++ b/httemplate/misc/schedule-appointment.html @@ -12,7 +12,8 @@ my $custnum = encode_entities( $cgi->param('custnum') ); my $query = join('&', map "username=$_", @username). "&LengthMin=$LengthMin". - "&custnum=$custnum"; + "&custnum=$custnum". + "&RedirectToBasics=1"; #XXX '&pkgnum=$pkgnum";need to be for specific package/location, not just for a customer... default to active(/ordered) package in a pkg_class w/ticketing_queueid, otherwise, a popup? we're getting complicated like form-creat_ticket.html my $url = $p. 'rt/Search/Schedule.html?'. $query; diff --git a/httemplate/misc/xmlhttp-ticket-update.html b/httemplate/misc/xmlhttp-ticket-update.html new file mode 100644 index 000000000..bd58b95c6 --- /dev/null +++ b/httemplate/misc/xmlhttp-ticket-update.html @@ -0,0 +1,67 @@ +<% encode_json($return) %>\ +<%init> + +my $id = $cgi->param('id'); +my $starts = $cgi->param('starts'); +my $due = $cgi->param('due'); +my $username = $cgi->param('username'); + +my $ticket = FS::TicketSystem->get_ticket_object( \%session, ticket_id=>$id ); + +#hmm, this should happen in a single transaction and either commit or rollback, +# but in reality failures "Don't Happen" so its not like a ticket gets +# half changed + +my $return; +if ( $ticket ) { + + my($orv, $omsg) = $ticket->SetOwner( $username, 'Steal' ); + $orv = 1 if ! $orv && $omsg =~ /already own/i; + + if ( $orv ) { + + my $date = RT::Date->new( $session{CurrentUser} ); + $date->Set( Format=>'unix', Value=>$starts, ); + my($srv, $smsg) = $ticket->SetStarts( $date->ISO ); + $srv = 1 if ! $srv && $smsg =~ /already the current value/i; + + my $ddate; + unless ( ! $srv ) { + $ddate = RT::Date->new( $session{CurrentUser} ); + $ddate->Set( Format=>'unix', Value=>$due, ); + my($drv, $dmsg) = $ticket->SetDue( $ddate->ISO ); + #XXX lame + } + + if ( $srv ) { + + my ($sm, $sh) = ( $date->Localtime('user'))[1,2]; + my ($em, $eh) = ($ddate->Localtime('user'))[1,2]; + + #false laziness w/CalendarSlotSchedule and CalendarDaySchedule + my %hash = $m->comp('/rt/Ticket/Elements/Customers', Ticket => $ticket); + my @cust_main = values( %{$hash{cust_main}} ); + + $return = { 'error' => '', + #'starts' => $starts, + #'due' => $due, + #'username' => $username, + #false laziness w/CalendarSlotSchedule + 'sched_label' => + FS::sched_avail::pretty_time($sh*60+$sm). '-'. + FS::sched_avail::pretty_time($eh*60+$em). ': '. + encode_entities($cust_main[0]->_FreesideURILabel), + }; + } else { + $return = { 'error' => $smsg }; + } + + } else { + $return = { 'error' => $omsg }; + } + +} else { + $return = { 'error' => 'Unknown ticket id' }; +} + +</%init> |