if $DEBUG;
if ( $opt{m}->interp->comp_exists("/$opt{action}/$svcdb.cgi") ) {
$url = "$svcdb.cgi?";
+ } elsif ( $opt{m}->interp->comp_exists("/$opt{action}/$svcdb.html") ) {
+ $url = "$svcdb.html?";
} else {
-
my $generic = $opt{action} eq 'search' ? 'cust_svc' : 'svc_Common';
$url = "$generic.html?svcdb=$svcdb;";
$url .= 'svcnum=' if $query =~ /^\d+(;|$)/ or $query eq '';
}
- import FS::CGI 'rooturl'; #WTF! why is this necessary
- my $return = rooturl(). "$opt{action}/$url$query";
+ my $return = FS::CGI::rooturl(). "$opt{action}/$url$query";
$return = qq!<A HREF="$return">! if $opt{ahref};
}
sub parse_lt_gt {
- my($cgi, $field) = @_;
+ my($cgi, $field) = (shift, shift);
+ my $table = ( @_ && length($_[0]) ) ? shift.'.' : '';
my @search = ();
my $num = $1;
$num =~ s/[\,\s]+//g;
- my $search = "$field $op{$op} $num";
+ my $search = "$table$field $op{$op} $num";
push @search, $search;
warn "found ${field}_$op field; adding search element $search\n"
# cust_main report subroutines
###
+=over 4
=item cust_header [ CUST_FIELDS_VALUE ]
my %header2method = (
'Customer' => 'name',
- 'Cust. Status' => 'ucfirst_cust_status',
+ 'Cust. Status' => 'cust_status_label',
'Cust#' => 'custnum',
'Name' => 'contact',
'Company' => 'company',
'(bill) State' => 'bill_state',
'(bill) Zip' => 'bill_zip',
'(bill) Country' => 'bill_country_full',
+ '(bill) Latitude' => 'bill_latitude',
+ '(bill) Longitude' => 'bill_longitude',
'(service) Address 1' => 'ship_address1',
'(service) Address 2' => 'ship_address2',
'(service) City' => 'ship_city',
'(service) State' => 'ship_state',
'(service) Zip' => 'ship_zip',
'(service) Country' => 'ship_country_full',
+ '(service) Latitude' => 'ship_latitude',
+ '(service) Longitude' => 'ship_longitude',
'Invoicing email(s)' => 'invoicing_list_emailonly_scalar',
'Payment Type' => 'payby',
'Current Balance' => 'current_balance',
#inefficientish, but tiny lists and only run once per page
my @location_fields;
- foreach my $field (qw( address1 address2 city state zip )) {
+ foreach my $field (qw( address1 address2 city state zip latitude longitude )) {
foreach my $pre ('bill_','ship_') {
if ( grep { $_ eq $pre.$field } @cust_fields ) {
push @location_fields, $pre.'location.'.$field.' AS '.$pre.$field;
}
}
+=item cust_links
+
+Returns an array of links to view/cust_main.cgi, for use with cust_fields.
+
+=cut
+
+sub cust_links {
+ my $link = [ FS::CGI::rooturl().'view/cust_main.cgi?', 'custnum' ];
+
+ return map { $_ eq 'cust_status_label' ? '' : $link }
+ @cust_fields;
+}
+
=item is_mobile
Utility function to determine if the client is a mobile browser.
}
return 0;
}
-
+
+=back
+
+=cut
+
###
# begin JSRPC code...
###