diff options
Diffstat (limited to 'httemplate/misc')
-rw-r--r-- | httemplate/misc/tax-fetch_and_import.cgi | 3 | ||||
-rw-r--r-- | httemplate/misc/tax-fetch_and_replace.cgi | 3 | ||||
-rw-r--r-- | httemplate/misc/tower-export.html | 36 | ||||
-rw-r--r-- | httemplate/misc/xmlhttp-ticket-update.html | 19 |
4 files changed, 54 insertions, 7 deletions
diff --git a/httemplate/misc/tax-fetch_and_import.cgi b/httemplate/misc/tax-fetch_and_import.cgi index 33a6c9b01..970d47c32 100644 --- a/httemplate/misc/tax-fetch_and_import.cgi +++ b/httemplate/misc/tax-fetch_and_import.cgi @@ -29,8 +29,9 @@ Import a tax data update. <TR> <TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px"> <INPUT TYPE = "submit" + NAME = "submitButton" VALUE = "Download and Import" - onClick = "document.TaxRateImport.submit.disabled=true; process();" + onClick = "document.TaxRateImport.submitButton.disabled=true; process();" > </TD> </TR> diff --git a/httemplate/misc/tax-fetch_and_replace.cgi b/httemplate/misc/tax-fetch_and_replace.cgi index 3290a3c44..ff64e6320 100644 --- a/httemplate/misc/tax-fetch_and_replace.cgi +++ b/httemplate/misc/tax-fetch_and_replace.cgi @@ -29,8 +29,9 @@ Replace tax data. <TR> <TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px"> <INPUT TYPE = "submit" + NAME = "submitButton" VALUE = "Download and Import" - onClick = "document.TaxRateImport.submit.disabled=true; process();" + onClick = "document.TaxRateImport.submitButton.disabled=true; process();" > </TD> </TR> diff --git a/httemplate/misc/tower-export.html b/httemplate/misc/tower-export.html new file mode 100644 index 000000000..9d63640f0 --- /dev/null +++ b/httemplate/misc/tower-export.html @@ -0,0 +1,36 @@ +<%init> +# currently, browse/tower just shows all towers, so do the same here +my @towers = qsearch({ table => 'tower' }); +http_header('Content-Type' => 'text/csv'); +http_header('Content-Disposition' => 'attachment;filename=towers.csv'); +if ( $cgi->param('format') eq 'tc' ) { + # towercoverage.com format: not a true CSV, no quoting (so no way to include + # commas in any field, so we strip them) + + # lat/long are signed decimals, northeast positive + # height is in meters + # Description/Group are not necessary + # sector/antenna information (orientation, beamwidth, gain, frequency, + # etc.) is in what TC calls a "Coverage", which can't be edited this way. + my $text = "SiteName,Latitude,Longitude,Description,Group,Height\n"; + + foreach my $tower (@towers) { + next if ( !$tower->latitude or !$tower->longitude ); + + my $name = $tower->towername; + my $height = ($tower->height || 0) / 3.28; + $name =~ s(,)( )g; + $text .= join(',', + $name, + $tower->latitude, + $tower->longitude, + '', + '', + $height, + ) . "\n"; + } + $m->print($text); +} else { + die('unknown format '.$cgi->param('format')); +} +</%init> diff --git a/httemplate/misc/xmlhttp-ticket-update.html b/httemplate/misc/xmlhttp-ticket-update.html index e81e353c5..01fb1b44d 100644 --- a/httemplate/misc/xmlhttp-ticket-update.html +++ b/httemplate/misc/xmlhttp-ticket-update.html @@ -13,7 +13,13 @@ my $ticket = FS::TicketSystem->get_ticket_object( \%session, ticket_id=>$id ); my $return; if ( $ticket ) { - my($orv, $omsg) = $ticket->SetOwner( $username ); + my $curowner = $ticket->OwnerObj->Name; + my($orv, $omsg); + if (( $curowner eq $FS::CurrentUser::CurrentUser->username ) or ( $curowner eq 'nobody' )) { + ($orv, $omsg) = $ticket->SetOwner( $username ); + } else { + ($orv, $omsg) = $ticket->SetOwner( $username, 'Steal' ); + } $orv = 1 if ! $orv && $omsg =~ /already own/i; if ( $orv ) { @@ -40,15 +46,18 @@ if ( $ticket ) { my %hash = $m->comp('/rt/Ticket/Elements/Customers', Ticket => $ticket); my @cust_main = values( %{$hash{cust_main}} ); + my $timelabel = FS::sched_avail::pretty_time($sh*60+$sm). '-'. + FS::sched_avail::pretty_time($eh*60+$em); + my $titlelabel = encode_entities($cust_main[0]->_FreesideURILabel); + $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), + 'sched_label' => $timelabel . ': ' . $titlelabel, + 'sched_label_time' => $timelabel, + 'sched_label_title' => $titlelabel, }; } else { $return = { 'error' => $smsg }; |