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"
}
sub cust_sort_fields {
- cust_header(@_);
+ cust_header(@_) if( @_ or !@cust_fields );
#inefficientish, but tiny lists and only run once per page
map { $_ eq 'custnum' ? 'custnum' : '' } @cust_fields;
my @fields = qw( last first company );
# push @fields, map "ship_$_", @fields;
- cust_header(@_);
+ cust_header(@_) if( @_ or !@cust_fields );
#inefficientish, but tiny lists and only run once per page
my @location_fields;
sub cust_fields_subs {
my $unlinked_warn = 0;
+
return map {
my $f = $_;
if ( $unlinked_warn++ ) {
}
}
+=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.